aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/padata.c
diff options
context:
space:
mode:
authorSteffen Klassert <steffen.klassert@secunet.com>2010-04-29 08:42:30 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2010-05-02 23:32:12 -0400
commit6751fb3c0e0cfcc40a1a0acabca97370c9ec6c6b (patch)
tree30ab0d2a12715e4c95e1858639b4f540ce45c6b5 /kernel/padata.c
parent7b389b2cc539dc2dc60b049240942be54958c93a (diff)
padata: Use get_online_cpus/put_online_cpus
This patch puts get_online_cpus/put_online_cpus around the places we modify the padata cpumask to ensure that no cpu goes offline during this operation. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'kernel/padata.c')
-rw-r--r--kernel/padata.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/kernel/padata.c b/kernel/padata.c
index fc9f19a00ae4..82958e01564b 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -441,6 +441,8 @@ int padata_set_cpumask(struct padata_instance *pinst,
441 441
442 mutex_lock(&pinst->lock); 442 mutex_lock(&pinst->lock);
443 443
444 get_online_cpus();
445
444 pd = padata_alloc_pd(pinst, cpumask); 446 pd = padata_alloc_pd(pinst, cpumask);
445 if (!pd) { 447 if (!pd) {
446 err = -ENOMEM; 448 err = -ENOMEM;
@@ -452,6 +454,8 @@ int padata_set_cpumask(struct padata_instance *pinst,
452 padata_replace(pinst, pd); 454 padata_replace(pinst, pd);
453 455
454out: 456out:
457 put_online_cpus();
458
455 mutex_unlock(&pinst->lock); 459 mutex_unlock(&pinst->lock);
456 460
457 return err; 461 return err;
@@ -485,8 +489,10 @@ int padata_add_cpu(struct padata_instance *pinst, int cpu)
485 489
486 mutex_lock(&pinst->lock); 490 mutex_lock(&pinst->lock);
487 491
492 get_online_cpus();
488 cpumask_set_cpu(cpu, pinst->cpumask); 493 cpumask_set_cpu(cpu, pinst->cpumask);
489 err = __padata_add_cpu(pinst, cpu); 494 err = __padata_add_cpu(pinst, cpu);
495 put_online_cpus();
490 496
491 mutex_unlock(&pinst->lock); 497 mutex_unlock(&pinst->lock);
492 498
@@ -521,8 +527,10 @@ int padata_remove_cpu(struct padata_instance *pinst, int cpu)
521 527
522 mutex_lock(&pinst->lock); 528 mutex_lock(&pinst->lock);
523 529
530 get_online_cpus();
524 cpumask_clear_cpu(cpu, pinst->cpumask); 531 cpumask_clear_cpu(cpu, pinst->cpumask);
525 err = __padata_remove_cpu(pinst, cpu); 532 err = __padata_remove_cpu(pinst, cpu);
533 put_online_cpus();
526 534
527 mutex_unlock(&pinst->lock); 535 mutex_unlock(&pinst->lock);
528 536
@@ -626,6 +634,8 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
626 if (!pinst) 634 if (!pinst)
627 goto err; 635 goto err;
628 636
637 get_online_cpus();
638
629 pd = padata_alloc_pd(pinst, cpumask); 639 pd = padata_alloc_pd(pinst, cpumask);
630 if (!pd) 640 if (!pd)
631 goto err_free_inst; 641 goto err_free_inst;
@@ -647,6 +657,8 @@ struct padata_instance *padata_alloc(const struct cpumask *cpumask,
647 register_hotcpu_notifier(&pinst->cpu_notifier); 657 register_hotcpu_notifier(&pinst->cpu_notifier);
648#endif 658#endif
649 659
660 put_online_cpus();
661
650 mutex_init(&pinst->lock); 662 mutex_init(&pinst->lock);
651 663
652 return pinst; 664 return pinst;
@@ -655,6 +667,7 @@ err_free_pd:
655 padata_free_pd(pd); 667 padata_free_pd(pd);
656err_free_inst: 668err_free_inst:
657 kfree(pinst); 669 kfree(pinst);
670 put_online_cpus();
658err: 671err:
659 return NULL; 672 return NULL;
660} 673}