aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-04-04 21:11:08 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-19 13:44:59 -0400
commitb53e921ba1cff8453dc9a87a84052fa12d5b30bd (patch)
tree021cadb6c58543ecccd95b55fc319f249ebf176e /arch/x86
parentf9a86fcbbb1e5542eabf45c9144ac4b6330861a4 (diff)
generic: reduce stack pressure in sched_affinity
* Modify sched_affinity functions to pass cpumask_t variables by reference instead of by value. * Use new set_cpus_allowed_ptr function. Depends on: [sched-devel]: sched: add new set_cpus_allowed_ptr function Cc: Paul Jackson <pj@sgi.com> Cc: Cliff Wickman <cpw@sgi.com> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_amd_64.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
index 32671da8184e..7c9a813e1193 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd_64.c
@@ -251,18 +251,18 @@ struct threshold_attr {
251 ssize_t(*store) (struct threshold_block *, const char *, size_t count); 251 ssize_t(*store) (struct threshold_block *, const char *, size_t count);
252}; 252};
253 253
254static cpumask_t affinity_set(unsigned int cpu) 254static void affinity_set(unsigned int cpu, cpumask_t *oldmask,
255 cpumask_t *newmask)
255{ 256{
256 cpumask_t oldmask = current->cpus_allowed; 257 *oldmask = current->cpus_allowed;
257 cpumask_t newmask = CPU_MASK_NONE; 258 cpus_clear(*newmask);
258 cpu_set(cpu, newmask); 259 cpu_set(cpu, *newmask);
259 set_cpus_allowed(current, newmask); 260 set_cpus_allowed_ptr(current, newmask);
260 return oldmask;
261} 261}
262 262
263static void affinity_restore(cpumask_t oldmask) 263static void affinity_restore(const cpumask_t *oldmask)
264{ 264{
265 set_cpus_allowed(current, oldmask); 265 set_cpus_allowed_ptr(current, oldmask);
266} 266}
267 267
268#define SHOW_FIELDS(name) \ 268#define SHOW_FIELDS(name) \
@@ -277,15 +277,15 @@ static ssize_t store_interrupt_enable(struct threshold_block *b,
277 const char *buf, size_t count) 277 const char *buf, size_t count)
278{ 278{
279 char *end; 279 char *end;
280 cpumask_t oldmask; 280 cpumask_t oldmask, newmask;
281 unsigned long new = simple_strtoul(buf, &end, 0); 281 unsigned long new = simple_strtoul(buf, &end, 0);
282 if (end == buf) 282 if (end == buf)
283 return -EINVAL; 283 return -EINVAL;
284 b->interrupt_enable = !!new; 284 b->interrupt_enable = !!new;
285 285
286 oldmask = affinity_set(b->cpu); 286 affinity_set(b->cpu, &oldmask, &newmask);
287 threshold_restart_bank(b, 0, 0); 287 threshold_restart_bank(b, 0, 0);
288 affinity_restore(oldmask); 288 affinity_restore(&oldmask);
289 289
290 return end - buf; 290 return end - buf;
291} 291}
@@ -294,7 +294,7 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
294 const char *buf, size_t count) 294 const char *buf, size_t count)
295{ 295{
296 char *end; 296 char *end;
297 cpumask_t oldmask; 297 cpumask_t oldmask, newmask;
298 u16 old; 298 u16 old;
299 unsigned long new = simple_strtoul(buf, &end, 0); 299 unsigned long new = simple_strtoul(buf, &end, 0);
300 if (end == buf) 300 if (end == buf)
@@ -306,9 +306,9 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
306 old = b->threshold_limit; 306 old = b->threshold_limit;
307 b->threshold_limit = new; 307 b->threshold_limit = new;
308 308
309 oldmask = affinity_set(b->cpu); 309 affinity_set(b->cpu, &oldmask, &newmask);
310 threshold_restart_bank(b, 0, old); 310 threshold_restart_bank(b, 0, old);
311 affinity_restore(oldmask); 311 affinity_restore(&oldmask);
312 312
313 return end - buf; 313 return end - buf;
314} 314}
@@ -316,10 +316,10 @@ static ssize_t store_threshold_limit(struct threshold_block *b,
316static ssize_t show_error_count(struct threshold_block *b, char *buf) 316static ssize_t show_error_count(struct threshold_block *b, char *buf)
317{ 317{
318 u32 high, low; 318 u32 high, low;
319 cpumask_t oldmask; 319 cpumask_t oldmask, newmask;
320 oldmask = affinity_set(b->cpu); 320 affinity_set(b->cpu, &oldmask, &newmask);
321 rdmsr(b->address, low, high); 321 rdmsr(b->address, low, high);
322 affinity_restore(oldmask); 322 affinity_restore(&oldmask);
323 return sprintf(buf, "%x\n", 323 return sprintf(buf, "%x\n",
324 (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit)); 324 (high & 0xFFF) - (THRESHOLD_MAX - b->threshold_limit));
325} 325}
@@ -327,10 +327,10 @@ static ssize_t show_error_count(struct threshold_block *b, char *buf)
327static ssize_t store_error_count(struct threshold_block *b, 327static ssize_t store_error_count(struct threshold_block *b,
328 const char *buf, size_t count) 328 const char *buf, size_t count)
329{ 329{
330 cpumask_t oldmask; 330 cpumask_t oldmask, newmask;
331 oldmask = affinity_set(b->cpu); 331 affinity_set(b->cpu, &oldmask, &newmask);
332 threshold_restart_bank(b, 1, 0); 332 threshold_restart_bank(b, 1, 0);
333 affinity_restore(oldmask); 333 affinity_restore(&oldmask);
334 return 1; 334 return 1;
335} 335}
336 336
@@ -468,7 +468,7 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
468{ 468{
469 int i, err = 0; 469 int i, err = 0;
470 struct threshold_bank *b = NULL; 470 struct threshold_bank *b = NULL;
471 cpumask_t oldmask = CPU_MASK_NONE; 471 cpumask_t oldmask, newmask;
472 char name[32]; 472 char name[32];
473 473
474 sprintf(name, "threshold_bank%i", bank); 474 sprintf(name, "threshold_bank%i", bank);
@@ -519,10 +519,10 @@ static __cpuinit int threshold_create_bank(unsigned int cpu, unsigned int bank)
519 519
520 per_cpu(threshold_banks, cpu)[bank] = b; 520 per_cpu(threshold_banks, cpu)[bank] = b;
521 521
522 oldmask = affinity_set(cpu); 522 affinity_set(cpu, &oldmask, &newmask);
523 err = allocate_threshold_blocks(cpu, bank, 0, 523 err = allocate_threshold_blocks(cpu, bank, 0,
524 MSR_IA32_MC0_MISC + bank * 4); 524 MSR_IA32_MC0_MISC + bank * 4);
525 affinity_restore(oldmask); 525 affinity_restore(&oldmask);
526 526
527 if (err) 527 if (err)
528 goto out_free; 528 goto out_free;