Patch "bcache: at least try to shrink 1 node in bch_mca_scan()" has been added to the 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bcache: at least try to shrink 1 node in bch_mca_scan()

to the 4.14-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bcache-at-least-try-to-shrink-1-node-in-bch_mca_scan.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e5a27fbf90ada632c37af1b4e80234d89349b004
Author: Coly Li <colyli@xxxxxxx>
Date:   Wed Nov 13 16:03:24 2019 +0800

    bcache: at least try to shrink 1 node in bch_mca_scan()
    
    [ Upstream commit 9fcc34b1a6dd4b8e5337e2b6ef45e428897eca6b ]
    
    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@xxxxxxx>
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c
index 9406326216f1..96a6583e7b52 100644
--- a/drivers/md/bcache/btree.c
+++ b/drivers/md/bcache/btree.c
@@ -685,6 +685,8 @@ static unsigned long bch_mca_scan(struct shrinker *shrink,
 	 * IO can always make forward progress:
 	 */
 	nr /= c->btree_pages;
+	if (nr == 0)
+		nr = 1;
 	nr = min_t(unsigned long, nr, mca_can_free(c));
 
 	i = 0;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux