aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/hrtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r--kernel/hrtimer.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 421be5fe5cc7..27a83ee41443 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1003,10 +1003,18 @@ hrtimer_start(struct hrtimer *timer, ktime_t tim, const enum hrtimer_mode mode)
1003 */ 1003 */
1004 raise = timer->state == HRTIMER_STATE_PENDING; 1004 raise = timer->state == HRTIMER_STATE_PENDING;
1005 1005
1006 /*
1007 * We use preempt_disable to prevent this task from migrating after
1008 * setting up the softirq and raising it. Otherwise, if me migrate
1009 * we will raise the softirq on the wrong CPU.
1010 */
1011 preempt_disable();
1012
1006 unlock_hrtimer_base(timer, &flags); 1013 unlock_hrtimer_base(timer, &flags);
1007 1014
1008 if (raise) 1015 if (raise)
1009 hrtimer_raise_softirq(); 1016 hrtimer_raise_softirq();
1017 preempt_enable();
1010 1018
1011 return ret; 1019 return ret;
1012} 1020}
@@ -1078,7 +1086,7 @@ ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
1078} 1086}
1079EXPORT_SYMBOL_GPL(hrtimer_get_remaining); 1087EXPORT_SYMBOL_GPL(hrtimer_get_remaining);
1080 1088
1081#if defined(CONFIG_NO_IDLE_HZ) || defined(CONFIG_NO_HZ) 1089#ifdef CONFIG_NO_HZ
1082/** 1090/**
1083 * hrtimer_get_next_event - get the time until next expiry event 1091 * hrtimer_get_next_event - get the time until next expiry event
1084 * 1092 *
@@ -1669,7 +1677,7 @@ void __init hrtimers_init(void)
1669 (void *)(long)smp_processor_id()); 1677 (void *)(long)smp_processor_id());
1670 register_cpu_notifier(&hrtimers_nb); 1678 register_cpu_notifier(&hrtimers_nb);
1671#ifdef CONFIG_HIGH_RES_TIMERS 1679#ifdef CONFIG_HIGH_RES_TIMERS
1672 open_softirq(HRTIMER_SOFTIRQ, run_hrtimer_softirq, NULL); 1680 open_softirq(HRTIMER_SOFTIRQ, run_hrtimer_softirq);
1673#endif 1681#endif
1674} 1682}
1675 1683