[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090401114641.GF22478@linux.vnet.ibm.com>
Date: Wed, 1 Apr 2009 17:16:41 +0530
From: Arun R Bharadwaj <arun@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org, linux-pm@...ts.linux-foundation.org
Cc: a.p.zijlstra@...llo.nl, ego@...ibm.com, tglx@...utronix.de,
mingo@...e.hu, andi@...stfloor.org, venkatesh.pallipadi@...el.com,
vatsa@...ux.vnet.ibm.com, arjan@...radead.org,
svaidy@...ux.vnet.ibm.com, Arun Bharadwaj <arun@...ux.vnet.ibm.com>
Subject: Re: [v4 RFC PATCH 4/4] timers: logic to move non pinned timers
* Arun R Bharadwaj <arun@...ux.vnet.ibm.com> [2009-04-01 17:07:38]:
--------snip--------------
> Index: linux.trees.git/include/linux/hrtimer.h
> ===================================================================
> --- linux.trees.git.orig/include/linux/hrtimer.h
> +++ linux.trees.git/include/linux/hrtimer.h
> @@ -22,7 +22,6 @@
> #include <linux/wait.h>
> #include <linux/percpu.h>
>
> -
> struct hrtimer_clock_base;
> struct hrtimer_cpu_base;
>
> @@ -376,6 +375,24 @@ extern ktime_t hrtimer_get_remaining(con
> extern int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp);
>
> extern ktime_t hrtimer_get_next_event(void);
> +extern ktime_t hrtimer_get_next_event_on(int cpu);
> +
> +#define TICK_PERIOD_IN_NS NSEC_PER_SEC / HZ
> +/*
> + * Helper function to check before migrating a hrtimer if it expires
> + * before the next timer interrupt on the target cpu.
> + */
> +static inline int check_hrtimer_latency(struct hrtimer *timer, int cpu)
> +{
> + unsigned long next_hrtimeout, next_jiffies;
> + next_jiffies = get_next_timer_interrupt_on(jiffies, cpu);
> + next_jiffies = next_jiffies * TICK_PERIOD_IN_NS;
> + next_hrtimeout = hrtimer_get_expires_ns(timer);
> +
> + if (next_hrtimeout > next_jiffies)
> + return 1;
> + return 0;
> +}
>
This function can be greatly simplified.
Here i am getting the next timer interrupt on target_cpu.
The target_cpu is the idle load balancer.
So we can check if the hrtimer expiry is before the next tick
on the ilb or not.
By doing this we can eliminate a lot of extra code, which would
otherwise be needed in the form of helper functions for
get_next_timer_interrupt_on().
After simplification the code would simply look like
static inline int check_hrtimer_latency(struct hrtimer *timer, int cpu)
{
unsigned long next_hrtimeout, next_jiffies;
next_jiffies = (jiffies + 1) * TICK_PERIOD_IN_NS;
next_hrtimeout = hrtimer_get_expires_ns(timer);
if(.....)
}
--arun
> /*
> * A timer is active, when it is enqueued into the rbtree or the callback
> Index: linux.trees.git/include/linux/timer.h
> ===================================================================
> --- linux.trees.git.orig/include/linux/timer.h
> +++ linux.trees.git/include/linux/timer.h
> @@ -184,7 +184,7 @@ extern unsigned long next_timer_interrup
> * jiffie.
> */
> extern unsigned long get_next_timer_interrupt(unsigned long now);
> -
> +extern unsigned long get_next_timer_interrupt_on(unsigned long now, int cpu);
> /*
> * Timer-statistics info:
> */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists