From: Valentin Schneider <vschneid@redhat.com>
To: Hillf Danton <hdanton@sina.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Lai Jiangshan <jiangshanlai@gmail.com>,
Peter Zijlstra <peterz@infradead.org>,
Frederic Weisbecker <frederic@kernel.org>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH v4 4/4] workqueue: Unbind workers before sending them to exit()
Date: Wed, 05 Oct 2022 17:14:17 +0100 [thread overview]
Message-ID: <xhsmh7d1e2qp2.mognet@vschneid.remote.csb> (raw)
In-Reply-To: <20221005145022.1695-1-hdanton@sina.com>
On 05/10/22 22:50, Hillf Danton wrote:
> On 05 Oct 2022 12:13:17 +0100 Valentin Schneider <vschneid@redhat.com>
>
> Bound kworkers can be destroyed by the idle timer on a housekeeping CPU.
>
> Diff is only for thoughts.
>
> +++ b/kernel/workqueue.c
> @@ -1985,6 +1985,7 @@ fail:
> static void destroy_worker(struct worker *worker)
> {
> struct worker_pool *pool = worker->pool;
> + int cpu = smp_processor_id();
>
> lockdep_assert_held(&pool->lock);
>
> @@ -1999,6 +2000,12 @@ static void destroy_worker(struct worker
>
> list_del_init(&worker->entry);
> worker->flags |= WORKER_DIE;
> +
> + if (!(pool->flags & POOL_DISASSOCIATED) && pool->cpu != cpu) {
> + /* send worker to die on a housekeeping cpu */
> + cpumask_clear(&worker->task->cpus_mask);
> + cpumask_set_cpu(cpu, &worker->task->cpus_mask);
> + }
> wake_up_process(worker->task);
> }
>
The proper interface to play with that cpumask is set_cpus_allowed_ptr(),
which requires a sleepable context, hence the whole series.
next prev parent reply other threads:[~2022-10-05 16:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221004150521.822266-1-vschneid@redhat.com>
[not found] ` <20221004150521.822266-5-vschneid@redhat.com>
2022-10-05 1:08 ` Hillf Danton
2022-10-05 11:13 ` Valentin Schneider
2022-10-05 14:50 ` Hillf Danton
2022-10-05 16:14 ` Valentin Schneider [this message]
2022-10-06 2:07 ` Hillf Danton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xhsmh7d1e2qp2.mognet@vschneid.remote.csb \
--to=vschneid@redhat.com \
--cc=frederic@kernel.org \
--cc=hdanton@sina.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mtosatti@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox