Re: [patch 2/2] cpu hotplug notifier for updating sched domains

From: Nick Piggin
Date: Tue Sep 07 2004 - 21:33:41 EST




Nathan Lynch wrote:

On Tue, 2004-09-07 at 19:44, Nick Piggin wrote:

I think the next step is to now make the setup code only use cpu_online_map


^^^ OK I see you've already done that. Sorry I should have looked at the
patches a bit closer. Your implementation looks very nice.

and get rid of everywhere I had been doing cpus_and(tmp, ..., cpu_online_map).


^^^ This should still be done, of course. That can come later.

This may also make your patch 1/2 unnecessary? What do you think?


Well, we have to "lie" to arch_init_sched_domains a little bit when
bringing a cpu online, by setting the soon-to-be-online cpu's bit in the
argument mask. So I think the first patch is still necessary.



Can't we do everything in the CPU_UP_ONLINE case though?


One other thing:

void __init sched_init_smp(void)
{
+ lock_cpu_hotplug();
arch_init_sched_domains(cpu_online_map);
sched_domain_debug();
+ unlock_cpu_hotplug();
+
+ hotcpu_notifier(update_sched_domains, 0);
}

Do you have a theoretical race here? Can we hotplug a CPU before the notifier
is registered? (I know we *can't* because it is still earlyish boot).

Can you move hotcpu_notifier under the cpu_hotplug lock? Seems not because
register_cpu_notifier takes the lock itself. Seems like a flaw in the API to
me. Probably the notifier chain should be protected by a lock that nests
inside the cpucontrol lock. Rusty?


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/