summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kernel/sched.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index 1cf66c7f1732..bb552059577d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -33,6 +33,7 @@
#include <linux/timer.h>
#include <linux/rcupdate.h>
#include <linux/cpu.h>
+#include <linux/percpu.h>
#ifdef CONFIG_NUMA
#define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
@@ -170,12 +171,12 @@ struct runqueue {
struct list_head migration_queue;
atomic_t nr_iowait;
-} ____cacheline_aligned;
+};
-static struct runqueue runqueues[NR_CPUS] __cacheline_aligned;
+static DEFINE_PER_CPU(struct runqueue, runqueues);
-#define cpu_rq(cpu) (runqueues + (cpu))
-#define this_rq() cpu_rq(smp_processor_id())
+#define cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
+#define this_rq() (&__get_cpu_var(runqueues))
#define task_rq(p) cpu_rq(task_cpu(p))
#define cpu_curr(cpu) (cpu_rq(cpu)->curr)
#define rt_task(p) ((p)->prio < MAX_RT_PRIO)