[Devel] [PATCH RH8 v2 3/4] kernel/cgroup: implement cgroup_get_e_ve_css
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Jul 13 18:07:28 MSK 2021
On 09.07.2021 02:23, Andrey Zhadchenko wrote:
> Existing cgroup_get_e_css() is not suited for cgroup-v1 and will always
> return root cgroup css. Implement new cgroup_get_e_ve_css to return
> ve css.
>
> https://jira.sw.ru/browse/PSBM-131253
> Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
Reviewed-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
> include/linux/cgroup.h | 2 ++
> kernel/cgroup/cgroup.c | 17 +++++++++++++++++
> 2 files changed, 19 insertions(+)
>
> diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
> index 1223bc8..dbe6137 100644
> --- a/include/linux/cgroup.h
> +++ b/include/linux/cgroup.h
> @@ -876,6 +876,8 @@ int cgroup_path_ns(struct cgroup *cgrp, char *buf, size_t buflen,
> void cgroup_unmark_ve_roots(struct ve_struct *ve);
> struct cgroup_subsys_state *css_local_root(struct cgroup_subsys_state *css);
> struct ve_struct *cgroup_get_ve_owner(struct cgroup *cgrp);
> +struct cgroup_subsys_state *cgroup_get_e_ve_css(struct cgroup *cgrp,
> + struct cgroup_subsys *ss);
> #endif
>
> #else /* !CONFIG_CGROUPS */
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index 57ff462c..ad72ebb 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -656,6 +656,23 @@ struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgrp,
> return css;
> }
>
> +#ifdef CONFIG_VE
> +struct cgroup_subsys_state *cgroup_get_e_ve_css(struct cgroup *cgrp,
> + struct cgroup_subsys *ss)
> +{
> + struct cgroup_subsys_state *css;
> + struct ve_struct *ve;
> +
> + rcu_read_lock();
> +
> + ve = cgroup_get_ve_owner(cgrp);
> + css = ve_get_init_css(ve, ss->id);
> +
> + rcu_read_unlock();
> + return css;
> +}
> +#endif
> +
> static void cgroup_get_live(struct cgroup *cgrp)
> {
> WARN_ON_ONCE(cgroup_is_dead(cgrp));
>
More information about the Devel
mailing list