diff options
Diffstat (limited to 'kernel/padata.c')
-rw-r--r-- | kernel/padata.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/padata.c b/kernel/padata.c index 0c708f648853..868f947166d7 100644 --- a/kernel/padata.c +++ b/kernel/padata.c | |||
@@ -940,6 +940,8 @@ static struct kobj_type padata_attr_type = { | |||
940 | * @wq: workqueue to use for the allocated padata instance | 940 | * @wq: workqueue to use for the allocated padata instance |
941 | * @pcpumask: cpumask that will be used for padata parallelization | 941 | * @pcpumask: cpumask that will be used for padata parallelization |
942 | * @cbcpumask: cpumask that will be used for padata serialization | 942 | * @cbcpumask: cpumask that will be used for padata serialization |
943 | * | ||
944 | * Must be called from a cpus_read_lock() protected region | ||
943 | */ | 945 | */ |
944 | static struct padata_instance *padata_alloc(struct workqueue_struct *wq, | 946 | static struct padata_instance *padata_alloc(struct workqueue_struct *wq, |
945 | const struct cpumask *pcpumask, | 947 | const struct cpumask *pcpumask, |
@@ -952,7 +954,6 @@ static struct padata_instance *padata_alloc(struct workqueue_struct *wq, | |||
952 | if (!pinst) | 954 | if (!pinst) |
953 | goto err; | 955 | goto err; |
954 | 956 | ||
955 | get_online_cpus(); | ||
956 | if (!alloc_cpumask_var(&pinst->cpumask.pcpu, GFP_KERNEL)) | 957 | if (!alloc_cpumask_var(&pinst->cpumask.pcpu, GFP_KERNEL)) |
957 | goto err_free_inst; | 958 | goto err_free_inst; |
958 | if (!alloc_cpumask_var(&pinst->cpumask.cbcpu, GFP_KERNEL)) { | 959 | if (!alloc_cpumask_var(&pinst->cpumask.cbcpu, GFP_KERNEL)) { |
@@ -976,14 +977,12 @@ static struct padata_instance *padata_alloc(struct workqueue_struct *wq, | |||
976 | 977 | ||
977 | pinst->flags = 0; | 978 | pinst->flags = 0; |
978 | 979 | ||
979 | put_online_cpus(); | ||
980 | |||
981 | BLOCKING_INIT_NOTIFIER_HEAD(&pinst->cpumask_change_notifier); | 980 | BLOCKING_INIT_NOTIFIER_HEAD(&pinst->cpumask_change_notifier); |
982 | kobject_init(&pinst->kobj, &padata_attr_type); | 981 | kobject_init(&pinst->kobj, &padata_attr_type); |
983 | mutex_init(&pinst->lock); | 982 | mutex_init(&pinst->lock); |
984 | 983 | ||
985 | #ifdef CONFIG_HOTPLUG_CPU | 984 | #ifdef CONFIG_HOTPLUG_CPU |
986 | cpuhp_state_add_instance_nocalls(hp_online, &pinst->node); | 985 | cpuhp_state_add_instance_nocalls_cpuslocked(hp_online, &pinst->node); |
987 | #endif | 986 | #endif |
988 | return pinst; | 987 | return pinst; |
989 | 988 | ||
@@ -992,7 +991,6 @@ err_free_masks: | |||
992 | free_cpumask_var(pinst->cpumask.cbcpu); | 991 | free_cpumask_var(pinst->cpumask.cbcpu); |
993 | err_free_inst: | 992 | err_free_inst: |
994 | kfree(pinst); | 993 | kfree(pinst); |
995 | put_online_cpus(); | ||
996 | err: | 994 | err: |
997 | return NULL; | 995 | return NULL; |
998 | } | 996 | } |
@@ -1003,9 +1001,12 @@ err: | |||
1003 | * parallel workers. | 1001 | * parallel workers. |
1004 | * | 1002 | * |
1005 | * @wq: workqueue to use for the allocated padata instance | 1003 | * @wq: workqueue to use for the allocated padata instance |
1004 | * | ||
1005 | * Must be called from a cpus_read_lock() protected region | ||
1006 | */ | 1006 | */ |
1007 | struct padata_instance *padata_alloc_possible(struct workqueue_struct *wq) | 1007 | struct padata_instance *padata_alloc_possible(struct workqueue_struct *wq) |
1008 | { | 1008 | { |
1009 | lockdep_assert_cpus_held(); | ||
1009 | return padata_alloc(wq, cpu_possible_mask, cpu_possible_mask); | 1010 | return padata_alloc(wq, cpu_possible_mask, cpu_possible_mask); |
1010 | } | 1011 | } |
1011 | EXPORT_SYMBOL(padata_alloc_possible); | 1012 | EXPORT_SYMBOL(padata_alloc_possible); |