[PATCH slab/for-next v2 02/14] lib/maple_tree: specify SLAB_MAY_ACCOUNT for maple_node cache

Liam R. Howlett liam at infradead.org
Thu Nov 26 11:34:30 PST 2026


On 26/11/25 09:37PM, Harry Yoo (Meta) wrote:
> Maple tree users can pass accounted gfp flags down to node allocations
> (e.g. arm64 KVM's smccc_filter uses GFP_KERNEL_ACCOUNT). Specify
> SLAB_MAY_ACCOUNT when the object may be charged to a memcg.
> __GFP_ACCOUNT without SLAB_MAY_ACCOUNT will not be allowed.
> 
> Path: mtree_insert_range(GFP_KERNEL_ACCOUNT) -> mas_nomem()
>   -> mas_alloc_nodes() -> kmem_cache_alloc(maple_node_cache)
> 
> Cc: "Liam R. Howlett" <liam at infradead.org>
> Cc: Alice Ryhl <aliceryhl at google.com>
> Cc: Andrew Ballance <andrewjballance at gmail.com>
> Cc: maple-tree at lists.infradead.org
> Signed-off-by: Harry Yoo (Meta) <harry at kernel.org>

Reviewed-by: Liam R. Howlett (Google) <liam at infradead.org>

> ---
>  lib/maple_tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index f7f51f1b40d9..5ff176f1a021 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5815,7 +5815,7 @@ void __init maple_tree_init(void)
>  
>  	maple_node_cache = kmem_cache_create("maple_node",
>  			sizeof(struct maple_node), &args,
> -			SLAB_PANIC);
> +			SLAB_PANIC | SLAB_MAY_ACCOUNT);
>  }
>  
>  /**
> 
> -- 
> 2.54.0
> 



More information about the maple-tree mailing list