Re: [RFC][PATCH] CPUSets: Move most calls to rebuild_sched_domains() to the workqueue

From: Paul Menage
Date: Thu Jun 26 2008 - 17:17:55 EST


On Thu, Jun 26, 2008 at 1:34 PM, Paul Menage <menage@xxxxxxxxxx> wrote:
>
> void get_online_cpus(void)
> {
> might_sleep();
> if (cpu_hotplug.active_writer == current)
> return;
> down_read(&cpu_hotplug.lock);
> }
>
> void put_online_cpus(void)
> {
> if (cpu_hotplug.active_writer == current)
> return;
> up_read(&cpu_hotplug.lock);
> }
>
> static void cpu_hotplug_begin(void)
> {
> down_write(&cpu_hotplug.lock);
> cpu_hotplug.active_writer = current;
> }
>
> static void cpu_hotplug_done(void)
> {
> cpu_hotplug.active_writer = NULL;
> up_write(&cpu_hotplug.lock);
> }
>
> I think that combined with moving the async rebuild_sched_domains to a
> separate thread should solve the problem, but I'm wondering why
> cpu_hotplug.lock was implemented this way in the first place.

Oh, I guess that doesn't work because of recursive calls to
get_online_cpus(). Maybe we need a down_read_recursive() that skips
ahead of waiting writers if the lock is already held in read mode?

Paul
--
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/