Re: [PATCH v2 4/6] rust: workqueue: add creation of workqueues

From: Danilo Krummrich

Date: Fri Aug 07 2026 - 18:40:48 EST


On Fri Aug 7, 2026 at 6:52 PM CEST, Danilo Krummrich wrote:
> * new_power_efficient(): WQ_UNBOUND | WQ_POWER_EFFICIENT, add
> .percpu(),

[...]

> + pub fn new_power_efficient() -> Builder<TypePowerEfficient> {
> + Builder {
> + flags: bindings::wq_flags_WQ_UNBOUND | bindings::wq_flags_WQ_POWER_EFFICIENT,

I actually meant to add WQ_PERCPU, which should be the default for
WQ_POWER_EFFICIENT, in order to avoid the warning below.

But I somehow managed to fix it the wrong way around and made WQ_UNBOUND the
default.

So, this should just be bindings::wq_flags_WQ_PERCPU |
bindings::wq_flags_WQ_POWER_EFFICIENT.

- Danilo

[ 1.381581] workqueue: my-wq is using neither WQ_PERCPU or WQ_UNBOUND. Setting WQ_PERCPU.
[ 1.382274] WARNING: kernel/workqueue.c:5852 at alloc_workqueue_va+0x794/0x800, CPU#0: kunit_try_catch/851
[ 1.383088] Modules linked in:
[ 1.383359] CPU: 0 UID: 0 PID: 851 Comm: kunit_try_catch Tainted: G W N 7.2.0-rc1+ #67 PREEMPT(full)
[ 1.384236] Tainted: [W]=WARN, [N]=TEST
[ 1.384567] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.17.0-2-2 04/01/2014
[ 1.385364] RIP: 0010:alloc_workqueue_va+0x79b/0x800
[ 1.385784] Code: 49 8d 96 b8 00 00 00 b9 01 00 00 00 41 b8 00 08 00 00 e8 08 83 ef ff e9 88 f9 ff ff 48 8d 3d cc 1c e2 01 49 8d b6 b8 00 00 00 <67> 48 0f b9 3a 41 81 cc 00 01 00 00 e9 40 f9 ff ff 48 8d 3d bd 1c
[ 1.387337] RSP: 0018:ffffc90000473d58 EFLAGS: 00010246
[ 1.387779] RAX: 0000000000000000 RBX: ffff888102041600 RCX: 8313f7e158b49600
[ 1.388382] RDX: ffff8881020416d8 RSI: ffff8881020416b8 RDI: ffffffff8312e020
[ 1.388985] RBP: 0000000000000000 R08: 00000000ffffffff R09: 00000000ffffffff
[ 1.389587] R10: ffff8881020416bd R11: 0000000000000000 R12: 0000000000000080
[ 1.390192] R13: ffffffff82ad53fd R14: ffff888102041600 R15: ffffc90000473de0
[ 1.390793] FS: 0000000000000000(0000) GS:ffff8881b81cf000(0000) knlGS:0000000000000000
[ 1.391478] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1.391968] CR2: ffff88813ffff000 CR3: 0000000002e22000 CR4: 0000000000750ef0
[ 1.392568] PKRU: 55555554
[ 1.392804] Call Trace:
[ 1.393027] <TASK>
[ 1.393219] alloc_workqueue_noprof+0x5b/0x80
[ 1.393594] rust_doctest_kernel_workqueue_builder_rs_12+0x3a/0x1f0
[ 1.394129] ? _task_rq_lock+0x55/0x150
[ 1.394462] ? call_rcu+0xec/0x270
[ 1.394756] ? kvm_clock_get_cycles+0x18/0x40
[ 1.395136] ? ktime_get_ts64+0x6d/0x170
[ 1.395477] kunit_try_run_case+0x93/0x190
[ 1.395826] kunit_generic_run_threadfn_adapter+0x22/0x40
[ 1.396290] ? kunit_try_catch_run+0x210/0x210
[ 1.396670] kthread+0xfb/0x120
[ 1.396942] ? kthread_blkcg+0x40/0x40
[ 1.397270] ret_from_fork+0xee/0x260
[ 1.397590] ? kthread_blkcg+0x40/0x40
[ 1.397910] ret_from_fork_asm+0x11/0x20
[ 1.398255] </TASK>
[ 1.398453] ---[ end trace 0000000000000000 ]---