From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Roland Dreier <rdreier@cisco.com>
Cc: linux-kernel@vger.kernel.org,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Stefan Richter <stefanr@s5r6.in-berlin.de>
Subject: [PATCH 0/1] introduce __cancel_delayed_work()
Date: Fri, 28 Aug 2009 19:59:31 +0200 [thread overview]
Message-ID: <20090828175931.GA19326@redhat.com> (raw)
In-Reply-To: <ada7hwqto0z.fsf@cisco.com>
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.
next prev parent reply other threads:[~2009-08-28 18:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 21:51 Is adding requeue_delayed_work() a good idea Roland Dreier
2009-08-21 11:55 ` Oleg Nesterov
2009-08-21 21:53 ` Roland Dreier
2009-08-22 10:35 ` Stefan Richter
2009-08-24 18:01 ` Oleg Nesterov
2009-08-24 21:11 ` Roland Dreier
2009-08-25 9:39 ` Oleg Nesterov
2009-08-26 18:42 ` Roland Dreier
2009-08-28 17:59 ` Oleg Nesterov [this message]
2009-08-28 18:00 ` [PATCH 1/1] introduce __cancel_delayed_work() Oleg Nesterov
2009-09-01 16:09 ` Roland Dreier
2009-09-01 16:40 ` Dmitry Torokhov
2009-09-01 22:29 ` Andrew Morton
2009-09-01 0:44 ` Is adding requeue_delayed_work() a good idea Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090828175931.GA19326@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rdreier@cisco.com \
--cc=stefanr@s5r6.in-berlin.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.