diff options
Diffstat (limited to 'mm/page_cgroup.c')
-rw-r--r-- | mm/page_cgroup.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c index f0559e049e00..e910524e5a08 100644 --- a/mm/page_cgroup.c +++ b/mm/page_cgroup.c | |||
@@ -28,9 +28,16 @@ struct page_cgroup *lookup_page_cgroup(struct page *page) | |||
28 | struct page_cgroup *base; | 28 | struct page_cgroup *base; |
29 | 29 | ||
30 | base = NODE_DATA(page_to_nid(page))->node_page_cgroup; | 30 | base = NODE_DATA(page_to_nid(page))->node_page_cgroup; |
31 | #ifdef CONFIG_DEBUG_VM | ||
32 | /* | ||
33 | * The sanity checks the page allocator does upon freeing a | ||
34 | * page can reach here before the page_cgroup arrays are | ||
35 | * allocated when feeding a range of pages to the allocator | ||
36 | * for the first time during bootup or memory hotplug. | ||
37 | */ | ||
31 | if (unlikely(!base)) | 38 | if (unlikely(!base)) |
32 | return NULL; | 39 | return NULL; |
33 | 40 | #endif | |
34 | offset = pfn - NODE_DATA(page_to_nid(page))->node_start_pfn; | 41 | offset = pfn - NODE_DATA(page_to_nid(page))->node_start_pfn; |
35 | return base + offset; | 42 | return base + offset; |
36 | } | 43 | } |
@@ -85,9 +92,16 @@ struct page_cgroup *lookup_page_cgroup(struct page *page) | |||
85 | { | 92 | { |
86 | unsigned long pfn = page_to_pfn(page); | 93 | unsigned long pfn = page_to_pfn(page); |
87 | struct mem_section *section = __pfn_to_section(pfn); | 94 | struct mem_section *section = __pfn_to_section(pfn); |
88 | 95 | #ifdef CONFIG_DEBUG_VM | |
96 | /* | ||
97 | * The sanity checks the page allocator does upon freeing a | ||
98 | * page can reach here before the page_cgroup arrays are | ||
99 | * allocated when feeding a range of pages to the allocator | ||
100 | * for the first time during bootup or memory hotplug. | ||
101 | */ | ||
89 | if (!section->page_cgroup) | 102 | if (!section->page_cgroup) |
90 | return NULL; | 103 | return NULL; |
104 | #endif | ||
91 | return section->page_cgroup + pfn; | 105 | return section->page_cgroup + pfn; |
92 | } | 106 | } |
93 | 107 | ||