Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-23 Thread Jarek Poplawski
On Mon, Oct 22, 2007 at 10:02:59PM +0400, Oleg Nesterov wrote: ... > If this work doesn't rearm itself - yes. (otherwise, the same ->func > can run twice _at the same time_) > > But again, in this case wait_on_work() after try_to_grab_pending() == 1 > doesn't block, so we can just do > >

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-23 Thread Jarek Poplawski
On Mon, Oct 22, 2007 at 10:02:59PM +0400, Oleg Nesterov wrote: > On 10/22, Jarek Poplawski wrote: ... > > OK, I know I'm dumber and dumber everyday, > > You are not alone. I have the same feeling about myself! Feeling is not the same, only true knowledge counts! > > > these all flushes are > >

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-23 Thread Jarek Poplawski
On Mon, Oct 22, 2007 at 10:02:59PM +0400, Oleg Nesterov wrote: On 10/22, Jarek Poplawski wrote: ... OK, I know I'm dumber and dumber everyday, You are not alone. I have the same feeling about myself! Feeling is not the same, only true knowledge counts! these all flushes are rtnl

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-23 Thread Jarek Poplawski
On Mon, Oct 22, 2007 at 10:02:59PM +0400, Oleg Nesterov wrote: ... If this work doesn't rearm itself - yes. (otherwise, the same -func can run twice _at the same time_) But again, in this case wait_on_work() after try_to_grab_pending() == 1 doesn't block, so we can just do if

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-22 Thread Oleg Nesterov
On 10/22, Jarek Poplawski wrote: > > On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: > > On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: > > > On 10/18, Jarek Poplawski wrote: > > > > > > > > +/** > > > > + * flush_work_sync - block until a work_struct's callback

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-22 Thread Jarek Poplawski
On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: > On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: > > On 10/18, Jarek Poplawski wrote: > > > > > > +/** > > > + * flush_work_sync - block until a work_struct's callback has terminated > >

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-22 Thread Jarek Poplawski
On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: On 10/18, Jarek Poplawski wrote: +/** + * flush_work_sync - block until a work_struct's callback has terminated

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-22 Thread Oleg Nesterov
On 10/22, Jarek Poplawski wrote: On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: On 10/18, Jarek Poplawski wrote: +/** + * flush_work_sync - block until a work_struct's callback has terminated

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-19 Thread Johannes Berg
On Thu, 2007-10-18 at 19:48 +0400, Oleg Nesterov wrote: > > +void flush_work_sync(struct work_struct *work) > If we really the new helper, perhaps we can make it a bit better? > > 1. Modify insert_work() to take the "struct list_head *at" parameter instead >of "int tail". I think this patch

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-19 Thread Jarek Poplawski
On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: ... > sched_work_sync() with rtnl_lock(). It's only less probable to lockup > with this than with flush_schedule_work(). ...But, not much less... Jarek P. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-19 Thread Jarek Poplawski
On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: > On 10/18, Jarek Poplawski wrote: > > > > +/** > > + * flush_work_sync - block until a work_struct's callback has terminated > ^^^ > Hmm... > > > + * Similar to

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-19 Thread Johannes Berg
On Thu, 2007-10-18 at 19:48 +0400, Oleg Nesterov wrote: +void flush_work_sync(struct work_struct *work) If we really the new helper, perhaps we can make it a bit better? 1. Modify insert_work() to take the struct list_head *at parameter instead of int tail. I think this patch will also

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-19 Thread Jarek Poplawski
On Fri, Oct 19, 2007 at 09:50:14AM +0200, Jarek Poplawski wrote: ... sched_work_sync() with rtnl_lock(). It's only less probable to lockup with this than with flush_schedule_work(). ...But, not much less... Jarek P. - To unsubscribe from this list: send the line unsubscribe linux-kernel in the

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-19 Thread Jarek Poplawski
On Thu, Oct 18, 2007 at 07:48:19PM +0400, Oleg Nesterov wrote: On 10/18, Jarek Poplawski wrote: +/** + * flush_work_sync - block until a work_struct's callback has terminated ^^^ Hmm... + * Similar to

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-18 Thread Maciej W. Rozycki
On Thu, 18 Oct 2007, Oleg Nesterov wrote: > If we can't just cancel the work, can't we do something like > > if (cancel_work_sync(w)) > w->func(w); > > instead? We do an equivalent of this -- all that we care about that w->func(w) would do is enable_irq() and the rest we

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-18 Thread Oleg Nesterov
On 10/18, Jarek Poplawski wrote: > > +/** > + * flush_work_sync - block until a work_struct's callback has terminated ^^^ Hmm... > + * Similar to cancel_work_sync() but will only busy wait (without cancel) > + * if the work

[PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-18 Thread Jarek Poplawski
After reading this and earlier threads about phylib's way of using workqueue I think such a lighter and safer wrt. locking alternative for flush_scheduled_work should be useful, but maybe it's only my imagination. So, let's ask Oleg Nesterov, whose solutions are here only copy-cut-pasted &

[PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-18 Thread Jarek Poplawski
After reading this and earlier threads about phylib's way of using workqueue I think such a lighter and safer wrt. locking alternative for flush_scheduled_work should be useful, but maybe it's only my imagination. So, let's ask Oleg Nesterov, whose solutions are here only copy-cut-pasted

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-18 Thread Oleg Nesterov
On 10/18, Jarek Poplawski wrote: +/** + * flush_work_sync - block until a work_struct's callback has terminated ^^^ Hmm... + * Similar to cancel_work_sync() but will only busy wait (without cancel) + * if the work is

Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event workqueue handling fixes

2007-10-18 Thread Maciej W. Rozycki
On Thu, 18 Oct 2007, Oleg Nesterov wrote: If we can't just cancel the work, can't we do something like if (cancel_work_sync(w)) w-func(w); instead? We do an equivalent of this -- all that we care about that w-func(w) would do is enable_irq() and the rest we want to