From: Nguyen Ngoc Thang <ngocthang2710.1999@gmail.com>
To: Breno Leitao <leitao@debian.org>
Cc: Tejun Heo <tj@kernel.org>, Lai Jiangshan <jiangshanlai@gmail.com>,
linux-kernel@vger.kernel.org,
syzbot+8922e6b8343f70be92e8@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] workqueue: annotate the lockless nr_running increment racing with need_more_worker()
Date: Wed, 14 Oct 2026 22:44:23 +0700 [thread overview]
Message-ID: <20261014154423.20915-1-ngocthang2710.1999@gmail.com> (raw)
In-Reply-To: <20261013112905.9673-1-ngocthang2710.1999@gmail.com>
On Wed, Oct 14, 2026, Breno Leitao wrote:
> Isn't it better to annotate the nr_running field in the structure, rather than
> at reading time?
Agreed. The lockless increment is how nr_running is meant to work, so
the field is the right place for the annotation. v3 marks it
__data_racy and drops the data_race() in need_more_worker():
https://lore.kernel.org/all/20261014154342.20661-1-ngocthang2710.1999@gmail.com/
The trade-off is that KCSAN now ignores every access to nr_running,
including the locked ones. If someone later adds a decrement without
pool->lock, KCSAN won't catch it. I think that's acceptable, because
the rules are documented right above the field.
Thanks,
Nguyen Ngoc Thang
prev parent reply other threads:[~2026-10-14 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 11:29 Nguyen Ngoc Thang
2026-10-14 9:19 ` Breno Leitao
2026-10-14 15:44 ` Nguyen Ngoc Thang [this message]
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=20261014154423.20915-1-ngocthang2710.1999@gmail.com \
--to=ngocthang2710.1999@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+8922e6b8343f70be92e8@syzkaller.appspotmail.com \
--cc=tj@kernel.org \
/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®