btrfs: Fix slab accounting flags
authorNikolay Borisov <n.borisov.lkml@gmail.com>
Thu, 23 Jun 2016 18:17:08 +0000 (21:17 +0300)
committerDavid Sterba <dsterba@suse.com>
Tue, 26 Jul 2016 11:52:25 +0000 (13:52 +0200)
commitfba4b697710eb2a4bee456b9d39e9239c66f8bee
treefdd49decee2eac671ab875c9b195fb3ec5730692
parent7af7c616fa2f1ce6c0d806b89898d2df098b4bd8
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>
fs/btrfs/backref.c
fs/btrfs/delayed-inode.c
fs/btrfs/delayed-ref.c
fs/btrfs/disk-io.c
fs/btrfs/extent_io.c
fs/btrfs/extent_map.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c