From: Tejun Heo <tj@kernel.org>
To: Waiman Long <longman@redhat.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
linux-kernel@vger.kernel.org, Juri Lelli <juri.lelli@redhat.com>,
Cestmir Kalina <ckalina@redhat.com>,
Alex Gladkov <agladkov@redhat.com>, Phil Auld <pauld@redhat.com>,
Costa Shulyupin <cshulyup@redhat.com>
Subject: Re: [PATCH wq/for-6.9 v5 2/4] workqueue: Enable unbound cpumask update on ordered workqueues
Date: Thu, 8 Feb 2024 07:42:27 -1000 [thread overview]
Message-ID: <ZcUSg1t-hXbZXsKj@slm.duckdns.org> (raw)
In-Reply-To: <20240208161014.1084943-3-longman@redhat.com>
Hello,
Generally looks good to me. Minor nits below:
On Thu, Feb 08, 2024 at 11:10:12AM -0500, Waiman Long wrote:
> +static void unplug_oldest_pwq(struct workqueue_struct *wq)
> +{
> + struct pool_workqueue *pwq;
> + unsigned long flags;
> +
> + lockdep_assert_held(&wq->mutex);
> +
> + pwq = list_first_entry_or_null(&wq->pwqs, struct pool_workqueue,
> + pwqs_node);
> + if (WARN_ON_ONCE(!pwq))
> + return;
> + raw_spin_lock_irqsave(&pwq->pool->lock, flags);
Can we do raw_spin_lock_irq() instead?
> @@ -4740,6 +4784,13 @@ static void pwq_release_workfn(struct kthread_work *work)
> mutex_lock(&wq->mutex);
> list_del_rcu(&pwq->pwqs_node);
> is_last = list_empty(&wq->pwqs);
> +
> + /*
> + * For ordered workqueue with a plugged dfl_pwq, restart it now.
> + */
> + if (!is_last && (wq->flags & __WQ_ORDERED))
> + unplug_oldest_pwq(wq);
I'm not so sure about is_last test here. unplug_oldest_pwq() is testing for
NULL anyway, so maybe just drop this test here and drop WARN_ON_ONCE()
there?
> @@ -4966,6 +5017,15 @@ apply_wqattrs_prepare(struct workqueue_struct *wq,
> cpumask_copy(new_attrs->__pod_cpumask, new_attrs->cpumask);
> ctx->attrs = new_attrs;
>
> + /*
> + * For initialized ordered workqueues, there is only one pwq (dfl_pwq).
> + * Set the plugged flag of ctx->dfl_pwq to suspend execution of newly
> + * queued work items until execution of older work items in the old
> + * pwq's have completed.
> + */
> + if (!list_empty(&wq->pwqs) && (wq->flags & __WQ_ORDERED))
> + ctx->dfl_pwq->plugged = true;
Can we test __WQ_ORDERED first?
Thanks.
--
tejun
next prev parent reply other threads:[~2024-02-08 17:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 16:10 [PATCH wq/for-6.9 v5 0/4] " Waiman Long
2024-02-08 16:10 ` [PATCH wq/for-6.9 v5 1/4] workqueue: Link pwq's into wq->pwqs from oldest to newest Waiman Long
2024-02-08 16:10 ` [PATCH wq/for-6.9 v5 2/4] workqueue: Enable unbound cpumask update on ordered workqueues Waiman Long
2024-02-08 17:42 ` Tejun Heo [this message]
2024-02-08 16:10 ` [PATCH wq/for-6.9 v5 3/4] kernel/workqueue: Let rescuers follow unbound wq cpumask changes Waiman Long
2024-02-08 16:10 ` [PATCH wq/for-6.9 v5 4/4] workqueue: Bind unbound workqueue rescuer to wq_unbound_cpumask Waiman Long
2024-02-08 19:12 ` [PATCH wq/for-6.9 v6 2/4] workqueue: Enable unbound cpumask update on ordered workqueues Waiman Long
2024-02-08 19:26 ` [PATCH wq/for-6.9 v5 0/4] " Tejun Heo
2024-02-08 19:33 ` Waiman Long
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=ZcUSg1t-hXbZXsKj@slm.duckdns.org \
--to=tj@kernel.org \
--cc=agladkov@redhat.com \
--cc=ckalina@redhat.com \
--cc=cshulyup@redhat.com \
--cc=jiangshanlai@gmail.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=pauld@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®