Skip to content

Commit 37bb6cb

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
hrtimer: unlock hrtimer_wakeup
hrtimer_wakeup creates a base->lock rq->lock lock dependancy. Avoid this by switching to HRTIMER_CB_IRQSAFE_NO_SOFTIRQ which doesn't hold base->lock. This fully untangles hrtimer locks from the scheduler locks, and allows hrtimer usage in the scheduler proper. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent d3d7445 commit 37bb6cb

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎kernel/hrtimer.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
12931293
sl->timer.function = hrtimer_wakeup;
12941294
sl->task = task;
12951295
#ifdef CONFIG_HIGH_RES_TIMERS
1296-
sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_RESTART;
1296+
sl->timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
12971297
#endif
12981298
}
12991299

@@ -1304,6 +1304,8 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
13041304
do {
13051305
set_current_state(TASK_INTERRUPTIBLE);
13061306
hrtimer_start(&t->timer, t->timer.expires, mode);
1307+
if (!hrtimer_active(&t->timer))
1308+
t->task = NULL;
13071309

13081310
if (likely(t->task))
13091311
schedule();

0 commit comments

Comments
 (0)