[dm-devel] Patch "dm writecache: set a default MAX_WRITEBACK_JOBS" has been added to the 5.19-stable tree

Sasha Levin sashal at kernel.org
Mon Aug 15 05:59:55 UTC 2022


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

    dm writecache: set a default MAX_WRITEBACK_JOBS

to the 5.19-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:
     dm-writecache-set-a-default-max_writeback_jobs.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable at vger.kernel.org> know about it.



commit 83402c76c0b6106f058eb77746a1cec1dd7273fd
Author: Mikulas Patocka <mpatocka at redhat.com>
Date:   Wed Jul 13 07:09:04 2022 -0400

    dm writecache: set a default MAX_WRITEBACK_JOBS
    
    [ Upstream commit ca7dc242e358e46d963b32f9d9dd829785a9e957 ]
    
    dm-writecache has the capability to limit the number of writeback jobs
    in progress. However, this feature was off by default. As such there
    were some out-of-memory crashes observed when lowering the low
    watermark while the cache is full.
    
    This commit enables writeback limit by default. It is set to 256MiB or
    1/16 of total system memory, whichever is smaller.
    
    Cc: stable at vger.kernel.org
    Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
    Signed-off-by: Mike Snitzer <snitzer at kernel.org>
    Signed-off-by: Sasha Levin <sashal at kernel.org>

diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index d74c5a7a0ab4..d572135cd43f 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -22,7 +22,7 @@
 
 #define HIGH_WATERMARK			50
 #define LOW_WATERMARK			45
-#define MAX_WRITEBACK_JOBS		0
+#define MAX_WRITEBACK_JOBS		min(0x10000000 / PAGE_SIZE, totalram_pages() / 16)
 #define ENDIO_LATENCY			16
 #define WRITEBACK_LATENCY		64
 #define AUTOCOMMIT_BLOCKS_SSD		65536



More information about the dm-devel mailing list