From fc7c1c5ffa9751b3ecee85ccbcd69fe89247cdc8 Mon Sep 17 00:00:00 2001 From: Johannes Weiner Date: Thu, 12 Jan 2012 17:18:40 -0800 Subject: [PATCH] --- yaml --- r: 284379 b: refs/heads/master c: 00c54c0bac24bb02d2460c516da76651a7451286 h: refs/heads/master i: 284377: 4d88eac9ee0063514c11d74962be40519fefe2f8 284375: 42b231ad8e06d944abc597087e3ed8a888fd8b45 v: v3 --- [refs] | 2 +- trunk/mm/page_cgroup.c | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 027957c9e940..1d547c8ae674 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: cfa449461e67b60df986170eecb089831fa9e49a +refs/heads/master: 00c54c0bac24bb02d2460c516da76651a7451286 diff --git a/trunk/mm/page_cgroup.c b/trunk/mm/page_cgroup.c index f0559e049e00..e910524e5a08 100644 --- a/trunk/mm/page_cgroup.c +++ b/trunk/mm/page_cgroup.c @@ -28,9 +28,16 @@ struct page_cgroup *lookup_page_cgroup(struct page *page) struct page_cgroup *base; base = NODE_DATA(page_to_nid(page))->node_page_cgroup; +#ifdef CONFIG_DEBUG_VM + /* + * The sanity checks the page allocator does upon freeing a + * page can reach here before the page_cgroup arrays are + * allocated when feeding a range of pages to the allocator + * for the first time during bootup or memory hotplug. + */ if (unlikely(!base)) return NULL; - +#endif offset = pfn - NODE_DATA(page_to_nid(page))->node_start_pfn; return base + offset; } @@ -85,9 +92,16 @@ struct page_cgroup *lookup_page_cgroup(struct page *page) { unsigned long pfn = page_to_pfn(page); struct mem_section *section = __pfn_to_section(pfn); - +#ifdef CONFIG_DEBUG_VM + /* + * The sanity checks the page allocator does upon freeing a + * page can reach here before the page_cgroup arrays are + * allocated when feeding a range of pages to the allocator + * for the first time during bootup or memory hotplug. + */ if (!section->page_cgroup) return NULL; +#endif return section->page_cgroup + pfn; }