From: Oleg Nesterov <oleg@tv-sign.ru>
To: Krishna Kumar <krkumar2@in.ibm.com>
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [RFC] [PATCH 1/1]: timers: Change add_timer to use add_timer_on
Date: Mon, 22 Sep 2008 18:43:03 +0400 [thread overview]
Message-ID: <20080922144303.GA295@tv-sign.ru> (raw)
In-Reply-To: <20080922043438.21118.93359.sendpatchset@localhost.localdomain>
(add Thomas)
On 09/22, Krishna Kumar wrote:
>
> timer: Change add_timer to not check for existing timer.
Perhaps the changelog should explain why ;)
But, besides the removing BUG_ON(), the patch does something else.
> static inline void add_timer(struct timer_list *timer)
> {
> - BUG_ON(timer_pending(timer));
> - __mod_timer(timer, timer->expires);
> + add_timer_on(timer, raw_smp_processor_id());
> }
This is racy wrt CPU hotplug. The CPU can be cpu_down()'ed right
after raw_smp_processor_id() returns, and before we actually add
the timer.
Another problem is that now it is add_timer() becomes unsafe wrt
concurrent del_timer/del_timer_sync, because add_timer_on() does
not lock the timer, it only locks the target base.
Oleg.
prev parent reply other threads:[~2008-09-22 14:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-22 4:34 [RFC] [PATCH 0/1] timers: add_timer should never be called if pending Krishna Kumar
2008-09-22 4:34 ` [RFC] [PATCH 1/1]: timers: Change add_timer to use add_timer_on Krishna Kumar
2008-09-22 14:43 ` Oleg Nesterov [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=20080922144303.GA295@tv-sign.ru \
--to=oleg@tv-sign.ru \
--cc=akpm@linux-foundation.org \
--cc=krkumar2@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox