[PATCH] kernfs: account kernfs_node_cache as reclaimable

From: Cong Wang
Date: Fri Jan 26 2018 - 17:47:30 EST


Similar to commit df206988e03e
("fs: fuse: account fuse_inode slab memory as reclaimable"), these
kernfs nodes are currently included in the unreclaimable slab counts -
SUnreclaim in /proc/meminfo. And they are reclaimable too and can be
freed by kernfs_evict_inode() via /proc/sys/vm/drop_caches easily.

Mark the slab cache reclaimable.

Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Signed-off-by: Cong Wang <xiyou.wangcong@xxxxxxxxx>
---
fs/kernfs/mount.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/kernfs/mount.c b/fs/kernfs/mount.c
index 26dd9a50f383..66a699d06c9a 100644
--- a/fs/kernfs/mount.c
+++ b/fs/kernfs/mount.c
@@ -411,6 +411,6 @@ void __init kernfs_init(void)
kernfs_node_cache = kmem_cache_create("kernfs_node_cache",
sizeof(struct kernfs_node),
0,
- SLAB_PANIC | SLAB_TYPESAFE_BY_RCU,
+ SLAB_PANIC | SLAB_TYPESAFE_BY_RCU | SLAB_RECLAIM_ACCOUNT,
NULL);
}
--
2.13.0