diff options
-rw-r--r-- | include/linux/workqueue.h | 4 | ||||
-rw-r--r-- | kernel/workqueue.c | 28 |
2 files changed, 13 insertions, 19 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index d59525fca4d3..b7c585b5ec1c 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -435,10 +435,6 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, | |||
435 | 435 | ||
436 | extern void destroy_workqueue(struct workqueue_struct *wq); | 436 | extern void destroy_workqueue(struct workqueue_struct *wq); |
437 | 437 | ||
438 | struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask); | ||
439 | void free_workqueue_attrs(struct workqueue_attrs *attrs); | ||
440 | int apply_workqueue_attrs(struct workqueue_struct *wq, | ||
441 | const struct workqueue_attrs *attrs); | ||
442 | int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); | 438 | int workqueue_set_unbound_cpumask(cpumask_var_t cpumask); |
443 | 439 | ||
444 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, | 440 | extern bool queue_work_on(int cpu, struct workqueue_struct *wq, |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 95aea04ff722..601d61150b65 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -3329,7 +3329,7 @@ EXPORT_SYMBOL_GPL(execute_in_process_context); | |||
3329 | * | 3329 | * |
3330 | * Undo alloc_workqueue_attrs(). | 3330 | * Undo alloc_workqueue_attrs(). |
3331 | */ | 3331 | */ |
3332 | void free_workqueue_attrs(struct workqueue_attrs *attrs) | 3332 | static void free_workqueue_attrs(struct workqueue_attrs *attrs) |
3333 | { | 3333 | { |
3334 | if (attrs) { | 3334 | if (attrs) { |
3335 | free_cpumask_var(attrs->cpumask); | 3335 | free_cpumask_var(attrs->cpumask); |
@@ -3339,21 +3339,20 @@ void free_workqueue_attrs(struct workqueue_attrs *attrs) | |||
3339 | 3339 | ||
3340 | /** | 3340 | /** |
3341 | * alloc_workqueue_attrs - allocate a workqueue_attrs | 3341 | * alloc_workqueue_attrs - allocate a workqueue_attrs |
3342 | * @gfp_mask: allocation mask to use | ||
3343 | * | 3342 | * |
3344 | * Allocate a new workqueue_attrs, initialize with default settings and | 3343 | * Allocate a new workqueue_attrs, initialize with default settings and |
3345 | * return it. | 3344 | * return it. |
3346 | * | 3345 | * |
3347 | * Return: The allocated new workqueue_attr on success. %NULL on failure. | 3346 | * Return: The allocated new workqueue_attr on success. %NULL on failure. |
3348 | */ | 3347 | */ |
3349 | struct workqueue_attrs *alloc_workqueue_attrs(gfp_t gfp_mask) | 3348 | static struct workqueue_attrs *alloc_workqueue_attrs(void) |
3350 | { | 3349 | { |
3351 | struct workqueue_attrs *attrs; | 3350 | struct workqueue_attrs *attrs; |
3352 | 3351 | ||
3353 | attrs = kzalloc(sizeof(*attrs), gfp_mask); | 3352 | attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); |
3354 | if (!attrs) | 3353 | if (!attrs) |
3355 | goto fail; | 3354 | goto fail; |
3356 | if (!alloc_cpumask_var(&attrs->cpumask, gfp_mask)) | 3355 | if (!alloc_cpumask_var(&attrs->cpumask, GFP_KERNEL)) |
3357 | goto fail; | 3356 | goto fail; |
3358 | 3357 | ||
3359 | cpumask_copy(attrs->cpumask, cpu_possible_mask); | 3358 | cpumask_copy(attrs->cpumask, cpu_possible_mask); |
@@ -3431,7 +3430,7 @@ static int init_worker_pool(struct worker_pool *pool) | |||
3431 | pool->refcnt = 1; | 3430 | pool->refcnt = 1; |
3432 | 3431 | ||
3433 | /* shouldn't fail above this point */ | 3432 | /* shouldn't fail above this point */ |
3434 | pool->attrs = alloc_workqueue_attrs(GFP_KERNEL); | 3433 | pool->attrs = alloc_workqueue_attrs(); |
3435 | if (!pool->attrs) | 3434 | if (!pool->attrs) |
3436 | return -ENOMEM; | 3435 | return -ENOMEM; |
3437 | return 0; | 3436 | return 0; |
@@ -3896,8 +3895,8 @@ apply_wqattrs_prepare(struct workqueue_struct *wq, | |||
3896 | 3895 | ||
3897 | ctx = kzalloc(struct_size(ctx, pwq_tbl, nr_node_ids), GFP_KERNEL); | 3896 | ctx = kzalloc(struct_size(ctx, pwq_tbl, nr_node_ids), GFP_KERNEL); |
3898 | 3897 | ||
3899 | new_attrs = alloc_workqueue_attrs(GFP_KERNEL); | 3898 | new_attrs = alloc_workqueue_attrs(); |
3900 | tmp_attrs = alloc_workqueue_attrs(GFP_KERNEL); | 3899 | tmp_attrs = alloc_workqueue_attrs(); |
3901 | if (!ctx || !new_attrs || !tmp_attrs) | 3900 | if (!ctx || !new_attrs || !tmp_attrs) |
3902 | goto out_free; | 3901 | goto out_free; |
3903 | 3902 | ||
@@ -4033,7 +4032,7 @@ static int apply_workqueue_attrs_locked(struct workqueue_struct *wq, | |||
4033 | * | 4032 | * |
4034 | * Return: 0 on success and -errno on failure. | 4033 | * Return: 0 on success and -errno on failure. |
4035 | */ | 4034 | */ |
4036 | int apply_workqueue_attrs(struct workqueue_struct *wq, | 4035 | static int apply_workqueue_attrs(struct workqueue_struct *wq, |
4037 | const struct workqueue_attrs *attrs) | 4036 | const struct workqueue_attrs *attrs) |
4038 | { | 4037 | { |
4039 | int ret; | 4038 | int ret; |
@@ -4044,7 +4043,6 @@ int apply_workqueue_attrs(struct workqueue_struct *wq, | |||
4044 | 4043 | ||
4045 | return ret; | 4044 | return ret; |
4046 | } | 4045 | } |
4047 | EXPORT_SYMBOL_GPL(apply_workqueue_attrs); | ||
4048 | 4046 | ||
4049 | /** | 4047 | /** |
4050 | * wq_update_unbound_numa - update NUMA affinity of a wq for CPU hot[un]plug | 4048 | * wq_update_unbound_numa - update NUMA affinity of a wq for CPU hot[un]plug |
@@ -4242,7 +4240,7 @@ struct workqueue_struct *alloc_workqueue(const char *fmt, | |||
4242 | return NULL; | 4240 | return NULL; |
4243 | 4241 | ||
4244 | if (flags & WQ_UNBOUND) { | 4242 | if (flags & WQ_UNBOUND) { |
4245 | wq->unbound_attrs = alloc_workqueue_attrs(GFP_KERNEL); | 4243 | wq->unbound_attrs = alloc_workqueue_attrs(); |
4246 | if (!wq->unbound_attrs) | 4244 | if (!wq->unbound_attrs) |
4247 | goto err_free_wq; | 4245 | goto err_free_wq; |
4248 | } | 4246 | } |
@@ -5395,7 +5393,7 @@ static struct workqueue_attrs *wq_sysfs_prep_attrs(struct workqueue_struct *wq) | |||
5395 | 5393 | ||
5396 | lockdep_assert_held(&wq_pool_mutex); | 5394 | lockdep_assert_held(&wq_pool_mutex); |
5397 | 5395 | ||
5398 | attrs = alloc_workqueue_attrs(GFP_KERNEL); | 5396 | attrs = alloc_workqueue_attrs(); |
5399 | if (!attrs) | 5397 | if (!attrs) |
5400 | return NULL; | 5398 | return NULL; |
5401 | 5399 | ||
@@ -5817,7 +5815,7 @@ static void __init wq_numa_init(void) | |||
5817 | return; | 5815 | return; |
5818 | } | 5816 | } |
5819 | 5817 | ||
5820 | wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(GFP_KERNEL); | 5818 | wq_update_unbound_numa_attrs_buf = alloc_workqueue_attrs(); |
5821 | BUG_ON(!wq_update_unbound_numa_attrs_buf); | 5819 | BUG_ON(!wq_update_unbound_numa_attrs_buf); |
5822 | 5820 | ||
5823 | /* | 5821 | /* |
@@ -5892,7 +5890,7 @@ int __init workqueue_init_early(void) | |||
5892 | for (i = 0; i < NR_STD_WORKER_POOLS; i++) { | 5890 | for (i = 0; i < NR_STD_WORKER_POOLS; i++) { |
5893 | struct workqueue_attrs *attrs; | 5891 | struct workqueue_attrs *attrs; |
5894 | 5892 | ||
5895 | BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); | 5893 | BUG_ON(!(attrs = alloc_workqueue_attrs())); |
5896 | attrs->nice = std_nice[i]; | 5894 | attrs->nice = std_nice[i]; |
5897 | unbound_std_wq_attrs[i] = attrs; | 5895 | unbound_std_wq_attrs[i] = attrs; |
5898 | 5896 | ||
@@ -5901,7 +5899,7 @@ int __init workqueue_init_early(void) | |||
5901 | * guaranteed by max_active which is enforced by pwqs. | 5899 | * guaranteed by max_active which is enforced by pwqs. |
5902 | * Turn off NUMA so that dfl_pwq is used for all nodes. | 5900 | * Turn off NUMA so that dfl_pwq is used for all nodes. |
5903 | */ | 5901 | */ |
5904 | BUG_ON(!(attrs = alloc_workqueue_attrs(GFP_KERNEL))); | 5902 | BUG_ON(!(attrs = alloc_workqueue_attrs())); |
5905 | attrs->nice = std_nice[i]; | 5903 | attrs->nice = std_nice[i]; |
5906 | attrs->no_numa = true; | 5904 | attrs->no_numa = true; |
5907 | ordered_wq_attrs[i] = attrs; | 5905 | ordered_wq_attrs[i] = attrs; |