aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index b0afd8db1396..6247e4a8350f 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -263,6 +263,7 @@ struct rq {
263 263
264 unsigned int clock_warps, clock_overflows; 264 unsigned int clock_warps, clock_overflows;
265 unsigned int clock_unstable_events; 265 unsigned int clock_unstable_events;
266 u64 tick_timestamp;
266 267
267 atomic_t nr_iowait; 268 atomic_t nr_iowait;
268 269
@@ -341,8 +342,11 @@ static void __update_rq_clock(struct rq *rq)
341 /* 342 /*
342 * Catch too large forward jumps too: 343 * Catch too large forward jumps too:
343 */ 344 */
344 if (unlikely(delta > 2*TICK_NSEC)) { 345 if (unlikely(clock + delta > rq->tick_timestamp + TICK_NSEC)) {
345 clock++; 346 if (clock < rq->tick_timestamp + TICK_NSEC)
347 clock = rq->tick_timestamp + TICK_NSEC;
348 else
349 clock++;
346 rq->clock_overflows++; 350 rq->clock_overflows++;
347 } else { 351 } else {
348 if (unlikely(delta > rq->clock_max_delta)) 352 if (unlikely(delta > rq->clock_max_delta))
@@ -3308,9 +3312,16 @@ void scheduler_tick(void)
3308 int cpu = smp_processor_id(); 3312 int cpu = smp_processor_id();
3309 struct rq *rq = cpu_rq(cpu); 3313 struct rq *rq = cpu_rq(cpu);
3310 struct task_struct *curr = rq->curr; 3314 struct task_struct *curr = rq->curr;
3315 u64 next_tick = rq->tick_timestamp + TICK_NSEC;
3311 3316
3312 spin_lock(&rq->lock); 3317 spin_lock(&rq->lock);
3313 __update_rq_clock(rq); 3318 __update_rq_clock(rq);
3319 /*
3320 * Let rq->clock advance by at least TICK_NSEC:
3321 */
3322 if (unlikely(rq->clock < next_tick))
3323 rq->clock = next_tick;
3324 rq->tick_timestamp = rq->clock;
3314 update_cpu_load(rq); 3325 update_cpu_load(rq);
3315 if (curr != rq->idle) /* FIXME: needed? */ 3326 if (curr != rq->idle) /* FIXME: needed? */
3316 curr->sched_class->task_tick(rq, curr); 3327 curr->sched_class->task_tick(rq, curr);