Skip to contentSkip to conversation

workqueue: remove meaningless BUILD_BUG_ON() in init_workqueues()

PATCH In review Libin 2 participants 4 messages Sep 9, 2013 – Sep 10, 2013 Workqueue

lore
Share & tools
lore

Libin

author
#0 lore raw

PATCH 1/1 workqueue: remove meaningless BUILD_BUG_ON() in init_workqueues()

From: Li Bin <[email protected]>

In the current implementation, this BUILD_BUG_ON makes no sense. First of all, the number of worker pools needed cannot be determined at compile time, because the number of backing pools for UNBOUND workqueues is dynamic based on the assigned custom attributes. Secondly, it should use WORK_OFFQ_POOL_BITS instead of (BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT).

---
 kernel/workqueue.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/workqueue.c +0 -4
index 987293d..41019b1 100644
@@ -5009,10 +5009,6 @@ static int __init init_workqueues(void)
 	int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL };
 	int i, cpu;
 
-	/* make sure we have enough bits for OFFQ pool ID */
-	BUILD_BUG_ON((1LU << (BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT)) <
-		     WORK_CPU_END * NR_STD_WORKER_POOLS);
-
 	WARN_ON(__alignof__(struct pool_workqueue) < __alignof__(long long));
 
 	pwq_cache = KMEM_CACHE(pool_workqueue, SLAB_PANIC);
Signature · 1 line
1.8.2.1
maintainer
#1 lore raw

Hello, Libin.

Quoted 19 lines · Libin

From: Li Bin <[email protected]>

In the current implementation, this BUILD_BUG_ON makes no sense. First of all, the number of worker pools needed cannot be determined at compile time, because the number of backing pools for UNBOUND workqueues is dynamic based on the assigned custom attributes. Secondly, it should use WORK_OFFQ_POOL_BITS instead of (BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT).

---
 kernel/workqueue.c | 4 ----
 1 file changed, 4 deletions(-)
kernel/workqueue.c +0 -0
index 987293d..41019b1 100644

kernel/workqueue.c static int __init init_workqueues(void) · line 5015

Quoted 7 lines
kernel/workqueue.c +0 -4
@@ -5009,10 +5009,6 @@ static int __init init_workqueues(void)
 	int std_nice[NR_STD_WORKER_POOLS] = { 0, HIGHPRI_NICE_LEVEL };
 	int i, cpu;
 
-	/* make sure we have enough bits for OFFQ pool ID */
-	BUILD_BUG_ON((1LU << (BITS_PER_LONG - WORK_OFFQ_POOL_SHIFT)) <
-		     WORK_CPU_END * NR_STD_WORKER_POOLS);
-

Indeed, but can you please update worker_pool_assign_id() so that it doesn't allocate ids >= WORK_OFFQ_POOL_NONE?

Thanks.

Signature · 1 line
tejun
maintainer
#2 lore raw
Quoted 2 lines · Tejun Heo

Indeed, but can you please update worker_pool_assign_id() so that it doesn't allocate ids >= WORK_OFFQ_POOL_NONE?

So, you did this separately on the next patch. Can you please roll that patch into this one with the suggested update?

Thanks.

Signature · 1 line
tejun
author
#3 lore raw
Quoted 6 lines · Tejun Heo
Quoted 2 lines · Tejun Heo

Indeed, but can you please update worker_pool_assign_id() so that it doesn't allocate ids >= WORK_OFFQ_POOL_NONE?

So, you did this separately on the next patch. Can you please roll that patch into this one with the suggested update?

Hello Tejun,
I will update it according to your suggestion.

Thanks!
Libin

Quoted 3 lines

Thanks.