提交 34aee88a 编写于 作者: T Thomas Gleixner

hrtimer: Use cpu_base->active_base for hotpath iterators

The active_bases field is guaranteed to be in sync with the timerqueue
of the corresponding clock base. So we can use it for iterating over
the clock bases. This allows to break out early if no more active
clock bases are available and avoids touching the cache lines of
inactive clock bases.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
Reviewed-by: NPreeti U Murthy <preeti@linux.vnet.ibm.com>
Acked-by: NPeter Zijlstra <peterz@infradead.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/20150414203501.322887675@linutronix.deSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 e19ffe8b
...@@ -419,16 +419,16 @@ static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base) ...@@ -419,16 +419,16 @@ static ktime_t __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base)
{ {
struct hrtimer_clock_base *base = cpu_base->clock_base; struct hrtimer_clock_base *base = cpu_base->clock_base;
ktime_t expires, expires_next = { .tv64 = KTIME_MAX }; ktime_t expires, expires_next = { .tv64 = KTIME_MAX };
int i; unsigned int active = cpu_base->active_bases;
for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++, base++) { for (; active; base++, active >>= 1) {
struct timerqueue_node *next; struct timerqueue_node *next;
struct hrtimer *timer; struct hrtimer *timer;
next = timerqueue_getnext(&base->active); if (!(active & 0x01))
if (!next)
continue; continue;
next = timerqueue_getnext(&base->active);
timer = container_of(next, struct hrtimer, node); timer = container_of(next, struct hrtimer, node);
expires = ktime_sub(hrtimer_get_expires(timer), base->offset); expires = ktime_sub(hrtimer_get_expires(timer), base->offset);
if (expires.tv64 < expires_next.tv64) if (expires.tv64 < expires_next.tv64)
...@@ -1214,17 +1214,16 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base, ...@@ -1214,17 +1214,16 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now) static void __hrtimer_run_queues(struct hrtimer_cpu_base *cpu_base, ktime_t now)
{ {
int i; struct hrtimer_clock_base *base = cpu_base->clock_base;
unsigned int active = cpu_base->active_bases;
for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { for (; active; base++, active >>= 1) {
struct hrtimer_clock_base *base;
struct timerqueue_node *node; struct timerqueue_node *node;
ktime_t basenow; ktime_t basenow;
if (!(cpu_base->active_bases & (1 << i))) if (!(active & 0x01))
continue; continue;
base = cpu_base->clock_base + i;
basenow = ktime_add(now, base->offset); basenow = ktime_add(now, base->offset);
while ((node = timerqueue_getnext(&base->active))) { while ((node = timerqueue_getnext(&base->active))) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册