From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-kernel@vger.kernel.org,
Lai Jiangshan <jiangshan.ljs@antgroup.com>,
Waiman Long <longman@redhat.com>
Subject: Re: [PATCH 2/6] workqueue: Protect wq_unbound_cpumask with wq_pool_attach_mutex in init_rescuer()
Date: Wed, 3 Jul 2024 08:28:12 -1000 [thread overview]
Message-ID: <ZoWYPMGVIvOV4o8x@slm.duckdns.org> (raw)
In-Reply-To: <20240703033855.3373-3-jiangshanlai@gmail.com>
Hello, Lai.
On Wed, Jul 03, 2024 at 11:38:51AM +0800, Lai Jiangshan wrote:
> @@ -5533,6 +5533,9 @@ static int init_rescuer(struct workqueue_struct *wq)
> return ret;
> }
>
> + /* lock wq_pool_attach_mutex for wq_unbound_cpumask */
> + mutex_lock(&wq_pool_attach_mutex);
> +
> wq->rescuer = rescuer;
> if (wq->flags & WQ_UNBOUND)
> kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
> @@ -5540,6 +5543,8 @@ static int init_rescuer(struct workqueue_struct *wq)
> kthread_bind_mask(rescuer->task, cpu_possible_mask);
> wake_up_process(rescuer->task);
>
> + mutex_unlock(&wq_pool_attach_mutex);
> +
Isn't that just protecting the reads on wq_unbound_cpumask? I don't
understand what this protects against. Shouldn't the interlocking be
something like "either new rescuer reads the updated cpumask or the
workqueue is already on the workqueue list"?
Thanks.
--
tejun
next prev parent reply other threads:[~2024-07-03 18:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-03 3:38 [PATCH 0/6] workqueue: Make the PWQ allocation and WQ enlistment atomic Lai Jiangshan
2024-07-03 3:38 ` [PATCH 1/6] workqueue: Register sysfs after the whole creation of the new wq Lai Jiangshan
2024-07-03 3:38 ` [PATCH 2/6] workqueue: Protect wq_unbound_cpumask with wq_pool_attach_mutex in init_rescuer() Lai Jiangshan
2024-07-03 15:14 ` Waiman Long
2024-07-03 18:28 ` Tejun Heo [this message]
2024-07-03 3:38 ` [PATCH 3/6] workqueue: Separate out destroy_rescuer() Lai Jiangshan
2024-07-03 3:38 ` [PATCH 4/6] workqueue: Init rescuer before alloc and link pwqs Lai Jiangshan
2024-07-03 3:38 ` [PATCH 5/6] workqueue: Move kthread_flush_worker() out of alloc_and_link_pwqs() Lai Jiangshan
2024-07-03 3:38 ` [PATCH 6/6] workqueue: Put PWQ allocation and WQ enlistment in the same lock C.S Lai Jiangshan
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=ZoWYPMGVIvOV4o8x@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshan.ljs@antgroup.com \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.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®