Re: [PATCH V2] workqueue: Process rescuer work items one-by-one using a positional marker

From: Lai Jiangshan

Date: Tue Nov 18 2025 - 04:40:14 EST


Hello

On Tue, Nov 18, 2025 at 5:34 PM Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:

> ---
> Changed from v1:
>
> Insert the marker and use it purely as iteration marker as Tejun
> request.
> It is hard to maintain the proper state of it, expecially maintaining
> it only in pool->worklist which also requires an unlikely path in the
> worker_thread() path.

It is hard to maintain the proper state of it if it is treated as a work
item as V1, especially maintaining it only in pool->worklist which
also requires an unlikely path in the worker_thread() path to
defeat the collision requeuing.

Thanks
Lai

>
> Add an unlikely path in the worker_thread() path(in assign_work()).
>
> Add other code in other place to make it not be treated like a work
> item. I'm sure all the paths have been covered now, but I still feel
> a bit nevous about it for future changes.
>
> Extra the code to assign work in the rescuer_thread() out as
> assign_rescue_work().
>
> V1: https://lore.kernel.org/lkml/20251113163426.2950-1-jiangshanlai@xxxxxxxxx/
>