The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Zqiang <qiang1.zhang@intel.com>
Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: Create kworker only for boot CPU pool prior SMP initialization
Date: Mon, 4 Apr 2022 07:40:04 -1000	[thread overview]
Message-ID: <YkstdEGbfg9PAKKc@slm.duckdns.org> (raw)
In-Reply-To: <20220331131435.2864347-1-qiang1.zhang@intel.com>

On Thu, Mar 31, 2022 at 09:14:35PM +0800, Zqiang wrote:
> The workqueue_init() is called before SMP initialization, which
> means only the boot CPU is online, just create kworker for boot
> CPU pool.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>  kernel/workqueue.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index abcc9a2ac319..3948babe02d5 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -6120,11 +6120,9 @@ void __init workqueue_init(void)
>  	mutex_unlock(&wq_pool_mutex);
>  
>  	/* create the initial workers */
> -	for_each_online_cpu(cpu) {
> -		for_each_cpu_worker_pool(pool, cpu) {
> -			pool->flags &= ~POOL_DISASSOCIATED;
> -			BUG_ON(!create_worker(pool));
> -		}
> +	for_each_cpu_worker_pool(pool, smp_processor_id()) {
> +		pool->flags &= ~POOL_DISASSOCIATED;
> +		BUG_ON(!create_worker(pool));

I mean, I guess this would work but what's the benefit? It doesn't make any
practical difference and the code is now more fragile to external changes.

Thanks.

-- 
tejun

      reply	other threads:[~2022-04-04 22:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-31 13:14 [PATCH] workqueue: Create kworker only for boot CPU pool prior SMP initialization Zqiang
2022-04-04 17:40 ` Tejun Heo [this message]

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=YkstdEGbfg9PAKKc@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=qiang1.zhang@intel.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