Re: [PATCH v4 4/4] workqueue: Unbind workers before sending them to exit()

Hillf Danton
2022-10-05T01:08:50Z

On 4 Oct 2022 16:05:21 +0100 Valentin Schneider <vschneid@redhat.com>
> It has been reported that isolated CPUs can suffer from interference due to
> per-CPU kworkers waking up just to die.
>
> A surge of workqueue activity during initial setup of a latency-sensitive
> application (refresh_vm_stats() being one of the culprits) can cause extra
> per-CPU kworkers to be spawned. Then, said latency-sensitive task can be
> running merrily on an isolated CPU only to be interrupted sometime later by
> a kworker marked for death (cf. IDLE_WORKER_TIMEOUT, 5 minutes after last
> kworker activity).
>
Is tick stopped on the isolated CPU? If tick can hit it then it can accept
more than exiting kworker. Another option is exclude isolated CPUs from
active CPUs because workqueue has other works to do than isolating CPUs.

> Prevent this by affining kworkers to the wq_unbound_cpumask (which doesn't
> contain isolated CPUs, cf. HK_TYPE_WQ) before waking them up after marking
> them with WORKER_DIE.
>