summaryrefslogtreecommitdiff
path: root/kernel/time
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2018-01-22 11:50:22 +0530
committerAmit Pundir <amit.pundir@linaro.org>2018-01-22 11:50:22 +0530
commit395ae9f4e6934c9f61d7002dc12b267d0c302104 (patch)
treed80d145feb56614796dfe6c2ce41db16b290daf3 /kernel/time
parent317c5652a7c300c2d82ef5bfae8d3558f389d219 (diff)
parent13b48cd3ac945d4e4075bec53f107a315fe771ae (diff)
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Conflicts: kernel/fork.c Conflict due to Kaiser implementation in LTS 4.4.110. net/ipv4/raw.c Minor conflict due to LTS commit be27b620a861 ("net: ipv4: fix for a race condition in raw_sendmsg")
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/tick-sched.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 34f9a9c417d9..a935cbdc55a4 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -568,6 +568,11 @@ static void tick_nohz_restart(struct tick_sched *ts, ktime_t now)
tick_program_event(hrtimer_get_expires(&ts->sched_timer), 1);
}
+static inline bool local_timer_softirq_pending(void)
+{
+ return local_softirq_pending() & TIMER_SOFTIRQ;
+}
+
static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
ktime_t now, int cpu)
{
@@ -584,8 +589,18 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts,
} while (read_seqretry(&jiffies_lock, seq));
ts->last_jiffies = basejiff;
- if (rcu_needs_cpu(basemono, &next_rcu) ||
- arch_needs_cpu() || irq_work_needs_cpu()) {
+ /*
+ * Keep the periodic tick, when RCU, architecture or irq_work
+ * requests it.
+ * Aside of that check whether the local timer softirq is
+ * pending. If so its a bad idea to call get_next_timer_interrupt()
+ * because there is an already expired timer, so it will request
+ * immeditate expiry, which rearms the hardware timer with a
+ * minimal delta which brings us back to this place
+ * immediately. Lather, rinse and repeat...
+ */
+ if (rcu_needs_cpu(basemono, &next_rcu) || arch_needs_cpu() ||
+ irq_work_needs_cpu() || local_timer_softirq_pending()) {
next_tick = basemono + TICK_NSEC;
} else {
/*