From: Thomas Gleixner <tglx@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: "Zhang\, Qiang" <Qiang.Zhang@windriver.com>,
"tj\@kernel.org" <tj@kernel.org>,
"akpm\@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm\@kvack.org" <linux-mm@kvack.org>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] kthread_worker: re-set CPU affinities if CPU come online
Date: Thu, 29 Oct 2020 16:01:46 +0100 [thread overview]
Message-ID: <87pn51dqjp.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20201029130818.GC16774@alley>
On Thu, Oct 29 2020 at 14:08, Petr Mladek wrote:
> On Thu 2020-10-29 09:27:26, Thomas Gleixner wrote:
>> The expected semantics of a cpu bound kthread_worker are completely
>> unclear and undocumented. This needs to be fixed first and once this is
>> established and agreed on then the gaps in the implementation can be
>> closed.
>
> I thought about some sane semantic and it goes down to
> the following problem:
>
> The per-CPU kthread workers are created by explicitly calling
> kthread_create_worker_on_cpu() on each CPU.
>
> The API does _not_ store the information how to start the worker.
> As a result, it is not able to start a new one when the CPU
> goes online "for the first time". I mean when the CPU was offline
> when the API user created the workers.
>
> It means that the API user is responsible for handling CPU hotplug
> on its own. We probably should just document it and do nothing else [*]
> [*] IMHO, it does not even make sense to manipulate the affinity.
> It would just give a false feeling that it is enough.
Agreed on both.
> Alternative solution would be to extend the API and allow to create
> kthread_worker on each online CPU. It would require to store
> parameters needed to create the kthread only new online CPUs.
> Then we might think about some sane semantic for CPU hotplug.
That facility already exists: smpboot_register_percpu_thread()
So "all" you'd need to do is to provide a kthread_worker variant which
utilizes that. It's straight forward, but not sure whether it's worth
the trouble.
> Well, it might be hard to define a sane semantic unless there are
> more users of the API. So, I tend to keep it simple and just
> document the status quo.
Ack.
Thanks,
tglx
prev parent reply other threads:[~2020-10-29 15:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-28 7:30 qiang.zhang
2020-10-28 8:30 ` Thomas Gleixner
2020-10-28 8:45 ` 回复: " Zhang, Qiang
2020-10-28 9:23 ` Thomas Gleixner
2020-10-29 3:14 ` 回复: " Zhang, Qiang
2020-10-29 8:27 ` Thomas Gleixner
2020-10-29 13:08 ` Petr Mladek
2020-10-29 15:01 ` Thomas Gleixner [this message]
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=87pn51dqjp.fsf@nanos.tec.linutronix.de \
--to=tglx@linutronix.de \
--cc=Qiang.Zhang@windriver.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pmladek@suse.com \
--cc=tj@kernel.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