[RHEL8,COMMIT] ve/cgroup: export cgroup_get_ve_root1() + cleanup

Submitted by Konstantin Khorenko on Nov. 3, 2020, 12:59 p.m.

Details

Message ID 202011031259.0A3CxJ7s2050386@finist-co8.sw.ru
State New
Series "ve/proc/sched/stat: Virtualize /proc/stat in a Container"
Headers show

Commit Message

Konstantin Khorenko Nov. 3, 2020, 12:59 p.m.
The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.15
------>
commit ddd749df382cda3fc10fa5c1ab5aecfe872b21bc
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Fri Oct 23 19:12:55 2020 +0300

    ve/cgroup: export cgroup_get_ve_root1() + cleanup
    
    Will be used by later patches.
    
    Fixes: 7afc6e2134c3 ("ve/cgroups: Introduce subgroups_limit control")
    
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
    Reviewed-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 include/linux/ve.h     | 6 ++++++
 kernel/cgroup/cgroup.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/include/linux/ve.h b/include/linux/ve.h
index 2f9204cbd0f4..447a91dbd4d4 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -152,6 +152,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);
@@ -178,6 +180,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)