[PATCH 2/5] time: Minimize number of touch_softlockup_watchdog

From: Don Zickus
Date: Wed Dec 21 2011 - 16:19:19 EST


Another patch where I was worried about overhead on a change
in the softlockup code. Currently on my x86 box it seems the
tick code was touch the softlockup every millisecond.

To minimize, I moved the touch_softlockup_watchdog to a
common function, tick_do_update_jiffies64. Then the code
only ever touches the softlockup when there was a greater
than 1 second jump in the tick.

Considering the softlockup fires ever 20 seconds or so, this
should be safe for now.

This saves about a 1 thousand calls/per second.

Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
---
kernel/time/tick-sched.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 31cc061..00578c0 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -73,6 +73,8 @@ static void tick_do_update_jiffies64(ktime_t now)

last_jiffies_update = ktime_add_ns(last_jiffies_update,
incr * ticks);
+ if (incr > NSEC_PER_SEC)
+ touch_softlockup_watchdog();
}
do_timer(++ticks);

@@ -144,8 +146,6 @@ static void tick_nohz_update_jiffies(ktime_t now)
local_irq_save(flags);
tick_do_update_jiffies64(now);
local_irq_restore(flags);
-
- touch_softlockup_watchdog();
}

/*
@@ -572,7 +572,6 @@ void tick_nohz_restart_sched_tick(void)
account_idle_ticks(ticks);
#endif

- touch_softlockup_watchdog();
/*
* Cancel the scheduled timer and restore the tick
*/
@@ -625,7 +624,6 @@ static void tick_nohz_handler(struct clock_event_device *dev)
* do when we go busy again does not account too much ticks.
*/
if (ts->tick_stopped) {
- touch_softlockup_watchdog();
ts->idle_jiffies++;
}

@@ -783,7 +781,6 @@ static enum hrtimer_restart tick_sched_timer(struct hrtimer *timer)
* when we go busy again does not account too much ticks.
*/
if (ts->tick_stopped) {
- touch_softlockup_watchdog();
ts->idle_jiffies++;
}
update_process_times(user_mode(regs));
--
1.7.7.4

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