(cc'ing Breno as he has been working in the area)
Hello,
Sorry about the delay.
On Tue, Aug 04, 2026 at 11:19:24AM +0100, Tvrtko Ursulin wrote:
> struct workqueue_attrs {
> /**
> - * @nice: nice level
> + * @prio: priority level
> + */
> + enum wq_priority prio;
> +
> + /**
> + * @nice: nice level for WQ_PRIO_HIGH
> */
> int nice;
I find this rather confusing. We're scattering the same internal state
across multiple fields. If you look at scheduler code, rt and normal nice
values are encoded into a single prio value, maybe we can do the same?
> static int alloc_and_link_pwqs(struct workqueue_struct *wq)
> {
> - bool highpri = wq->flags & WQ_HIGHPRI;
> - int cpu, ret;
> + int prio, cpu, ret;
>
> lockdep_assert_held(&wq_pool_mutex);
>
> + if (wq->flags & WQ_RTPRI)
> + prio = WQ_PRIO_RT;
> + else if (wq->flags & WQ_HIGHPRI)
> + prio = WQ_PRIO_HIGH;
> + else
> + prio = WQ_PRIO_NORMAL;
> +
> wq->cpu_pwq = alloc_percpu(struct pool_workqueue *);
> if (!wq->cpu_pwq)
> goto enomem;
> @@ -5622,7 +5637,7 @@ static int alloc_and_link_pwqs(struct workqueue_struct
> *wq)
> struct pool_workqueue **pwq_p;
> struct worker_pool *pool;
>
> - pool = &(per_cpu_ptr(pools, cpu)[highpri]);
> + pool = &(per_cpu_ptr(pools, cpu)[prio]);
And this looks a bit confusing too because there's no per-cpu counterpart
but it looks like there should be.
I wonder whether this would look better after the percpu and unbound pool
unification that Breno is working on.
Thanks.
--
tejun