[PATCH slab/for-next v2 01/14] mm/slab: allow passing SLAB_MAY_ACCOUNT to kmem_cache_create()

Hao Li hao.li at linux.dev
Thu Dec 3 14:23:22 UTC 2026


On Wed, Nov 25, 2026 at 09:37:02PM +0000, Harry Yoo (Meta) wrote:
> Callers will specify SLAB_MAY_ACCOUNT for caches whose objects may be
> allocated with __GFP_ACCOUNT. Accept the flag in SLAB_CORE_FLAGS.
> 
> SLAB_MAY_ACCOUNT prevents merging but is not part of the sysfs ID. This
> was fine while all mergeable caches had the flag. Now that callers may
> specify it, encode it in create_unique_id() to keep the ID unique.
> 
> Define the flag in tools/ as well to avoid breaking the userspace tests.
> 
> Signed-off-by: Harry Yoo (Meta) <harry at kernel.org>
> ---
>  mm/slab.h                  | 2 +-
>  mm/slub.c                  | 2 ++
>  tools/include/linux/slab.h | 3 +++
>  3 files changed, 6 insertions(+), 1 deletion(-)

Looks good to me.
Reviewed-by: Hao Li <hao.li at linux.dev>

-- 
Thanks,
Hao



More information about the Linux-security-module-archive mailing list