All of lore.kernel.org
 help / color / mirror / Atom feed
From: Breno Leitao <leitao@debian.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	 Yao Kai <yaokai34@huawei.com>,
	liuyongqiang <liuyongqiang13@huawei.com>
Subject: Re: [PATCH 2/3] workqueue: Maintain pwq->total_in_flight
Date: Wed, 9 Sep 2026 04:40:55 -0700	[thread overview]
Message-ID: <aqFEOlDD8PfMfnqz@gmail.com> (raw)
In-Reply-To: <20260901210929.3092513-3-tj@kernel.org>

On Tue, Sep 01, 2026 at 11:09:28AM -1000, Tejun Heo wrote:
> pwq_busy() scans all of pwq->nr_in_flight[] to tell whether anything is in
> flight. Maintain the sum in pwq->total_in_flight, which fits in existing
> padding, and test that instead.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>

Reviewed-by: Breno Leitao <leitao@debian.org>

I've found that the color is either used as 'unsigned int', and
sometimes as 'int'.

The color is 'int' in get_work_color(), work_color_to_flags(),
work_next_color(), in the work_color/flush_color fields of
pool_workqueue, workqueue_struct and wq_flusher, and in the
flush_workqueue_prep_pwqs() parameters - but it is 'unsigned int' in
worker->current_color and in insert_wq_barrier()'s local, which is one
of the two callers you're converting.

It's not a big deal: the value wraps at WORK_NR_COLORS, so it is always
[0, 15] and everything round-trips. It does leave oddities like

        worker->current_color = INT_MAX;

storing INT_MAX into an unsigned int. I may send a patch later to make
them all the same type - it would have to be 'int', since -1 is a live
sentinel for flush_color and flush_workqueue_prep_pwqs() documents "<
0 for no-op".

  reply	other threads:[~2026-09-09 11:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 21:09 [PATCHSET wq/for-7.4] workqueue: Make flush_workqueue() cost scale with active pwqs Tejun Heo
2026-09-01 21:09 ` [PATCH 1/3] workqueue: Add for_each_node_with_fallback() Tejun Heo
2026-09-09 11:01   ` Breno Leitao
2026-09-01 21:09 ` [PATCH 2/3] workqueue: Maintain pwq->total_in_flight Tejun Heo
2026-09-09 11:40   ` Breno Leitao [this message]
2026-09-01 21:09 ` [PATCH 3/3] workqueue: Make flush_workqueue() visit only pwqs active since the last flush Tejun Heo
2026-09-10 10:53   ` Breno Leitao
2026-09-08 17:33 ` [PATCHSET wq/for-7.4] workqueue: Make flush_workqueue() cost scale with active pwqs Tejun Heo
2026-09-09 10:32 ` Breno Leitao

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=aqFEOlDD8PfMfnqz@gmail.com \
    --to=leitao@debian.org \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyongqiang13@huawei.com \
    --cc=tj@kernel.org \
    --cc=yaokai34@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.