diff options
-rw-r--r-- | kernel/workqueue.c | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index f2c5638bb5ab..5abf42f63c08 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -476,13 +476,8 @@ static struct cpu_workqueue_struct *get_cwq(unsigned int cpu, | |||
476 | struct workqueue_struct *wq) | 476 | struct workqueue_struct *wq) |
477 | { | 477 | { |
478 | if (!(wq->flags & WQ_UNBOUND)) { | 478 | if (!(wq->flags & WQ_UNBOUND)) { |
479 | if (likely(cpu < nr_cpu_ids)) { | 479 | if (likely(cpu < nr_cpu_ids)) |
480 | #ifdef CONFIG_SMP | ||
481 | return per_cpu_ptr(wq->cpu_wq.pcpu, cpu); | 480 | return per_cpu_ptr(wq->cpu_wq.pcpu, cpu); |
482 | #else | ||
483 | return wq->cpu_wq.single; | ||
484 | #endif | ||
485 | } | ||
486 | } else if (likely(cpu == WORK_CPU_UNBOUND)) | 481 | } else if (likely(cpu == WORK_CPU_UNBOUND)) |
487 | return wq->cpu_wq.single; | 482 | return wq->cpu_wq.single; |
488 | return NULL; | 483 | return NULL; |
@@ -2899,13 +2894,8 @@ static int alloc_cwqs(struct workqueue_struct *wq) | |||
2899 | const size_t size = sizeof(struct cpu_workqueue_struct); | 2894 | const size_t size = sizeof(struct cpu_workqueue_struct); |
2900 | const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS, | 2895 | const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS, |
2901 | __alignof__(unsigned long long)); | 2896 | __alignof__(unsigned long long)); |
2902 | #ifdef CONFIG_SMP | ||
2903 | bool percpu = !(wq->flags & WQ_UNBOUND); | ||
2904 | #else | ||
2905 | bool percpu = false; | ||
2906 | #endif | ||
2907 | 2897 | ||
2908 | if (percpu) | 2898 | if (!(wq->flags & WQ_UNBOUND)) |
2909 | wq->cpu_wq.pcpu = __alloc_percpu(size, align); | 2899 | wq->cpu_wq.pcpu = __alloc_percpu(size, align); |
2910 | else { | 2900 | else { |
2911 | void *ptr; | 2901 | void *ptr; |
@@ -2929,13 +2919,7 @@ static int alloc_cwqs(struct workqueue_struct *wq) | |||
2929 | 2919 | ||
2930 | static void free_cwqs(struct workqueue_struct *wq) | 2920 | static void free_cwqs(struct workqueue_struct *wq) |
2931 | { | 2921 | { |
2932 | #ifdef CONFIG_SMP | 2922 | if (!(wq->flags & WQ_UNBOUND)) |
2933 | bool percpu = !(wq->flags & WQ_UNBOUND); | ||
2934 | #else | ||
2935 | bool percpu = false; | ||
2936 | #endif | ||
2937 | |||
2938 | if (percpu) | ||
2939 | free_percpu(wq->cpu_wq.pcpu); | 2923 | free_percpu(wq->cpu_wq.pcpu); |
2940 | else if (wq->cpu_wq.single) { | 2924 | else if (wq->cpu_wq.single) { |
2941 | /* the pointer to free is stored right after the cwq */ | 2925 | /* the pointer to free is stored right after the cwq */ |