[PATCH slab/for-next v2 10/14] fanotify: specify SLAB_MAY_ACCOUNT for event caches

Hao Li hao.li at linux.dev
Thu Dec 3 15:00:01 UTC 2026


On Wed, Nov 25, 2026 at 09:37:11PM +0000, Harry Yoo (Meta) wrote:
> fanotify events are allocated with GFP_KERNEL_ACCOUNT and charged to
> the memcg of the listener. Specify SLAB_MAY_ACCOUNT when the object
> may be charged to a memcg. __GFP_ACCOUNT without SLAB_MAY_ACCOUNT
> will not be allowed.
> 
> Path: fsnotify() -> fanotify_handle_event()
>   -> fanotify_alloc_event(GFP_KERNEL_ACCOUNT)
>   -> kmem_cache_alloc(fanotify_{fid,path,perm,mnt}_event_cachep)
> 
> Cc: Jan Kara <jack at suse.cz>
> Cc: Amir Goldstein <amir73il at gmail.com>
> Cc: linux-fsdevel at vger.kernel.org
> Signed-off-by: Harry Yoo (Meta) <harry at kernel.org>
> ---
>  fs/notify/fanotify/fanotify_user.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

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