Re: kcompactd hotplug fail

Thomas Gleixner
2020-09-10T14:30:30Z

On Thu, Sep 10 2020 at 16:10, peterz wrote:
> While playing with hotplug, I ran into the below:
>
> [ 2305.676384] ------------[ cut here ]------------
> [ 2305.681543] WARNING: CPU: 1 PID: 15 at kernel/sched/core.c:1924 __set_cpus_allowed_ptr+0x1bd/0x230
> [ 2305.821454] kcompactd_cpu_online+0xa1/0xb0
>
> Given:
>
> static int __init kcompactd_init(void)
> {
> ...
> ret = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
> "mm/compaction:online",
> kcompactd_cpu_online, NULL);
>
> and:
>
>
> CPUHP_AP_ONLINE_DYN,
> CPUHP_AP_ONLINE_DYN_END = CPUHP_AP_ONLINE_DYN + 30,
> CPUHP_AP_X86_HPET_ONLINE,
> CPUHP_AP_X86_KVM_CLK_ONLINE,
> CPUHP_AP_ACTIVE,
>
> this is somewhat expected behaviour.
>
> It tries and set the compaction affinity to include the newly onlined
> CPU before it is marked active and that's a no-no.
>
> Ideally the kcompactd notifier is ran after AP_ACTIVE, not before.

Indeed. So we need steps post ACTIVE which we did not want to have in
the first place :)

Thanks,

tglx