dect
/
linux-2.6
Archived
13
0
Fork 0

memcg: page_cgroup array is never stored on reserved pages

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 <mhocko@suse.cz>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Michal Hocko 2011-03-23 16:42:41 -07:00 committed by Linus Torvalds
parent dde79e005a
commit 6cfddb2615
1 changed files with 5 additions and 5 deletions

View File

@ -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