From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Anton Vorontsov <anton@enomsg.org>,
Alexey Perevalov <a.perevalov@samsung.com>,
kyungmin.park@samsung.com, cw00.choi@samsung.com
Subject: [RFC patch 2/5] hrtimer: Make use of the active bases bitfield
Date: Fri, 21 Feb 2014 17:56:16 -0000 [thread overview]
Message-ID: <20140221174639.557494772@linutronix.de> (raw)
In-Reply-To: <20140221173936.583477951@linutronix.de>
[-- Attachment #1: hrtimer-use-active-bases.patch --]
[-- Type: text/plain, Size: 2102 bytes --]
Instead of looping through all bases, find the active ones via the
cpu_base->active_bases bit field.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
kernel/hrtimer.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
Index: tip/kernel/hrtimer.c
===================================================================
--- tip.orig/kernel/hrtimer.c
+++ tip/kernel/hrtimer.c
@@ -1284,7 +1284,8 @@ void hrtimer_interrupt(struct clock_even
{
struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
ktime_t expires_next, now, entry_time, delta;
- int i, retries = 0;
+ unsigned long bases;
+ int retries = 0;
BUG_ON(!cpu_base->hres_active);
cpu_base->nr_events++;
@@ -1302,16 +1303,18 @@ retry:
* this CPU.
*/
cpu_base->expires_next.tv64 = KTIME_MAX;
+ bases = cpu_base->active_bases;
- for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
+ while (bases) {
struct hrtimer_clock_base *base;
struct timerqueue_node *node;
ktime_t basenow;
+ int idx;
- if (!(cpu_base->active_bases & (1 << i)))
- continue;
+ idx = __ffs(bases);
+ bases &= ~(1 << idx);
- base = cpu_base->clock_base + i;
+ base = cpu_base->clock_base + idx;
basenow = ktime_add(now, base->offset);
while ((node = timerqueue_getnext(&base->active))) {
@@ -1479,18 +1482,24 @@ void hrtimer_run_pending(void)
*/
void hrtimer_run_queues(void)
{
- struct timerqueue_node *node;
struct hrtimer_cpu_base *cpu_base = &__get_cpu_var(hrtimer_bases);
- struct hrtimer_clock_base *base;
- int index, gettime = 1;
+ unsigned long bases;
+ int gettime = 1;
if (hrtimer_hres_active())
return;
- for (index = 0; index < HRTIMER_MAX_CLOCK_BASES; index++) {
- base = &cpu_base->clock_base[index];
- if (!timerqueue_getnext(&base->active))
- continue;
+ bases = cpu_base->active_bases;
+
+ while (bases) {
+ struct hrtimer_clock_base *base;
+ struct timerqueue_node *node;
+ int idx;
+
+ idx = __ffs(bases);
+ bases &= ~(1 << idx);
+
+ base = &cpu_base->clock_base[idx];
if (gettime) {
hrtimer_get_softirq_time(cpu_base);
next prev parent reply other threads:[~2014-02-21 17:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 17:56 [RFC patch 0/5] hrtimers: Add deferrable mode Thomas Gleixner
2014-02-21 17:56 ` [RFC patch 1/5] hrtimer: Always check for HRTIMER_MODE_REL Thomas Gleixner
2014-02-25 11:56 ` Peter Zijlstra
2014-02-21 17:56 ` [RFC patch 3/5] hrtimer: Add support for deferrable hrtimers Thomas Gleixner
2014-02-21 17:56 ` Thomas Gleixner [this message]
2014-02-25 12:01 ` [RFC patch 2/5] hrtimer: Make use of the active bases bitfield Peter Zijlstra
2014-02-21 17:56 ` [RFC patch 4/5] posix-timers: Expose deferrable mode to user space Thomas Gleixner
2014-02-21 17:56 ` [RFC patch 5/5] timerfd: " Thomas Gleixner
2014-02-25 8:36 ` Richard Cochran
2014-02-26 3:02 ` [RFC patch 0/5] hrtimers: Add deferrable mode Andy Lutomirski
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=20140221174639.557494772@linutronix.de \
--to=tglx@linutronix.de \
--cc=a.perevalov@samsung.com \
--cc=anton@enomsg.org \
--cc=cw00.choi@samsung.com \
--cc=john.stultz@linaro.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®