From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 64C6C311C32 for ; Sat, 21 Mar 2026 18:28:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774117681; cv=none; b=YUoV3aOzRYTN79pYbYbUl/DcDpWheHdZiIErlpTKAjQciQPjb6NNxv2THXSnsdgBHTEXLU8LBnoO7dIynYzBqah2j297jKMj+dw1RBLzSB86Pcty7C+hMO7bPp8bgIVW7DBpDjuzluPY4lYVsGSpaAEMlpDckl4wCpaamnmTBZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774117681; c=relaxed/simple; bh=6B+V1LRyBwFqng6bjuK8aSCcwdsBfiRqvtx7f5x7xQY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L+AO2rrpGjBqK68zOCV+1nvNcjXdU2gLV7okEeUD2dNile1noEx5K/2xjc/G5hUMxnX4kqqDaYe71I+LThq6j2gI31spGqZ4nEmHDmy2GjmWeoJX6Zt4k1itLJ71XiUmoBS+sAQaVKLydq2rrIW6Ls4YE5Wwpgm8/U7OspykNls= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iUFbw3P1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iUFbw3P1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF933C19421; Sat, 21 Mar 2026 18:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774117681; bh=6B+V1LRyBwFqng6bjuK8aSCcwdsBfiRqvtx7f5x7xQY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iUFbw3P1JKB9EJHKRBfU2J8WFZplR/OZzA4Fq1bibMXU08kfD+frIyF8TS4XV7xE2 vaqidmY/Mt6+X2+nDIx2szhrBaSjpJJHvXXDIuI99R49J3tNiKZC2+WzMNQSO9NK9B d9UTk0MRchdzSAxehA7R+z3wsP16L806w8lTCGYgly9sJnuSnKUMKV2WR/daUu7i8+ t7ep0+F6bZZkcnIH3INADe9J2MYARBLG0O/Ni/iPpFUP8smI3hnaHrQGDMZFnco8l3 AA3XGHfs0ywjplHtDi4KQYzAchaBnjk2xfxU2sBsxnhwk53Uv2Z2wa1zi4AJwDFlL2 J2ODG9R4cXcgQ== Date: Sat, 21 Mar 2026 08:27:59 -1000 From: Tejun Heo To: Song Liu Cc: linux-kernel@vger.kernel.org, jiangshanlai@gmail.com, leitao@debian.org, pmladek@suse.com, kernel-team@meta.com, puranjay@kernel.org Subject: Re: [PATCH] workqueue: Fix false positive stall reports Message-ID: References: <20260320192332.1726079-1-song@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260320192332.1726079-1-song@kernel.org> Hello, On Fri, Mar 20, 2026 at 12:23:32PM -0700, Song Liu wrote: > index b77119d71641..5b501ff1223a 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -7701,6 +7701,23 @@ static void wq_watchdog_timer_fn(struct timer_list *unused) > > /* did we stall? */ > if (time_after(now, ts + thresh)) { > + unsigned long irq_flags; > + > + raw_spin_lock_irqsave(&pool->lock, irq_flags); Can you use guard() instead? I don't think we can just keep the lock in the block. > + /* > + * Recheck last_progress_ts with pool->lock, this > + * eliminates false positive where we report wq > + * stall for newly queued work. > + */ And I think this deserves a bit more explanation. Can you move this comment outside the block where /* did we stall? */ is and give the scenario where it can go wrong w/o the locked check? > + pool_ts = READ_ONCE(pool->last_progress_ts); pool->last_progress_ts is write protected by pool lock. No need for READ_ONCE(). > + if (time_after(pool_ts, touched)) > + ts = pool_ts; > + else > + ts = touched; > + raw_spin_unlock_irqrestore(&pool->lock, irq_flags); > + if (!time_after(now, ts + thresh)) > + continue; Thanks. -- tejun