Commit deadcf58 authored by Rusty Russell's avatar Rusty Russell Committed by Anton Blanchard

[PATCH] Make runqueues a per-cpu variable

Makes scheduler use per-cpu variables for the runqueues.
parent b9cc291f
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/rcupdate.h> #include <linux/rcupdate.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <linux/percpu.h>
#ifdef CONFIG_NUMA #ifdef CONFIG_NUMA
#define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu)) #define cpu_to_node_mask(cpu) node_to_cpumask(cpu_to_node(cpu))
...@@ -170,12 +171,12 @@ struct runqueue { ...@@ -170,12 +171,12 @@ struct runqueue {
struct list_head migration_queue; struct list_head migration_queue;
atomic_t nr_iowait; 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 cpu_rq(cpu) (&per_cpu(runqueues, (cpu)))
#define this_rq() cpu_rq(smp_processor_id()) #define this_rq() (&__get_cpu_var(runqueues))
#define task_rq(p) cpu_rq(task_cpu(p)) #define task_rq(p) cpu_rq(task_cpu(p))
#define cpu_curr(cpu) (cpu_rq(cpu)->curr) #define cpu_curr(cpu) (cpu_rq(cpu)->curr)
#define rt_task(p) ((p)->prio < MAX_RT_PRIO) #define rt_task(p) ((p)->prio < MAX_RT_PRIO)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment