[libvirt] [PATCH] qemuSetupMemoryCgroup: Handle hard_limit properly

Osier Yang jyang at redhat.com
Tue Aug 20 10:08:20 UTC 2013


On 20/08/13 17:10, Michal Privoznik wrote:
> Since 16bcb3 we have a regression. The hard_limit is set
> unconditionally. By default, the limit is zero. Hence, if user hasn't
> configured any, we set the zero in cgroup subsystem making the kernel
> kill the corresponding qemu process immediately. The proper fix is to
> set hard_limit iff user has configure any.

s/iff/if/,

> ---
>   src/qemu/qemu_cgroup.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 9673e8e..e27945e 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -428,7 +428,8 @@ qemuSetupMemoryCgroup(virDomainObjPtr vm)
>           }
>       }
>   
> -    if (virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit) < 0)
> +    if (vm->def->mem.hard_limit != 0 &&
> +        virCgroupSetMemoryHardLimit(priv->cgroup, vm->def->mem.hard_limit) < 0)
>           return -1;
>   
>       if (vm->def->mem.soft_limit != 0 &&

ACK




More information about the libvir-list mailing list