diff options
author | Steffen Klassert <steffen.klassert@secunet.com> | 2010-07-07 09:30:47 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-07-14 08:29:29 -0400 |
commit | ee836555120140f770005b8ce6673c913d1b9a98 (patch) | |
tree | 73f62f460c8b18997a76cf38e7f5021086558c56 /kernel/padata.c | |
parent | 4c879170296174bde05cd1c643dac16594edee77 (diff) |
padata: Block until the instance is unused on stop
This patch makes padata_stop to block until the padata
instance is unused. Also we split padata_stop to a locked
and a unlocked version. This is in preparation to be able
to change the cpumask after a call to patata stop.
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.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/kernel/padata.c b/kernel/padata.c index e7d723a3e31d..9e18dfa372a9 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -490,6 +490,20 @@ static void __padata_start(struct padata_instance *pinst) | |||
490 | pinst->flags |= PADATA_INIT; | 490 | pinst->flags |= PADATA_INIT; |
491 | } | 491 | } |
492 | 492 | ||
493 | static void __padata_stop(struct padata_instance *pinst) | ||
494 | { | ||
495 | if (!(pinst->flags & PADATA_INIT)) | ||
496 | return; | ||
497 | |||
498 | pinst->flags &= ~PADATA_INIT; | ||
499 | |||
500 | synchronize_rcu(); | ||
501 | |||
502 | get_online_cpus(); | ||
503 | padata_flush_queues(pinst->pd); | ||
504 | put_online_cpus(); | ||
505 | } | ||
506 | |||
493 | /* Replace the internal control stucture with a new one. */ | 507 | /* Replace the internal control stucture with a new one. */ |
494 | static void padata_replace(struct padata_instance *pinst, | 508 | static void padata_replace(struct padata_instance *pinst, |
495 | struct parallel_data *pd_new) | 509 | struct parallel_data *pd_new) |
@@ -649,7 +663,7 @@ EXPORT_SYMBOL(padata_start); | |||
649 | void padata_stop(struct padata_instance *pinst) | 663 | void padata_stop(struct padata_instance *pinst) |
650 | { | 664 | { |
651 | mutex_lock(&pinst->lock); | 665 | mutex_lock(&pinst->lock); |
652 | pinst->flags &= ~PADATA_INIT; | 666 | __padata_stop(pinst); |
653 | mutex_unlock(&pinst->lock); | 667 | mutex_unlock(&pinst->lock); |
654 | } | 668 | } |
655 | EXPORT_SYMBOL(padata_stop); | 669 | EXPORT_SYMBOL(padata_stop); |
@@ -770,17 +784,11 @@ EXPORT_SYMBOL(padata_alloc); | |||
770 | */ | 784 | */ |
771 | void padata_free(struct padata_instance *pinst) | 785 | void padata_free(struct padata_instance *pinst) |
772 | { | 786 | { |
773 | padata_stop(pinst); | ||
774 | |||
775 | synchronize_rcu(); | ||
776 | |||
777 | #ifdef CONFIG_HOTPLUG_CPU | 787 | #ifdef CONFIG_HOTPLUG_CPU |
778 | unregister_hotcpu_notifier(&pinst->cpu_notifier); | 788 | unregister_hotcpu_notifier(&pinst->cpu_notifier); |
779 | #endif | 789 | #endif |
780 | get_online_cpus(); | ||
781 | padata_flush_queues(pinst->pd); | ||
782 | put_online_cpus(); | ||
783 | 790 | ||
791 | padata_stop(pinst); | ||
784 | padata_free_pd(pinst->pd); | 792 | padata_free_pd(pinst->pd); |
785 | free_cpumask_var(pinst->cpumask); | 793 | free_cpumask_var(pinst->cpumask); |
786 | kfree(pinst); | 794 | kfree(pinst); |