[PATCH 2/2] powerpc/mm: Enable page table accounting

Balbir Singh bsingharora at gmail.com
Mon Feb 20 13:12:57 AEDT 2017


Enabled __GFP_ACCOUNT in pgtable_get_gfp_flags(). This
allows accounting of page table allocation via kmem to
the correct cgroup. Basic testing was done to see if
the accounting reflects in

1. perf record tracing
2. memory.kmem.slabinfo

Signed-off-by: Balbir Singh <bsingharora at gmail.com>
---
 arch/powerpc/include/asm/book3s/64/pgalloc.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/book3s/64/pgalloc.h b/arch/powerpc/include/asm/book3s/64/pgalloc.h
index d0a9ca6..9207213 100644
--- a/arch/powerpc/include/asm/book3s/64/pgalloc.h
+++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h
@@ -52,7 +52,9 @@ extern void __tlb_remove_table(void *_table);
 
 static inline gfp_t pgtable_get_gfp_flags(struct mm_struct *mm, gfp_t gfp)
 {
-	return gfp;
+	if (mm == &init_mm)
+		return gfp;
+	return gfp | __GFP_ACCOUNT;
 }
 
 static inline pgd_t *radix__pgd_alloc(struct mm_struct *mm)
-- 
2.9.3



More information about the Linuxppc-dev mailing list