From: Oleg Nesterov <oleg@tv-sign.ru>
To: Jarek Poplawski <jarkao2@o2.pl>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Howells <dhowells@redhat.com>,
David Miller <davem@davemloft.net>, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] cancel_delayed_work: use del_timer() instead of del_timer_sync()
Date: Thu, 26 Apr 2007 19:29:53 +0400 [thread overview]
Message-ID: <20070426152953.GA1824@tv-sign.ru> (raw)
In-Reply-To: <20070426142921.GE3145@ff.dom.local>
On 04/26, Jarek Poplawski wrote:
>
> On Wed, Apr 25, 2007 at 04:52:14PM +0400, Oleg Nesterov wrote:
> >
> > > It seems this
> > > change cannot do any harm, but anyway it could change a few
> > > things, e.g. with current version of cancel_rearming_delayed_work
> > > some flush_workqueue could be done needlessly, before the work
> > > is queued from timer.
> >
> > I don't think so... Could you clarify?
>
> With a code like:
>
> if (!cancel_delayed_work(dwork))
> flush_workqueue(wq);
>
> if cancel_ returns 0, and there is _queue_work in progress,
> flush_ will be done once, after this work is queued.
>
> After the patch, and the same situation flush_ also runs
> one time, but maybe without the work in a queue.
First, this is very unlikely event, and the behaviour is correct,
do you agree?
Even in this case, it is very unlikely that flush_cpu_workqueue()
will take cwq->lock before extremely short delayed_work_timer_fn.
Even if it does, work->func() likely will be completed when the
caller of flush_workqueue() will be woken by run_workquue() and
gets CPU.
Please also look at http://marc.info/?t=117699337200022&r=1
> > > It's not a big deal here, but if anybody
> > > did something like this without loop - it could matter.
> > >
> > > So, probably a lot of current code should be checked, before
> > > applying and I doubt the gain is worth of this. Maybe, for
> > > safety, make this with new name as an alternative and
> > > deprecate the current version?
> >
> > This change should not make any visible difference for the callers,
> > otherwise it is buggy.
>
> IMHO, there is the same visible difference,
> as between del_timer and del_timer_sync.
Jarek, please, could you be more explicite ? del_timer() and
del_timer_sync() are different in many ways. What exactly will
impact the user of cancel_delaye_work ?
Oleg.
next prev parent reply other threads:[~2007-04-26 16:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-24 21:50 [PATCH] cancel_delayed_work: use del_timer() instead of del_timer_sync() Oleg Nesterov
2007-04-25 10:04 ` David Howells
2007-04-25 13:02 ` Jarek Poplawski
2007-04-25 12:52 ` Oleg Nesterov
2007-04-26 14:29 ` Jarek Poplawski
2007-04-26 15:29 ` Oleg Nesterov [this message]
2007-04-27 6:15 ` Jarek Poplawski
2007-04-27 7:23 ` Oleg Nesterov
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=20070426152953.GA1824@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=dhowells@redhat.com \
--cc=jarkao2@o2.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox