Re: [PATCH v2] workqueue: annotate the lockless nr_running increment racing with need_more_worker()
From: Breno Leitao
Date: Wed Oct 14 2026 - 05:20:47 EST
On Tue, Oct 13, 2026 at 06:29:05PM +0700, Nguyen Ngoc Thang wrote:
> static bool need_more_worker(struct worker_pool *pool)
> {
> - return !list_empty(&pool->worklist) && !pool->nr_running;
> + /* Racy against the lockless increment, see @nr_running. */
> + return !list_empty(&pool->worklist) && !data_race(pool->nr_running);
Isn't it better to annotate the nr_running field in the structure, rather than
at reading time?