public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Thomas Gleixner <tglx@linutronix.de>,
	Roman Zippel <zippel@linux-m68k.org>
Subject: [PATCH 2.6.16-mm1] __mod_timer: simplify ->base changing
Date: Sun, 26 Mar 2006 06:44:53 +0400	[thread overview]
Message-ID: <20060326024453.GA9292@oleg> (raw)

On top of
	kill-__init_timer_base-in-favor-of-boot_tvec_bases.patch

Since base and new_base are of the same type now, we can save one
'if' branch and simplify the code a bit.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>

--- MM/kernel/timer.c~	2006-03-25 18:44:18.000000000 +0300
+++ MM/kernel/timer.c	2006-03-25 18:50:07.000000000 +0300
@@ -215,21 +215,19 @@ int __mod_timer(struct timer_list *timer
 		 * handler yet has not finished. This also guarantees that
 		 * the timer is serialized wrt itself.
 		 */
-		if (unlikely(base->running_timer == timer)) {
-			/* The timer remains on a former base */
-			new_base = base;
-		} else {
+		if (likely(base->running_timer != timer)) {
 			/* See the comment in lock_timer_base() */
 			timer->base = NULL;
 			spin_unlock(&base->lock);
-			spin_lock(&new_base->lock);
-			timer->base = new_base;
+			base = new_base;
+			spin_lock(&base->lock);
+			timer->base = base;
 		}
 	}
 
 	timer->expires = expires;
-	internal_add_timer(new_base, timer);
-	spin_unlock_irqrestore(&new_base->lock, flags);
+	internal_add_timer(base, timer);
+	spin_unlock_irqrestore(&base->lock, flags);
 
 	return ret;
 }


             reply	other threads:[~2006-03-25 23:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-26  2:44 Oleg Nesterov [this message]
2006-03-26 16:41 ` [PATCH 2.6.16-mm1] __mod_timer: simplify ->base changing Ingo Molnar

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=20060326024453.GA9292@oleg \
    --to=oleg@tv-sign.ru \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=zippel@linux-m68k.org \
    /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