From nobody Mon Feb 9 16:18:14 2026 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 07ECE134CB for ; Wed, 30 Apr 2025 01:05:27 +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=1745975127; cv=none; b=iMXspUzqlTrL8XuF1SCGbDff2C/mliCHijTm0arSXhAOBRd1IgchB0HzWDAP0nyLgq5eDJfF4It69kky+Qo6DM3m337bvqhXeXBVkq1okeFz+R6Zmk2KhUqizSXgO8fhWE4ome4hFZr//LbZ4/vrwc6hx4rMMiEtXWZ2qINd7QA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745975127; c=relaxed/simple; bh=drIhZlz6qjJXl6CfFVToJFT9tX9Y5dyNfzQrE+P3u7o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TvymNZ79VCtwKK3JOIAauBJZmCfO2gzJH4SM+H/nDbuC+IqRY2ItGalxGhdNBgI/kM4cW/sVUV9/3j3VjdD+03hvu41D8kR0CX/J/YwVNb8WxxK4sGiAOJ+/hsRzLbTBqlhyU95/GvMKx5mtUAbtVZDUpEVBlzrDhG9C33MX9hM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZYO3AJC6; 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="ZYO3AJC6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBF39C4CEE3; Wed, 30 Apr 2025 01:05:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1745975126; bh=drIhZlz6qjJXl6CfFVToJFT9tX9Y5dyNfzQrE+P3u7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYO3AJC6RXPJeaS+caIxQrzhTeKEi94FbgC1Uc0iLBoCA9Zlwz2uW+qGjfMy23MoH d/FukNP/1PD10TRwKVeS3SJ0FrP0lDcjL/M3fNSZ80DhXg7Amzv3aW8oEi52P7Musl 8vJ1mBpFZ3ZP2gBr/1SE8Gxbc/XEmn0ac4fpCFd3k4YDkYoLUTIrBefLx4xmPGRXHf wwaZ5gVACPV+52BuXVgLfFBeQzJS41F+c5lhjTn/98IUwFJ6uPUbKRdm7baj3vNpcA 4UDh7yJAbIG2288Fz9h2fSgCbDbCAHDzwUYVKHrCQsrHJEcRjrRDyaTHN7shzllQcW qSbbWYc511zPQ== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 7B7DDCE0E61; Tue, 29 Apr 2025 18:05:25 -0700 (PDT) From: "Paul E. McKenney" To: linux-kernel@vger.kernel.org Cc: kernel-team@meta.com, Andrew Morton , Kuniyuki Iwashima , Mateusz Guzik , Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky , Jon Pan-Doh , Bjorn Helgaas , Karolina Stolarek , "Paul E. McKenney" Subject: [PATCH v4 07/20] ratelimit: Count misses due to lock contention Date: Tue, 29 Apr 2025 18:05:11 -0700 Message-Id: <20250430010524.3614408-7-paulmck@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The ___ratelimit() function simply returns zero ("do ratelimiting") if the trylock fails, but does not adjust the ->missed field. This means that the resulting dropped printk()s are dropped silently, which could seriously confuse people trying to do console-log-based debugging. Therefore, increment the ->missed field upon trylock failure. Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paul= mck-laptop/ Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/ Signed-off-by: Paul E. McKenney Reviewed-by: Petr Mladek Cc: Andrew Morton Cc: Kuniyuki Iwashima Cc: Mateusz Guzik Cc: Steven Rostedt Cc: John Ogness Cc: Sergey Senozhatsky --- lib/ratelimit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ratelimit.c b/lib/ratelimit.c index 18703f92d73e7..19ad3cdbd1711 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c @@ -44,8 +44,10 @@ int ___ratelimit(struct ratelimit_state *rs, const char = *func) * in addition to the one that will be printed by * the entity that is holding the lock already: */ - if (!raw_spin_trylock_irqsave(&rs->lock, flags)) + if (!raw_spin_trylock_irqsave(&rs->lock, flags)) { + ratelimit_state_inc_miss(rs); return 0; + } =20 if (!rs->begin) rs->begin =3D jiffies; --=20 2.40.1