diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2009-03-23 09:50:03 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-03-23 16:20:20 -0400 |
commit | 80c5520811d3805adcb15c570ea5e2d489fa5d0b (patch) | |
tree | ae797a7f4af39f80e77526533d06ac23b439f0ab /kernel | |
parent | b3e3b302cf6dc8d60b67f0e84d1fa5648889c038 (diff) | |
parent | 8c083f081d0014057901c68a0a3e0f8ca7ac8d23 (diff) |
Merge branch 'cpus4096' into irq/threaded
Conflicts:
arch/parisc/kernel/irq.c
kernel/irq/handle.c
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/exit.c | 5 | ||||
-rw-r--r-- | kernel/fork.c | 5 | ||||
-rw-r--r-- | kernel/irq/chip.c | 5 | ||||
-rw-r--r-- | kernel/irq/handle.c | 54 | ||||
-rw-r--r-- | kernel/irq/internals.h | 7 | ||||
-rw-r--r-- | kernel/irq/manage.c | 12 | ||||
-rw-r--r-- | kernel/irq/migration.c | 12 | ||||
-rw-r--r-- | kernel/irq/numa_migrate.c | 19 | ||||
-rw-r--r-- | kernel/irq/proc.c | 4 | ||||
-rw-r--r-- | kernel/kexec.c | 2 | ||||
-rw-r--r-- | kernel/module.c | 64 | ||||
-rw-r--r-- | kernel/panic.c | 8 | ||||
-rw-r--r-- | kernel/sched.c | 56 | ||||
-rw-r--r-- | kernel/sched_rt.c | 32 | ||||
-rw-r--r-- | kernel/softirq.c | 5 | ||||
-rw-r--r-- | kernel/stop_machine.c | 2 |
16 files changed, 189 insertions, 103 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index efd30ccf3858..167e1e3ad7c6 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -980,12 +980,9 @@ static void check_stack_usage(void) | |||
980 | { | 980 | { |
981 | static DEFINE_SPINLOCK(low_water_lock); | 981 | static DEFINE_SPINLOCK(low_water_lock); |
982 | static int lowest_to_date = THREAD_SIZE; | 982 | static int lowest_to_date = THREAD_SIZE; |
983 | unsigned long *n = end_of_stack(current); | ||
984 | unsigned long free; | 983 | unsigned long free; |
985 | 984 | ||
986 | while (*n == 0) | 985 | free = stack_not_used(current); |
987 | n++; | ||
988 | free = (unsigned long)n - (unsigned long)end_of_stack(current); | ||
989 | 986 | ||
990 | if (free >= lowest_to_date) | 987 | if (free >= lowest_to_date) |
991 | return; | 988 | return; |
diff --git a/kernel/fork.c b/kernel/fork.c index 4854c2c4a82e..6715ebc3761d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <linux/proc_fs.h> | 61 | #include <linux/proc_fs.h> |
62 | #include <linux/blkdev.h> | 62 | #include <linux/blkdev.h> |
63 | #include <trace/sched.h> | 63 | #include <trace/sched.h> |
64 | #include <linux/magic.h> | ||
64 | 65 | ||
65 | #include <asm/pgtable.h> | 66 | #include <asm/pgtable.h> |
66 | #include <asm/pgalloc.h> | 67 | #include <asm/pgalloc.h> |
@@ -212,6 +213,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
212 | { | 213 | { |
213 | struct task_struct *tsk; | 214 | struct task_struct *tsk; |
214 | struct thread_info *ti; | 215 | struct thread_info *ti; |
216 | unsigned long *stackend; | ||
217 | |||
215 | int err; | 218 | int err; |
216 | 219 | ||
217 | prepare_to_copy(orig); | 220 | prepare_to_copy(orig); |
@@ -237,6 +240,8 @@ static struct task_struct *dup_task_struct(struct task_struct *orig) | |||
237 | goto out; | 240 | goto out; |
238 | 241 | ||
239 | setup_thread_stack(tsk, orig); | 242 | setup_thread_stack(tsk, orig); |
243 | stackend = end_of_stack(tsk); | ||
244 | *stackend = STACK_END_MAGIC; /* for overflow detection */ | ||
240 | 245 | ||
241 | #ifdef CONFIG_CC_STACKPROTECTOR | 246 | #ifdef CONFIG_CC_STACKPROTECTOR |
242 | tsk->stack_canary = get_random_int(); | 247 | tsk->stack_canary = get_random_int(); |
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 03d0bed2b8d9..c687ba4363f2 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -46,7 +46,10 @@ void dynamic_irq_init(unsigned int irq) | |||
46 | desc->irq_count = 0; | 46 | desc->irq_count = 0; |
47 | desc->irqs_unhandled = 0; | 47 | desc->irqs_unhandled = 0; |
48 | #ifdef CONFIG_SMP | 48 | #ifdef CONFIG_SMP |
49 | cpumask_setall(&desc->affinity); | 49 | cpumask_setall(desc->affinity); |
50 | #ifdef CONFIG_GENERIC_PENDING_IRQ | ||
51 | cpumask_clear(desc->pending_mask); | ||
52 | #endif | ||
50 | #endif | 53 | #endif |
51 | spin_unlock_irqrestore(&desc->lock, flags); | 54 | spin_unlock_irqrestore(&desc->lock, flags); |
52 | } | 55 | } |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index f6cdda68e5c6..9ebf77968871 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/kernel_stat.h> | 17 | #include <linux/kernel_stat.h> |
18 | #include <linux/rculist.h> | 18 | #include <linux/rculist.h> |
19 | #include <linux/hash.h> | 19 | #include <linux/hash.h> |
20 | #include <linux/bootmem.h> | ||
20 | 21 | ||
21 | #include "internals.h" | 22 | #include "internals.h" |
22 | 23 | ||
@@ -69,6 +70,7 @@ int nr_irqs = NR_IRQS; | |||
69 | EXPORT_SYMBOL_GPL(nr_irqs); | 70 | EXPORT_SYMBOL_GPL(nr_irqs); |
70 | 71 | ||
71 | #ifdef CONFIG_SPARSE_IRQ | 72 | #ifdef CONFIG_SPARSE_IRQ |
73 | |||
72 | static struct irq_desc irq_desc_init = { | 74 | static struct irq_desc irq_desc_init = { |
73 | .irq = -1, | 75 | .irq = -1, |
74 | .status = IRQ_DISABLED, | 76 | .status = IRQ_DISABLED, |
@@ -76,9 +78,6 @@ static struct irq_desc irq_desc_init = { | |||
76 | .handle_irq = handle_bad_irq, | 78 | .handle_irq = handle_bad_irq, |
77 | .depth = 1, | 79 | .depth = 1, |
78 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | 80 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), |
79 | #ifdef CONFIG_SMP | ||
80 | .affinity = CPU_MASK_ALL | ||
81 | #endif | ||
82 | }; | 81 | }; |
83 | 82 | ||
84 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) | 83 | void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr) |
@@ -115,6 +114,10 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | |||
115 | printk(KERN_ERR "can not alloc kstat_irqs\n"); | 114 | printk(KERN_ERR "can not alloc kstat_irqs\n"); |
116 | BUG_ON(1); | 115 | BUG_ON(1); |
117 | } | 116 | } |
117 | if (!init_alloc_desc_masks(desc, cpu, false)) { | ||
118 | printk(KERN_ERR "can not alloc irq_desc cpumasks\n"); | ||
119 | BUG_ON(1); | ||
120 | } | ||
118 | arch_init_chip_data(desc, cpu); | 121 | arch_init_chip_data(desc, cpu); |
119 | } | 122 | } |
120 | 123 | ||
@@ -123,7 +126,7 @@ static void init_one_irq_desc(int irq, struct irq_desc *desc, int cpu) | |||
123 | */ | 126 | */ |
124 | DEFINE_SPINLOCK(sparse_irq_lock); | 127 | DEFINE_SPINLOCK(sparse_irq_lock); |
125 | 128 | ||
126 | struct irq_desc *irq_desc_ptrs[NR_IRQS] __read_mostly; | 129 | struct irq_desc **irq_desc_ptrs __read_mostly; |
127 | 130 | ||
128 | static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = { | 131 | static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_smp = { |
129 | [0 ... NR_IRQS_LEGACY-1] = { | 132 | [0 ... NR_IRQS_LEGACY-1] = { |
@@ -133,14 +136,10 @@ static struct irq_desc irq_desc_legacy[NR_IRQS_LEGACY] __cacheline_aligned_in_sm | |||
133 | .handle_irq = handle_bad_irq, | 136 | .handle_irq = handle_bad_irq, |
134 | .depth = 1, | 137 | .depth = 1, |
135 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), | 138 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc_init.lock), |
136 | #ifdef CONFIG_SMP | ||
137 | .affinity = CPU_MASK_ALL | ||
138 | #endif | ||
139 | } | 139 | } |
140 | }; | 140 | }; |
141 | 141 | ||
142 | /* FIXME: use bootmem alloc ...*/ | 142 | static unsigned int *kstat_irqs_legacy; |
143 | static unsigned int kstat_irqs_legacy[NR_IRQS_LEGACY][NR_CPUS]; | ||
144 | 143 | ||
145 | int __init early_irq_init(void) | 144 | int __init early_irq_init(void) |
146 | { | 145 | { |
@@ -150,18 +149,30 @@ int __init early_irq_init(void) | |||
150 | 149 | ||
151 | init_irq_default_affinity(); | 150 | init_irq_default_affinity(); |
152 | 151 | ||
152 | /* initialize nr_irqs based on nr_cpu_ids */ | ||
153 | arch_probe_nr_irqs(); | ||
154 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs); | ||
155 | |||
153 | desc = irq_desc_legacy; | 156 | desc = irq_desc_legacy; |
154 | legacy_count = ARRAY_SIZE(irq_desc_legacy); | 157 | legacy_count = ARRAY_SIZE(irq_desc_legacy); |
155 | 158 | ||
159 | /* allocate irq_desc_ptrs array based on nr_irqs */ | ||
160 | irq_desc_ptrs = alloc_bootmem(nr_irqs * sizeof(void *)); | ||
161 | |||
162 | /* allocate based on nr_cpu_ids */ | ||
163 | /* FIXME: invert kstat_irgs, and it'd be a per_cpu_alloc'd thing */ | ||
164 | kstat_irqs_legacy = alloc_bootmem(NR_IRQS_LEGACY * nr_cpu_ids * | ||
165 | sizeof(int)); | ||
166 | |||
156 | for (i = 0; i < legacy_count; i++) { | 167 | for (i = 0; i < legacy_count; i++) { |
157 | desc[i].irq = i; | 168 | desc[i].irq = i; |
158 | desc[i].kstat_irqs = kstat_irqs_legacy[i]; | 169 | desc[i].kstat_irqs = kstat_irqs_legacy + i * nr_cpu_ids; |
159 | lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); | 170 | lockdep_set_class(&desc[i].lock, &irq_desc_lock_class); |
160 | 171 | init_alloc_desc_masks(&desc[i], 0, true); | |
161 | irq_desc_ptrs[i] = desc + i; | 172 | irq_desc_ptrs[i] = desc + i; |
162 | } | 173 | } |
163 | 174 | ||
164 | for (i = legacy_count; i < NR_IRQS; i++) | 175 | for (i = legacy_count; i < nr_irqs; i++) |
165 | irq_desc_ptrs[i] = NULL; | 176 | irq_desc_ptrs[i] = NULL; |
166 | 177 | ||
167 | return arch_early_irq_init(); | 178 | return arch_early_irq_init(); |
@@ -169,7 +180,10 @@ int __init early_irq_init(void) | |||
169 | 180 | ||
170 | struct irq_desc *irq_to_desc(unsigned int irq) | 181 | struct irq_desc *irq_to_desc(unsigned int irq) |
171 | { | 182 | { |
172 | return (irq < NR_IRQS) ? irq_desc_ptrs[irq] : NULL; | 183 | if (irq_desc_ptrs && irq < nr_irqs) |
184 | return irq_desc_ptrs[irq]; | ||
185 | |||
186 | return NULL; | ||
173 | } | 187 | } |
174 | 188 | ||
175 | struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | 189 | struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) |
@@ -178,10 +192,9 @@ struct irq_desc *irq_to_desc_alloc_cpu(unsigned int irq, int cpu) | |||
178 | unsigned long flags; | 192 | unsigned long flags; |
179 | int node; | 193 | int node; |
180 | 194 | ||
181 | if (irq >= NR_IRQS) { | 195 | if (irq >= nr_irqs) { |
182 | printk(KERN_WARNING "irq >= NR_IRQS in irq_to_desc_alloc: %d %d\n", | 196 | WARN(1, "irq (%d) >= nr_irqs (%d) in irq_to_desc_alloc\n", |
183 | irq, NR_IRQS); | 197 | irq, nr_irqs); |
184 | WARN_ON(1); | ||
185 | return NULL; | 198 | return NULL; |
186 | } | 199 | } |
187 | 200 | ||
@@ -223,9 +236,6 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
223 | .handle_irq = handle_bad_irq, | 236 | .handle_irq = handle_bad_irq, |
224 | .depth = 1, | 237 | .depth = 1, |
225 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock), | 238 | .lock = __SPIN_LOCK_UNLOCKED(irq_desc->lock), |
226 | #ifdef CONFIG_SMP | ||
227 | .affinity = CPU_MASK_ALL | ||
228 | #endif | ||
229 | } | 239 | } |
230 | }; | 240 | }; |
231 | 241 | ||
@@ -238,14 +248,16 @@ int __init early_irq_init(void) | |||
238 | 248 | ||
239 | init_irq_default_affinity(); | 249 | init_irq_default_affinity(); |
240 | 250 | ||
251 | printk(KERN_INFO "NR_IRQS:%d\n", NR_IRQS); | ||
252 | |||
241 | desc = irq_desc; | 253 | desc = irq_desc; |
242 | count = ARRAY_SIZE(irq_desc); | 254 | count = ARRAY_SIZE(irq_desc); |
243 | 255 | ||
244 | for (i = 0; i < count; i++) { | 256 | for (i = 0; i < count; i++) { |
245 | desc[i].irq = i; | 257 | desc[i].irq = i; |
258 | init_alloc_desc_masks(&desc[i], 0, true); | ||
246 | desc[i].kstat_irqs = kstat_irqs_all[i]; | 259 | desc[i].kstat_irqs = kstat_irqs_all[i]; |
247 | } | 260 | } |
248 | |||
249 | return arch_early_irq_init(); | 261 | return arch_early_irq_init(); |
250 | } | 262 | } |
251 | 263 | ||
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index b60950bf5a16..ee1aa9f8e8b9 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -17,7 +17,14 @@ extern struct lock_class_key irq_desc_lock_class; | |||
17 | extern void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr); | 17 | extern void init_kstat_irqs(struct irq_desc *desc, int cpu, int nr); |
18 | extern void clear_kstat_irqs(struct irq_desc *desc); | 18 | extern void clear_kstat_irqs(struct irq_desc *desc); |
19 | extern spinlock_t sparse_irq_lock; | 19 | extern spinlock_t sparse_irq_lock; |
20 | |||
21 | #ifdef CONFIG_SPARSE_IRQ | ||
22 | /* irq_desc_ptrs allocated at boot time */ | ||
23 | extern struct irq_desc **irq_desc_ptrs; | ||
24 | #else | ||
25 | /* irq_desc_ptrs is a fixed size array */ | ||
20 | extern struct irq_desc *irq_desc_ptrs[NR_IRQS]; | 26 | extern struct irq_desc *irq_desc_ptrs[NR_IRQS]; |
27 | #endif | ||
21 | 28 | ||
22 | #ifdef CONFIG_PROC_FS | 29 | #ifdef CONFIG_PROC_FS |
23 | extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); | 30 | extern void register_irq_proc(unsigned int irq, struct irq_desc *desc); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index ea119effe096..6458e99984c0 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -90,14 +90,14 @@ int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask) | |||
90 | 90 | ||
91 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 91 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
92 | if (desc->status & IRQ_MOVE_PCNTXT || desc->status & IRQ_DISABLED) { | 92 | if (desc->status & IRQ_MOVE_PCNTXT || desc->status & IRQ_DISABLED) { |
93 | cpumask_copy(&desc->affinity, cpumask); | 93 | cpumask_copy(desc->affinity, cpumask); |
94 | desc->chip->set_affinity(irq, cpumask); | 94 | desc->chip->set_affinity(irq, cpumask); |
95 | } else { | 95 | } else { |
96 | desc->status |= IRQ_MOVE_PENDING; | 96 | desc->status |= IRQ_MOVE_PENDING; |
97 | cpumask_copy(&desc->pending_mask, cpumask); | 97 | cpumask_copy(desc->pending_mask, cpumask); |
98 | } | 98 | } |
99 | #else | 99 | #else |
100 | cpumask_copy(&desc->affinity, cpumask); | 100 | cpumask_copy(desc->affinity, cpumask); |
101 | desc->chip->set_affinity(irq, cpumask); | 101 | desc->chip->set_affinity(irq, cpumask); |
102 | #endif | 102 | #endif |
103 | desc->status |= IRQ_AFFINITY_SET; | 103 | desc->status |= IRQ_AFFINITY_SET; |
@@ -119,16 +119,16 @@ static int setup_affinity(unsigned int irq, struct irq_desc *desc) | |||
119 | * one of the targets is online. | 119 | * one of the targets is online. |
120 | */ | 120 | */ |
121 | if (desc->status & (IRQ_AFFINITY_SET | IRQ_NO_BALANCING)) { | 121 | if (desc->status & (IRQ_AFFINITY_SET | IRQ_NO_BALANCING)) { |
122 | if (cpumask_any_and(&desc->affinity, cpu_online_mask) | 122 | if (cpumask_any_and(desc->affinity, cpu_online_mask) |
123 | < nr_cpu_ids) | 123 | < nr_cpu_ids) |
124 | goto set_affinity; | 124 | goto set_affinity; |
125 | else | 125 | else |
126 | desc->status &= ~IRQ_AFFINITY_SET; | 126 | desc->status &= ~IRQ_AFFINITY_SET; |
127 | } | 127 | } |
128 | 128 | ||
129 | cpumask_and(&desc->affinity, cpu_online_mask, irq_default_affinity); | 129 | cpumask_and(desc->affinity, cpu_online_mask, irq_default_affinity); |
130 | set_affinity: | 130 | set_affinity: |
131 | desc->chip->set_affinity(irq, &desc->affinity); | 131 | desc->chip->set_affinity(irq, desc->affinity); |
132 | 132 | ||
133 | return 0; | 133 | return 0; |
134 | } | 134 | } |
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c index bd72329e630c..e05ad9be43b7 100644 --- a/kernel/irq/migration.c +++ b/kernel/irq/migration.c | |||
@@ -18,7 +18,7 @@ void move_masked_irq(int irq) | |||
18 | 18 | ||
19 | desc->status &= ~IRQ_MOVE_PENDING; | 19 | desc->status &= ~IRQ_MOVE_PENDING; |
20 | 20 | ||
21 | if (unlikely(cpumask_empty(&desc->pending_mask))) | 21 | if (unlikely(cpumask_empty(desc->pending_mask))) |
22 | return; | 22 | return; |
23 | 23 | ||
24 | if (!desc->chip->set_affinity) | 24 | if (!desc->chip->set_affinity) |
@@ -38,13 +38,13 @@ void move_masked_irq(int irq) | |||
38 | * For correct operation this depends on the caller | 38 | * For correct operation this depends on the caller |
39 | * masking the irqs. | 39 | * masking the irqs. |
40 | */ | 40 | */ |
41 | if (likely(cpumask_any_and(&desc->pending_mask, cpu_online_mask) | 41 | if (likely(cpumask_any_and(desc->pending_mask, cpu_online_mask) |
42 | < nr_cpu_ids)) { | 42 | < nr_cpu_ids)) { |
43 | cpumask_and(&desc->affinity, | 43 | cpumask_and(desc->affinity, |
44 | &desc->pending_mask, cpu_online_mask); | 44 | desc->pending_mask, cpu_online_mask); |
45 | desc->chip->set_affinity(irq, &desc->affinity); | 45 | desc->chip->set_affinity(irq, desc->affinity); |
46 | } | 46 | } |
47 | cpumask_clear(&desc->pending_mask); | 47 | cpumask_clear(desc->pending_mask); |
48 | } | 48 | } |
49 | 49 | ||
50 | void move_native_irq(int irq) | 50 | void move_native_irq(int irq) |
diff --git a/kernel/irq/numa_migrate.c b/kernel/irq/numa_migrate.c index aef18ab6b75b..243d6121e50e 100644 --- a/kernel/irq/numa_migrate.c +++ b/kernel/irq/numa_migrate.c | |||
@@ -33,15 +33,22 @@ static void free_kstat_irqs(struct irq_desc *old_desc, struct irq_desc *desc) | |||
33 | old_desc->kstat_irqs = NULL; | 33 | old_desc->kstat_irqs = NULL; |
34 | } | 34 | } |
35 | 35 | ||
36 | static void init_copy_one_irq_desc(int irq, struct irq_desc *old_desc, | 36 | static bool init_copy_one_irq_desc(int irq, struct irq_desc *old_desc, |
37 | struct irq_desc *desc, int cpu) | 37 | struct irq_desc *desc, int cpu) |
38 | { | 38 | { |
39 | memcpy(desc, old_desc, sizeof(struct irq_desc)); | 39 | memcpy(desc, old_desc, sizeof(struct irq_desc)); |
40 | if (!init_alloc_desc_masks(desc, cpu, false)) { | ||
41 | printk(KERN_ERR "irq %d: can not get new irq_desc cpumask " | ||
42 | "for migration.\n", irq); | ||
43 | return false; | ||
44 | } | ||
40 | spin_lock_init(&desc->lock); | 45 | spin_lock_init(&desc->lock); |
41 | desc->cpu = cpu; | 46 | desc->cpu = cpu; |
42 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); | 47 | lockdep_set_class(&desc->lock, &irq_desc_lock_class); |
43 | init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids); | 48 | init_copy_kstat_irqs(old_desc, desc, cpu, nr_cpu_ids); |
49 | init_copy_desc_masks(old_desc, desc); | ||
44 | arch_init_copy_chip_data(old_desc, desc, cpu); | 50 | arch_init_copy_chip_data(old_desc, desc, cpu); |
51 | return true; | ||
45 | } | 52 | } |
46 | 53 | ||
47 | static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc) | 54 | static void free_one_irq_desc(struct irq_desc *old_desc, struct irq_desc *desc) |
@@ -71,12 +78,18 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc, | |||
71 | node = cpu_to_node(cpu); | 78 | node = cpu_to_node(cpu); |
72 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); | 79 | desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node); |
73 | if (!desc) { | 80 | if (!desc) { |
74 | printk(KERN_ERR "irq %d: can not get new irq_desc for migration.\n", irq); | 81 | printk(KERN_ERR "irq %d: can not get new irq_desc " |
82 | "for migration.\n", irq); | ||
83 | /* still use old one */ | ||
84 | desc = old_desc; | ||
85 | goto out_unlock; | ||
86 | } | ||
87 | if (!init_copy_one_irq_desc(irq, old_desc, desc, cpu)) { | ||
75 | /* still use old one */ | 88 | /* still use old one */ |
89 | kfree(desc); | ||
76 | desc = old_desc; | 90 | desc = old_desc; |
77 | goto out_unlock; | 91 | goto out_unlock; |
78 | } | 92 | } |
79 | init_copy_one_irq_desc(irq, old_desc, desc, cpu); | ||
80 | 93 | ||
81 | irq_desc_ptrs[irq] = desc; | 94 | irq_desc_ptrs[irq] = desc; |
82 | spin_unlock_irqrestore(&sparse_irq_lock, flags); | 95 | spin_unlock_irqrestore(&sparse_irq_lock, flags); |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index aae3f742bcec..692363dd591f 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -20,11 +20,11 @@ static struct proc_dir_entry *root_irq_dir; | |||
20 | static int irq_affinity_proc_show(struct seq_file *m, void *v) | 20 | static int irq_affinity_proc_show(struct seq_file *m, void *v) |
21 | { | 21 | { |
22 | struct irq_desc *desc = irq_to_desc((long)m->private); | 22 | struct irq_desc *desc = irq_to_desc((long)m->private); |
23 | const struct cpumask *mask = &desc->affinity; | 23 | const struct cpumask *mask = desc->affinity; |
24 | 24 | ||
25 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 25 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
26 | if (desc->status & IRQ_MOVE_PENDING) | 26 | if (desc->status & IRQ_MOVE_PENDING) |
27 | mask = &desc->pending_mask; | 27 | mask = desc->pending_mask; |
28 | #endif | 28 | #endif |
29 | seq_cpumask(m, mask); | 29 | seq_cpumask(m, mask); |
30 | seq_putc(m, '\n'); | 30 | seq_putc(m, '\n'); |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 483899578259..c7fd6692939d 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -1130,7 +1130,7 @@ void crash_save_cpu(struct pt_regs *regs, int cpu) | |||
1130 | return; | 1130 | return; |
1131 | memset(&prstatus, 0, sizeof(prstatus)); | 1131 | memset(&prstatus, 0, sizeof(prstatus)); |
1132 | prstatus.pr_pid = current->pid; | 1132 | prstatus.pr_pid = current->pid; |
1133 | elf_core_copy_regs(&prstatus.pr_reg, regs); | 1133 | elf_core_copy_kernel_regs(&prstatus.pr_reg, regs); |
1134 | buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS, | 1134 | buf = append_elf_note(buf, KEXEC_CORE_NOTE_NAME, NT_PRSTATUS, |
1135 | &prstatus, sizeof(prstatus)); | 1135 | &prstatus, sizeof(prstatus)); |
1136 | final_note(buf); | 1136 | final_note(buf); |
diff --git a/kernel/module.c b/kernel/module.c index 1196f5d11700..29f2d7b33dd4 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -51,6 +51,7 @@ | |||
51 | #include <linux/tracepoint.h> | 51 | #include <linux/tracepoint.h> |
52 | #include <linux/ftrace.h> | 52 | #include <linux/ftrace.h> |
53 | #include <linux/async.h> | 53 | #include <linux/async.h> |
54 | #include <linux/percpu.h> | ||
54 | 55 | ||
55 | #if 0 | 56 | #if 0 |
56 | #define DEBUGP printk | 57 | #define DEBUGP printk |
@@ -366,6 +367,34 @@ static struct module *find_module(const char *name) | |||
366 | } | 367 | } |
367 | 368 | ||
368 | #ifdef CONFIG_SMP | 369 | #ifdef CONFIG_SMP |
370 | |||
371 | #ifdef CONFIG_HAVE_DYNAMIC_PER_CPU_AREA | ||
372 | |||
373 | static void *percpu_modalloc(unsigned long size, unsigned long align, | ||
374 | const char *name) | ||
375 | { | ||
376 | void *ptr; | ||
377 | |||
378 | if (align > PAGE_SIZE) { | ||
379 | printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n", | ||
380 | name, align, PAGE_SIZE); | ||
381 | align = PAGE_SIZE; | ||
382 | } | ||
383 | |||
384 | ptr = __alloc_reserved_percpu(size, align); | ||
385 | if (!ptr) | ||
386 | printk(KERN_WARNING | ||
387 | "Could not allocate %lu bytes percpu data\n", size); | ||
388 | return ptr; | ||
389 | } | ||
390 | |||
391 | static void percpu_modfree(void *freeme) | ||
392 | { | ||
393 | free_percpu(freeme); | ||
394 | } | ||
395 | |||
396 | #else /* ... !CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | ||
397 | |||
369 | /* Number of blocks used and allocated. */ | 398 | /* Number of blocks used and allocated. */ |
370 | static unsigned int pcpu_num_used, pcpu_num_allocated; | 399 | static unsigned int pcpu_num_used, pcpu_num_allocated; |
371 | /* Size of each block. -ve means used. */ | 400 | /* Size of each block. -ve means used. */ |
@@ -480,21 +509,6 @@ static void percpu_modfree(void *freeme) | |||
480 | } | 509 | } |
481 | } | 510 | } |
482 | 511 | ||
483 | static unsigned int find_pcpusec(Elf_Ehdr *hdr, | ||
484 | Elf_Shdr *sechdrs, | ||
485 | const char *secstrings) | ||
486 | { | ||
487 | return find_sec(hdr, sechdrs, secstrings, ".data.percpu"); | ||
488 | } | ||
489 | |||
490 | static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) | ||
491 | { | ||
492 | int cpu; | ||
493 | |||
494 | for_each_possible_cpu(cpu) | ||
495 | memcpy(pcpudest + per_cpu_offset(cpu), from, size); | ||
496 | } | ||
497 | |||
498 | static int percpu_modinit(void) | 512 | static int percpu_modinit(void) |
499 | { | 513 | { |
500 | pcpu_num_used = 2; | 514 | pcpu_num_used = 2; |
@@ -513,7 +527,26 @@ static int percpu_modinit(void) | |||
513 | return 0; | 527 | return 0; |
514 | } | 528 | } |
515 | __initcall(percpu_modinit); | 529 | __initcall(percpu_modinit); |
530 | |||
531 | #endif /* CONFIG_HAVE_DYNAMIC_PER_CPU_AREA */ | ||
532 | |||
533 | static unsigned int find_pcpusec(Elf_Ehdr *hdr, | ||
534 | Elf_Shdr *sechdrs, | ||
535 | const char *secstrings) | ||
536 | { | ||
537 | return find_sec(hdr, sechdrs, secstrings, ".data.percpu"); | ||
538 | } | ||
539 | |||
540 | static void percpu_modcopy(void *pcpudest, const void *from, unsigned long size) | ||
541 | { | ||
542 | int cpu; | ||
543 | |||
544 | for_each_possible_cpu(cpu) | ||
545 | memcpy(pcpudest + per_cpu_offset(cpu), from, size); | ||
546 | } | ||
547 | |||
516 | #else /* ... !CONFIG_SMP */ | 548 | #else /* ... !CONFIG_SMP */ |
549 | |||
517 | static inline void *percpu_modalloc(unsigned long size, unsigned long align, | 550 | static inline void *percpu_modalloc(unsigned long size, unsigned long align, |
518 | const char *name) | 551 | const char *name) |
519 | { | 552 | { |
@@ -535,6 +568,7 @@ static inline void percpu_modcopy(void *pcpudst, const void *src, | |||
535 | /* pcpusec should be 0, and size of that section should be 0. */ | 568 | /* pcpusec should be 0, and size of that section should be 0. */ |
536 | BUG_ON(size != 0); | 569 | BUG_ON(size != 0); |
537 | } | 570 | } |
571 | |||
538 | #endif /* CONFIG_SMP */ | 572 | #endif /* CONFIG_SMP */ |
539 | 573 | ||
540 | #define MODINFO_ATTR(field) \ | 574 | #define MODINFO_ATTR(field) \ |
diff --git a/kernel/panic.c b/kernel/panic.c index 2a2ff36ff44d..32fe4eff1b89 100644 --- a/kernel/panic.c +++ b/kernel/panic.c | |||
@@ -74,6 +74,9 @@ NORET_TYPE void panic(const char * fmt, ...) | |||
74 | vsnprintf(buf, sizeof(buf), fmt, args); | 74 | vsnprintf(buf, sizeof(buf), fmt, args); |
75 | va_end(args); | 75 | va_end(args); |
76 | printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); | 76 | printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); |
77 | #ifdef CONFIG_DEBUG_BUGVERBOSE | ||
78 | dump_stack(); | ||
79 | #endif | ||
77 | bust_spinlocks(0); | 80 | bust_spinlocks(0); |
78 | 81 | ||
79 | /* | 82 | /* |
@@ -355,15 +358,18 @@ EXPORT_SYMBOL(warn_slowpath); | |||
355 | #endif | 358 | #endif |
356 | 359 | ||
357 | #ifdef CONFIG_CC_STACKPROTECTOR | 360 | #ifdef CONFIG_CC_STACKPROTECTOR |
361 | |||
358 | /* | 362 | /* |
359 | * Called when gcc's -fstack-protector feature is used, and | 363 | * Called when gcc's -fstack-protector feature is used, and |
360 | * gcc detects corruption of the on-stack canary value | 364 | * gcc detects corruption of the on-stack canary value |
361 | */ | 365 | */ |
362 | void __stack_chk_fail(void) | 366 | void __stack_chk_fail(void) |
363 | { | 367 | { |
364 | panic("stack-protector: Kernel stack is corrupted"); | 368 | panic("stack-protector: Kernel stack is corrupted in: %p\n", |
369 | __builtin_return_address(0)); | ||
365 | } | 370 | } |
366 | EXPORT_SYMBOL(__stack_chk_fail); | 371 | EXPORT_SYMBOL(__stack_chk_fail); |
372 | |||
367 | #endif | 373 | #endif |
368 | 374 | ||
369 | core_param(panic, panic_timeout, int, 0644); | 375 | core_param(panic, panic_timeout, int, 0644); |
diff --git a/kernel/sched.c b/kernel/sched.c index 8e2558c2ba67..11dd52780adb 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3448,19 +3448,23 @@ find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle, | |||
3448 | */ | 3448 | */ |
3449 | #define MAX_PINNED_INTERVAL 512 | 3449 | #define MAX_PINNED_INTERVAL 512 |
3450 | 3450 | ||
3451 | /* Working cpumask for load_balance and load_balance_newidle. */ | ||
3452 | static DEFINE_PER_CPU(cpumask_var_t, load_balance_tmpmask); | ||
3453 | |||
3451 | /* | 3454 | /* |
3452 | * Check this_cpu to ensure it is balanced within domain. Attempt to move | 3455 | * Check this_cpu to ensure it is balanced within domain. Attempt to move |
3453 | * tasks if there is an imbalance. | 3456 | * tasks if there is an imbalance. |
3454 | */ | 3457 | */ |
3455 | static int load_balance(int this_cpu, struct rq *this_rq, | 3458 | static int load_balance(int this_cpu, struct rq *this_rq, |
3456 | struct sched_domain *sd, enum cpu_idle_type idle, | 3459 | struct sched_domain *sd, enum cpu_idle_type idle, |
3457 | int *balance, struct cpumask *cpus) | 3460 | int *balance) |
3458 | { | 3461 | { |
3459 | int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0; | 3462 | int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0; |
3460 | struct sched_group *group; | 3463 | struct sched_group *group; |
3461 | unsigned long imbalance; | 3464 | unsigned long imbalance; |
3462 | struct rq *busiest; | 3465 | struct rq *busiest; |
3463 | unsigned long flags; | 3466 | unsigned long flags; |
3467 | struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask); | ||
3464 | 3468 | ||
3465 | cpumask_setall(cpus); | 3469 | cpumask_setall(cpus); |
3466 | 3470 | ||
@@ -3615,8 +3619,7 @@ out: | |||
3615 | * this_rq is locked. | 3619 | * this_rq is locked. |
3616 | */ | 3620 | */ |
3617 | static int | 3621 | static int |
3618 | load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd, | 3622 | load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd) |
3619 | struct cpumask *cpus) | ||
3620 | { | 3623 | { |
3621 | struct sched_group *group; | 3624 | struct sched_group *group; |
3622 | struct rq *busiest = NULL; | 3625 | struct rq *busiest = NULL; |
@@ -3624,6 +3627,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd, | |||
3624 | int ld_moved = 0; | 3627 | int ld_moved = 0; |
3625 | int sd_idle = 0; | 3628 | int sd_idle = 0; |
3626 | int all_pinned = 0; | 3629 | int all_pinned = 0; |
3630 | struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask); | ||
3627 | 3631 | ||
3628 | cpumask_setall(cpus); | 3632 | cpumask_setall(cpus); |
3629 | 3633 | ||
@@ -3764,10 +3768,6 @@ static void idle_balance(int this_cpu, struct rq *this_rq) | |||
3764 | struct sched_domain *sd; | 3768 | struct sched_domain *sd; |
3765 | int pulled_task = 0; | 3769 | int pulled_task = 0; |
3766 | unsigned long next_balance = jiffies + HZ; | 3770 | unsigned long next_balance = jiffies + HZ; |
3767 | cpumask_var_t tmpmask; | ||
3768 | |||
3769 | if (!alloc_cpumask_var(&tmpmask, GFP_ATOMIC)) | ||
3770 | return; | ||
3771 | 3771 | ||
3772 | for_each_domain(this_cpu, sd) { | 3772 | for_each_domain(this_cpu, sd) { |
3773 | unsigned long interval; | 3773 | unsigned long interval; |
@@ -3778,7 +3778,7 @@ static void idle_balance(int this_cpu, struct rq *this_rq) | |||
3778 | if (sd->flags & SD_BALANCE_NEWIDLE) | 3778 | if (sd->flags & SD_BALANCE_NEWIDLE) |
3779 | /* If we've pulled tasks over stop searching: */ | 3779 | /* If we've pulled tasks over stop searching: */ |
3780 | pulled_task = load_balance_newidle(this_cpu, this_rq, | 3780 | pulled_task = load_balance_newidle(this_cpu, this_rq, |
3781 | sd, tmpmask); | 3781 | sd); |
3782 | 3782 | ||
3783 | interval = msecs_to_jiffies(sd->balance_interval); | 3783 | interval = msecs_to_jiffies(sd->balance_interval); |
3784 | if (time_after(next_balance, sd->last_balance + interval)) | 3784 | if (time_after(next_balance, sd->last_balance + interval)) |
@@ -3793,7 +3793,6 @@ static void idle_balance(int this_cpu, struct rq *this_rq) | |||
3793 | */ | 3793 | */ |
3794 | this_rq->next_balance = next_balance; | 3794 | this_rq->next_balance = next_balance; |
3795 | } | 3795 | } |
3796 | free_cpumask_var(tmpmask); | ||
3797 | } | 3796 | } |
3798 | 3797 | ||
3799 | /* | 3798 | /* |
@@ -3943,11 +3942,6 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle) | |||
3943 | unsigned long next_balance = jiffies + 60*HZ; | 3942 | unsigned long next_balance = jiffies + 60*HZ; |
3944 | int update_next_balance = 0; | 3943 | int update_next_balance = 0; |
3945 | int need_serialize; | 3944 | int need_serialize; |
3946 | cpumask_var_t tmp; | ||
3947 | |||
3948 | /* Fails alloc? Rebalancing probably not a priority right now. */ | ||
3949 | if (!alloc_cpumask_var(&tmp, GFP_ATOMIC)) | ||
3950 | return; | ||
3951 | 3945 | ||
3952 | for_each_domain(cpu, sd) { | 3946 | for_each_domain(cpu, sd) { |
3953 | if (!(sd->flags & SD_LOAD_BALANCE)) | 3947 | if (!(sd->flags & SD_LOAD_BALANCE)) |
@@ -3972,7 +3966,7 @@ static void rebalance_domains(int cpu, enum cpu_idle_type idle) | |||
3972 | } | 3966 | } |
3973 | 3967 | ||
3974 | if (time_after_eq(jiffies, sd->last_balance + interval)) { | 3968 | if (time_after_eq(jiffies, sd->last_balance + interval)) { |
3975 | if (load_balance(cpu, rq, sd, idle, &balance, tmp)) { | 3969 | if (load_balance(cpu, rq, sd, idle, &balance)) { |
3976 | /* | 3970 | /* |
3977 | * We've pulled tasks over so either we're no | 3971 | * We've pulled tasks over so either we're no |
3978 | * longer idle, or one of our SMT siblings is | 3972 | * longer idle, or one of our SMT siblings is |
@@ -4006,8 +4000,6 @@ out: | |||
4006 | */ | 4000 | */ |
4007 | if (likely(update_next_balance)) | 4001 | if (likely(update_next_balance)) |
4008 | rq->next_balance = next_balance; | 4002 | rq->next_balance = next_balance; |
4009 | |||
4010 | free_cpumask_var(tmp); | ||
4011 | } | 4003 | } |
4012 | 4004 | ||
4013 | /* | 4005 | /* |
@@ -5944,12 +5936,7 @@ void sched_show_task(struct task_struct *p) | |||
5944 | printk(KERN_CONT " %016lx ", thread_saved_pc(p)); | 5936 | printk(KERN_CONT " %016lx ", thread_saved_pc(p)); |
5945 | #endif | 5937 | #endif |
5946 | #ifdef CONFIG_DEBUG_STACK_USAGE | 5938 | #ifdef CONFIG_DEBUG_STACK_USAGE |
5947 | { | 5939 | free = stack_not_used(p); |
5948 | unsigned long *n = end_of_stack(p); | ||
5949 | while (!*n) | ||
5950 | n++; | ||
5951 | free = (unsigned long)n - (unsigned long)end_of_stack(p); | ||
5952 | } | ||
5953 | #endif | 5940 | #endif |
5954 | printk(KERN_CONT "%5lu %5d %6d\n", free, | 5941 | printk(KERN_CONT "%5lu %5d %6d\n", free, |
5955 | task_pid_nr(p), task_pid_nr(p->real_parent)); | 5942 | task_pid_nr(p), task_pid_nr(p->real_parent)); |
@@ -7254,7 +7241,7 @@ cpu_to_core_group(int cpu, const struct cpumask *cpu_map, | |||
7254 | { | 7241 | { |
7255 | int group; | 7242 | int group; |
7256 | 7243 | ||
7257 | cpumask_and(mask, &per_cpu(cpu_sibling_map, cpu), cpu_map); | 7244 | cpumask_and(mask, topology_thread_cpumask(cpu), cpu_map); |
7258 | group = cpumask_first(mask); | 7245 | group = cpumask_first(mask); |
7259 | if (sg) | 7246 | if (sg) |
7260 | *sg = &per_cpu(sched_group_core, group).sg; | 7247 | *sg = &per_cpu(sched_group_core, group).sg; |
@@ -7283,7 +7270,7 @@ cpu_to_phys_group(int cpu, const struct cpumask *cpu_map, | |||
7283 | cpumask_and(mask, cpu_coregroup_mask(cpu), cpu_map); | 7270 | cpumask_and(mask, cpu_coregroup_mask(cpu), cpu_map); |
7284 | group = cpumask_first(mask); | 7271 | group = cpumask_first(mask); |
7285 | #elif defined(CONFIG_SCHED_SMT) | 7272 | #elif defined(CONFIG_SCHED_SMT) |
7286 | cpumask_and(mask, &per_cpu(cpu_sibling_map, cpu), cpu_map); | 7273 | cpumask_and(mask, topology_thread_cpumask(cpu), cpu_map); |
7287 | group = cpumask_first(mask); | 7274 | group = cpumask_first(mask); |
7288 | #else | 7275 | #else |
7289 | group = cpu; | 7276 | group = cpu; |
@@ -7626,7 +7613,7 @@ static int __build_sched_domains(const struct cpumask *cpu_map, | |||
7626 | SD_INIT(sd, SIBLING); | 7613 | SD_INIT(sd, SIBLING); |
7627 | set_domain_attribute(sd, attr); | 7614 | set_domain_attribute(sd, attr); |
7628 | cpumask_and(sched_domain_span(sd), | 7615 | cpumask_and(sched_domain_span(sd), |
7629 | &per_cpu(cpu_sibling_map, i), cpu_map); | 7616 | topology_thread_cpumask(i), cpu_map); |
7630 | sd->parent = p; | 7617 | sd->parent = p; |
7631 | p->child = sd; | 7618 | p->child = sd; |
7632 | cpu_to_cpu_group(i, cpu_map, &sd->groups, tmpmask); | 7619 | cpu_to_cpu_group(i, cpu_map, &sd->groups, tmpmask); |
@@ -7637,7 +7624,7 @@ static int __build_sched_domains(const struct cpumask *cpu_map, | |||
7637 | /* Set up CPU (sibling) groups */ | 7624 | /* Set up CPU (sibling) groups */ |
7638 | for_each_cpu(i, cpu_map) { | 7625 | for_each_cpu(i, cpu_map) { |
7639 | cpumask_and(this_sibling_map, | 7626 | cpumask_and(this_sibling_map, |
7640 | &per_cpu(cpu_sibling_map, i), cpu_map); | 7627 | topology_thread_cpumask(i), cpu_map); |
7641 | if (i != cpumask_first(this_sibling_map)) | 7628 | if (i != cpumask_first(this_sibling_map)) |
7642 | continue; | 7629 | continue; |
7643 | 7630 | ||
@@ -8309,6 +8296,9 @@ void __init sched_init(void) | |||
8309 | #ifdef CONFIG_USER_SCHED | 8296 | #ifdef CONFIG_USER_SCHED |
8310 | alloc_size *= 2; | 8297 | alloc_size *= 2; |
8311 | #endif | 8298 | #endif |
8299 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
8300 | alloc_size += num_possible_cpus() * cpumask_size(); | ||
8301 | #endif | ||
8312 | /* | 8302 | /* |
8313 | * As sched_init() is called before page_alloc is setup, | 8303 | * As sched_init() is called before page_alloc is setup, |
8314 | * we use alloc_bootmem(). | 8304 | * we use alloc_bootmem(). |
@@ -8346,6 +8336,12 @@ void __init sched_init(void) | |||
8346 | ptr += nr_cpu_ids * sizeof(void **); | 8336 | ptr += nr_cpu_ids * sizeof(void **); |
8347 | #endif /* CONFIG_USER_SCHED */ | 8337 | #endif /* CONFIG_USER_SCHED */ |
8348 | #endif /* CONFIG_RT_GROUP_SCHED */ | 8338 | #endif /* CONFIG_RT_GROUP_SCHED */ |
8339 | #ifdef CONFIG_CPUMASK_OFFSTACK | ||
8340 | for_each_possible_cpu(i) { | ||
8341 | per_cpu(load_balance_tmpmask, i) = (void *)ptr; | ||
8342 | ptr += cpumask_size(); | ||
8343 | } | ||
8344 | #endif /* CONFIG_CPUMASK_OFFSTACK */ | ||
8349 | } | 8345 | } |
8350 | 8346 | ||
8351 | #ifdef CONFIG_SMP | 8347 | #ifdef CONFIG_SMP |
@@ -9490,7 +9486,7 @@ cpuacct_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp) | |||
9490 | 9486 | ||
9491 | static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu) | 9487 | static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu) |
9492 | { | 9488 | { |
9493 | u64 *cpuusage = percpu_ptr(ca->cpuusage, cpu); | 9489 | u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); |
9494 | u64 data; | 9490 | u64 data; |
9495 | 9491 | ||
9496 | #ifndef CONFIG_64BIT | 9492 | #ifndef CONFIG_64BIT |
@@ -9509,7 +9505,7 @@ static u64 cpuacct_cpuusage_read(struct cpuacct *ca, int cpu) | |||
9509 | 9505 | ||
9510 | static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val) | 9506 | static void cpuacct_cpuusage_write(struct cpuacct *ca, int cpu, u64 val) |
9511 | { | 9507 | { |
9512 | u64 *cpuusage = percpu_ptr(ca->cpuusage, cpu); | 9508 | u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); |
9513 | 9509 | ||
9514 | #ifndef CONFIG_64BIT | 9510 | #ifndef CONFIG_64BIT |
9515 | /* | 9511 | /* |
@@ -9605,7 +9601,7 @@ static void cpuacct_charge(struct task_struct *tsk, u64 cputime) | |||
9605 | ca = task_ca(tsk); | 9601 | ca = task_ca(tsk); |
9606 | 9602 | ||
9607 | for (; ca; ca = ca->parent) { | 9603 | for (; ca; ca = ca->parent) { |
9608 | u64 *cpuusage = percpu_ptr(ca->cpuusage, cpu); | 9604 | u64 *cpuusage = per_cpu_ptr(ca->cpuusage, cpu); |
9609 | *cpuusage += cputime; | 9605 | *cpuusage += cputime; |
9610 | } | 9606 | } |
9611 | } | 9607 | } |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index bac1061cea2f..da932f4c8524 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -960,12 +960,13 @@ static struct task_struct *pick_next_highest_task_rt(struct rq *rq, int cpu) | |||
960 | 960 | ||
961 | static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask); | 961 | static DEFINE_PER_CPU(cpumask_var_t, local_cpu_mask); |
962 | 962 | ||
963 | static inline int pick_optimal_cpu(int this_cpu, cpumask_t *mask) | 963 | static inline int pick_optimal_cpu(int this_cpu, |
964 | const struct cpumask *mask) | ||
964 | { | 965 | { |
965 | int first; | 966 | int first; |
966 | 967 | ||
967 | /* "this_cpu" is cheaper to preempt than a remote processor */ | 968 | /* "this_cpu" is cheaper to preempt than a remote processor */ |
968 | if ((this_cpu != -1) && cpu_isset(this_cpu, *mask)) | 969 | if ((this_cpu != -1) && cpumask_test_cpu(this_cpu, mask)) |
969 | return this_cpu; | 970 | return this_cpu; |
970 | 971 | ||
971 | first = cpumask_first(mask); | 972 | first = cpumask_first(mask); |
@@ -981,6 +982,7 @@ static int find_lowest_rq(struct task_struct *task) | |||
981 | struct cpumask *lowest_mask = __get_cpu_var(local_cpu_mask); | 982 | struct cpumask *lowest_mask = __get_cpu_var(local_cpu_mask); |
982 | int this_cpu = smp_processor_id(); | 983 | int this_cpu = smp_processor_id(); |
983 | int cpu = task_cpu(task); | 984 | int cpu = task_cpu(task); |
985 | cpumask_var_t domain_mask; | ||
984 | 986 | ||
985 | if (task->rt.nr_cpus_allowed == 1) | 987 | if (task->rt.nr_cpus_allowed == 1) |
986 | return -1; /* No other targets possible */ | 988 | return -1; /* No other targets possible */ |
@@ -1013,19 +1015,25 @@ static int find_lowest_rq(struct task_struct *task) | |||
1013 | if (this_cpu == cpu) | 1015 | if (this_cpu == cpu) |
1014 | this_cpu = -1; /* Skip this_cpu opt if the same */ | 1016 | this_cpu = -1; /* Skip this_cpu opt if the same */ |
1015 | 1017 | ||
1016 | for_each_domain(cpu, sd) { | 1018 | if (alloc_cpumask_var(&domain_mask, GFP_ATOMIC)) { |
1017 | if (sd->flags & SD_WAKE_AFFINE) { | 1019 | for_each_domain(cpu, sd) { |
1018 | cpumask_t domain_mask; | 1020 | if (sd->flags & SD_WAKE_AFFINE) { |
1019 | int best_cpu; | 1021 | int best_cpu; |
1020 | 1022 | ||
1021 | cpumask_and(&domain_mask, sched_domain_span(sd), | 1023 | cpumask_and(domain_mask, |
1022 | lowest_mask); | 1024 | sched_domain_span(sd), |
1025 | lowest_mask); | ||
1023 | 1026 | ||
1024 | best_cpu = pick_optimal_cpu(this_cpu, | 1027 | best_cpu = pick_optimal_cpu(this_cpu, |
1025 | &domain_mask); | 1028 | domain_mask); |
1026 | if (best_cpu != -1) | 1029 | |
1027 | return best_cpu; | 1030 | if (best_cpu != -1) { |
1031 | free_cpumask_var(domain_mask); | ||
1032 | return best_cpu; | ||
1033 | } | ||
1034 | } | ||
1028 | } | 1035 | } |
1036 | free_cpumask_var(domain_mask); | ||
1029 | } | 1037 | } |
1030 | 1038 | ||
1031 | /* | 1039 | /* |
diff --git a/kernel/softirq.c b/kernel/softirq.c index 9041ea7948fe..57d3f67f6f38 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -796,6 +796,11 @@ int __init __weak early_irq_init(void) | |||
796 | return 0; | 796 | return 0; |
797 | } | 797 | } |
798 | 798 | ||
799 | int __init __weak arch_probe_nr_irqs(void) | ||
800 | { | ||
801 | return 0; | ||
802 | } | ||
803 | |||
799 | int __init __weak arch_early_irq_init(void) | 804 | int __init __weak arch_early_irq_init(void) |
800 | { | 805 | { |
801 | return 0; | 806 | return 0; |
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c index 0cd415ee62a2..74541ca49536 100644 --- a/kernel/stop_machine.c +++ b/kernel/stop_machine.c | |||
@@ -170,7 +170,7 @@ int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus) | |||
170 | * doesn't hit this CPU until we're ready. */ | 170 | * doesn't hit this CPU until we're ready. */ |
171 | get_cpu(); | 171 | get_cpu(); |
172 | for_each_online_cpu(i) { | 172 | for_each_online_cpu(i) { |
173 | sm_work = percpu_ptr(stop_machine_work, i); | 173 | sm_work = per_cpu_ptr(stop_machine_work, i); |
174 | INIT_WORK(sm_work, stop_cpu); | 174 | INIT_WORK(sm_work, stop_cpu); |
175 | queue_work_on(i, stop_machine_wq, sm_work); | 175 | queue_work_on(i, stop_machine_wq, sm_work); |
176 | } | 176 | } |