[PATCH slab/for-next 12/14] hostfs: specify SLAB_MAY_ACCOUNT for inode cache

From: Harry Yoo (Meta)

Date: Wed Oct 21 2026 - 07:56:09 EST


hostfs inodes are allocated with 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: lookup -> hostfs_iget() -> hostfs_alloc_inode()
-> alloc_inode_sb(sb, hostfs_inode_cache, GFP_KERNEL_ACCOUNT)

Assisted-by: LLM
Cc: Richard Weinberger <richard@xxxxxx>
Cc: Anton Ivanov <anton.ivanov@xxxxxxxxxxxxxxxxxx>
Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Cc: linux-um@xxxxxxxxxxxxxxxxxxx
Signed-off-by: Harry Yoo (Meta) <harry@xxxxxxxxxx>
---
fs/hostfs/hostfs_kern.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 7add056d47d8..2d55f53569ca 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -1078,7 +1078,7 @@ MODULE_ALIAS_FS("hostfs");

static int __init init_hostfs(void)
{
- hostfs_inode_cache = KMEM_CACHE(hostfs_inode_info, 0);
+ hostfs_inode_cache = KMEM_CACHE(hostfs_inode_info, SLAB_MAY_ACCOUNT);
if (!hostfs_inode_cache)
return -ENOMEM;
return register_filesystem(&hostfs_type);

--
2.54.0