[Devel] [PATCH VZ8 v1 03/14] cgroup: port CGROUP_REMOVED flag from vz7

Kirill Tkhai ktkhai at virtuozzo.com
Mon Jan 25 13:01:33 MSK 2021


On 20.01.2021 12:56, Valeriy Vdovin wrote:
> The flag will be used in subsequent patches
> Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>

> ---
>  include/linux/cgroup-defs.h | 2 ++
>  include/linux/cgroup.h      | 5 +++++
>  kernel/cgroup/cgroup.c      | 1 +
>  3 files changed, 8 insertions(+)
> 
> diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
> index a3b309ab1a90..5ee5f10e3de7 100644
> --- a/include/linux/cgroup-defs.h
> +++ b/include/linux/cgroup-defs.h
> @@ -57,6 +57,8 @@ enum {
>  
>  /* bits in struct cgroup flags field */
>  enum {
> +	/* Control Cgroup is dead */
> +	CGRP_REMOVED,
>  	/* Control Group requires release notifications to userspace */
>  	CGRP_NOTIFY_ON_RELEASE,
>  	/*
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index c0a42c3d43fa..dfd9460986ee 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -922,6 +922,11 @@ static inline bool cgroup_task_frozen(struct task_struct *task)
>  	return task->frozen;
>  }
>  
> +static inline int cgroup_is_removed(const struct cgroup *cgrp)
> +{
> +	return test_bit(CGRP_REMOVED, &cgrp->flags);
> +}
> +
>  #else /* !CONFIG_CGROUPS */
>  
>  static inline void cgroup_enter_frozen(void) { }
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index 797a3971ab46..447c8f003496 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -5562,6 +5562,7 @@ static int cgroup_destroy_locked(struct cgroup *cgrp)
>  			tcgrp->freezer.nr_frozen_descendants--;
>  	}
>  	spin_unlock_irq(&css_set_lock);
> +	set_bit(CGRP_REMOVED, &cgrp->flags);
>  
>  	cgroup1_check_for_release(parent);
>  
> 



More information about the Devel mailing list