[GIT pull] timer fixes for 3.15

From: Thomas Gleixner
Date: Thu Apr 17 2014 - 16:49:02 EST


Linus,

please pull the latest timers-urgent-for-linus git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-for-linus

Viresh unearthed the following three hickups in the timer/timekeeping
code:

- Negated check for the result of a clock event selection

- A missing early exit in the jiffies update path which causes
update_wall_time to be called for nothing causing lock contention
and wasted cycles in the timer interrupt

- Checking a variable in the NOHZ code enable code for true which can
only be set by that very code after the check succeeds. That results
in a rock solid runtime disablement of that feature.

Thanks,

tglx

------------------>
Viresh Kumar (3):
tick-common: Fix wrong check in tick_check_replacement()
tick-sched: Don't call update_wall_time() when delta is lesser than tick_period
tick-sched: Check tick_nohz_enabled in tick_nohz_switch_to_nohz()


kernel/time/tick-common.c | 2 +-
kernel/time/tick-sched.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 0156612..0a0608e 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -276,7 +276,7 @@ static bool tick_check_preferred(struct clock_event_device *curdev,
bool tick_check_replacement(struct clock_event_device *curdev,
struct clock_event_device *newdev)
{
- if (tick_check_percpu(curdev, newdev, smp_processor_id()))
+ if (!tick_check_percpu(curdev, newdev, smp_processor_id()))
return false;

return tick_check_preferred(curdev, newdev);
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 9f8af69..6558b7a 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -84,6 +84,9 @@ static void tick_do_update_jiffies64(ktime_t now)

/* Keep the tick_next_period variable up to date */
tick_next_period = ktime_add(last_jiffies_update, tick_period);
+ } else {
+ write_sequnlock(&jiffies_lock);
+ return;
}
write_sequnlock(&jiffies_lock);
update_wall_time();
@@ -967,7 +970,7 @@ static void tick_nohz_switch_to_nohz(void)
struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched);
ktime_t next;

- if (!tick_nohz_active)
+ if (!tick_nohz_enabled)
return;

local_irq_disable();
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/