From: Petr Holasek Date: Thu, 13 Jan 2011 01:00:34 +0000 (-0800) Subject: kpagecount: add slab page checking because _mapcount is in a union X-Git-Tag: upstream/snapshot3+hdmi~11977 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a6fc86d2b43bf1086557f023a24adf91db915559;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git kpagecount: add slab page checking because _mapcount is in a union Add a PageSlab() check before adding the _mapcount value to /kpagecount. page->_mapcount is in a union with the SLAB structure so for pages controlled by SLAB, page_mapcount() returns nonsense. Signed-off-by: Petr Holasek Cc: Wu Fengguang Cc: Matt Mackall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/page.c b/fs/proc/page.c index 3b8b456..b06c674 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -40,7 +40,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, ppage = pfn_to_page(pfn); else ppage = NULL; - if (!ppage) + if (!ppage || PageSlab(ppage)) pcount = 0; else pcount = page_mapcount(ppage);