From: Greg Kroah-Hartman Date: Sat, 5 Aug 2023 15:29:09 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.14.321~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c0c6446d77bf743a692d17ac0397e1882a8ce89;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: loop-select-i-o-scheduler-none-from-inside-add_disk.patch --- diff --git a/queue-5.10/loop-select-i-o-scheduler-none-from-inside-add_disk.patch b/queue-5.10/loop-select-i-o-scheduler-none-from-inside-add_disk.patch new file mode 100644 index 00000000000..ef985ca0283 --- /dev/null +++ b/queue-5.10/loop-select-i-o-scheduler-none-from-inside-add_disk.patch @@ -0,0 +1,53 @@ +From 2112f5c1330a671fa852051d85cb9eadc05d7eb7 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Thu, 5 Aug 2021 10:42:00 -0700 +Subject: loop: Select I/O scheduler 'none' from inside add_disk() + +From: Bart Van Assche + +commit 2112f5c1330a671fa852051d85cb9eadc05d7eb7 upstream. + +We noticed that the user interface of Android devices becomes very slow +under memory pressure. This is because Android uses the zram driver on top +of the loop driver for swapping, because under memory pressure the swap +code alternates reads and writes quickly, because mq-deadline is the +default scheduler for loop devices and because mq-deadline delays writes by +five seconds for such a workload with default settings. Fix this by making +the kernel select I/O scheduler 'none' from inside add_disk() for loop +devices. This default can be overridden at any time from user space, +e.g. via a udev rule. This approach has an advantage compared to changing +the I/O scheduler from userspace from 'mq-deadline' into 'none', namely +that synchronize_rcu() does not get called. + +This patch changes the default I/O scheduler for loop devices from +'mq-deadline' into 'none'. + +Additionally, this patch reduces the Android boot time on my test setup +with 0.5 seconds compared to configuring the loop I/O scheduler from user +space. + +Cc: Christoph Hellwig +Cc: Ming Lei +Cc: Tetsuo Handa +Cc: Martijn Coenen +Cc: Jaegeuk Kim +Signed-off-by: Bart Van Assche +Link: https://lore.kernel.org/r/20210805174200.3250718-3-bvanassche@acm.org +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/loop.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -2109,7 +2109,8 @@ static int loop_add(struct loop_device * + lo->tag_set.queue_depth = 128; + lo->tag_set.numa_node = NUMA_NO_NODE; + lo->tag_set.cmd_size = sizeof(struct loop_cmd); +- lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING; ++ lo->tag_set.flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING | ++ BLK_MQ_F_NO_SCHED; + lo->tag_set.driver_data = lo; + + err = blk_mq_alloc_tag_set(&lo->tag_set); diff --git a/queue-5.10/series b/queue-5.10/series index 73f8cd09a39..f6922dfe938 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -121,3 +121,4 @@ x86-kprobes-update-kcb-status-flag-after-singlestepping.patch x86-kprobes-fix-jng-jnle-emulation.patch io_uring-gate-iowait-schedule-on-having-pending-requests.patch perf-fix-function-pointer-case.patch +loop-select-i-o-scheduler-none-from-inside-add_disk.patch