[Devel] [PATCH RHEL8 COMMIT] mm/memcontrol.c: export mem_cgroup_is_root()

Konstantin Khorenko khorenko at virtuozzo.com
Thu Apr 2 17:12:54 MSK 2020


The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.3.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.3.4
------>
commit 8fcafa22c742be7c63e7b4e0dbb5528b529fc728
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Thu Apr 2 17:12:52 2020 +0300

    mm/memcontrol.c: export mem_cgroup_is_root()
    
    This will be used in next patch.
    
    Link: http://lkml.kernel.org/r/153063064347.1818.1987011484100392706.stgit@localhost.localdomain
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    Acked-by: Vladimir Davydov <vdavydov.dev at gmail.com>
    Tested-by: Shakeel Butt <shakeelb at google.com>
    Cc: Al Viro <viro at zeniv.linux.org.uk>
    Cc: Andrey Ryabinin <aryabinin at virtuozzo.com>
    Cc: Chris Wilson <chris at chris-wilson.co.uk>
    Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
    Cc: Guenter Roeck <linux at roeck-us.net>
    Cc: "Huang, Ying" <ying.huang at intel.com>
    Cc: Johannes Weiner <hannes at cmpxchg.org>
    Cc: Josef Bacik <jbacik at fb.com>
    Cc: Li RongQing <lirongqing at baidu.com>
    Cc: Matthew Wilcox <willy at infradead.org>
    Cc: Matthias Kaehlcke <mka at chromium.org>
    Cc: Mel Gorman <mgorman at techsingularity.net>
    Cc: Michal Hocko <mhocko at kernel.org>
    Cc: Minchan Kim <minchan at kernel.org>
    Cc: Philippe Ombredanne <pombredanne at nexb.com>
    Cc: Roman Gushchin <guro at fb.com>
    Cc: Sahitya Tummala <stummala at codeaurora.org>
    Cc: Stephen Rothwell <sfr at canb.auug.org.au>
    Cc: Tetsuo Handa <penguin-kernel at I-love.SAKURA.ne.jp>
    Cc: Thomas Gleixner <tglx at linutronix.de>
    Cc: Waiman Long <longman at redhat.com>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    (cherry picked from commit dfd2f10ccfd7e6bd2a096eaf42e76a7229776322)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 include/linux/memcontrol.h | 10 ++++++++++
 mm/memcontrol.c            |  5 -----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 86e97cd353d1..2b6323b13bc5 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -331,6 +331,11 @@ struct mem_cgroup {
 
 extern struct mem_cgroup *root_mem_cgroup;
 
+static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
+{
+	return (memcg == root_mem_cgroup);
+}
+
 static inline bool mem_cgroup_disabled(void)
 {
 	return !cgroup_subsys_enabled(memory_cgrp_subsys);
@@ -814,6 +819,11 @@ void mem_cgroup_split_huge_fixup(struct page *head);
 
 struct mem_cgroup;
 
+static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
+{
+	return true;
+}
+
 static inline bool mem_cgroup_disabled(void)
 {
 	return true;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index f8998aaf8528..54c3ed698a79 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -265,11 +265,6 @@ struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr)
 	return &container_of(vmpr, struct mem_cgroup, vmpressure)->css;
 }
 
-static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
-{
-	return (memcg == root_mem_cgroup);
-}
-
 #ifdef CONFIG_MEMCG_KMEM
 /*
  * This will be the memcg's index in each cache's ->memcg_params.memcg_caches.


More information about the Devel mailing list