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 4.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-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From ca7dc242e358e46d963b32f9d9dd829785a9e957 Mon Sep 17 00:00:00 2001 From: Mikulas Patocka <mpatocka@xxxxxxxxxx> Date: Wed, 13 Jul 2022 07:09:04 -0400 Subject: dm writecache: set a default MAX_WRITEBACK_JOBS From: Mikulas Patocka <mpatocka@xxxxxxxxxx> commit ca7dc242e358e46d963b32f9d9dd829785a9e957 upstream. 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@xxxxxxxxxxxxxxx Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/md/dm-writecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -20,7 +20,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 Patches currently in stable-queue which might be from mpatocka@xxxxxxxxxx are queue-4.19/md-raid10-fix-kasan-warning.patch queue-4.19/dm-raid-fix-address-sanitizer-warning-in-raid_status.patch queue-4.19/dm-raid-fix-address-sanitizer-warning-in-raid_resume.patch queue-4.19/add-barriers-to-buffer_uptodate-and-set_buffer_uptodate.patch queue-4.19/dm-writecache-set-a-default-max_writeback_jobs.patch