From: Mikulas Patocka Date: Thu, 13 Jul 2023 16:00:28 +0000 (+0200) Subject: bcachefs: mark bch_inode_info and bkey_cached as reclaimable X-Git-Tag: io_uring-6.7-2023-11-10~119^2~194 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=5eaa76d813d48a524a1ce040539048b851a0a20c;p=linux-block.git bcachefs: mark bch_inode_info and bkey_cached as reclaimable Mark these caches as reclaimable, so that available memory is correctly reported when there is a lot of cached inodes. Note that more work is needed - you should add __GFP_RECLAIMABLE to some of the kmalloc calls, so that they are allocated from the "kmalloc-rcl-*" caches. Signed-off-by: Mikulas Patocka Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c index 34d959c4e640..badb541f493f 100644 --- a/fs/bcachefs/btree_key_cache.c +++ b/fs/bcachefs/btree_key_cache.c @@ -1066,7 +1066,7 @@ void bch2_btree_key_cache_exit(void) int __init bch2_btree_key_cache_init(void) { - bch2_key_cache = KMEM_CACHE(bkey_cached, 0); + bch2_key_cache = KMEM_CACHE(bkey_cached, SLAB_RECLAIM_ACCOUNT); if (!bch2_key_cache) return -ENOMEM; diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c index 9280f514bc9f..e1824bdffdf8 100644 --- a/fs/bcachefs/fs.c +++ b/fs/bcachefs/fs.c @@ -1926,7 +1926,7 @@ int __init bch2_vfs_init(void) { int ret = -ENOMEM; - bch2_inode_cache = KMEM_CACHE(bch_inode_info, 0); + bch2_inode_cache = KMEM_CACHE(bch_inode_info, SLAB_RECLAIM_ACCOUNT); if (!bch2_inode_cache) goto err;