kernel_optimize_test/fs/btrfs
Filipe Manana 7064dd5c36 Btrfs: don't monopolize a core when evicting inode
If an inode has a very large number of extent maps, we can spend
a lot of time freeing them, which triggers a soft lockup warning.
Therefore reschedule if we need to when freeing the extent maps
while evicting the inode.

I could trigger this all the time by running xfstests/generic/299 on
a file system with the no-holes feature enabled. That test creates
an inode with 11386677 extent maps.

    $ mkfs.btrfs -f -O no-holes $TEST_DEV
    $ MKFS_OPTIONS="-O no-holes" ./check generic/299
    generic/299 382s ...
    Message from syslogd@debian-vm3 at Aug  7 10:44:29 ...
     kernel:[85304.208017] BUG: soft lockup - CPU#0 stuck for 22s! [umount:25330]
     384s
    Ran: generic/299
    Passed all 1 tests

    $ dmesg
    (...)
    [86304.300017] BUG: soft lockup - CPU#0 stuck for 23s! [umount:25330]
    (...)
    [86304.300036] Call Trace:
    [86304.300036]  [<ffffffff81698ba9>] __slab_free+0x54/0x295
    [86304.300036]  [<ffffffffa02ee9cc>] ? free_extent_map+0x5c/0xb0 [btrfs]
    [86304.300036]  [<ffffffff811a6cd2>] kmem_cache_free+0x282/0x2a0
    [86304.300036]  [<ffffffffa02ee9cc>] free_extent_map+0x5c/0xb0 [btrfs]
    [86304.300036]  [<ffffffffa02e3775>] btrfs_evict_inode+0xd5/0x660 [btrfs]
    [86304.300036]  [<ffffffff811e7c8d>] ? __inode_wait_for_writeback+0x6d/0xc0
    [86304.300036]  [<ffffffff816a389b>] ? _raw_spin_unlock+0x2b/0x40
    [86304.300036]  [<ffffffff811d8cbb>] evict+0xab/0x180
    [86304.300036]  [<ffffffff811d8dce>] dispose_list+0x3e/0x60
    [86304.300036]  [<ffffffff811d9b04>] evict_inodes+0xf4/0x110
    [86304.300036]  [<ffffffff811bd953>] generic_shutdown_super+0x53/0x110
    [86304.300036]  [<ffffffff811bdaa6>] kill_anon_super+0x16/0x30
    [86304.300036]  [<ffffffffa02a78ba>] btrfs_kill_super+0x1a/0xa0 [btrfs]
    [86304.300036]  [<ffffffff811bd3a9>] deactivate_locked_super+0x59/0x80
    [86304.300036]  [<ffffffff811be44e>] deactivate_super+0x4e/0x70
    [86304.300036]  [<ffffffff811dec14>] mntput_no_expire+0x174/0x1f0
    [86304.300036]  [<ffffffff811deab7>] ? mntput_no_expire+0x17/0x1f0
    [86304.300036]  [<ffffffff811e0517>] SyS_umount+0x97/0x100
    (...)

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Tested-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: Chris Mason <clm@fb.com>
2014-08-21 07:55:25 -07:00
..
tests
acl.c
async-thread.c
async-thread.h
backref.c Btrfs: Fix memory corruption by ulist_add_merge() on 32bit arch 2014-08-15 07:43:19 -07:00
backref.h
btrfs_inode.h btrfs: disable strict file flushes for renames and truncates 2014-08-15 07:43:42 -07:00
check-integrity.c
check-integrity.h
compression.c
compression.h
ctree.c
ctree.h
delayed-inode.c
delayed-inode.h
delayed-ref.c
delayed-ref.h
dev-replace.c
dev-replace.h
dir-item.c
disk-io.c Btrfs: Fix wrong device size when we are resizing the device 2014-08-19 08:52:18 -07:00
disk-io.h
export.c
export.h
extent_io.c btrfs: Return right extent when fiemap gives unaligned offset and len. 2014-08-19 08:52:14 -07:00
extent_io.h
extent_map.c
extent_map.h
extent-tree.c Btrfs: don't consider the missing device when allocating new chunks 2014-08-19 08:52:19 -07:00
file-item.c Btrfs: fix csum tree corruption, duplicate and outdated checksums 2014-08-15 07:43:40 -07:00
file.c Btrfs: fill_holes: Fix slot number passed to hole_mergeable() call. 2014-08-19 08:36:26 -07:00
free-space-cache.c
free-space-cache.h
hash.c
hash.h
inode-item.c
inode-map.c
inode-map.h
inode.c Btrfs: don't monopolize a core when evicting inode 2014-08-21 07:55:25 -07:00
ioctl.c Btrfs: race free update of commit root for ro snapshots 2014-08-21 07:55:21 -07:00
Kconfig
locking.c
locking.h
lzo.c
Makefile
math.h
ordered-data.c btrfs: disable strict file flushes for renames and truncates 2014-08-15 07:43:42 -07:00
ordered-data.h btrfs: disable strict file flushes for renames and truncates 2014-08-15 07:43:42 -07:00
orphan.c
print-tree.c
print-tree.h
props.c
props.h
qgroup.c btrfs: correctly handle return from ulist_add 2014-08-15 07:43:16 -07:00
qgroup.h btrfs: qgroup: account shared subtrees during snapshot delete 2014-08-15 07:43:14 -07:00
raid56.c
raid56.h
rcu-string.h
reada.c
relocation.c
root-tree.c
scrub.c Btrfs: don't write any data into a readonly device when scrub 2014-08-19 08:52:17 -07:00
send.c
send.h
struct-funcs.c
super.c
sysfs.c Btrfs: fix regression of btrfs device replace 2014-08-21 07:55:20 -07:00
sysfs.h
transaction.c btrfs: disable strict file flushes for renames and truncates 2014-08-15 07:43:42 -07:00
transaction.h btrfs: disable strict file flushes for renames and truncates 2014-08-15 07:43:42 -07:00
tree-defrag.c
tree-log.c Btrfs: fix hole detection during file fsync 2014-08-21 07:55:24 -07:00
tree-log.h
ulist.c
ulist.h Btrfs: Fix memory corruption by ulist_add_merge() on 32bit arch 2014-08-15 07:43:19 -07:00
uuid-tree.c
volumes.c Btrfs: Fix wrong device size when we are resizing the device 2014-08-19 08:52:18 -07:00
volumes.h
xattr.c
xattr.h
zlib.c