[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZcUSg1t-hXbZXsKj@slm.duckdns.org>
Date: Thu, 8 Feb 2024 07:42:27 -1000
From: Tejun Heo <tj@...nel.org>
To: Waiman Long <longman@...hat.com>
Cc: Lai Jiangshan <jiangshanlai@...il.com>, linux-kernel@...r.kernel.org,
Juri Lelli <juri.lelli@...hat.com>,
Cestmir Kalina <ckalina@...hat.com>,
Alex Gladkov <agladkov@...hat.com>, Phil Auld <pauld@...hat.com>,
Costa Shulyupin <cshulyup@...hat.com>
Subject: Re: [PATCH wq/for-6.9 v5 2/4] workqueue: Enable unbound cpumask
update on ordered workqueues
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
Powered by blists - more mailing lists