memcg: bad page if page_cgroup when free
authorHugh Dickins <[email protected]>
Tue, 4 Mar 2008 22:29:07 +0000 (14:29 -0800)
committerLinus Torvalds <[email protected]>
Wed, 5 Mar 2008 00:35:15 +0000 (16:35 -0800)
commit9442ec9df40d952b0de185ae5638a74970388e01
tree14b06d71203be119d93736464ca49f37ce402c1c
parent98837c7f82ef78aa38f40462aa2fcac68fd3acbf
memcg: bad page if page_cgroup when free

Replace free_hot_cold_page's VM_BUG_ON(page_get_page_cgroup(page)) by a "Bad
page state" and clear: most users don't have CONFIG_DEBUG_VM on, and if it
were set here, it'd likely cause corruption when the page is reused.

Don't use page_assign_page_cgroup to clear it: that should be private to
memcontrol.c, and always called with the lock taken; and memmap_init_zone
doesn't need it either - like page->mapping and other pointers throughout the
kernel, Linux assumes pointers in zeroed structures are NULL pointers.

Instead use page_reset_bad_cgroup, added to memcontrol.h for this only.

Signed-off-by: Hugh Dickins <[email protected]>
Cc: David Rientjes <[email protected]>
Acked-by: Balbir Singh <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Hirokazu Takahashi <[email protected]>
Cc: YAMAMOTO Takashi <[email protected]>
Cc: Paul Menage <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/memcontrol.h
mm/memcontrol.c
mm/page_alloc.c