aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorNikolay Borisov <n.borisov.lkml@gmail.com>2016-06-23 14:17:08 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-26 07:52:25 -0400
commitfba4b697710eb2a4bee456b9d39e9239c66f8bee (patch)
treefdd49decee2eac671ab875c9b195fb3ec5730692 /fs/btrfs/inode.c
parent7af7c616fa2f1ce6c0d806b89898d2df098b4bd8 (diff)
btrfs: Fix slab accounting flags
BTRFS is using a variety of slab caches to satisfy internal needs. Those slab caches are always allocated with the SLAB_RECLAIM_ACCOUNT, meaning allocations from the caches are going to be accounted as SReclaimable. At the same time btrfs is not registering any shrinkers whatsoever, thus preventing memory from the slabs to be shrunk. This means those caches are not in fact reclaimable. To fix this remove the SLAB_RECLAIM_ACCOUNT on all caches apart from the inode cache, since this one is being freed by the generic VFS super_block shrinker. Also set the transaction related caches as SLAB_TEMPORARY, to better document the lifetime of the objects (it just translates to SLAB_RECLAIM_ACCOUNT). Signed-off-by: Nikolay Borisov <n.borisov.lkml@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5c2c076bc552..01c6fca925f7 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -9392,25 +9392,25 @@ int btrfs_init_cachep(void)
9392 9392
9393 btrfs_trans_handle_cachep = kmem_cache_create("btrfs_trans_handle", 9393 btrfs_trans_handle_cachep = kmem_cache_create("btrfs_trans_handle",
9394 sizeof(struct btrfs_trans_handle), 0, 9394 sizeof(struct btrfs_trans_handle), 0,
9395 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 9395 SLAB_TEMPORARY | SLAB_MEM_SPREAD, NULL);
9396 if (!btrfs_trans_handle_cachep) 9396 if (!btrfs_trans_handle_cachep)
9397 goto fail; 9397 goto fail;
9398 9398
9399 btrfs_transaction_cachep = kmem_cache_create("btrfs_transaction", 9399 btrfs_transaction_cachep = kmem_cache_create("btrfs_transaction",
9400 sizeof(struct btrfs_transaction), 0, 9400 sizeof(struct btrfs_transaction), 0,
9401 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 9401 SLAB_TEMPORARY | SLAB_MEM_SPREAD, NULL);
9402 if (!btrfs_transaction_cachep) 9402 if (!btrfs_transaction_cachep)
9403 goto fail; 9403 goto fail;
9404 9404
9405 btrfs_path_cachep = kmem_cache_create("btrfs_path", 9405 btrfs_path_cachep = kmem_cache_create("btrfs_path",
9406 sizeof(struct btrfs_path), 0, 9406 sizeof(struct btrfs_path), 0,
9407 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 9407 SLAB_MEM_SPREAD, NULL);
9408 if (!btrfs_path_cachep) 9408 if (!btrfs_path_cachep)
9409 goto fail; 9409 goto fail;
9410 9410
9411 btrfs_free_space_cachep = kmem_cache_create("btrfs_free_space", 9411 btrfs_free_space_cachep = kmem_cache_create("btrfs_free_space",
9412 sizeof(struct btrfs_free_space), 0, 9412 sizeof(struct btrfs_free_space), 0,
9413 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 9413 SLAB_MEM_SPREAD, NULL);
9414 if (!btrfs_free_space_cachep) 9414 if (!btrfs_free_space_cachep)
9415 goto fail; 9415 goto fail;
9416 9416