[Devel] [PATCH RH8] ve/cgroup: remove rcu_read_lock from cgroup_get_ve_root

Evgenii Shatokhin eshatokhin at virtuozzo.com
Thu Apr 29 16:02:25 MSK 2021


From: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>

It is likely a leftover from __cgroup_path where it protects cgrp->name
in cgroup_get_ve_root there is nothing rcu_dereferenced, also in
cgroup_is_descendant there is no rcu for cgrp->parent.

https://jira.sw.ru/browse/PSBM-69678

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

eshatokhin@:
It seems, the actual fix for PSBM-69678  was ported to VZ8 as a part of
90c47968843b3 "ve/cgroups: Introduce subgroups_limit control"
and
90368f957e01b "ve/sched/stat: Introduce functions to calculate vcpustat data".

Only "f8168436b4eb ve/cgroup: remove rcu_read_lock from cgroup_get_ve_root"
was skipped, so here it is.

cgroup_get_ve_root1() does not dereference RCU-protected pointers,
cgroup_parent() does not do that do that either, so rcu_read_lock/unlock
are not needed.

Done in the scope of https://jira.sw.ru/browse/PSBM-127794.

Signed-off-by: Evgenii Shatokhin <eshatokhin at virtuozzo.com>
---
 kernel/cgroup/cgroup.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 779a71bdbaef..23b8b3ffe50f 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2087,7 +2087,6 @@ struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
 {
 	struct cgroup *ve_root = NULL;
 
-	rcu_read_lock();
 	do {
 		if (test_bit(CGRP_VE_ROOT, &cgrp->flags)) {
 			ve_root = cgrp;
@@ -2095,7 +2094,6 @@ struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
 		}
 		cgrp = cgroup_parent(cgrp);
 	} while (cgrp);
-	rcu_read_unlock();
 
 	return ve_root;
 }
-- 
2.29.0



More information about the Devel mailing list