mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC] workqueue: allow system workqueue be used in memory reclaim
@ 2023-11-08  1:28 Junxiao Bi
  2023-11-09 18:58 ` Tejun Heo
  2023-11-16  7:39 ` kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Junxiao Bi @ 2023-11-08  1:28 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-raid, tj, jiangshanlai, song, junxiao.bi

The following deadlock was triggered on Intel IMSM raid1 volumes.

The sequence of the event is this:

1. memory reclaim was waiting xfs journal flushing and get stucked by
md flush work.

2. md flush work was queued into "md" workqueue, but never get executed,
kworker thread can not be created and also the rescuer thread was executing
md flush work for another md disk and get stuck because
"MD_SB_CHANGE_PENDING" flag was set.

3. That flag should be set by some md write process which was asking to
update md superblock to change in_sync status to 0, and then it used
kernfs_notify to ask "mdmon" process to update superblock, after that,
write process waited that flag to be cleared.

4. But "mdmon" was never wake up, because kernfs_notify() depended on
system wide workqueue "system_wq" to do the notify, but since that
workqueue doesn't have a rescuer thread, notify will not happen.

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 6e578f576a6f..e3338e3be700 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -6597,7 +6597,7 @@ void __init workqueue_init_early(void)
 		ordered_wq_attrs[i] = attrs;
 	}
 
-	system_wq = alloc_workqueue("events", 0, 0);
+	system_wq = alloc_workqueue("events", WQ_MEM_RECLAIM, 0);
 	system_highpri_wq = alloc_workqueue("events_highpri", WQ_HIGHPRI, 0);
 	system_long_wq = alloc_workqueue("events_long", 0, 0);
 	system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND,
-- 
2.39.3 (Apple Git-145)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-11-16  7:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08  1:28 [RFC] workqueue: allow system workqueue be used in memory reclaim Junxiao Bi
2023-11-09 18:58 ` Tejun Heo
2023-11-09 23:36   ` junxiao.bi
2023-11-16  7:39 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®