[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070412160004.GA4183@tv-sign.ru>
Date: Thu, 12 Apr 2007 20:00:04 +0400
From: Oleg Nesterov <oleg@...sign.ru>
To: Srivatsa Vaddagiri <vatsa@...ibm.com>
Cc: Gautham R Shenoy <ego@...ibm.com>, akpm@...ux-foundation.org,
paulmck@...ibm.com, torvalds@...ux-foundation.org,
linux-kernel@...r.kernel.org, "Rafael J. Wysocki" <rjw@...k.pl>,
mingo@...e.hu, dipankar@...ibm.com, dino@...ibm.com,
masami.hiramatsu.pt@...achi.com
Subject: Re: [PATCH 7/8] Clean up workqueue.c with respect to the freezer based cpu-hotplug
On 04/12, Srivatsa Vaddagiri wrote:
>
> On Tue, Apr 03, 2007 at 10:48:20PM +0530, Srivatsa Vaddagiri wrote:
> > > Actually, we should do this before destroy_workqueue() calls flush_workqueue().
> > > Otherwise flush_cpu_workqueue() can hang forever in a similar manner.
> >
> > Yep. I guess these are a class of freezer deadlocks very similar to vfork
> > parent waiting on child case. I get a feeling these should become common
> > outside of kthread too (A waits on B for something, B gets frozen, which
> > means A won't freeze causing freezer to fail). Can freezer detect this
> > dependency somehow and thaw B automatically? Probably not that easy ..
>
> I wonder if there is some value in "enforcing" an order in which
> processes get frozen i.e freeze A first before B. That may solve the
> deadlocks we have been discussing wrt kthread_stop and flush_workqueue
> as well.
Perhaps we can add "atomic_t xxx" to task_struct.
int freezing(struct task_struct *p)
{
return test_tsk_thread_flag(p, TIF_FREEZE)
&& atomic_read(&p->xxx) == 0;
}
void xxx_start(struct task_struct *p)
{
atomic_inc(p->xxx);
thaw_process(p);
}
xxx_end(struct task_struct *p)
{
atomic_dec(p->xxx);
}
Now,
xxx_start(p);
... wait for something which depends on p...
xxx_end(p);
Of course we need other changes, freeze_process() should check ->xxx, etc.
I am not sure this makes sense.
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