[PATCH v1 2/3] /proc/kpageflags: return KPF_SLAB for slab tail pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently /proc/kpageflags returns just KPF_COMPOUND_TAIL for slab tail pages,
which is inconvenient when grasping how slab pages are distributed (userspace
always needs to check which kind of tail pages by itself). This patch sets
KPF_SLAB for such pages.

With this patch:

  $ grep Slab /proc/meminfo ; tools/vm/page-types -b slab
  Slab:              64880 kB
               flags      page-count       MB  symbolic-flags                     long-symbolic-flags
  0x0000000000000080           16220       63  _______S__________________________________ slab
               total           16220       63

16220 pages equals to 64880 kB, so returned result is consistent with the
global counter.

Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx>
---
 fs/proc/page.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git v4.5-rc2-mmotm-2016-02-02-17-08/fs/proc/page.c v4.5-rc2-mmotm-2016-02-02-17-08_patched/fs/proc/page.c
index 42998bb..40a4685 100644
--- v4.5-rc2-mmotm-2016-02-02-17-08/fs/proc/page.c
+++ v4.5-rc2-mmotm-2016-02-02-17-08_patched/fs/proc/page.c
@@ -160,6 +160,8 @@ u64 stable_page_flags(struct page *page)
 	u |= kpf_copy_bit(k, KPF_LOCKED,	PG_locked);
 
 	u |= kpf_copy_bit(k, KPF_SLAB,		PG_slab);
+	if (PageTail(page) && PageSlab(compound_head(page)))
+		u |= 1 << KPF_SLAB;
 
 	u |= kpf_copy_bit(k, KPF_ERROR,		PG_error);
 	u |= kpf_copy_bit(k, KPF_DIRTY,		PG_dirty);
-- 
2.7.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]