Make runqueues a per-cpu variable
PATCH 1/1 Make runqueues a per-cpu variable
Linus, please apply.
Makes scheduler use per-cpu variables for the runqueues.
Name: Make Scheduler Use per-cpu
Author: Rusty Russell
Status: Tested on 2.5.73-bk8
D: Makes scheduler use per-cpu variables for the runqueues.
kernel/sched.c +5 -4
@@ -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)
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.