aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/memcontrol.h17
-rw-r--r--init/Kconfig12
-rw-r--r--mm/debug.c5
-rw-r--r--mm/memcontrol.c15
-rw-r--r--mm/page_alloc.c12
5 files changed, 12 insertions, 49 deletions
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index c4d080875164..6ea9f919e888 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -173,10 +173,6 @@ static inline void mem_cgroup_count_vm_event(struct mm_struct *mm,
173void mem_cgroup_split_huge_fixup(struct page *head); 173void mem_cgroup_split_huge_fixup(struct page *head);
174#endif 174#endif
175 175
176#ifdef CONFIG_DEBUG_VM
177bool mem_cgroup_bad_page_check(struct page *page);
178void mem_cgroup_print_bad_page(struct page *page);
179#endif
180#else /* CONFIG_MEMCG */ 176#else /* CONFIG_MEMCG */
181struct mem_cgroup; 177struct mem_cgroup;
182 178
@@ -346,19 +342,6 @@ void mem_cgroup_count_vm_event(struct mm_struct *mm, enum vm_event_item idx)
346} 342}
347#endif /* CONFIG_MEMCG */ 343#endif /* CONFIG_MEMCG */
348 344
349#if !defined(CONFIG_MEMCG) || !defined(CONFIG_DEBUG_VM)
350static inline bool
351mem_cgroup_bad_page_check(struct page *page)
352{
353 return false;
354}
355
356static inline void
357mem_cgroup_print_bad_page(struct page *page)
358{
359}
360#endif
361
362enum { 345enum {
363 UNDER_LIMIT, 346 UNDER_LIMIT,
364 SOFT_LIMIT, 347 SOFT_LIMIT,
diff --git a/init/Kconfig b/init/Kconfig
index 46768752130d..7e9fbd48e2ab 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -983,18 +983,6 @@ config MEMCG
983 Provides a memory resource controller that manages both anonymous 983 Provides a memory resource controller that manages both anonymous
984 memory and page cache. (See Documentation/cgroups/memory.txt) 984 memory and page cache. (See Documentation/cgroups/memory.txt)
985 985
986 Note that setting this option increases fixed memory overhead
987 associated with each page of memory in the system. By this,
988 8(16)bytes/PAGE_SIZE on 32(64)bit system will be occupied by memory
989 usage tracking struct at boot. Total amount of this is printed out
990 at boot.
991
992 Only enable when you're ok with these trade offs and really
993 sure you need the memory resource controller. Even when you enable
994 this, you can set "cgroup_disable=memory" at your boot option to
995 disable memory resource controller and you can avoid overheads.
996 (and lose benefits of memory resource controller)
997
998config MEMCG_SWAP 986config MEMCG_SWAP
999 bool "Memory Resource Controller Swap Extension" 987 bool "Memory Resource Controller Swap Extension"
1000 depends on MEMCG && SWAP 988 depends on MEMCG && SWAP
diff --git a/mm/debug.c b/mm/debug.c
index 5ce45c9a29b5..0e58f3211f89 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -95,7 +95,10 @@ void dump_page_badflags(struct page *page, const char *reason,
95 dump_flags(page->flags & badflags, 95 dump_flags(page->flags & badflags,
96 pageflag_names, ARRAY_SIZE(pageflag_names)); 96 pageflag_names, ARRAY_SIZE(pageflag_names));
97 } 97 }
98 mem_cgroup_print_bad_page(page); 98#ifdef CONFIG_MEMCG
99 if (page->mem_cgroup)
100 pr_alert("page->mem_cgroup:%p\n", page->mem_cgroup);
101#endif
99} 102}
100 103
101void dump_page(struct page *page, const char *reason) 104void dump_page(struct page *page, const char *reason)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ab270e34ba3e..1869cb64d089 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3157,21 +3157,6 @@ static inline int mem_cgroup_move_swap_account(swp_entry_t entry,
3157} 3157}
3158#endif 3158#endif
3159 3159
3160#ifdef CONFIG_DEBUG_VM
3161bool mem_cgroup_bad_page_check(struct page *page)
3162{
3163 if (mem_cgroup_disabled())
3164 return false;
3165
3166 return page->mem_cgroup != NULL;
3167}
3168
3169void mem_cgroup_print_bad_page(struct page *page)
3170{
3171 pr_alert("page->mem_cgroup:%p\n", page->mem_cgroup);
3172}
3173#endif
3174
3175static DEFINE_MUTEX(memcg_limit_mutex); 3160static DEFINE_MUTEX(memcg_limit_mutex);
3176 3161
3177static int mem_cgroup_resize_limit(struct mem_cgroup *memcg, 3162static int mem_cgroup_resize_limit(struct mem_cgroup *memcg,
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 22cfdeffbf69..a7198c065999 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -640,8 +640,10 @@ static inline int free_pages_check(struct page *page)
640 bad_reason = "PAGE_FLAGS_CHECK_AT_FREE flag(s) set"; 640 bad_reason = "PAGE_FLAGS_CHECK_AT_FREE flag(s) set";
641 bad_flags = PAGE_FLAGS_CHECK_AT_FREE; 641 bad_flags = PAGE_FLAGS_CHECK_AT_FREE;
642 } 642 }
643 if (unlikely(mem_cgroup_bad_page_check(page))) 643#ifdef CONFIG_MEMCG
644 bad_reason = "cgroup check failed"; 644 if (unlikely(page->mem_cgroup))
645 bad_reason = "page still charged to cgroup";
646#endif
645 if (unlikely(bad_reason)) { 647 if (unlikely(bad_reason)) {
646 bad_page(page, bad_reason, bad_flags); 648 bad_page(page, bad_reason, bad_flags);
647 return 1; 649 return 1;
@@ -900,8 +902,10 @@ static inline int check_new_page(struct page *page)
900 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set"; 902 bad_reason = "PAGE_FLAGS_CHECK_AT_PREP flag set";
901 bad_flags = PAGE_FLAGS_CHECK_AT_PREP; 903 bad_flags = PAGE_FLAGS_CHECK_AT_PREP;
902 } 904 }
903 if (unlikely(mem_cgroup_bad_page_check(page))) 905#ifdef CONFIG_MEMCG
904 bad_reason = "cgroup check failed"; 906 if (unlikely(page->mem_cgroup))
907 bad_reason = "page still charged to cgroup";
908#endif
905 if (unlikely(bad_reason)) { 909 if (unlikely(bad_reason)) {
906 bad_page(page, bad_reason, bad_flags); 910 bad_page(page, bad_reason, bad_flags);
907 return 1; 911 return 1;