aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-07-20 05:07:48 -0400
committerTejun Heo <tj@kernel.org>2010-07-20 05:15:14 -0400
commit931ac77ef65d2d90ee1def63d2041402ec7c53ab (patch)
tree370153ff6e85c9e8e0d00f1811d214dbcba6b00a /kernel/workqueue.c
parent9f9c23644b07e7a51f6f39064e61c150be712932 (diff)
workqueue: fix build problem on !CONFIG_SMP
Commit f3421797 (workqueue: implement unbound workqueue) incorrectly tested CONFIG_SMP as part of a C expression in alloc/free_cwqs(). As CONFIG_SMP is not defined in UP, this breaks build. Fix it by using Found during linux-next build test. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index aca94726e20a..79a11e40f311 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2615,11 +2615,15 @@ static int alloc_cwqs(struct workqueue_struct *wq)
2615 const size_t size = sizeof(struct cpu_workqueue_struct); 2615 const size_t size = sizeof(struct cpu_workqueue_struct);
2616 const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS, 2616 const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
2617 __alignof__(unsigned long long)); 2617 __alignof__(unsigned long long));
2618#ifdef CONFIG_SMP
2619 bool percpu = !(wq->flags & WQ_UNBOUND);
2620#else
2621 bool percpu = false;
2622#endif
2618 2623
2619 if (CONFIG_SMP && !(wq->flags & WQ_UNBOUND)) { 2624 if (percpu)
2620 /* on SMP, percpu allocator can align itself */
2621 wq->cpu_wq.pcpu = __alloc_percpu(size, align); 2625 wq->cpu_wq.pcpu = __alloc_percpu(size, align);
2622 } else { 2626 else {
2623 void *ptr; 2627 void *ptr;
2624 2628
2625 /* 2629 /*
@@ -2641,7 +2645,13 @@ static int alloc_cwqs(struct workqueue_struct *wq)
2641 2645
2642static void free_cwqs(struct workqueue_struct *wq) 2646static void free_cwqs(struct workqueue_struct *wq)
2643{ 2647{
2644 if (CONFIG_SMP && !(wq->flags & WQ_UNBOUND)) 2648#ifdef CONFIG_SMP
2649 bool percpu = !(wq->flags & WQ_UNBOUND);
2650#else
2651 bool percpu = false;
2652#endif
2653
2654 if (percpu)
2645 free_percpu(wq->cpu_wq.pcpu); 2655 free_percpu(wq->cpu_wq.pcpu);
2646 else if (wq->cpu_wq.single) { 2656 else if (wq->cpu_wq.single) {
2647 /* the pointer to free is stored right after the cwq */ 2657 /* the pointer to free is stored right after the cwq */