Re: [PATCH 1/4] workqueue: Reap workers via kthread_stop() and remove detach_completion

From: Lai Jiangshan
Date: Sun Jul 28 2024 - 21:49:53 EST


Hello Marc

On Thu, Jul 25, 2024 at 8:11 AM Lai Jiangshan <jiangshanlai@xxxxxxxxx> wrote:
> > 2024/07/23 18:01:21 [M83LP63]: [ 157.267727] ------------[ cut here ]------------
> > 2024/07/23 18:01:21 [M83LP63]: [ 157.267735] WARNING: CPU: 21 PID: 725 at kernel/workqueue.c:3340 worker_thread+0x54e/0x558
>
>
> > @@ -3330,7 +3338,6 @@ static int worker_thread(void *__worker)
> > ida_free(&pool->worker_ida, worker->id);
> > worker_detach_from_pool(worker);
> > WARN_ON_ONCE(!list_empty(&worker->entry));
> > - kfree(worker);
> > return 0;
> > }
>
> The condition "!list_empty(&worker->entry)" can be true when the
> worker is still in the cull_list awaiting being reaped by
> reap_dying_workers() after
> this change.
>
> I will remove the WARN_ON_ONCE().
>

Here is the fix:
https://lore.kernel.org/lkml/20240725010437.694727-1-jiangshanlai@xxxxxxxxx/

Could you take a look please.

Thank you for the report,
Lai