[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZXn4qiMetd7zY1sb@localhost.localdomain>
Date: Wed, 13 Dec 2023 19:32:10 +0100
From: Juri Lelli <juri.lelli@...hat.com>
To: Tejun Heo <tj@...nel.org>
Cc: Aaron Tomlin <atomlin@...mlin.com>, linux-kernel@...r.kernel.org,
jiangshanlai@...il.com, peterz@...radead.org
Subject: Re: [RFC PATCH 0/2] workqueue: Introduce PF_WQ_RESCUE_WORKER
On 13/12/23 05:35, Tejun Heo wrote:
> Hello,
>
> On Wed, Dec 13, 2023 at 09:59:42AM +0100, Juri Lelli wrote:
> > Something like the following then maybe?
> >
> > ---
> > kernel/workqueue.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> > index 2989b57e154a7..ed73f7f80d57d 100644
> > --- a/kernel/workqueue.c
> > +++ b/kernel/workqueue.c
> > @@ -4405,6 +4405,12 @@ static void apply_wqattrs_commit(struct apply_wqattrs_ctx *ctx)
> > link_pwq(ctx->dfl_pwq);
> > swap(ctx->wq->dfl_pwq, ctx->dfl_pwq);
> >
> > + /* rescuer needs to respect wq cpumask changes */
> > + if (ctx->wq->rescuer) {
> > + kthread_bind_mask(ctx->wq->rescuer->task, ctx->attrs->cpumask);
> > + wake_up_process(ctx->wq->rescuer->task);
> > + }
> > +
> > mutex_unlock(&ctx->wq->mutex);
> > }
>
> I'm not sure kthread_bind_mask() would be safe here. The rescuer might be
> running a work item. wait_task_inactive() might fail and we don't want to
> change cpumask while the rescuer is active anyway.
>
> Maybe the easiest way to do this is making rescuer_thread() restore the wq's
> cpumask right before going to sleep, and making apply_wqattrs_commit() just
> wake up the rescuer.
Hummm, don't think we can call that either while the rescuer is actually
running. Maybe we can simply s/kthread_bind_mask/set_cpus_allowed_ptr/
in the above?
Thanks,
Juri
Powered by blists - more mailing lists