diff options
author | Johannes Weiner <hannes@cmpxchg.org> | 2014-12-10 18:44:58 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 20:41:09 -0500 |
commit | 9edad6ea0f1416415f6fe31cc9d1dbc3817803ed (patch) | |
tree | 0f734696a3f9e66ce5f43f602a78736c0ff66b68 /mm/page_alloc.c | |
parent | 5d1ea48bdde67898e87d6d8f511fd097fa64c749 (diff) |
mm: move page->mem_cgroup bad page handling into generic code
Now that the external page_cgroup data structure and its lookup is
gone, let the generic bad_page() check for page->mem_cgroup sanity.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: David S. Miller <davem@davemloft.net>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Tejun Heo <tj@kernel.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 12 |
1 files changed, 8 insertions, 4 deletions
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; |