Re: [PATCH v3 2/2] rust: workqueue: add creation of workqueues
From: Alice Ryhl
Date: Fri Feb 27 2026 - 14:05:42 EST
On Fri, Feb 27, 2026 at 04:30:59PM +0100, Danilo Krummrich wrote:
> On Fri Feb 27, 2026 at 3:53 PM CET, Alice Ryhl wrote:
> > + /// Set the maximum number of active cpus.
> > + ///
> > + /// If not set, a reasonable default value is used. The maximum value is `WQ_MAX_ACTIVE`.
>
> Should we just mention the default value?
I can mention the constant name, but I'd like to avoid mentioning a
value that might change.
> > + #[inline]
> > + pub fn max_active(mut self, max_active: u32) -> Builder {
> > + self.max_active = i32::try_from(max_active).unwrap_or(i32::MAX);
>
> The workqueue code prints a warning for max_active > WQ_MAX_ACTIVE. Maybe use
> debug_assert()?
What's wrong with just making use of the C-side warning?
> It's also a bit unfortunate that alloc_ordered_workqueue() becomes
> .max_active(1).
>
> At the same time having a separate ordered() method competes with max_active().
>
> Mybe a type state, i.e. Builder<Ordered> that doesn't have max_active()?
Sorry I'm a bit confused by this. Why does an ordered() compete with
max_active()?
Alice