On Mon, Dec 27, 2021 at 05:12:41PM +0800, Xie Yongji wrote: > The rescuer thread might take over the works queued on > the workqueue when the worker thread creation timed out. > If this happens, we have no chance to create multiple > recv threads which causes I/O hung on this nbd device. > > To fix it, we can not simply remove the WQ_MEM_RECLAIM > flag since the recv work is in the memory reclaim path. > So this patch tries to create kthreads directly to > handle the recv work instead of using workqueue. > I still don't understand why we can't drop WQ_MEM_RECLAIM. IIRC your argument is that we need it because a reconnect could happen under memory pressure and we need to be able to queue work for that. However your code makes it so we're just doing a kthread_create(), which isn't coming out of some emergency pool, so it's just as likely to fail as a !WQ_MEM_RECLAIM workqueue. Thanks, Josef