[PATCH] hfs, hfsplus: use SLAB_RECLAIM_ACCOUNT and SLAB_MEM_SPREAD flags

From: Mikulas Patocka
Date: Mon Oct 03 2016 - 14:48:03 EST


Add the flags SLAB_RECLAIM_ACCOUNT and SLAB_MEM_SPREAD to hfs and hfsplus
inode cache, so that it is consistent with other filesystems.

The SLAB_RECLAIM_ACCOUNT flags accounts memory allocated for the inode
cache in the "SReclaimable" field in /proc/meminfo.

The SLAB_MEM_SPREAD spreads the allocated memory across all NUMA nodes,
most other filesystems use this flag.

Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx>

Index: linux-2.6/fs/hfs/super.c
===================================================================
--- linux-2.6.orig/fs/hfs/super.c
+++ linux-2.6/fs/hfs/super.c
@@ -484,7 +484,8 @@ static int __init init_hfs_fs(void)

hfs_inode_cachep = kmem_cache_create("hfs_inode_cache",
sizeof(struct hfs_inode_info), 0,
- SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT, hfs_init_once);
+ SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT,
+ hfs_init_once);
if (!hfs_inode_cachep)
return -ENOMEM;
err = register_filesystem(&hfs_fs_type);
Index: linux-2.6/fs/hfsplus/super.c
===================================================================
--- linux-2.6.orig/fs/hfsplus/super.c
+++ linux-2.6/fs/hfsplus/super.c
@@ -666,7 +666,8 @@ static int __init init_hfsplus_fs(void)
int err;

hfsplus_inode_cachep = kmem_cache_create("hfsplus_icache",
- HFSPLUS_INODE_SIZE, 0, SLAB_HWCACHE_ALIGN|SLAB_ACCOUNT,
+ HFSPLUS_INODE_SIZE, 0,
+ SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD | SLAB_ACCOUNT,
hfsplus_init_once);
if (!hfsplus_inode_cachep)
return -ENOMEM;