Commit 6cfddb26 authored by Michal Hocko's avatar Michal Hocko Committed by Linus Torvalds

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: default avatarMichal Hocko <mhocko@suse.cz>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent dde79e00
...@@ -153,12 +153,12 @@ static void free_page_cgroup(void *addr) ...@@ -153,12 +153,12 @@ static void free_page_cgroup(void *addr)
vfree(addr); vfree(addr);
} else { } else {
struct page *page = virt_to_page(addr); struct page *page = virt_to_page(addr);
if (!PageReserved(page)) { /* Is bootmem ? */
size_t table_size = size_t table_size =
sizeof(struct page_cgroup) * PAGES_PER_SECTION; sizeof(struct page_cgroup) * PAGES_PER_SECTION;
BUG_ON(PageReserved(page));
free_pages_exact(addr, table_size); free_pages_exact(addr, table_size);
} }
}
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment