[PATCH slab/for-next 08/14] powerpc/mm: specify SLAB_MAY_ACCOUNT for pgtable caches
From: Harry Yoo (Meta)
Date: Wed Oct 21 2026 - 07:54:59 EST
User page tables are allocated from PGT_CACHE() with
pgtable_gfp_flags(), which adds __GFP_ACCOUNT for non-kernel mms.
Specify SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
__GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
Path: copy_process() -> mm_init() -> pgd_alloc()
-> kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
pgtable_gfp_flags(mm, GFP_KERNEL))
Assisted-by: LLM
Cc: Madhavan Srinivasan <maddy@xxxxxxxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Nicholas Piggin <npiggin@xxxxxxxxx>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@xxxxxxxxxx>
Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
Signed-off-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>
---
arch/powerpc/mm/init-common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/mm/init-common.c b/arch/powerpc/mm/init-common.c
index 745097554bea..72dfcc559630 100644
--- a/arch/powerpc/mm/init-common.c
+++ b/arch/powerpc/mm/init-common.c
@@ -140,7 +140,8 @@ void pgtable_cache_add(unsigned int shift)
align = max_t(unsigned long, align, minalign);
name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift);
if (name)
- new = kmem_cache_create(name, table_size, align, 0, ctor(shift));
+ new = kmem_cache_create(name, table_size, align,
+ SLAB_MAY_ACCOUNT, ctor(shift));
if (!new)
panic("Could not allocate pgtable cache for order %d", shift);
--
2.54.0