From: Marcelo Tosatti <mtosatti@redhat.com>
To: linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
Anna-Maria Gleixner <anna-maria@linutronix.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
Haris Okanovic <haris.okanovic@ni.com>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 3/3] timers: condense pending bitmap information
Date: Mon, 15 Apr 2019 17:12:16 -0300 [thread overview]
Message-ID: <20190415201429.499455390@amt.cnet> (raw)
In-Reply-To: 20190415201213.600254019@amt.cnet
[-- Attachment #1: 03-optimize-pending-map-check --]
[-- Type: text/plain, Size: 1564 bytes --]
Condense the pending bitmap information in a bool.
Improves cyclictest results by 4us.
Signed-off-by: Marcelo Tosatti <mtosatti@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;
next prev parent reply other threads:[~2019-04-15 20:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-15 20:12 [patch 0/3] do not raise timer softirq unconditionally (spinlockless version) Marcelo Tosatti
2019-04-15 20:12 ` [patch 1/3] timers: raise timer softirq on __mod_timer/add_timer_on Marcelo Tosatti
2019-05-29 14:53 ` Anna-Maria Gleixner
2019-05-30 19:23 ` Marcelo Tosatti
2019-04-15 20:12 ` [patch 2/3] timers: do not raise softirq unconditionally (spinlockless version) Marcelo Tosatti
2019-05-29 14:53 ` Anna-Maria Gleixner
2019-05-30 20:14 ` Marcelo Tosatti
2019-05-31 11:55 ` Anna-Maria Gleixner
2019-06-11 11:45 ` Anna-Maria Gleixner
2019-06-04 6:29 ` Peter Xu
2019-06-06 15:14 ` Marcelo Tosatti
2019-04-15 20:12 ` Marcelo Tosatti [this message]
2019-04-15 20:17 ` [patch 0/3] do not raise timer " Marcelo Tosatti
2019-05-06 3:22 ` Marcelo Tosatti
2019-05-06 7:17 ` Daniel Bristot de Oliveira
2019-05-06 9:22 ` Thomas Gleixner
2019-05-29 14:52 ` Anna-Maria Gleixner
2019-05-30 19:38 ` Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190415201429.499455390@amt.cnet \
--to=mtosatti@redhat.com \
--cc=anna-maria@linutronix.de \
--cc=bristot@redhat.com \
--cc=haris.okanovic@ni.com \
--cc=lcapitulino@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).