提交 a2c348fe 编写于 作者: O Oleg Nesterov 提交者: Linus Torvalds

[PATCH] __mod_timer: simplify ->base changing

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: NOleg Nesterov <oleg@tv-sign.ru>
Acked-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 3691c519
...@@ -215,21 +215,19 @@ int __mod_timer(struct timer_list *timer, unsigned long expires) ...@@ -215,21 +215,19 @@ int __mod_timer(struct timer_list *timer, unsigned long expires)
* handler yet has not finished. This also guarantees that * handler yet has not finished. This also guarantees that
* the timer is serialized wrt itself. * the timer is serialized wrt itself.
*/ */
if (unlikely(base->running_timer == timer)) { if (likely(base->running_timer != timer)) {
/* The timer remains on a former base */
new_base = base;
} else {
/* See the comment in lock_timer_base() */ /* See the comment in lock_timer_base() */
timer->base = NULL; timer->base = NULL;
spin_unlock(&base->lock); spin_unlock(&base->lock);
spin_lock(&new_base->lock); base = new_base;
timer->base = new_base; spin_lock(&base->lock);
timer->base = base;
} }
} }
timer->expires = expires; timer->expires = expires;
internal_add_timer(new_base, timer); internal_add_timer(base, timer);
spin_unlock_irqrestore(&new_base->lock, flags); spin_unlock_irqrestore(&base->lock, flags);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册