[PATCH 2/3] timer: Limit the scope of __tvec_bases to init_timers_cpu()

From: Viresh Kumar
Date: Mon Mar 30 2015 - 01:17:47 EST


per-cpu variable '__tvec_bases' is used for all CPUs except the boot CPU, which
uses 'boot_tvec_bases'. Because of this special case, we shouldn't make direct
references to __tvec_bases from timer core as there are chances of using the
wrong instance for boot CPU.

To force that, lets move __tvec_bases to the only routine which can use it
directly (to set tvec_bases).

Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
kernel/time/timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 6e8220ec8a62..40918a5d3e1d 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -93,7 +93,6 @@ struct tvec_base {
struct tvec_base boot_tvec_bases;
EXPORT_SYMBOL(boot_tvec_bases);
static DEFINE_PER_CPU(struct tvec_base *, tvec_bases) = &boot_tvec_bases;
-static DEFINE_PER_CPU(struct tvec_base, __tvec_bases);

/* Functions below help us manage 'deferrable' flag */
static inline unsigned int tbase_get_deferrable(struct tvec_base *base)
@@ -1537,6 +1536,7 @@ static int init_timers_cpu(int cpu)
{
struct tvec_base *base = per_cpu(tvec_bases, cpu);
static char tvec_base_done[NR_CPUS];
+ static DEFINE_PER_CPU(struct tvec_base, __tvec_bases);
int j;

if (!tvec_base_done[cpu]) {
--
2.3.0.rc0.44.ga94655d

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/