From: Andrew Morton <akpm@osdl.org>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu,
christoph@lameter.com, kenneth.w.chen@intel.com
Subject: Re: [PATCH 6/5] timers: enable irqs in __mod_timer()
Date: Mon, 21 Mar 2005 21:43:05 -0800 [thread overview]
Message-ID: <20050321214305.3b7af964.akpm@osdl.org> (raw)
In-Reply-To: <423ED7E4.2A1F0970@tv-sign.ru>
Oleg Nesterov <oleg@tv-sign.ru> wrote:
>
> If the timer is currently running on another CPU, __mod_timer()
> spins with interrupts disabled and timer->lock held. I think it
> is better to spin_unlock_irqrestore(&timer->lock) in __mod_timer's
> retry path.
>
> This patch is unneccessary long. It is because it tries to cleanup
> the code a bit. I do not like the fact that lock+test+unlock pattern
> is duplicated in the code.
>
> If you think that this patch uglifies the code or does not match
> kernel's coding style - just say nack :)
I've seen worse ;)
I think this makes it a bit more kernel-like?
--- 25/kernel/timer.c~timers-enable-irqs-in-__mod_timer-tidy 2005-03-21 21:41:03.000000000 -0800
+++ 25-akpm/kernel/timer.c 2005-03-21 21:41:57.000000000 -0800
@@ -174,12 +174,13 @@ int __mod_timer(struct timer_list *timer
{
tvec_base_t *old_base, *new_base;
unsigned long flags;
- int new_lock, ret;
+ int new_lock;
+ int ret = -1;
BUG_ON(!timer->function);
check_timer(timer);
- for (ret = -1; ret < 0; ) {
+ do {
spin_lock_irqsave(&timer->lock, flags);
new_base = &__get_cpu_var(tvec_bases);
old_base = timer_base(timer);
@@ -227,7 +228,7 @@ unlock:
if (new_lock)
spin_unlock(&new_base->lock);
spin_unlock_irqrestore(&timer->lock, flags);
- }
+ } while (ret == -1);
return ret;
}
_
next prev parent reply other threads:[~2005-03-22 5:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-21 14:19 Oleg Nesterov
2005-03-22 5:43 ` Andrew Morton [this message]
2005-03-24 21:56 ` [PATCH 0/5] timers: description Chen, Kenneth W
2005-03-26 19:52 ` Chen, Kenneth W
2005-03-27 10:08 ` Oleg Nesterov
2005-03-28 19:12 ` Christoph Lameter
2005-03-29 11:27 ` Oleg Nesterov
2005-03-29 14:47 ` Christoph Lameter
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=20050321214305.3b7af964.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=christoph@lameter.com \
--cc=kenneth.w.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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
all inboxes | Powered by JetHome®