Skip to contentSkip to conversation

linux-next: build failure after merge of the final tree (workqueues tree related)

PATCH New Stephen Rothwell 2 participants 3 messages Jul 20, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Tejun,

After merging the final tree, today's linux-next build (powerpc allnoconfig) failed like this:

kernel/workqueue.c: In function 'alloc_cwqs':
kernel/workqueue.c:2634: error: 'CONFIG_SMP' undeclared (first use in this function) kernel/workqueue.c: In function 'free_cwqs':
kernel/workqueue.c:2659: error: 'CONFIG_SMP' undeclared (first use in this function)

Caused by commit f34217977d717385a3e9fd7018ac39fade3964c0 ("workqueue:
implement unbound workqueue"). Config symbols need to be checked for being defined ...

I have used the workqueues tree from next-20100719 for today.

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
maintainer
#1 lore raw
Quoted 5 lines · Stephen Rothwell

Hi Tejun,

After merging the final tree, today's linux-next build (powerpc allnoconfig) failed like this:

Quoted 8 lines

kernel/workqueue.c: In function 'alloc_cwqs':
kernel/workqueue.c:2634: error: 'CONFIG_SMP' undeclared (first use in this function) kernel/workqueue.c: In function 'free_cwqs':
kernel/workqueue.c:2659: error: 'CONFIG_SMP' undeclared (first use in this function)

Caused by commit f34217977d717385a3e9fd7018ac39fade3964c0 ("workqueue:
implement unbound workqueue"). Config symbols need to be checked for being defined ...

Heh, yeah, I have no idea what I was thinking. Will fix up soon.

Thanks.

Signature · 1 line
tejun
maintainer
#2 lore raw

PATCH 1/1 workqueue: fix build problem on !CONFIG_SMP

In reply to Stephen Rothwell

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.

---
 kernel/workqueue.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
kernel/workqueue.c +14 -4
index aca9472..79a11e4 100644
@@ -2615,11 +2615,15 @@ static int alloc_cwqs(struct workqueue_struct *wq)
 	const size_t size = sizeof(struct cpu_workqueue_struct);
 	const size_t align = max_t(size_t, 1 << WORK_STRUCT_FLAG_BITS,
 				   __alignof__(unsigned long long));
+#ifdef CONFIG_SMP
+	bool percpu = !(wq->flags & WQ_UNBOUND);
+#else
+	bool percpu = false;
+#endif
 
-	if (CONFIG_SMP && !(wq->flags & WQ_UNBOUND)) {
-		/* on SMP, percpu allocator can align itself */
+	if (percpu)
 		wq->cpu_wq.pcpu = __alloc_percpu(size, align);
-	} else {
+	else {
 		void *ptr;
 
 		/*
@@ -2641,7 +2645,13 @@ static int alloc_cwqs(struct workqueue_struct *wq)
 
 static void free_cwqs(struct workqueue_struct *wq)
 {
-	if (CONFIG_SMP && !(wq->flags & WQ_UNBOUND))
+#ifdef CONFIG_SMP
+	bool percpu = !(wq->flags & WQ_UNBOUND);
+#else
+	bool percpu = false;
+#endif
+
+	if (percpu)
 		free_percpu(wq->cpu_wq.pcpu);
 	else if (wq->cpu_wq.single) {
 		/* the pointer to free is stored right after the cwq */
Signature · 1 line
1.6.4.2