Re: [PATCH RESEND] mm/vmalloc: Use dedicated unbound workqueues for vmap drain

From: Uladzislau Rezki

Date: Wed Sep 16 2026 - 12:04:40 EST


On Wed, Sep 16, 2026 at 08:12:27AM +0800, Hillf Danton wrote:
> On Mon, 14 Sep 2026 18:56:26 +0200 "Uladzislau Rezki (Sony)" wrote:
> > This patch does not use queue_work_on() semantic thus i do not want to
> > queue all helpers on current CPU. Instead scheduler does balancing and
> > that is it.
> >
> [Fair queue in the Eric Dumazet accent]
>
> +static bool
> +schedule_drain_vmap_work(struct workqueue_struct *wq,
> + struct work_struct *work)
> +{
> + if (wq)
> + return queue_work(wq, work);
> +
> + return false;
> +}
> +
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/workqueue.h#n697
>
> static inline bool queue_work(struct workqueue_struct *wq,
> struct work_struct *work)
> {
> return queue_work_on(WORK_CPU_UNBOUND, wq, work);
> }
>
> queue_work_on
> __queue_work
> if (req_cpu == WORK_CPU_UNBOUND) {
> if (wq->flags & WQ_UNBOUND)
> cpu = wq_select_unbound_cpu(raw_smp_processor_id());
> else
> cpu = raw_smp_processor_id();
> }
> /*
> * When queueing an unbound work item to a wq, prefer local CPU if allowed
> * by wq_unbound_cpumask. Otherwise, round robin among the allowed ones to
> * avoid perturbing sensitive tasks.
> */
> static int wq_select_unbound_cpu(int cpu)
> {
> pr_warn_once("workqueue: round-robin CPU selection forced, expect performance impact\n");
> }
>
/**
* worker_attach_to_pool() - attach a worker to a pool
* @worker: worker to be attached
* @pool: the target pool
*
* Attach @worker to @pool. Once attached, the %WORKER_UNBOUND flag and
* cpu-binding of @worker are kept coordinated with the pool across
* cpu-[un]hotplugs.
*/
static void worker_attach_to_pool(struct worker *worker,
struct worker_pool *pool)
{
mutex_lock(&wq_pool_attach_mutex);

/*
* The wq_pool_attach_mutex ensures %POOL_DISASSOCIATED remains stable
* across this function. See the comments above the flag definition for
* details. BH workers are, while per-CPU, always DISASSOCIATED.
*/
if (pool->flags & POOL_DISASSOCIATED) {
worker->flags |= WORKER_UNBOUND;
} else {
WARN_ON_ONCE(pool->flags & POOL_BH);
kthread_set_per_cpu(worker->task, pool->cpu);
}
...
}

A local CPU preference for WQ_UNBOUND is not the same as executing on
the __bound__ per-CPU system kworker.

--
Uladzislau Rezki