Condense the pending bitmap information in a bool.

Improves cyclictest results by 4us.

Signed-off-by: Marcelo Tosatti <mtosa...@redhat.com>

---
 kernel/time/timer.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Index: linux-rt-devel/kernel/time/timer.c
===================================================================
--- linux-rt-devel.orig/kernel/time/timer.c     2019-04-15 14:22:56.000000000 
-0300
+++ linux-rt-devel/kernel/time/timer.c  2019-04-15 14:24:24.803312280 -0300
@@ -206,6 +206,7 @@
        unsigned int            cpu;
        bool                    is_idle;
        bool                    must_forward_clk;
+       bool                    pending_map_clear;
        DECLARE_BITMAP(pending_map, WHEEL_SIZE);
        struct hlist_head       vectors[WHEEL_SIZE];
 } ____cacheline_aligned;
@@ -538,6 +539,7 @@
 {
        hlist_add_head(&timer->entry, base->vectors + idx);
        __set_bit(idx, base->pending_map);
+       base->pending_map_clear = false;
        timer_set_idx(timer, idx);
 }
 
@@ -1741,6 +1743,9 @@
                while (levels--)
                        expire_timers(base, heads + levels);
        }
+       if (!housekeeping_cpu(base->cpu, HK_FLAG_TIMER) &&
+           bitmap_empty(base->pending_map, WHEEL_SIZE))
+               base->pending_map_clear = true;
        raw_spin_unlock_irq(&base->lock);
        wakeup_timer_waiters(base);
 }
@@ -1784,10 +1789,10 @@
 #endif
        base = this_cpu_ptr(&timer_bases[BASE_STD]);
        if (!housekeeping_cpu(base->cpu, HK_FLAG_TIMER)) {
-               if (!bitmap_empty(base->pending_map, WHEEL_SIZE))
+               if (!base->pending_map_clear)
                        goto raise;
                base++;
-               if (!bitmap_empty(base->pending_map, WHEEL_SIZE))
+               if (!base->pending_map_clear)
                        goto raise;
 
                return;


Reply via email to