aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/hrtimer.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 59ec50c1e905..658d49feedb9 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -374,8 +374,6 @@ static void enqueue_hrtimer(struct hrtimer *timer, struct hrtimer_base *base)
374 rb_link_node(&timer->node, parent, link); 374 rb_link_node(&timer->node, parent, link);
375 rb_insert_color(&timer->node, &base->active); 375 rb_insert_color(&timer->node, &base->active);
376 376
377 timer->state = HRTIMER_PENDING;
378
379 if (!base->first || timer->expires.tv64 < 377 if (!base->first || timer->expires.tv64 <
380 rb_entry(base->first, struct hrtimer, node)->expires.tv64) 378 rb_entry(base->first, struct hrtimer, node)->expires.tv64)
381 base->first = &timer->node; 379 base->first = &timer->node;
@@ -395,6 +393,7 @@ static void __remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base)
395 if (base->first == &timer->node) 393 if (base->first == &timer->node)
396 base->first = rb_next(&timer->node); 394 base->first = rb_next(&timer->node);
397 rb_erase(&timer->node, &base->active); 395 rb_erase(&timer->node, &base->active);
396 timer->node.rb_parent = HRTIMER_INACTIVE;
398} 397}
399 398
400/* 399/*
@@ -405,7 +404,6 @@ remove_hrtimer(struct hrtimer *timer, struct hrtimer_base *base)
405{ 404{
406 if (hrtimer_active(timer)) { 405 if (hrtimer_active(timer)) {
407 __remove_hrtimer(timer, base); 406 __remove_hrtimer(timer, base);
408 timer->state = HRTIMER_INACTIVE;
409 return 1; 407 return 1;
410 } 408 }
411 return 0; 409 return 0;
@@ -579,6 +577,7 @@ void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
579 clock_id = CLOCK_MONOTONIC; 577 clock_id = CLOCK_MONOTONIC;
580 578
581 timer->base = &bases[clock_id]; 579 timer->base = &bases[clock_id];
580 timer->node.rb_parent = HRTIMER_INACTIVE;
582} 581}
583 582
584/** 583/**
@@ -625,7 +624,6 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base)
625 fn = timer->function; 624 fn = timer->function;
626 data = timer->data; 625 data = timer->data;
627 set_curr_timer(base, timer); 626 set_curr_timer(base, timer);
628 timer->state = HRTIMER_INACTIVE;
629 __remove_hrtimer(timer, base); 627 __remove_hrtimer(timer, base);
630 spin_unlock_irq(&base->lock); 628 spin_unlock_irq(&base->lock);
631 629
@@ -633,12 +631,10 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base)
633 631
634 spin_lock_irq(&base->lock); 632 spin_lock_irq(&base->lock);
635 633
636 /* Another CPU has added back the timer */ 634 if (restart != HRTIMER_NORESTART) {
637 if (timer->state != HRTIMER_INACTIVE) 635 BUG_ON(hrtimer_active(timer));
638 continue;
639
640 if (restart != HRTIMER_NORESTART)
641 enqueue_hrtimer(timer, base); 636 enqueue_hrtimer(timer, base);
637 }
642 } 638 }
643 set_curr_timer(base, NULL); 639 set_curr_timer(base, NULL);
644 spin_unlock_irq(&base->lock); 640 spin_unlock_irq(&base->lock);