From: Akinobu Mita <akinobu.mita@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
"Michael H. Warfield" <mhw@wittsend.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] ip2: avoid add_timer() with pending timer
Date: Tue, 15 Jul 2008 12:06:39 +0900 [thread overview]
Message-ID: <20080715030639.GA3123@localhost.localdomain> (raw)
In-Reply-To: <20080714100402.b72e2b1e.akpm@linux-foundation.org>
On Mon, Jul 14, 2008 at 10:04:02AM -0700, Andrew Morton wrote:
> On Mon, 14 Jul 2008 11:49:55 +0900 Akinobu Mita <akinobu.mita@gmail.com> wrote:
>
> > @@ -746,10 +742,8 @@ ip2_loadmain(int *iop, int *irqp)
> > }
> > if ( ip2config.irq[i] == CIR_POLL ) {
> > retry:
> > - if (!TimerOn) {
> > - PollTimer.expires = POLL_TIMEOUT;
> > - add_timer ( &PollTimer );
> > - TimerOn = 1;
> > + if (!timer_pending(&PollTimer)) {
> > + mod_timer(&PollTimer, POLL_TIMEOUT);
> > printk( KERN_INFO "IP2: polling\n");
>
> This change to ip2_loadmain() might be racy if it actually did
> anything. But afaict timer_pending() can never be true here (we're
> only called from module_init()) so it can and should be removed.
Yes, ip2_loadmain() is only called from module_init(). But this add_timer()
is in the loop for each device. So it may be called more than once.
And yes, I can remove timer_pending() here because I switched to use
mod_timer() instead of add_timer(). But this PollTimer works as periodic
timer and it's global timer. So it will not cause a problem.
prev parent reply other threads:[~2008-07-15 3:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-14 2:49 [PATCH] ip2: avoid add_timer() with pending timer Akinobu Mita
2008-07-14 13:33 ` Alan Cox
2008-07-14 17:04 ` Andrew Morton
2008-07-15 3:06 ` Akinobu Mita [this message]
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=20080715030639.GA3123@localhost.localdomain \
--to=akinobu.mita@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mhw@wittsend.com \
/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