Skip to content

Commit

Permalink
timer-fd: Prevent live lock
Browse files Browse the repository at this point in the history
If hrtimer_try_to_cancel() requires a retry, then depending on the
priority setting te retry loop might prevent timer callback completion
on RT. Prevent that by waiting for completion on RT, no change for a
non RT kernel.

Reported-by: Sankara Muthukrishnan <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
KAGA-KOKO authored and andrewkim-pkt committed Jan 22, 2019
1 parent 9681428 commit c29f353
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/timerfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,10 @@ static int do_timerfd_settime(int ufd, int flags,
break;
}
spin_unlock_irq(&ctx->wqh.lock);
cpu_relax();
if (isalarm(ctx))
hrtimer_wait_for_timer(&ctx->t.alarm.timer);
else
hrtimer_wait_for_timer(&ctx->t.tmr);
}

/*
Expand Down

0 comments on commit c29f353

Please sign in to comment.