Re: [PATCH 4/4] kthread: Simplify kthread_park() completion

From: Peter Zijlstra
Date: Tue Jun 12 2018 - 08:43:13 EST


On Fri, Jun 08, 2018 at 11:52:20AM +0200, Oleg Nesterov wrote:
> in smpboot_update_cpumask_percpu_thread() can hit a KTHREAD_SHOULD_PARK
> thread? Lets look into kernel test robot's .config:
>
> CONFIG_NR_CPUS=1
>
> Now look at NR_CPUS==1 version of for_each_cpu* helpers:
>
> #define for_each_cpu(cpu, mask) \
> for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)

Argh, that issue again.

> So even if the "tmp" cpumask is empty the code above always does
>
> smpboot_park_thread(plug_thread, 0);
>
> and hits the already parked kthread.

OK, I'll write a new Changelog.