linux-uconsole/drivers/md/bcache
Coly Li 247acf4308 bcache: at least try to shrink 1 node in bch_mca_scan()
[ Upstream commit 9fcc34b1a6 ]

In bch_mca_scan(), the number of shrinking btree node is calculated
by code like this,
	unsigned long nr = sc->nr_to_scan;

        nr /= c->btree_pages;
        nr = min_t(unsigned long, nr, mca_can_free(c));
variable sc->nr_to_scan is number of objects (here is bcache B+tree
nodes' number) to shrink, and pointer variable sc is sent from memory
management code as parametr of a callback.

If sc->nr_to_scan is smaller than c->btree_pages, after the above
calculation, variable 'nr' will be 0 and nothing will be shrunk. It is
frequeently observed that only 1 or 2 is set to sc->nr_to_scan and make
nr to be zero. Then bch_mca_scan() will do nothing more then acquiring
and releasing mutex c->bucket_lock.

This patch checkes whether nr is 0 after the above calculation, if 0
is the result then set 1 to variable 'n'. Then at least bch_mca_scan()
will try to shrink a single B+tree node.

Signed-off-by: Coly Li <colyli@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-04 19:12:58 +01:00
..
alloc.c bcache: fix deadlock in bcache_allocator 2019-12-31 16:36:02 +01:00
bcache.h bcache: fix deadlock in bcache_allocator 2019-12-31 16:36:02 +01:00
bset.c bcache: fix stack corruption by PRECEDING_KEY() 2019-06-19 08:18:00 +02:00
bset.h bcache: fix stack corruption by PRECEDING_KEY() 2019-06-19 08:18:00 +02:00
btree.c bcache: at least try to shrink 1 node in bch_mca_scan() 2020-01-04 19:12:58 +01:00
btree.h bcache: fix race in btree_flush_write() 2019-09-16 08:22:23 +02:00
closure.c closures: fix a race on wakeup from closure_sync 2019-10-05 13:09:54 +02:00
closure.h bcache: add the missing comments for smp_mb()/smp_wmb() 2018-08-11 15:46:42 -06:00
debug.c bcache: do not check if debug dentry is ERR or NULL explicitly on remove 2019-12-05 09:20:07 +01:00
debug.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
extents.c bcache: treat stale && dirty keys as bad keys 2019-09-16 08:22:05 +02:00
extents.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
io.c bcache: ignore read-ahead request failure on backing device 2019-07-26 09:14:21 +02:00
journal.c bcache: fix race in btree_flush_write() 2019-09-16 08:22:23 +02:00
journal.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
Kconfig for-4.19/post-20180822 2018-08-22 13:38:05 -07:00
Makefile
movinggc.c bcache: style fix to add a blank line after declarations 2018-08-11 15:46:41 -06:00
request.c bcache: use (REQ_META|REQ_PRIO) to indicate bio for metadata 2019-03-23 20:10:13 +01:00
request.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
stats.c bcache: style fix to add a blank line after declarations 2018-08-11 15:46:41 -06:00
stats.h bcache: add identifier names to arguments of function definitions 2018-08-11 15:46:41 -06:00
super.c bcache: fix deadlock in bcache_allocator 2019-12-31 16:36:02 +01:00
sysfs.c bcache: fix input overflow to writeback_rate_minimum 2019-11-06 13:05:20 +01:00
sysfs.h bcache: improve sysfs_strtoul_clamp() 2019-04-05 22:33:09 +02:00
trace.c
util.c for-4.19/post-20180822 2018-08-22 13:38:05 -07:00
util.h bcache: Revert "bcache: fix high CPU occupancy during journal" 2019-07-26 09:14:21 +02:00
writeback.c bcache: do not mark writeback_running too early 2019-12-05 09:20:07 +01:00
writeback.h bcache: never writeback a discard operation 2019-03-23 20:10:10 +01:00