Skip to contentSkip to conversation

kernfs: account kernfs_node_cache as reclaimable

PATCH In review Cong Wang 2 participants 2 messages Jan 26, 2018 – Jan 29, 2018 kernfs

lore
Share & tools
lore

Cong Wang

author
#0 lore raw

PATCH 1/1 kernfs: account kernfs_node_cache as reclaimable

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 <[email protected]>
Cc Tejun Heo <[email protected]>
---
 fs/kernfs/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/kernfs/mount.c +1 -1
index 26dd9a50f383..66a699d06c9a 100644
@@ -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);
 }
Signature · 1 line
2.13.0
maintainer
#1 lore raw
Quoted 5 lines · Cong Wang

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.

That evicts the inode, not the kernfs_node. kernfs_node is the backing storage for these filesystems. They aren't reclaimable.

Thanks.

Signature · 1 line
tejun