Commit b5dd2f6047ca1080 ("block: loop: improve performance via blk-mq") started using a global WQ_MEM_RECLAIM workqueue. + loop_wq = alloc_workqueue("kloopd", + WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 0); Commit f4aa4c7bbac6c4af ("block: loop: convert to per-device workqueue") started using per device WQ_MEM_RECLAIM workqueue. - loop_wq = alloc_workqueue("kloopd", - WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 0); + lo->wq = alloc_workqueue("kloopd%d", + WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 0, + lo->lo_number); Commit 4d4e41aef9429872 ("block: loop: avoiding too many pending per work I/O") adjusted max_active parameter. - WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 0, + WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 16, Commit e03a3d7a94e2485b ("block: loop: use kthread_work") started using per device kthread. - lo->wq = alloc_workqueue("kloopd%d", - WQ_MEM_RECLAIM | WQ_HIGHPRI | WQ_UNBOUND, 16, - lo->lo_number); + lo->worker_task = kthread_run(kthread_worker_fn, + &lo->worker, "loop%d", lo->lo_number); Commit 87579e9b7d8dc36e ("loop: use worker per cgroup instead of kworker") again started using per device workqueue - lo->worker_task = kthread_run(loop_kthread_worker_fn, - &lo->worker, "loop%d", lo->lo_number); + lo->workqueue = alloc_workqueue("loop%d", + WQ_UNBOUND | WQ_FREEZABLE, + 0, + lo->lo_number); but forgot to restore WQ_MEM_RECLAIM flag. We should reserve one "struct task_struct" to each loop device in order to guarantee that I/O request for writeback operation can make forward progress even under memory pressure. I don't know why WQ_FREEZABLE flag was added, but let's add WQ_MEM_RECLAIM flag like commit f4aa4c7bbac6c4af ("block: loop: convert to per-device workqueue") describes. Fixes: 87579e9b7d8dc36e ("loop: use worker per cgroup instead of kworker") Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> --- drivers/block/loop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 19fe19eaa50e..60dfebcedd95 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -1013,7 +1013,7 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, lo->lo_flags |= LO_FLAGS_READ_ONLY; lo->workqueue = alloc_workqueue("loop%d", - WQ_UNBOUND | WQ_FREEZABLE, + WQ_MEM_RECLAIM | WQ_UNBOUND | WQ_FREEZABLE, 0, lo->lo_number); if (!lo->workqueue) { -- 2.32.0