mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Hillf Danton <hdanton@sina.com>
Cc: Uladzislau Rezki <urezki@gmail.com>,
	linux-mm@kvack.org, Baoquan He <bhe@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>, Dev Jain <dev.jain@arm.com>,
	lirongqing <lirongqing@baidu.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH RESEND] mm/vmalloc: Use dedicated unbound workqueues for vmap drain
Date: Wed, 16 Sep 2026 18:00:20 +0200	[thread overview]
Message-ID: <aqq9FM3ti6NIHxQ0@milan> (raw)
In-Reply-To: <20260916001228.644-1-hdanton@sina.com>

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

  reply	other threads:[~2026-09-16 16:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 15:27 Uladzislau Rezki (Sony)
2026-09-05 22:37 ` Andrew Morton
2026-09-08 14:23   ` Uladzislau Rezki
2026-09-06  3:50 ` Hillf Danton
2026-09-08 14:21   ` Uladzislau Rezki
2026-09-09  1:08     ` Hillf Danton
2026-09-14 16:56       ` Uladzislau Rezki
2026-09-16  0:12         ` Hillf Danton
2026-09-16 16:00           ` Uladzislau Rezki [this message]
2026-09-17  0:07             ` Hillf Danton
2026-09-10  8:33 ` Ye Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqq9FM3ti6NIHxQ0@milan \
    --to=urezki@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=dev.jain@arm.com \
    --cc=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lirongqing@baidu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®