Re: [PATCH 2/3] rcu: Defer RCU kthreads wakeup when CPU is dying

From: Hillf Danton
Date: Mon Dec 18 2023 - 23:45:34 EST


On Tue, 19 Dec 2023 00:19:15 +0100 Frederic Weisbecker <frederic@xxxxxxxxxx>
> +static void swake_up_one_online(struct swait_queue_head *wqh)
> +{
> + int cpu = get_cpu();
> +
> + /*
> + * If called from rcutree_report_cpu_starting(), wake up
> + * is dangerous that late in the CPU-down hotplug process. The
> + * scheduler might queue an ignored hrtimer. Defer the wake up
> + * to an online CPU instead.
> + */

But why is scheduler having any interest selecting a dying CPU for
adding a hrtimer on at the first place?

> + if (unlikely(cpu_is_offline(cpu))) {
> + int target;
> +
> + target = cpumask_any_and(housekeeping_cpumask(HK_TYPE_RCU),
> + cpu_online_mask);
> +
> + smp_call_function_single(target, swake_up_one_online_ipi,
> + wqh, 0);
> + put_cpu();
> + } else {
> + put_cpu();
> + swake_up_one(wqh);
> + }
> +}