aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-ref.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/delayed-ref.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/delayed-ref.c')
-rw-r--r--fs/btrfs/delayed-ref.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 430b3689b112..08e452599249 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -940,28 +940,28 @@ int btrfs_delayed_ref_init(void)
940 btrfs_delayed_ref_head_cachep = kmem_cache_create( 940 btrfs_delayed_ref_head_cachep = kmem_cache_create(
941 "btrfs_delayed_ref_head", 941 "btrfs_delayed_ref_head",
942 sizeof(struct btrfs_delayed_ref_head), 0, 942 sizeof(struct btrfs_delayed_ref_head), 0,
943 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 943 SLAB_MEM_SPREAD, NULL);
944 if (!btrfs_delayed_ref_head_cachep) 944 if (!btrfs_delayed_ref_head_cachep)
945 goto fail; 945 goto fail;
946 946
947 btrfs_delayed_tree_ref_cachep = kmem_cache_create( 947 btrfs_delayed_tree_ref_cachep = kmem_cache_create(
948 "btrfs_delayed_tree_ref", 948 "btrfs_delayed_tree_ref",
949 sizeof(struct btrfs_delayed_tree_ref), 0, 949 sizeof(struct btrfs_delayed_tree_ref), 0,
950 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 950 SLAB_MEM_SPREAD, NULL);
951 if (!btrfs_delayed_tree_ref_cachep) 951 if (!btrfs_delayed_tree_ref_cachep)
952 goto fail; 952 goto fail;
953 953
954 btrfs_delayed_data_ref_cachep = kmem_cache_create( 954 btrfs_delayed_data_ref_cachep = kmem_cache_create(
955 "btrfs_delayed_data_ref", 955 "btrfs_delayed_data_ref",
956 sizeof(struct btrfs_delayed_data_ref), 0, 956 sizeof(struct btrfs_delayed_data_ref), 0,
957 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 957 SLAB_MEM_SPREAD, NULL);
958 if (!btrfs_delayed_data_ref_cachep) 958 if (!btrfs_delayed_data_ref_cachep)
959 goto fail; 959 goto fail;
960 960
961 btrfs_delayed_extent_op_cachep = kmem_cache_create( 961 btrfs_delayed_extent_op_cachep = kmem_cache_create(
962 "btrfs_delayed_extent_op", 962 "btrfs_delayed_extent_op",
963 sizeof(struct btrfs_delayed_extent_op), 0, 963 sizeof(struct btrfs_delayed_extent_op), 0,
964 SLAB_RECLAIM_ACCOUNT | SLAB_MEM_SPREAD, NULL); 964 SLAB_MEM_SPREAD, NULL);
965 if (!btrfs_delayed_extent_op_cachep) 965 if (!btrfs_delayed_extent_op_cachep)
966 goto fail; 966 goto fail;
967 967