]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - fs/ext4/mballoc.c
ext4: add cond_resched() to ext4_free_blocks() & ext4_mb_regular_allocator()
authorTheodore Ts'o <tytso@mit.edu>
Wed, 12 Jun 2013 15:43:02 +0000 (11:43 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 12 Jun 2013 15:43:02 +0000 (11:43 -0400)
commit2ed5724d5a78a22864ef0bd6af4fcb8a15379f00
tree2518af807533068bc4e3877843188da90947394c
parent20970ba65d5a22f2e4efbfa100377722fde56935
ext4: add cond_resched() to ext4_free_blocks() & ext4_mb_regular_allocator()

For a file systems with a very large number of block groups, if all of
the block group bitmaps are in memory and the file system is
relatively badly fragmented, it's possible ext4_mb_regular_allocator()
to take a long time trying to find a good match.  This is especially
true if the tuning parameter mb_max_to_scan has been sent to a very
large number.  So add a cond_resched() to avoid soft lockup warnings
and to provide better system responsiveness.

For ext4_free_blocks(), if we are deleting a large range of blocks,
and data=journal is enabled so that EXT4_FREE_BLOCKS_FORGET is passed,
the loop to call sb_find_get_block() and to call ext4_forget() can
take over 10-15 milliseocnds or more.  So it's better to add a
cond_resched() here a well.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/mballoc.c