On Tue, Jul 10, 2012 at 05:14:01PM +0800, tangchen wrote:
create a new cgroup and move all hypervisor threads to the new
cgroup.
And then we can do the other things:
1. limit only vcpu usage rather than the whole qemu
2. limit for hypervisor threads(include vhost-net threads)
Signed-off-by: Wen Congyang <wency(a)cn.fujitsu.com>
---
src/qemu/qemu_cgroup.c | 67 ++++++++++++++++++++++++++++++++++++++++++++---
src/qemu/qemu_cgroup.h | 2 ++
src/qemu/qemu_process.c | 6 ++++-
3 files changed, 70 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index f8f375f..5f7e8b0 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -523,11 +523,12 @@ int qemuSetupCgroupForVcpu(struct qemud_driver *driver,
virDomainObjPtr vm)
}
if (priv->nvcpupids == 0 || priv->vcpupids[0] == vm->pid) {
- /* If we does not know VCPU<->PID mapping or all vcpu runs in the same
+ /* If we does not know VCPU<->PID mapping or all vcpus run in the same
* thread, we cannot control each vcpu.
*/
- virCgroupFree(&cgroup);
- return 0;
+ qemuReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Unable to get vcpus' pids."));
virReportError.
--
Thanks,
Hu Tao