[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070629170957.GA467@tv-sign.ru>
Date: Fri, 29 Jun 2007 21:09:57 +0400
From: Oleg Nesterov <oleg@...sign.ru>
To: Alexey Kuznetsov <kuznet@....inr.ac.ru>
Cc: Ingo Molnar <mingo@...e.hu>, Jeff Garzik <jeff@...zik.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Thomas Gleixner <tglx@...utronix.de>,
Christoph Hellwig <hch@...radead.org>,
john stultz <johnstul@...ibm.com>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Dipankar Sarma <dipankar@...ibm.com>,
"David S. Miller" <davem@...emloft.net>, matthew@....cx
Subject: Re: [RFC PATCH 0/6] Convert all tasklets to workqueues
(the email address of Matthew Wilcox looks wrong, changed to matthew@....cx)
On 06/29, Oleg Nesterov wrote:
>
> Steven, unless you have some objections, could you change tasklet_kill() ?
>
> > +static inline void tasklet_kill(struct tasklet_struct *t)
> > {
> > - return test_bit(TASKLET_STATE_SCHED, &t->state);
> > + flush_workqueue(ktaskletd_wq);
> > }
>
> Just change flush_workqueue(ktaskletd_wq) to cancel_work_sync(t-work).
Ugh, tasklet_disable() should be changed as well.
> @@ -84,35 +50,35 @@ static inline void tasklet_disable_nosyn
> static inline void tasklet_disable(struct tasklet_struct *t)
> {
> tasklet_disable_nosync(t);
> - tasklet_unlock_wait(t);
> - smp_mb();
> -}
> -
> -static inline void tasklet_enable(struct tasklet_struct *t)
> -{
> - smp_mb__before_atomic_dec();
> - atomic_dec(&t->count);
> + flush_workqueue(ktaskletd_wq);
> + /* flush_workqueue should provide us a barrier */
> }
Suppose we have the tasklets T1 and T2, both are scheduled on the
same CPU. T1 takes some spinlock LOCK.
Currently it is possible to do
spin_lock(LOCK);
disable_tasklet(T2);
With this patch, the above code hangs.
The most simple fix is to use wait_on_work(t->work) instead of
flush_workqueue(). Currently it is static, but we can export it.
This change will speedup tasklet_disable), btw.
A better fix imho is to use cancel_work_sync() again, but this
needs some complications to preserve TASKLET_STATE_PENDING.
This in turn means that cancel_work_sync() should return "int", but
not "void". This change makes sense regardless, I'll try to make a
patch on Sunday.
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