[Devel] [PATCH RH8 v2 2/4] kernel/ve: simplify ve_get_init_css
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Fri Jul 9 02:23:10 MSK 2021
Reuse css_local_root to ascend to marked css.
https://jira.sw.ru/browse/PSBM-131253
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
kernel/ve/ve.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 9667f90..0f42971 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -392,8 +392,7 @@ const char *ve_get_release_agent_path(struct ve_struct *ve,
struct cgroup_subsys_state *ve_get_init_css(struct ve_struct *ve, int subsys_id)
{
- struct cgroup_subsys_state *css, *tmp;
- struct cgroup *cgroup;
+ struct cgroup_subsys_state *css;
struct css_set *root_cset;
struct nsproxy *nsproxy;
@@ -403,18 +402,9 @@ struct cgroup_subsys_state *ve_get_init_css(struct ve_struct *ve, int subsys_id)
root_cset = nsproxy->cgroup_ns->root_cset;
css = root_cset->subsys[subsys_id];
/* nsproxy->cgroup_ns must hold root_cset refcnt */
- BUG_ON(!css_tryget(css));
-
- cgroup = css->cgroup;
- while (!test_bit(CGRP_VE_ROOT, &cgroup->flags) && cgroup_parent(cgroup))
- cgroup = cgroup_parent(cgroup);
- if (cgroup != css->cgroup) {
- tmp = cgroup->subsys[subsys_id];
- css_get(tmp);
- css_put(css);
- css = tmp;
- }
+ css = css_local_root(css);
+ BUG_ON(!css_tryget(css));
rcu_read_unlock();
return css;
--
1.8.3.1
More information about the Devel
mailing list