hrtimer: Avoid more SMP function calls in clock_was_set()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 13 Jul 2021 13:39:55 +0000 (15:39 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 10 Aug 2021 15:57:23 +0000 (17:57 +0200)
commit1e7f7fbcd40c69d23e3fe641ead9f3dc128fa8aa
treed124d58be009731ebff19eac5cc76fec77b4a149
parent81d741d3460ca422843ce0ec8351083f259c6166
hrtimer: Avoid more SMP function calls in clock_was_set()

By unconditionally updating the offsets there are more indicators
whether the SMP function calls on clock_was_set() can be avoided:

  - When the offset update already happened on the remote CPU then the
    remote update attempt will yield the same seqeuence number and no
    IPI is required.

  - When the remote CPU is currently handling hrtimer_interrupt(). In
    that case the remote CPU will reevaluate the timer bases before
    reprogramming anyway, so nothing to do.

  - After updating it can be checked whether the first expiring timer in
    the affected clock bases moves before the first expiring (softirq)
    timer of the CPU. If that's not the case then sending the IPI is not
    required.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210713135158.887322464@linutronix.de
kernel/time/hrtimer.c