diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-20 13:57:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-20 13:57:40 -0400 |
commit | 1eb51c33b21ffa3fceb634d1d6bcd6488c79bc26 (patch) | |
tree | 5360e0b439b35a97313ea8250209e7dacff8b9a6 | |
parent | b0b7065b64fe517b4a50915a1555e8ee98890d64 (diff) | |
parent | 3104bf03a923c72043a9c5009d9cd56724304916 (diff) |
Merge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
sched: Fix out of scope variable access in sched_slice()
sched: Hide runqueues from direct refer at source code level
sched: Remove unneeded __ref tag
sched, x86: Fix cpufreq + sched_clock() TSC scaling
-rw-r--r-- | arch/x86/include/asm/timer.h | 6 | ||||
-rw-r--r-- | arch/x86/kernel/tsc.c | 8 | ||||
-rw-r--r-- | kernel/sched.c | 2 | ||||
-rw-r--r-- | kernel/sched_cpupri.c | 2 | ||||
-rw-r--r-- | kernel/sched_debug.c | 6 | ||||
-rw-r--r-- | kernel/sched_fair.c | 3 |
6 files changed, 18 insertions, 9 deletions
diff --git a/arch/x86/include/asm/timer.h b/arch/x86/include/asm/timer.h index bd37ed444a21..20ca9c4d4686 100644 --- a/arch/x86/include/asm/timer.h +++ b/arch/x86/include/asm/timer.h | |||
@@ -45,12 +45,16 @@ extern int no_timer_check; | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | DECLARE_PER_CPU(unsigned long, cyc2ns); | 47 | DECLARE_PER_CPU(unsigned long, cyc2ns); |
48 | DECLARE_PER_CPU(unsigned long long, cyc2ns_offset); | ||
48 | 49 | ||
49 | #define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */ | 50 | #define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */ |
50 | 51 | ||
51 | static inline unsigned long long __cycles_2_ns(unsigned long long cyc) | 52 | static inline unsigned long long __cycles_2_ns(unsigned long long cyc) |
52 | { | 53 | { |
53 | return cyc * per_cpu(cyc2ns, smp_processor_id()) >> CYC2NS_SCALE_FACTOR; | 54 | int cpu = smp_processor_id(); |
55 | unsigned long long ns = per_cpu(cyc2ns_offset, cpu); | ||
56 | ns += cyc * per_cpu(cyc2ns, cpu) >> CYC2NS_SCALE_FACTOR; | ||
57 | return ns; | ||
54 | } | 58 | } |
55 | 59 | ||
56 | static inline unsigned long long cycles_2_ns(unsigned long long cyc) | 60 | static inline unsigned long long cycles_2_ns(unsigned long long cyc) |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index b0597ad02c93..6e1a368d21d4 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -590,22 +590,26 @@ EXPORT_SYMBOL(recalibrate_cpu_khz); | |||
590 | */ | 590 | */ |
591 | 591 | ||
592 | DEFINE_PER_CPU(unsigned long, cyc2ns); | 592 | DEFINE_PER_CPU(unsigned long, cyc2ns); |
593 | DEFINE_PER_CPU(unsigned long long, cyc2ns_offset); | ||
593 | 594 | ||
594 | static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | 595 | static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) |
595 | { | 596 | { |
596 | unsigned long long tsc_now, ns_now; | 597 | unsigned long long tsc_now, ns_now, *offset; |
597 | unsigned long flags, *scale; | 598 | unsigned long flags, *scale; |
598 | 599 | ||
599 | local_irq_save(flags); | 600 | local_irq_save(flags); |
600 | sched_clock_idle_sleep_event(); | 601 | sched_clock_idle_sleep_event(); |
601 | 602 | ||
602 | scale = &per_cpu(cyc2ns, cpu); | 603 | scale = &per_cpu(cyc2ns, cpu); |
604 | offset = &per_cpu(cyc2ns_offset, cpu); | ||
603 | 605 | ||
604 | rdtscll(tsc_now); | 606 | rdtscll(tsc_now); |
605 | ns_now = __cycles_2_ns(tsc_now); | 607 | ns_now = __cycles_2_ns(tsc_now); |
606 | 608 | ||
607 | if (cpu_khz) | 609 | if (cpu_khz) { |
608 | *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz; | 610 | *scale = (NSEC_PER_MSEC << CYC2NS_SCALE_FACTOR)/cpu_khz; |
611 | *offset = ns_now - (tsc_now * *scale >> CYC2NS_SCALE_FACTOR); | ||
612 | } | ||
609 | 613 | ||
610 | sched_clock_idle_wakeup_event(0); | 614 | sched_clock_idle_wakeup_event(0); |
611 | local_irq_restore(flags); | 615 | local_irq_restore(flags); |
diff --git a/kernel/sched.c b/kernel/sched.c index 247fd0fedd0b..92e51287b980 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -7822,7 +7822,7 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd) | |||
7822 | free_rootdomain(old_rd); | 7822 | free_rootdomain(old_rd); |
7823 | } | 7823 | } |
7824 | 7824 | ||
7825 | static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem) | 7825 | static int init_rootdomain(struct root_domain *rd, bool bootmem) |
7826 | { | 7826 | { |
7827 | gfp_t gfp = GFP_KERNEL; | 7827 | gfp_t gfp = GFP_KERNEL; |
7828 | 7828 | ||
diff --git a/kernel/sched_cpupri.c b/kernel/sched_cpupri.c index 7deffc9f0e5f..e6c251790dde 100644 --- a/kernel/sched_cpupri.c +++ b/kernel/sched_cpupri.c | |||
@@ -152,7 +152,7 @@ void cpupri_set(struct cpupri *cp, int cpu, int newpri) | |||
152 | * | 152 | * |
153 | * Returns: -ENOMEM if memory fails. | 153 | * Returns: -ENOMEM if memory fails. |
154 | */ | 154 | */ |
155 | int __init_refok cpupri_init(struct cpupri *cp, bool bootmem) | 155 | int cpupri_init(struct cpupri *cp, bool bootmem) |
156 | { | 156 | { |
157 | gfp_t gfp = GFP_KERNEL; | 157 | gfp_t gfp = GFP_KERNEL; |
158 | int i; | 158 | int i; |
diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c index 467ca72f1657..70c7e0b79946 100644 --- a/kernel/sched_debug.c +++ b/kernel/sched_debug.c | |||
@@ -162,7 +162,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
162 | { | 162 | { |
163 | s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1, | 163 | s64 MIN_vruntime = -1, min_vruntime, max_vruntime = -1, |
164 | spread, rq0_min_vruntime, spread0; | 164 | spread, rq0_min_vruntime, spread0; |
165 | struct rq *rq = &per_cpu(runqueues, cpu); | 165 | struct rq *rq = cpu_rq(cpu); |
166 | struct sched_entity *last; | 166 | struct sched_entity *last; |
167 | unsigned long flags; | 167 | unsigned long flags; |
168 | 168 | ||
@@ -191,7 +191,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
191 | if (last) | 191 | if (last) |
192 | max_vruntime = last->vruntime; | 192 | max_vruntime = last->vruntime; |
193 | min_vruntime = cfs_rq->min_vruntime; | 193 | min_vruntime = cfs_rq->min_vruntime; |
194 | rq0_min_vruntime = per_cpu(runqueues, 0).cfs.min_vruntime; | 194 | rq0_min_vruntime = cpu_rq(0)->cfs.min_vruntime; |
195 | spin_unlock_irqrestore(&rq->lock, flags); | 195 | spin_unlock_irqrestore(&rq->lock, flags); |
196 | SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "MIN_vruntime", | 196 | SEQ_printf(m, " .%-30s: %Ld.%06ld\n", "MIN_vruntime", |
197 | SPLIT_NS(MIN_vruntime)); | 197 | SPLIT_NS(MIN_vruntime)); |
@@ -248,7 +248,7 @@ void print_rt_rq(struct seq_file *m, int cpu, struct rt_rq *rt_rq) | |||
248 | 248 | ||
249 | static void print_cpu(struct seq_file *m, int cpu) | 249 | static void print_cpu(struct seq_file *m, int cpu) |
250 | { | 250 | { |
251 | struct rq *rq = &per_cpu(runqueues, cpu); | 251 | struct rq *rq = cpu_rq(cpu); |
252 | 252 | ||
253 | #ifdef CONFIG_X86 | 253 | #ifdef CONFIG_X86 |
254 | { | 254 | { |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 5f9650e8fe75..ba7fd6e9556f 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -430,12 +430,13 @@ static u64 sched_slice(struct cfs_rq *cfs_rq, struct sched_entity *se) | |||
430 | 430 | ||
431 | for_each_sched_entity(se) { | 431 | for_each_sched_entity(se) { |
432 | struct load_weight *load; | 432 | struct load_weight *load; |
433 | struct load_weight lw; | ||
433 | 434 | ||
434 | cfs_rq = cfs_rq_of(se); | 435 | cfs_rq = cfs_rq_of(se); |
435 | load = &cfs_rq->load; | 436 | load = &cfs_rq->load; |
436 | 437 | ||
437 | if (unlikely(!se->on_rq)) { | 438 | if (unlikely(!se->on_rq)) { |
438 | struct load_weight lw = cfs_rq->load; | 439 | lw = cfs_rq->load; |
439 | 440 | ||
440 | update_load_add(&lw, se->load.weight); | 441 | update_load_add(&lw, se->load.weight); |
441 | load = &lw; | 442 | load = &lw; |