public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.16-mm1] __mod_timer: simplify ->base changing
@ 2006-03-26  2:44 Oleg Nesterov
  2006-03-26 16:41 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Oleg Nesterov @ 2006-03-26  2:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, Roman Zippel

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;
 }


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2.6.16-mm1] __mod_timer: simplify ->base changing
  2006-03-26  2:44 [PATCH 2.6.16-mm1] __mod_timer: simplify ->base changing Oleg Nesterov
@ 2006-03-26 16:41 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2006-03-26 16:41 UTC (permalink / raw)
  To: Oleg Nesterov; +Cc: Andrew Morton, linux-kernel, Thomas Gleixner, Roman Zippel


* Oleg Nesterov <oleg@tv-sign.ru> wrote:

> 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>

nice!

Acked-by: Ingo Molnar <mingo@elte.hu>

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-26 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-26  2:44 [PATCH 2.6.16-mm1] __mod_timer: simplify ->base changing Oleg Nesterov
2006-03-26 16:41 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox