aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2018-08-17 18:48:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-17 19:20:31 -0400
commitdfd2f10ccfd7e6bd2a096eaf42e76a7229776322 (patch)
tree07b48453dc21b1fec366f74cf36e53430583d0be
parent3b82c4dcc2f0f98f2aca3b9dc9b88721e962eec9 (diff)
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@virtuozzo.com> Acked-by: Vladimir Davydov <vdavydov.dev@gmail.com> Tested-by: Shakeel Butt <shakeelb@google.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: "Huang, Ying" <ying.huang@intel.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Josef Bacik <jbacik@fb.com> Cc: Li RongQing <lirongqing@baidu.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Matthias Kaehlcke <mka@chromium.org> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Michal Hocko <mhocko@kernel.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Cc: Roman Gushchin <guro@fb.com> Cc: Sahitya Tummala <stummala@codeaurora.org> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Waiman Long <longman@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/memcontrol.h10
-rw-r--r--mm/memcontrol.c5
2 files changed, 10 insertions, 5 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 2cccbb9e1b3e..258c8a46959a 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -318,6 +318,11 @@ struct mem_cgroup {
318 318
319extern struct mem_cgroup *root_mem_cgroup; 319extern struct mem_cgroup *root_mem_cgroup;
320 320
321static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
322{
323 return (memcg == root_mem_cgroup);
324}
325
321static inline bool mem_cgroup_disabled(void) 326static inline bool mem_cgroup_disabled(void)
322{ 327{
323 return !cgroup_subsys_enabled(memory_cgrp_subsys); 328 return !cgroup_subsys_enabled(memory_cgrp_subsys);
@@ -784,6 +789,11 @@ void mem_cgroup_split_huge_fixup(struct page *head);
784 789
785struct mem_cgroup; 790struct mem_cgroup;
786 791
792static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
793{
794 return true;
795}
796
787static inline bool mem_cgroup_disabled(void) 797static inline bool mem_cgroup_disabled(void)
788{ 798{
789 return true; 799 return true;
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a35dc901424d..d8cd6c39eca5 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -261,11 +261,6 @@ struct cgroup_subsys_state *vmpressure_to_css(struct vmpressure *vmpr)
261 return &container_of(vmpr, struct mem_cgroup, vmpressure)->css; 261 return &container_of(vmpr, struct mem_cgroup, vmpressure)->css;
262} 262}
263 263
264static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
265{
266 return (memcg == root_mem_cgroup);
267}
268
269#ifdef CONFIG_MEMCG_KMEM 264#ifdef CONFIG_MEMCG_KMEM
270/* 265/*
271 * This will be the memcg's index in each cache's ->memcg_params.memcg_caches. 266 * This will be the memcg's index in each cache's ->memcg_params.memcg_caches.