@@ -652,21 +652,24 @@ static inline int hrtimer_hres_active(void)
652
652
return __hrtimer_hres_active (this_cpu_ptr (& hrtimer_bases ));
653
653
}
654
654
655
- /*
656
- * Reprogram the event source with checking both queues for the
657
- * next event
658
- * Called with interrupts disabled and base->lock held
659
- */
660
655
static void
661
- hrtimer_force_reprogram (struct hrtimer_cpu_base * cpu_base , int skip_equal )
656
+ __hrtimer_reprogram (struct hrtimer_cpu_base * cpu_base , int skip_equal ,
657
+ struct hrtimer * next_timer , ktime_t expires_next )
662
658
{
663
- ktime_t expires_next ;
659
+ /*
660
+ * If the hrtimer interrupt is running, then it will reevaluate the
661
+ * clock bases and reprogram the clock event device.
662
+ */
663
+ if (cpu_base -> in_hrtirq )
664
+ return ;
664
665
665
- expires_next = hrtimer_update_next_event (cpu_base );
666
+ if (expires_next > cpu_base -> expires_next )
667
+ return ;
666
668
667
669
if (skip_equal && expires_next == cpu_base -> expires_next )
668
670
return ;
669
671
672
+ cpu_base -> next_timer = next_timer ;
670
673
cpu_base -> expires_next = expires_next ;
671
674
672
675
/*
@@ -689,7 +692,23 @@ hrtimer_force_reprogram(struct hrtimer_cpu_base *cpu_base, int skip_equal)
689
692
if (!__hrtimer_hres_active (cpu_base ) || cpu_base -> hang_detected )
690
693
return ;
691
694
692
- tick_program_event (cpu_base -> expires_next , 1 );
695
+ tick_program_event (expires_next , 1 );
696
+ }
697
+
698
+ /*
699
+ * Reprogram the event source with checking both queues for the
700
+ * next event
701
+ * Called with interrupts disabled and base->lock held
702
+ */
703
+ static void
704
+ hrtimer_force_reprogram (struct hrtimer_cpu_base * cpu_base , int skip_equal )
705
+ {
706
+ ktime_t expires_next ;
707
+
708
+ expires_next = hrtimer_update_next_event (cpu_base );
709
+
710
+ __hrtimer_reprogram (cpu_base , skip_equal , cpu_base -> next_timer ,
711
+ expires_next );
693
712
}
694
713
695
714
/* High resolution timer related functions */
@@ -835,40 +854,7 @@ static void hrtimer_reprogram(struct hrtimer *timer, bool reprogram)
835
854
if (base -> cpu_base != cpu_base )
836
855
return ;
837
856
838
- /*
839
- * If the hrtimer interrupt is running, then it will
840
- * reevaluate the clock bases and reprogram the clock event
841
- * device. The callbacks are always executed in hard interrupt
842
- * context so we don't need an extra check for a running
843
- * callback.
844
- */
845
- if (cpu_base -> in_hrtirq )
846
- return ;
847
-
848
- if (expires >= cpu_base -> expires_next )
849
- return ;
850
-
851
- /* Update the pointer to the next expiring timer */
852
- cpu_base -> next_timer = timer ;
853
- cpu_base -> expires_next = expires ;
854
-
855
- /*
856
- * If hres is not active, hardware does not have to be
857
- * programmed yet.
858
- *
859
- * If a hang was detected in the last timer interrupt then we
860
- * do not schedule a timer which is earlier than the expiry
861
- * which we enforced in the hang detection. We want the system
862
- * to make progress.
863
- */
864
- if (!__hrtimer_hres_active (cpu_base ) || cpu_base -> hang_detected )
865
- return ;
866
-
867
- /*
868
- * Program the timer hardware. We enforce the expiry for
869
- * events which are already in the past.
870
- */
871
- tick_program_event (expires , 1 );
857
+ __hrtimer_reprogram (cpu_base , true, timer , expires );
872
858
}
873
859
874
860
/*
0 commit comments