Re: [PATCH v3 2/2] rust: add system_percpu() around the new system_percpu_wq

From: Marco Crivellari

Date: Mon Jan 12 2026 - 11:10:24 EST


On Mon, Jan 12, 2026 at 10:05 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> [...]
> Yes, we can provide a new `struct PerCpuQueue` with same contents as
> `Queue`, where the `enqueue` and `enqueue_delayed` methods take a cpu id
> parameter.
>
> Then, all of the functions for obtaining queues at the bottom of the
> file are updated to return &PerCpuQueue instead of &Queue when a cpu id
> sone option here is tohould be provided to spawn on that queue.
>
> This way, you write:
>
> workqueue::system().enqueue(my_work_item)
>
> or you write:
>
> workqueue::system_percpu().enqueue(my_work_item, cpu_id)
>
> This way you must supply cpu id with system_percpu_wq() but not with
> system().
>
> --
>
> Another approach is to add a new `enqueue_cpu` to the existing `Queue`
> struct. In that case, all of these four combinations become legal:
>
> workqueue::system().enqueue(my_work_item)
> workqueue::system().enqueue_cpu(my_work_item, cpu_id)
> workqueue::system_percpu().enqueue(my_work_item)
> workqueue::system_percpu().enqueue_cpu(my_work_item, cpu_id)
>
> which approach is best depends on whether you want all four combinations
> to be legal or not.
>
> Alice

Thank you Alice.

Personally I'm more oriented to the 1st version you mentioned. Seems a
cleaner interface for the user.

Should I start with a new v1 about this, or better increment the actual version?

Thank you!

--

Marco Crivellari

L3 Support Engineer