[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070107170932.GA238@tv-sign.ru>
Date: Sun, 7 Jan 2007 20:09:32 +0300
From: Oleg Nesterov <oleg@...sign.ru>
To: Srivatsa Vaddagiri <vatsa@...ibm.com>
Cc: Andrew Morton <akpm@...l.org>, David Howells <dhowells@...hat.com>,
Christoph Hellwig <hch@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
Linus Torvalds <torvalds@...l.org>,
linux-kernel@...r.kernel.org, Gautham shenoy <ego@...ibm.com>
Subject: Re: [PATCH] fix-flush_workqueue-vs-cpu_dead-race-update
On 01/07, Srivatsa Vaddagiri wrote:
>
> On Sun, Jan 07, 2007 at 03:56:03PM +0300, Oleg Nesterov wrote:
> > Srivatsa, I'm completely new to cpu-hotplug, so please correct me if I'm
> > wrong (in fact I _hope_ I am wrong) but as I see it, the hotplug/workqueue
> > interaction is broken by design, it can't be fixed by changing just locking.
> >
> > Once again. CPU dies, CPU_DEAD calls kthread_stop() and sleeps until
> > cwq->thread exits. To do so, this thread must at least complete the
> > currently running work->func().
>
> If run_workqueue() takes a lock_cpu_hotplug() successfully, then we shouldnt
> even reach till this point, as it will block writers (cpu_down/up) until it
> completes.
>
>
> run_workqueue()
> ---------------
>
> try_again:
> rc = lock_cpu_hotplug_interruptible();
>
> if (rc && kthread_should_stop())
> return;
>
> if (rc != 0)
> goto try_again;
>
> /* cpu_down/up shouldnt happen now untill we call unlock_cpu_hotplug */
> while (!list_empty(..))
> work->func();
This mean that every work->func() which may sleep delays cpu_down/up unpredictable,
not good. What about work->func which sleeps then re-queues itself? I guess we can
solve this, but this is what I said "other changes".
Also, lock_cpu_hotplug() should be per-cpu, otherwise we have livelock.
Not that I am against lock_cpu_hotplug (I can't judge), but its usage in run_workqueue
looks like complication to me. I may be wrong. But the main problem we don't have it :)
Oleg.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists