[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090828175931.GA19326@redhat.com>
Date: Fri, 28 Aug 2009 19:59:31 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>,
Roland Dreier <rdreier@...co.com>
Cc: linux-kernel@...r.kernel.org,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Stefan Richter <stefanr@...6.in-berlin.de>
Subject: [PATCH 0/1] introduce __cancel_delayed_work()
On 08/26, Roland Dreier wrote:
>
> > OK, in this case I think we have a simple solution,
> >
> > // like cancel_delayed_work, but uses del_timer().
> > // this means, if it returns 0 the timer function may be
> > // running and the queueing is in progress. The caller
> > // can't rely on flush_workqueue/etc
> > static inline int __cancel_delayed_work(struct delayed_work *work)
> > {
> > int ret;
> >
> > ret = del_timer(&work->timer);
> > if (ret)
> > work_clear_pending(&work->work);
> > return ret;
> > }
>
> This looks like it would work well. If we can get this into 2.6.32 then
> I will drop my patch and switch to this approach instead.
I am not sure how can I push this patch into 2.6.32, so I am just sending
it to Andrew.
Or. Please feel free to embed this change in mad.c fixes and send the patch
yourself (if it is not too late, I have to apologize for delay again).
As for requeue, perhaps we should add two helpers. The first is simple,
if (!mod_timer_pending(dwork->timer, new_delay))
queue_delayed_work(dwork, new_delay);
and I think this is what we need for mad.c. Another one is not "atomic"
but also cancells dwork. But this we we can't decide what exactly these
helpers should do, it is "safer" to add the trivial __cancel_delayed_work()
which hopefully can have other users.
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