diff mbox

[11/14] hrtimer: remove active_bases field from struct hrtimer_cpu_base

Message ID dc479af0df0a087f24719237e7af687caa71e0d1.1395832156.git.viresh.kumar@linaro.org
State New
Headers show

Commit Message

Viresh Kumar March 26, 2014, 11:21 a.m. UTC
Active_bases field of struct hrtimer_cpu_base is used at only one place, i.e.
hrtimer_interrupt() and at that place too we can easily use timerqueue_getnext()
instead to achieve the same result. I don't think this will have any performance
degradation issues and so removing this field.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 include/linux/hrtimer.h | 2 --
 kernel/hrtimer.c        | 8 ++------
 2 files changed, 2 insertions(+), 8 deletions(-)

Comments

Thomas Gleixner March 26, 2014, 5:28 p.m. UTC | #1
On Wed, 26 Mar 2014, Viresh Kumar wrote:

> Active_bases field of struct hrtimer_cpu_base is used at only one place, i.e.
> hrtimer_interrupt() and at that place too we can easily use timerqueue_getnext()
> instead to achieve the same result. I don't think this will have any performance
> degradation issues and so removing this field.

Instead of removing it we should actually use ffs and avoid the whole
looping. That was the intention in the first place, but I never wrote
the patch...

Thanks,

	tglx

 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Viresh Kumar March 27, 2014, 4:30 a.m. UTC | #2
On 26 March 2014 22:58, Thomas Gleixner <tglx@linutronix.de> wrote:
> Instead of removing it we should actually use ffs and avoid the whole
> looping. That was the intention in the first place, but I never wrote
> the patch...

I thought about that and then using ffs for a field of which only 4 bits
are useful didn't looked too convincing to me :)

But, probably it will make things slightly better in case this routine is
heavily used.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
diff mbox

Patch

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 6f524db..cb6a315 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -165,7 +165,6 @@  enum  hrtimer_base_type {
  * struct hrtimer_cpu_base - the per cpu clock bases
  * @lock:		lock protecting the base and associated clock bases
  *			and timers
- * @active_bases:	Bitfield to mark bases with active timers
  * @clock_was_set:	Indicates that clock was set from irq context.
  * @expires_next:	absolute time of the next event which was scheduled
  *			via clock_set_next_event()
@@ -179,7 +178,6 @@  enum  hrtimer_base_type {
  */
 struct hrtimer_cpu_base {
 	raw_spinlock_t			lock;
-	unsigned int			active_bases;
 	unsigned int			clock_was_set;
 #ifdef CONFIG_HIGH_RES_TIMERS
 	ktime_t				expires_next;
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 1e4eedb..f14d861 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -865,7 +865,6 @@  static int enqueue_hrtimer(struct hrtimer *timer,
 	debug_activate(timer);
 
 	timerqueue_add(&base->active, &timer->node);
-	base->cpu_base->active_bases |= 1 << base->index;
 
 	/*
 	 * HRTIMER_STATE_ENQUEUED is or'ed to the current state to preserve the
@@ -909,8 +908,6 @@  static void __remove_hrtimer(struct hrtimer *timer,
 		}
 #endif
 	}
-	if (!timerqueue_getnext(&base->active))
-		base->cpu_base->active_bases &= ~(1 << base->index);
 out:
 	timer->state = newstate;
 }
@@ -1284,14 +1281,13 @@  retry:
 	cpu_base->expires_next.tv64 = KTIME_MAX;
 
 	for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
-		struct hrtimer_clock_base *base;
+		struct hrtimer_clock_base *base = cpu_base->clock_base + i;
 		struct timerqueue_node *node;
 		ktime_t basenow;
 
-		if (!(cpu_base->active_bases & (1 << i)))
+		if (!timerqueue_getnext(&base->active))
 			continue;
 
-		base = cpu_base->clock_base + i;
 		basenow = ktime_add(now, base->offset);
 
 		while ((node = timerqueue_getnext(&base->active))) {