Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 284379
b: refs/heads/master
c: 00c54c0
h: refs/heads/master
i:
  284377: 4d88eac
  284375: 42b231a
v: v3
  • Loading branch information
Johannes Weiner authored and Linus Torvalds committed Jan 13, 2012
1 parent 33376e2 commit fc7c1c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cfa449461e67b60df986170eecb089831fa9e49a
refs/heads/master: 00c54c0bac24bb02d2460c516da76651a7451286
18 changes: 16 additions & 2 deletions trunk/mm/page_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit fc7c1c5

Please sign in to comment.