From: Anna-Maria Gleixner Date: Tue, 30 Jul 2019 22:33:50 +0000 (+0200) Subject: timerfd: Prepare for PREEMPT_RT X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a125ecc16453a4fe0ba865c7df87b9c722991fdf;p=linux.git timerfd: Prepare for PREEMPT_RT Use the hrtimer_cancel_wait_running() synchronization mechanism to prevent priority inversion and live locks on PREEMPT_RT. [ tglx: Split out of combo patch ] Signed-off-by: Anna-Maria Gleixner Signed-off-by: Sebastian Andrzej Siewior Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20190730223828.600085866@linutronix.de --- diff --git a/fs/timerfd.c b/fs/timerfd.c index 6a6fc8aa1de78..48305ba41e3c7 100644 --- a/fs/timerfd.c +++ b/fs/timerfd.c @@ -471,7 +471,11 @@ static int do_timerfd_settime(int ufd, int flags, break; } spin_unlock_irq(&ctx->wqh.lock); - cpu_relax(); + + if (isalarm(ctx)) + hrtimer_cancel_wait_running(&ctx->t.alarm.timer); + else + hrtimer_cancel_wait_running(&ctx->t.tmr); } /*