[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyC_9JemZdv4Gp4XG7BqLc72bS1uM8xv9vpQtSsyhefZvQ@mail.gmail.com>
Date: Tue, 26 Dec 2023 17:14:18 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: linux-kernel@...r.kernel.org, Naohiro.Aota@....com, kernel-team@...a.com
Subject: Re: [PATCH 08/10] workqueue: Introduce struct wq_node_nr_active
On Wed, Dec 20, 2023 at 3:26 PM Tejun Heo <tj@...nel.org> wrote:
> @@ -1498,12 +1539,21 @@ static bool pwq_tryinc_nr_active(struct pool_workqueue *pwq)
> {
> struct workqueue_struct *wq = pwq->wq;
> struct worker_pool *pool = pwq->pool;
> - bool obtained;
> + struct wq_node_nr_active *nna = wq_node_nr_active(wq, pool->node);
> + bool obtained = false;
>
> lockdep_assert_held(&pool->lock);
>
> - obtained = pwq->nr_active < wq->max_active;
> + if (!nna) {
> + /* per-cpu workqueue, pwq->nr_active is sufficient */
> + obtained = pwq->nr_active < wq->max_active;
> + goto out;
> + }
For unbound workqueue, it is not checked against wq->max_active anymore
and it is increased unconditionally. Is it by design?
> +
> + atomic_inc(&nna->count);
> + obtained = true;
>
> +out:
> if (obtained)
> pwq->nr_active++;
> return obtained;
Powered by blists - more mailing lists