aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHirokazu Takahashi <taka@valinux.co.jp>2009-01-07 21:08:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-08 11:31:05 -0500
commitf8d665422603ee1b8ed04dcad4242f14d623c941 (patch)
treed872a12113998ed99ce22247091c481b9f465faa /mm
parent08e552c69c6930d64722de3ec18c51844d06ee28 (diff)
memcg: add mem_cgroup_disabled()
We check mem_cgroup is disabled or not by checking mem_cgroup_subsys.disabled. I think it has more references than expected, now. replacing if (mem_cgroup_subsys.disabled) with if (mem_cgroup_disabled()) give us good look, I think. [kamezawa.hiroyu@jp.fujitsu.com: fix typo] Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c28
-rw-r--r--mm/page_cgroup.c4
2 files changed, 16 insertions, 16 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 8ce4e9e47959..9846f617115d 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -279,7 +279,7 @@ void mem_cgroup_del_lru_list(struct page *page, enum lru_list lru)
279 struct mem_cgroup *mem; 279 struct mem_cgroup *mem;
280 struct mem_cgroup_per_zone *mz; 280 struct mem_cgroup_per_zone *mz;
281 281
282 if (mem_cgroup_subsys.disabled) 282 if (mem_cgroup_disabled())
283 return; 283 return;
284 pc = lookup_page_cgroup(page); 284 pc = lookup_page_cgroup(page);
285 /* can happen while we handle swapcache. */ 285 /* can happen while we handle swapcache. */
@@ -302,7 +302,7 @@ void mem_cgroup_rotate_lru_list(struct page *page, enum lru_list lru)
302 struct mem_cgroup_per_zone *mz; 302 struct mem_cgroup_per_zone *mz;
303 struct page_cgroup *pc; 303 struct page_cgroup *pc;
304 304
305 if (mem_cgroup_subsys.disabled) 305 if (mem_cgroup_disabled())
306 return; 306 return;
307 307
308 pc = lookup_page_cgroup(page); 308 pc = lookup_page_cgroup(page);
@@ -319,7 +319,7 @@ void mem_cgroup_add_lru_list(struct page *page, enum lru_list lru)
319 struct page_cgroup *pc; 319 struct page_cgroup *pc;
320 struct mem_cgroup_per_zone *mz; 320 struct mem_cgroup_per_zone *mz;
321 321
322 if (mem_cgroup_subsys.disabled) 322 if (mem_cgroup_disabled())
323 return; 323 return;
324 pc = lookup_page_cgroup(page); 324 pc = lookup_page_cgroup(page);
325 /* barrier to sync with "charge" */ 325 /* barrier to sync with "charge" */
@@ -344,7 +344,7 @@ static void mem_cgroup_lru_fixup(struct page *page)
344void mem_cgroup_move_lists(struct page *page, 344void mem_cgroup_move_lists(struct page *page,
345 enum lru_list from, enum lru_list to) 345 enum lru_list from, enum lru_list to)
346{ 346{
347 if (mem_cgroup_subsys.disabled) 347 if (mem_cgroup_disabled())
348 return; 348 return;
349 mem_cgroup_del_lru_list(page, from); 349 mem_cgroup_del_lru_list(page, from);
350 mem_cgroup_add_lru_list(page, to); 350 mem_cgroup_add_lru_list(page, to);
@@ -731,7 +731,7 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
731int mem_cgroup_newpage_charge(struct page *page, 731int mem_cgroup_newpage_charge(struct page *page,
732 struct mm_struct *mm, gfp_t gfp_mask) 732 struct mm_struct *mm, gfp_t gfp_mask)
733{ 733{
734 if (mem_cgroup_subsys.disabled) 734 if (mem_cgroup_disabled())
735 return 0; 735 return 0;
736 if (PageCompound(page)) 736 if (PageCompound(page))
737 return 0; 737 return 0;
@@ -753,7 +753,7 @@ int mem_cgroup_newpage_charge(struct page *page,
753int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm, 753int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
754 gfp_t gfp_mask) 754 gfp_t gfp_mask)
755{ 755{
756 if (mem_cgroup_subsys.disabled) 756 if (mem_cgroup_disabled())
757 return 0; 757 return 0;
758 if (PageCompound(page)) 758 if (PageCompound(page))
759 return 0; 759 return 0;
@@ -799,7 +799,7 @@ int mem_cgroup_try_charge_swapin(struct mm_struct *mm,
799 struct mem_cgroup *mem; 799 struct mem_cgroup *mem;
800 swp_entry_t ent; 800 swp_entry_t ent;
801 801
802 if (mem_cgroup_subsys.disabled) 802 if (mem_cgroup_disabled())
803 return 0; 803 return 0;
804 804
805 if (!do_swap_account) 805 if (!do_swap_account)
@@ -833,7 +833,7 @@ int mem_cgroup_cache_charge_swapin(struct page *page,
833{ 833{
834 int ret = 0; 834 int ret = 0;
835 835
836 if (mem_cgroup_subsys.disabled) 836 if (mem_cgroup_disabled())
837 return 0; 837 return 0;
838 if (unlikely(!mm)) 838 if (unlikely(!mm))
839 mm = &init_mm; 839 mm = &init_mm;
@@ -880,7 +880,7 @@ void mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr)
880{ 880{
881 struct page_cgroup *pc; 881 struct page_cgroup *pc;
882 882
883 if (mem_cgroup_subsys.disabled) 883 if (mem_cgroup_disabled())
884 return; 884 return;
885 if (!ptr) 885 if (!ptr)
886 return; 886 return;
@@ -909,7 +909,7 @@ void mem_cgroup_commit_charge_swapin(struct page *page, struct mem_cgroup *ptr)
909 909
910void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *mem) 910void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *mem)
911{ 911{
912 if (mem_cgroup_subsys.disabled) 912 if (mem_cgroup_disabled())
913 return; 913 return;
914 if (!mem) 914 if (!mem)
915 return; 915 return;
@@ -930,7 +930,7 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
930 struct mem_cgroup *mem = NULL; 930 struct mem_cgroup *mem = NULL;
931 struct mem_cgroup_per_zone *mz; 931 struct mem_cgroup_per_zone *mz;
932 932
933 if (mem_cgroup_subsys.disabled) 933 if (mem_cgroup_disabled())
934 return NULL; 934 return NULL;
935 935
936 if (PageSwapCache(page)) 936 if (PageSwapCache(page))
@@ -1049,7 +1049,7 @@ int mem_cgroup_prepare_migration(struct page *page, struct mem_cgroup **ptr)
1049 struct mem_cgroup *mem = NULL; 1049 struct mem_cgroup *mem = NULL;
1050 int ret = 0; 1050 int ret = 0;
1051 1051
1052 if (mem_cgroup_subsys.disabled) 1052 if (mem_cgroup_disabled())
1053 return 0; 1053 return 0;
1054 1054
1055 pc = lookup_page_cgroup(page); 1055 pc = lookup_page_cgroup(page);
@@ -1131,7 +1131,7 @@ int mem_cgroup_shrink_usage(struct mm_struct *mm, gfp_t gfp_mask)
1131 int progress = 0; 1131 int progress = 0;
1132 int retry = MEM_CGROUP_RECLAIM_RETRIES; 1132 int retry = MEM_CGROUP_RECLAIM_RETRIES;
1133 1133
1134 if (mem_cgroup_subsys.disabled) 1134 if (mem_cgroup_disabled())
1135 return 0; 1135 return 0;
1136 if (!mm) 1136 if (!mm)
1137 return 0; 1137 return 0;
@@ -1697,7 +1697,7 @@ static void mem_cgroup_put(struct mem_cgroup *mem)
1697#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP 1697#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
1698static void __init enable_swap_cgroup(void) 1698static void __init enable_swap_cgroup(void)
1699{ 1699{
1700 if (!mem_cgroup_subsys.disabled && really_do_swap_account) 1700 if (!mem_cgroup_disabled() && really_do_swap_account)
1701 do_swap_account = 1; 1701 do_swap_account = 1;
1702} 1702}
1703#else 1703#else
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 74ae8e01d071..7006a11350c8 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -74,7 +74,7 @@ void __init page_cgroup_init(void)
74 74
75 int nid, fail; 75 int nid, fail;
76 76
77 if (mem_cgroup_subsys.disabled) 77 if (mem_cgroup_disabled())
78 return; 78 return;
79 79
80 for_each_online_node(nid) { 80 for_each_online_node(nid) {
@@ -247,7 +247,7 @@ void __init page_cgroup_init(void)
247 unsigned long pfn; 247 unsigned long pfn;
248 int fail = 0; 248 int fail = 0;
249 249
250 if (mem_cgroup_subsys.disabled) 250 if (mem_cgroup_disabled())
251 return; 251 return;
252 252
253 for (pfn = 0; !fail && pfn < max_pfn; pfn += PAGES_PER_SECTION) { 253 for (pfn = 0; !fail && pfn < max_pfn; pfn += PAGES_PER_SECTION) {