[Devel] [PATCH rh8 1/8] ve/cgroup: export cgroup_get_ve_root1() + cleanup

Konstantin Khorenko khorenko at virtuozzo.com
Wed Oct 28 18:57:30 MSK 2020


Will be used by later patches.

Fixes: 7afc6e2134c3 ("ve/cgroups: Introduce subgroups_limit control")

Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 include/linux/ve.h     | 6 ++++++
 kernel/cgroup/cgroup.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/include/linux/ve.h b/include/linux/ve.h
index 0341bb915923..20a28b043810 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -138,6 +138,8 @@ extern void monotonic_ve_to_abs(clockid_t which_clock, struct timespec64 *tp);
 extern bool current_user_ns_initial(void);
 struct user_namespace *ve_init_user_ns(void);
 
+extern struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp);
+
 #define ve_uevent_seqnum       (get_exec_env()->_uevent_seqnum)
 
 extern int vz_security_family_check(struct net *net, int family);
@@ -164,6 +166,10 @@ static inline struct user_namespace *ve_init_user_ns(void)
 	return &init_user_ns;
 }
 
+static inline struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
+{
+	return NULL;
+}
 #define ve_uevent_seqnum uevent_seqnum
 
 static inline int vz_security_family_check(struct net *net, int family) { return 0; }
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 4ee3eb24b0d1..97bf375ae334 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1901,7 +1901,7 @@ void cgroup_mark_ve_root(struct ve_struct *ve)
 	spin_unlock_irq(&css_set_lock);
 }
 
-static struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
+struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
 {
 	struct cgroup *ve_root = NULL;
 
@@ -1913,9 +1913,9 @@ static struct cgroup *cgroup_get_ve_root1(struct cgroup *cgrp)
 		}
 		cgrp = cgroup_parent(cgrp);
 	} while (cgrp);
-        rcu_read_unlock();
+	rcu_read_unlock();
 
-        return ve_root;
+	return ve_root;
 }
 
 static bool subgroup_limit_reached(struct cgroup *cgroup)
-- 
2.28.0



More information about the Devel mailing list