Bug 1030306

Summary: Very high unreclaimable slab memory with btrfs
Product: [Fedora] Fedora Reporter: Rudy Metzger <rudy.metzger>
Component: btrfs-progsAssignee: Josef Bacik <josef>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 19CC: esandeen, josef, mmahut
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 10:08:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rudy Metzger 2013-11-14 10:31:46 UTC
Description of problem:

When using btrfs, memory usage (slab memory) will go up and finally the machine runs out of memory.


Version-Release number of selected component (if applicable):

Fedora 19


How reproducible:

Always


Steps to Reproduce:
1. Install F19 (on a virtual machine)
2. Use btrfs for the file system
3. Use "ls -R /" to initially fill slab (already now uncreclaimable Slab is very high!)
4. Have it running for some time

Actual results:

System runs out of memory

Expected results:

Unreclaimable slab does not grow

Additional info:

The machine in questions as a virtual machine on a kvm host (but same behavior can be seen when running on physical machines).

[root@vm-machine ~]# uname -a
Linux vm-machine.domain.local 3.11.7-200.fc19.x86_64 #1 SMP Mon Nov 4 14:09:03 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@vm-machine ~]# modinfo btrfs
filename:       /lib/modules/3.11.7-200.fc19.x86_64/kernel/fs/btrfs/btrfs.ko
license:        GPL
alias:          devname:btrfs-control
alias:          char-major-10-234
alias:          fs-btrfs
depends:        libcrc32c,raid6_pq,xor,zlib_deflate
intree:         Y
vermagic:       3.11.7-200.fc19.x86_64 SMP mod_unload 
signer:         Fedora kernel signing key
sig_key:        81:C0:9E:56:78:F2:46:05:66:AF:2E:DE:38:3D:4B:66:D9:CD:13:F7
sig_hashalgo:   sha256
[root@vm-machine ~]# cat /proc/meminfo
MemTotal:        2051528 kB
MemFree:          125764 kB
Buffers:              20 kB
Cached:           614304 kB
SwapCached:            0 kB
Active:           430852 kB
Inactive:         353892 kB
Active(anon):     123952 kB
Inactive(anon):    50020 kB
Active(file):     306900 kB
Inactive(file):   303872 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       1023996 kB
SwapFree:        1023840 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:        170336 kB
Mapped:            43768 kB
Shmem:              3552 kB
Slab:            1099036 kB
SReclaimable:     170992 kB
SUnreclaim:       928044 kB
KernelStack:        1264 kB
PageTables:         8416 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2049760 kB
Committed_AS:     594716 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      151772 kB
VmallocChunk:   34359580148 kB
HardwareCorrupted:     0 kB
AnonHugePages:    116736 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:       49144 kB
DirectMap2M:     2048000 kB
[root@vm-machine ~]# cat /proc/slabinfo 
slabinfo - version: 2.1
# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>
btrfs_ordered_extent    418    418    368   22    2 : tunables    0    0    0 : slabdata     19     19      0
btrfs_extent_map   15722  16614    152   26    1 : tunables    0    0    0 : slabdata    639    639      0
btrfs_extent_buffer  37809  38016    320   12    1 : tunables    0    0    0 : slabdata   3168   3168      0
btrfs_extent_state  13582  13902     96   42    1 : tunables    0    0    0 : slabdata    331    331      0
btrfs_path            56     56    144   28    1 : tunables    0    0    0 : slabdata      2      2      0
btrfs_transaction   1144   1144    296   13    1 : tunables    0    0    0 : slabdata     88     88      0
btrfs_trans_handle     50     50    160   25    1 : tunables    0    0    0 : slabdata      2      2      0
btrfs_inode        97500  97770   1032   15    4 : tunables    0    0    0 : slabdata   6518   6518      0
ip6_dst_cache         42     42    384   21    2 : tunables    0    0    0 : slabdata      2      2      0
UDPLITEv6              0      0   1088   15    4 : tunables    0    0    0 : slabdata      0      0      0
UDPv6                 30     30   1088   15    4 : tunables    0    0    0 : slabdata      2      2      0
tw_sock_TCPv6          0      0    256   16    1 : tunables    0    0    0 : slabdata      0      0      0
TCPv6                 32     32   1984   16    8 : tunables    0    0    0 : slabdata      2      2      0
dm_snap_pending_exception      0      0    104   39    1 : tunables    0    0    0 : slabdata      0      0      0
kcopyd_job             0      0   3312    9    8 : tunables    0    0    0 : slabdata      0      0      0
dm_uevent              0      0   2608   12    8 : tunables    0    0    0 : slabdata      0      0      0
dm_rq_target_io        0      0    416   19    2 : tunables    0    0    0 : slabdata      0      0      0
cfq_queue             68     68    232   17    1 : tunables    0    0    0 : slabdata      4      4      0
bsg_cmd                0      0    312   13    1 : tunables    0    0    0 : slabdata      0      0      0
mqueue_inode_cache     18     18    896   18    4 : tunables    0    0    0 : slabdata      1      1      0
hugetlbfs_inode_cache     28     28    584   14    2 : tunables    0    0    0 : slabdata      2      2      0
jbd2_journal_handle     85     85     48   85    1 : tunables    0    0    0 : slabdata      1      1      0
jbd2_journal_head     36     36    112   36    1 : tunables    0    0    0 : slabdata      1      1      0
jbd2_revoke_table_s    256    256     16  256    1 : tunables    0    0    0 : slabdata      1      1      0
jbd2_revoke_record_s      0      0     32  128    1 : tunables    0    0    0 : slabdata      0      0      0
ext4_inode_cache     320    320   1016   16    4 : tunables    0    0    0 : slabdata     20     20      0
ext4_xattr          1058   1058     88   46    1 : tunables    0    0    0 : slabdata     23     23      0
ext4_free_data       576    576     64   64    1 : tunables    0    0    0 : slabdata      9      9      0
ext4_allocation_context    960    960    136   30    1 : tunables    0    0    0 : slabdata     32     32      0
ext4_io_end            0      0     80   51    1 : tunables    0    0    0 : slabdata      0      0      0
ext4_extent_status    612    612     40  102    1 : tunables    0    0    0 : slabdata      6      6      0
configfs_dir_cache     46     46     88   46    1 : tunables    0    0    0 : slabdata      1      1      0
dquot                 16     16    256   16    1 : tunables    0    0    0 : slabdata      1      1      0
kioctx                 0      0    448   18    2 : tunables    0    0    0 : slabdata      0      0      0
pid_namespace          0      0   2176   15    8 : tunables    0    0    0 : slabdata      0      0      0
posix_timers_cache      0      0    248   16    1 : tunables    0    0    0 : slabdata      0      0      0
UDP-Lite               0      0    896   18    4 : tunables    0    0    0 : slabdata      0      0      0
ip_fib_trie          146    146     56   73    1 : tunables    0    0    0 : slabdata      2      2      0
PING                   0      0    832   19    4 : tunables    0    0    0 : slabdata      0      0      0
UDP                   36     36    896   18    4 : tunables    0    0    0 : slabdata      2      2      0
tw_sock_TCP           21     21    192   21    1 : tunables    0    0    0 : slabdata      1      1      0
TCP                   36     36   1792   18    8 : tunables    0    0    0 : slabdata      2      2      0
blkdev_queue          30     30   2080   15    8 : tunables    0    0    0 : slabdata      2      2      0
blkdev_requests      193    210    376   21    2 : tunables    0    0    0 : slabdata     10     10      0
fsnotify_event_holder 110500 110500     24  170    1 : tunables    0    0    0 : slabdata    650    650      0
fsnotify_event       204    204    120   34    1 : tunables    0    0    0 : slabdata      6      6      0
sock_inode_cache     420    420    640   12    2 : tunables    0    0    0 : slabdata     35     35      0
shmem_inode_cache   3086   3168    656   12    2 : tunables    0    0    0 : slabdata    264    264      0
Acpi-ParseExt       1288   1288     72   56    1 : tunables    0    0    0 : slabdata     23     23      0
Acpi-Namespace       510    510     40  102    1 : tunables    0    0    0 : slabdata      5      5      0
taskstats             24     24    328   12    1 : tunables    0    0    0 : slabdata      2      2      0
proc_inode_cache   13802  15225    632   25    4 : tunables    0    0    0 : slabdata    609    609      0
sigqueue              50     50    160   25    1 : tunables    0    0    0 : slabdata      2      2      0
bdev_cache            38     38    832   19    4 : tunables    0    0    0 : slabdata      2      2      0
sysfs_dir_cache    13032  13032    112   36    1 : tunables    0    0    0 : slabdata    362    362      0
inode_cache        16126  17080    568   14    2 : tunables    0    0    0 : slabdata   1220   1220      0
dentry            109332 113463    192   21    1 : tunables    0    0    0 : slabdata   5403   5403      0
selinux_inode_security 130901 134130     80   51    1 : tunables    0    0    0 : slabdata   2630   2630      0
buffer_head          429    429    104   39    1 : tunables    0    0    0 : slabdata     11     11      0
vm_area_struct      5599   6204    184   22    1 : tunables    0    0    0 : slabdata    282    282      0
mm_struct            414    414    896   18    4 : tunables    0    0    0 : slabdata     23     23      0
files_cache           96     96    640   12    2 : tunables    0    0    0 : slabdata      8      8      0
signal_cache         148    180   1088   15    4 : tunables    0    0    0 : slabdata     12     12      0
sighand_cache        144    165   2112   15    8 : tunables    0    0    0 : slabdata     11     11      0
task_struct          175    208   1952   16    8 : tunables    0    0    0 : slabdata     13     13      0
anon_vma            2793   3008     64   64    1 : tunables    0    0    0 : slabdata     47     47      0
shared_policy_node   2380   2380     48   85    1 : tunables    0    0    0 : slabdata     28     28      0
numa_policy           30     30    136   30    1 : tunables    0    0    0 : slabdata      1      1      0
radix_tree_node    12757  13202    568   14    2 : tunables    0    0    0 : slabdata    943    943      0
idr_layer_cache      165    165   2112   15    8 : tunables    0    0    0 : slabdata     11     11      0
dma-kmalloc-8192       0      0   8192    4    8 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-4096       0      0   4096    8    8 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-2048       0      0   2048   16    8 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-1024       0      0   1024   16    4 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-512       16     16    512   16    2 : tunables    0    0    0 : slabdata      1      1      0
dma-kmalloc-256        0      0    256   16    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-128        0      0    128   32    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-64         0      0     64   64    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-32         0      0     32  128    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-16         0      0     16  256    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-8          0      0      8  512    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-192        0      0    192   21    1 : tunables    0    0    0 : slabdata      0      0      0
dma-kmalloc-96         0      0     96   42    1 : tunables    0    0    0 : slabdata      0      0      0
kmalloc-8192          44     44   8192    4    8 : tunables    0    0    0 : slabdata     11     11      0
kmalloc-4096         342    360   4096    8    8 : tunables    0    0    0 : slabdata     45     45      0
kmalloc-2048         376    400   2048   16    8 : tunables    0    0    0 : slabdata     25     25      0
kmalloc-1024        2928   2960   1024   16    4 : tunables    0    0    0 : slabdata    185    185      0
kmalloc-512          604    672    512   16    2 : tunables    0    0    0 : slabdata     42     42      0
kmalloc-256         5083   5280    256   16    1 : tunables    0    0    0 : slabdata    330    330      0
kmalloc-192         1594   1785    192   21    1 : tunables    0    0    0 : slabdata     85     85      0
kmalloc-128         1830   2272    128   32    1 : tunables    0    0    0 : slabdata     71     71      0
kmalloc-96          8806   9198     96   42    1 : tunables    0    0    0 : slabdata    219    219      0
kmalloc-64        14141888 14141888     64   64    1 : tunables    0    0    0 : slabdata 220967 220967      0
kmalloc-32        375936 375936     32  128    1 : tunables    0    0    0 : slabdata   2937   2937      0
kmalloc-16         68864  68864     16  256    1 : tunables    0    0    0 : slabdata    269    269      0
kmalloc-8         283648 283648      8  512    1 : tunables    0    0    0 : slabdata    554    554      0
kmem_cache_node      128    128     64   64    1 : tunables    0    0    0 : slabdata      2      2      0
kmem_cache           112    112    256   16    1 : tunables    0    0    0 : slabdata      7      7      0

Comment 1 Eric Sandeen 2013-11-18 18:21:29 UTC
If this is a bug, technically it's not a btrfs-progs bug, it's a kernel bug.

But if you file it as a kernel bug Josef will never see it.  ;)

So - which slabs grow as a result of these operations?  Maybe a before/after diff would be helpful.

Comment 2 Rudy Metzger 2013-11-21 10:08:42 UTC
I further investigated and it seems to be a problem within (the greeter) of lightdm. But I cannot fully reproduce it on this one machine, and not on others also using lightdm.

I will file a new report if I have more information, and closing this bug.