[Devel] [PATCH VZ8 v1 08/14] cgroup/ve: added helper function to get ve-related cgroup paths

Kirill Tkhai ktkhai at virtuozzo.com
Mon Jan 25 13:12:10 MSK 2021


On 20.01.2021 12:56, Valeriy Vdovin wrote:
> This fill make fake-absolute paths to support virtual ve roots in
> cgroup hierarchies.
> The path will be used in subsequent patches.
> 
> Signed-off-by: Valeriy.Vdovin <valeriy.vdovin at virtuozzo.com>

Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  kernel/cgroup/cgroup-v1.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
> index fb06fc9d96ca..21a7c36fbf44 100644
> --- a/kernel/cgroup/cgroup-v1.c
> +++ b/kernel/cgroup/cgroup-v1.c
> @@ -787,6 +787,16 @@ void cgroup1_check_for_release(struct cgroup *cgrp)
>  		schedule_work(&cgrp->release_agent_work);
>  }
>  
> +/*
> + * Used to get a fake-absolute path to a cgroup on kernfs filesystem, but it
> + * actually be relative to cgroup root, provided in the argument.
> + */
> +static inline int cgroup_path_ve_relative(struct cgroup *ve_root_cgrp,
> +	struct cgroup *cgrp, char *buf, size_t buflen)
> +{
> +	return kernfs_path_from_node(cgrp->kn, ve_root_cgrp->kn, buf, buflen);
> +}
> +
>  /*
>   * Notify userspace when a cgroup is released, by running the
>   * configured release agent with the name of the cgroup (path
> 



More information about the Devel mailing list