From: David Howells <dhowells@redhat.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Miller <davem@davemloft.net>,
ebiederm@xmission.com, containers@lists.osdl.org,
hch@infradead.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: Getting the new RxRPC patches upstream
Date: Tue, 24 Apr 2007 16:51:07 +0100 [thread overview]
Message-ID: <15160.1177429867@redhat.com> (raw)
In-Reply-To: <20070424142244.GA158@tv-sign.ru>
Oleg Nesterov <oleg@tv-sign.ru> wrote:
> Let's look at (2). cancel_delayed_work() (on top of del_timer()) returns 0,
> and this is correct, we failed to cancel the timer, and we don't know whether
> work->func() finished, or not.
Yes.
> The current code uses del_timer_sync(). It will also return 0. However, it
> will spin waiting for timer->function() to complete. So we are just wasting
> CPU.
That's my objection to using cancel_delayed_work() as it stands, although in
most cases it's a relatively minor waste of time. However, if the timer
expiry routine gets interrupted then it may not be so minor... So, yes, I'm
in full agreement with you there.
> I guess I misunderstood you. Perhaps, you propose a new helper which use
> try_to_del_timer_sync(), yes? Unless I missed something, this doesn't help.
> Because the return value == -1 should be treated as 0. We failed to stop
> the timer, and we can't free dwork.
Consider how I'm using try_to_cancel_delayed_work(): I use this when I want to
queue a delayed work item with a particular timeout (usually for immediate
processing), but the work item may already be pending.
If try_to_cancel_delayed_work() returns 0 or 1 (not pending or pending but
dequeued) then I can go ahead and just schedule the work item (I'll be holding
a lock to prevent anyone else from interfering).
However, if try_to_cancel_delayed_work() returns -1 then there's no usually no
point attempting to schedule the work item because I know the timer expiry
handler is doing that or going to do that.
The code looks like this in pretty much all cases:
if (try_to_cancel_delayed_work(&afs_server_reaper) >= 0)
schedule_delayed_work(&afs_server_reaper, 0);
And so could well be packaged into a convenience routine and placed in
workqueue.[ch]. However, this would still concern Dave Miller as my patches
would still be altering non-net stuff or depending on non-net patches he
doesn't have in his GIT tree.
Using cancel_delayer_work() instead would be acceptable, functionally, as that
just waits till the -1 return case no longer holds true, and so always returns
0 or 1.
In RxRPC, this is only used to cancel a pair global delayed work items in the
rmmod path, and so the inefficiency of cancel_delayed_work() is something I
can live with, though it's something I'd want to reduce in the longer term.
In AFS, this is not only used in object destruction paths, but is also used to
cancel the callback timer and initiate synchronisation processing with
immediate effect.
David
next prev parent reply other threads:[~2007-04-24 15:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11769696211263-git-send-email-ebiederm@xmission.com>
[not found] ` <m1slawn9eb.fsf@ebiederm.dsl.xmission.com>
[not found] ` <29341.1176975158@redhat.com>
[not found] ` <m1lkgoms4j.fsf@ebiederm.dsl.xmission.com>
2007-04-19 14:18 ` Getting the new RxRPC patches upstream David Howells
2007-04-19 15:50 ` Eric W. Biederman
2007-04-19 16:18 ` David Howells
2007-04-19 19:14 ` Eric W. Biederman
2007-04-19 20:14 ` David Miller
2007-04-20 1:15 ` Herbert Xu
2007-04-20 8:02 ` David Howells
2007-04-20 8:58 ` David Miller
2007-04-20 10:41 ` David Howells
2007-04-20 18:38 ` Andrew Morton
2007-04-20 21:28 ` Oleg Nesterov
2007-04-23 8:32 ` David Howells
2007-04-23 17:11 ` Oleg Nesterov
2007-04-24 13:37 ` David Howells
2007-04-24 14:22 ` Oleg Nesterov
2007-04-24 15:51 ` David Howells [this message]
2007-04-24 16:40 ` Oleg Nesterov
2007-04-24 16:58 ` David Howells
2007-04-24 17:33 ` Oleg Nesterov
2007-04-24 18:22 ` David Howells
2007-04-24 19:34 ` Oleg Nesterov
2007-04-25 8:10 ` David Howells
2007-04-25 10:41 ` Oleg Nesterov
2007-04-25 10:45 ` David Howells
2007-04-25 13:48 ` David Howells
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=15160.1177429867@redhat.com \
--to=dhowells@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=containers@lists.osdl.org \
--cc=davem@davemloft.net \
--cc=ebiederm@xmission.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oleg@tv-sign.ru \
/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;
as well as URLs for NNTP newsgroup(s).