Re: [PATCH v2 1/6] workqueue: Inherit NOIO and NOFS alloc flags

From: Tejun Heo
Date: Wed May 15 2024 - 12:54:26 EST


> @@ -5583,6 +5600,10 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
>
> /* init wq */
> wq->flags = flags;
> + if (current->flags & PF_MEMALLOC_NOIO)
> + wq->flags |= __WQ_NOIO;
> + if (current->flags & PF_MEMALLOC_NOFS)
> + wq->flags |= __WQ_NOFS;

So, yeah, please don't do this. What if a NOIO callers wants to scheduler a
work item so that it can user GFP_KERNEL allocations. I don't mind a
convenience feature to workqueue for this but this doesn't seem like the
right way. Also, memalloc_noio_save() and memalloc_nofs_save() are
convenience wrappers around memalloc_flags_save(), so it'd probably be
better to deal with gfp flags directly rather than singling out these two
flags.

Thanks.

--
tejun