Skip to content

Commit

Permalink
memcg: page_cgroup array is never stored on reserved pages
Browse files Browse the repository at this point in the history
KAMEZAWA Hiroyuki noted that free_pages_cgroup doesn't have to check for
PageReserved because we never store the array on reserved pages (neither
alloc_pages_exact nor vmalloc use those pages).

So we can replace the check by a BUG_ON.

Signed-off-by: Michal Hocko <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Balbir Singh <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Michal Hocko authored and torvalds committed Mar 24, 2011
1 parent dde79e0 commit 6cfddb2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mm/page_cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ static void free_page_cgroup(void *addr)
vfree(addr);
} else {
struct page *page = virt_to_page(addr);
if (!PageReserved(page)) { /* Is bootmem ? */
size_t table_size =
sizeof(struct page_cgroup) * PAGES_PER_SECTION;
free_pages_exact(addr, table_size);
}
size_t table_size =
sizeof(struct page_cgroup) * PAGES_PER_SECTION;

BUG_ON(PageReserved(page));
free_pages_exact(addr, table_size);
}
}
#endif
Expand Down

0 comments on commit 6cfddb2

Please sign in to comment.