Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-27 Thread Thomas Gleixner
Petr, On Tue, Oct 27 2020 at 17:39, Petr Mladek wrote: > On Mon 2020-10-26 14:52:13, qiang.zh...@windriver.com wrote: >> From: Zqiang >> >> When someone CPU offlined, the 'kthread_worker' which bind this CPU, >> will run anywhere, if this CPU online, recovery of 'kthread_worker' >> affinity by c

Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-27 Thread Petr Mladek
On Mon 2020-10-26 14:52:13, qiang.zh...@windriver.com wrote: > From: Zqiang > > When someone CPU offlined, the 'kthread_worker' which bind this CPU, > will run anywhere, if this CPU online, recovery of 'kthread_worker' > affinity by cpuhp notifiers. I am not familiar with CPU hotplug notifiers.

Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-26 Thread Tejun Heo
Hello, Petr. On Mon, Oct 26, 2020 at 05:45:55PM +0100, Petr Mladek wrote: > > I don't think this works. The kthread may have changed its binding while > > running using set_cpus_allowed_ptr() as you're doing above. Besides, when a > > cpu goes offline, the bound kthread can fall back to other cpus

Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-26 Thread Petr Mladek
On Mon 2020-10-26 09:50:11, Tejun Heo wrote: > On Mon, Oct 26, 2020 at 02:52:13PM +0800, qiang.zh...@windriver.com wrote: > > @@ -737,8 +741,11 @@ __kthread_create_worker(int cpu, unsigned int flags, > > if (IS_ERR(task)) > > goto fail_task; > > > > - if (cpu >= 0) > > + if (c

Re: [PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-26 Thread Tejun Heo
On Mon, Oct 26, 2020 at 02:52:13PM +0800, qiang.zh...@windriver.com wrote: > @@ -737,8 +741,11 @@ __kthread_create_worker(int cpu, unsigned int flags, > if (IS_ERR(task)) > goto fail_task; > > - if (cpu >= 0) > + if (cpu >= 0) { > kthread_bind(task, cpu);

[PATCH] kthread_worker: re-set CPU affinities if CPU come online

2020-10-25 Thread qiang . zhang
From: Zqiang When someone CPU offlined, the 'kthread_worker' which bind this CPU, will run anywhere, if this CPU online, recovery of 'kthread_worker' affinity by cpuhp notifiers. Signed-off-by: Zqiang --- include/linux/kthread.h | 2 ++ kernel/kthread.c| 35 +++