Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <pholasek@redhat.com>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Petr Holasek and committed by
Linus Torvalds
a6fc86d2 c6a34058

+1 -1
+1 -1
fs/proc/page.c
··· 40 40 ppage = pfn_to_page(pfn); 41 41 else 42 42 ppage = NULL; 43 - if (!ppage) 43 + if (!ppage || PageSlab(ppage)) 44 44 pcount = 0; 45 45 else 46 46 pcount = page_mapcount(ppage);