[PATCH slab/for-next v2 00/14] mm/slab: mandate SLAB_MAY_ACCOUNT for __GFP_ACCOUNT allocations to avoid wasting memory for slab metadata

Chris Down chris at chrisdown.name
Sat Nov 28 21:16:29 PST 2026


Hi Harry,

Harry Yoo (Meta) writes:
>While I tried to make sure the sweep is exhaustive, there can be a
>missing conversion. However that is not a correctness problem:
>the objects are just no longer charged to memcgs. Patch 13 adds
>VM_WARN_ON_ONCE in __memcg_slab_post_alloc_hook() to catch such a
>missing conversion.

This series looks good, thank you. But in terms of documentation, I
think we are a little bit light on where the SLAB_MAY_ACCOUNT
requirement is written down. Right now it's only written next to
SLAB_MAY_ACCOUNT in slab.h, but with that it's likely that people
adding __GFP_ACCOUNT won't see it. Could you also perhaps put it in
the __GFP_ACCOUNT comment in gfp_types.h and in
Documentation/core-api/memory-allocation.rst, which both still describe
__GFP_ACCOUNT as enough on its own? The comment above kmem_cache_charge()
also still says that only KMALLOC_NORMAL objects are skipped, so that
could be fixed in patch 14 as well.

I wouldn't block on that, but it would be good to improve this. I've
looked through these and am happy with them, and have tested where
possible so you can add:

Reviewed-by: Chris Down <chris at chrisdown.name>

For patches 1, 13 and 14:

Tested-by: Chris Down <chris at chrisdown.name>

Chris



More information about the linux-um mailing list