From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mout-y-111.mailbox.org (mout-y-111.mailbox.org [91.198.250.236]) (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 2EDA63D093C; Mon, 6 Jul 2026 06:47:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.198.250.236 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783320467; cv=none; b=FzHvtSHDvGj6A6yAE6ALBlilsOeENsA27ikyWBA7em5DVrhdHnBJjRD7Fy37ICLXi9q9+pbj8yC/v8+//oixYZFoWhYGCN0YIFFZDqHlRzvALSnERMQYtZFP2oA6nfjJZSySGooj0A/fSwy8cVMqmPGAvAm19zOQFNCr6qKDJ1c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783320467; c=relaxed/simple; bh=/PtvR2dnazpQOJk7UFgwLIewlTHNG+dDvVdArf0En58=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L+6zvn9GJrshDVnaA1vz/QpQwCkN7hR0x09fuw6bvzhwEhgHsVF7MQXaQAKK/DTISKI0xbevxKEkplHB1mQiR563wdAd0+LBZbNpIyDYazB1OmLFkKsvsktwDDLU4wCApS2POqbExHjqPyP9oukrM7XhNR9KZQl0O7g7aoNrGBA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mavick.dev; spf=pass smtp.mailfrom=mavick.dev; arc=none smtp.client-ip=91.198.250.236 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mavick.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mavick.dev Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (No client certificate requested) by mout-y-111.mailbox.org (Postfix) with ESMTPS id 4gt66h15Y2zMlf2; Sun, 05 Jul 2026 01:20:28 +0200 (CEST) From: Eugene Mavick Date: Sun, 05 Jul 2026 07:19:22 +0800 Subject: [PATCH 3/4] percpu-refcount: add ref_trace_final_put trace Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260705-refcount-final-put-trace-v1-3-cdd0014626a9@mavick.dev> References: <20260705-refcount-final-put-trace-v1-0-cdd0014626a9@mavick.dev> In-Reply-To: <20260705-refcount-final-put-trace-v1-0-cdd0014626a9@mavick.dev> To: Will Deacon , Peter Zijlstra , Boqun Feng , Mark Rutland , Gary Guo , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Andrew Morton , Dennis Zhou , Tejun Heo , Christoph Lameter Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-mm@kvack.org, Eugene Mavick X-Developer-Signature: v=1; a=openpgp-sha256; l=1195; i=m@mavick.dev; h=from:subject:message-id; bh=/PtvR2dnazpQOJk7UFgwLIewlTHNG+dDvVdArf0En58=; b=owGbwMvMwCU2V/5U3e1aE3/G02pJDFmeU5lWFh5nbLEtyaku9NspuYY/XsDL2NNow+y1V7ec9 DrzwjOro5SFQYyLQVZMkaUmK8E9Y+WsROOjk3pg5rAygQxh4OIUgIn0L2H477xezNv04g6u40f2 lCbH/+CcH5MerNTyTCQ1O351Krv0VoZ/2kLZM/VNEoJ/LDFl4Ig4cjLFZBrDE7H5t23u+r2yn87 FDAA= X-Developer-Key: i=m@mavick.dev; a=openpgp; fpr=7C6A604768A99A6133C5928C9D1FCA7EDB7D344F Add the ref_trace_final_put tracepoint to percpu_ref_put_many(). The tracepoint fires when the atomic counter reaches zero in the atomic fallback path (after percpu_ref_kill() has been called). Signed-off-by: Eugene Mavick --- include/linux/percpu-refcount.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/percpu-refcount.h b/include/linux/percpu-refcount.h index d73a1c08c3e3..55543ecdf60c 100644 --- a/include/linux/percpu-refcount.h +++ b/include/linux/percpu-refcount.h @@ -55,6 +55,7 @@ #include #include #include +#include struct percpu_ref; typedef void (percpu_ref_func_t)(struct percpu_ref *); @@ -331,8 +332,10 @@ static inline void percpu_ref_put_many(struct percpu_ref *ref, unsigned long nr) if (__ref_is_percpu(ref, &percpu_count)) this_cpu_sub(*percpu_count, nr); - else if (unlikely(atomic_long_sub_and_test(nr, &ref->data->count))) + else if (unlikely(atomic_long_sub_and_test(nr, &ref->data->count))) { + trace_ref_final_put(ref); ref->data->release(ref); + } rcu_read_unlock(); } -- 2.51.2