[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150330081826.GN23123@twins.programming.kicks-ass.net>
Date: Mon, 30 Mar 2015 10:18:26 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
linaro-kernel@...ts.linaro.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/3] timers: Allocate per-cpu tvec_base's statically
On Mon, Mar 30, 2015 at 10:47:16AM +0530, Viresh Kumar wrote:
> Hi Ingo/Thomas,
>
> Here are few cleanups around timer-core initialization. The first one is
> suggested by Peter Zijlstra [1] and the other two make few more changes in order
> to simplify it.
I did the below on top; I'll sit on these patches for a wee while in the
hope of the blackfin maintainer explaining his reasons for wrecking
____cacheline_aligned.
---
Subject: timer: Further simplify SMP and HOTPLUG logic
From: Peter Zijlstra <peterz@...radead.org>
Date: Mon Mar 30 10:09:19 CEST 2015
Remove one CONFIG_HOTPLUG_CPU #ifdef in trade for introducing one
CONFIG_SMP #ifdef.
The CONFIG_SMP ifdef avoids declaring the per-cpu __tvec_bases storage
on UP systems since they already have boot_tvec_bases.
Also (re)add a runtime check on the base alignment -- for the paranoid
amongst us :-)
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
---
kernel/time/timer.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1580,12 +1580,10 @@ static void migrate_timers(int cpu)
spin_unlock_irq(&new_base->lock);
put_cpu_var(tvec_bases);
}
-#endif /* CONFIG_HOTPLUG_CPU */
static int timer_cpu_notify(struct notifier_block *self,
unsigned long action, void *hcpu)
{
-#ifdef CONFIG_HOTPLUG_CPU
switch (action) {
case CPU_DEAD:
case CPU_DEAD_FROZEN:
@@ -1594,18 +1592,17 @@ static int timer_cpu_notify(struct notif
default:
break;
}
-#endif
+
return NOTIFY_OK;
}
-
-static struct notifier_block timers_nb = {
- .notifier_call = timer_cpu_notify,
-};
+#endif /* CONFIG_HOTPLUG_CPU */
static void __init init_timer_cpu(struct tvec_base *base, int cpu)
{
int j;
+ BUG_ON(base != tbase_get_base(base));
+
base->cpu = cpu;
per_cpu(tvec_bases, cpu) = base;
spin_lock_init(&base->lock);
@@ -1625,18 +1622,19 @@ static void __init init_timer_cpu(struct
static void __init init_timer_cpus(void)
{
- /* Used for all CPUs, except boot CPU (which uses boot_tvec_bases) */
- static DEFINE_PER_CPU(struct tvec_base, __tvec_bases);
- struct tvec_base *base;
int local_cpu = smp_processor_id();
+ struct tvec_base *base;
int cpu;
for_each_possible_cpu(cpu) {
- if (likely(cpu != local_cpu))
- base = per_cpu_ptr(&__tvec_bases, cpu);
- else
+ if (cpu == local_cpu)
base = &boot_tvec_bases;
-
+#ifdef CONFIG_SMP
+ else {
+ static DEFINE_PER_CPU(struct tvec_base, __tvec_bases);
+ base = per_cpu_ptr(&__tvec_bases, cpu);
+ }
+#endif
init_timer_cpu(base, cpu);
}
}
@@ -1648,7 +1646,7 @@ void __init init_timers(void)
init_timer_cpus();
init_timer_stats();
- register_cpu_notifier(&timers_nb);
+ cpu_notifier(timer_cpu_notify, 0);
open_softirq(TIMER_SOFTIRQ, run_timer_softirq);
}
--
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