diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-03-18 06:56:07 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-03-20 07:35:46 -0400 |
commit | 6201b4d61fbf194df6371fb3376c5026cb8f5eec (patch) | |
tree | fe26631f72f263256eecfe127346687b423b2e21 /kernel/hrtimer.c | |
parent | e2e680fb7566880f7210cadf628c092c0433971c (diff) |
timer: Remove code redundancy while calling get_nohz_timer_target()
There are only two users of get_nohz_timer_target(): timer and hrtimer. Both
call it under same circumstances, i.e.
#ifdef CONFIG_NO_HZ_COMMON
if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu))
return get_nohz_timer_target();
#endif
So, it makes more sense to get all this as part of get_nohz_timer_target()
instead of duplicating code at two places. For this another parameter is
required to be passed to this routine, pinned.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linaro-kernel@lists.linaro.org
Cc: fweisbec@gmail.com
Cc: peterz@infradead.org
Link: http://lkml.kernel.org/r/1e1b53537217d58d48c2d7a222a9c3ac47d5b64c.1395140107.git.viresh.kumar@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/hrtimer.c')
-rw-r--r-- | kernel/hrtimer.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 09094361dce5..d55092ceee29 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -168,19 +168,6 @@ struct hrtimer_clock_base *lock_hrtimer_base(const struct hrtimer *timer, | |||
168 | } | 168 | } |
169 | } | 169 | } |
170 | 170 | ||
171 | |||
172 | /* | ||
173 | * Get the preferred target CPU for NOHZ | ||
174 | */ | ||
175 | static int hrtimer_get_target(int this_cpu, int pinned) | ||
176 | { | ||
177 | #ifdef CONFIG_NO_HZ_COMMON | ||
178 | if (!pinned && get_sysctl_timer_migration() && idle_cpu(this_cpu)) | ||
179 | return get_nohz_timer_target(); | ||
180 | #endif | ||
181 | return this_cpu; | ||
182 | } | ||
183 | |||
184 | /* | 171 | /* |
185 | * With HIGHRES=y we do not migrate the timer when it is expiring | 172 | * With HIGHRES=y we do not migrate the timer when it is expiring |
186 | * before the next event on the target cpu because we cannot reprogram | 173 | * before the next event on the target cpu because we cannot reprogram |
@@ -214,7 +201,7 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, | |||
214 | struct hrtimer_clock_base *new_base; | 201 | struct hrtimer_clock_base *new_base; |
215 | struct hrtimer_cpu_base *new_cpu_base; | 202 | struct hrtimer_cpu_base *new_cpu_base; |
216 | int this_cpu = smp_processor_id(); | 203 | int this_cpu = smp_processor_id(); |
217 | int cpu = hrtimer_get_target(this_cpu, pinned); | 204 | int cpu = get_nohz_timer_target(pinned); |
218 | int basenum = base->index; | 205 | int basenum = base->index; |
219 | 206 | ||
220 | again: | 207 | again: |