diff options
-rw-r--r-- | include/linux/hrtimer.h | 1 | ||||
-rw-r--r-- | kernel/hrtimer.c | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 089bfb1fa01a..c657f3d4924a 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -40,6 +40,7 @@ enum hrtimer_restart { | |||
40 | enum hrtimer_state { | 40 | enum hrtimer_state { |
41 | HRTIMER_INACTIVE, /* Timer is inactive */ | 41 | HRTIMER_INACTIVE, /* Timer is inactive */ |
42 | HRTIMER_EXPIRED, /* Timer is expired */ | 42 | HRTIMER_EXPIRED, /* Timer is expired */ |
43 | HRTIMER_RUNNING, /* Timer is running the callback function */ | ||
43 | HRTIMER_PENDING, /* Timer is pending */ | 44 | HRTIMER_PENDING, /* Timer is pending */ |
44 | }; | 45 | }; |
45 | 46 | ||
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index f1c4155b49ac..f580dd9db286 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -550,6 +550,7 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base) | |||
550 | fn = timer->function; | 550 | fn = timer->function; |
551 | data = timer->data; | 551 | data = timer->data; |
552 | set_curr_timer(base, timer); | 552 | set_curr_timer(base, timer); |
553 | timer->state = HRTIMER_RUNNING; | ||
553 | __remove_hrtimer(timer, base); | 554 | __remove_hrtimer(timer, base); |
554 | spin_unlock_irq(&base->lock); | 555 | spin_unlock_irq(&base->lock); |
555 | 556 | ||
@@ -565,6 +566,10 @@ static inline void run_hrtimer_queue(struct hrtimer_base *base) | |||
565 | 566 | ||
566 | spin_lock_irq(&base->lock); | 567 | spin_lock_irq(&base->lock); |
567 | 568 | ||
569 | /* Another CPU has added back the timer */ | ||
570 | if (timer->state != HRTIMER_RUNNING) | ||
571 | continue; | ||
572 | |||
568 | if (restart == HRTIMER_RESTART) | 573 | if (restart == HRTIMER_RESTART) |
569 | enqueue_hrtimer(timer, base); | 574 | enqueue_hrtimer(timer, base); |
570 | else | 575 | else |