From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.18]) (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 0BCA9378D70; Mon, 23 Feb 2026 20:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=158.69.130.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771879473; cv=none; b=gBtWM9HEVVHGYCy2K/DH60qnEWTmOBzz8jjepoSdganMnboUQTd0v/VTzfJua3+8s0WFoCPrPKNlf5Lv+9B1aQsa74RSxdVMb7j8/OZb/XsAMR6+eS/3dP7DYlHyos6VMIoUpqCHZzkB+0PMHbEoiE1OHLbrtoMua3xKp0MYW2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771879473; c=relaxed/simple; bh=KRLeC9uIYhTend5uWbzrq9B2XZ0mtJpwAALcypC0Bbc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XmgHUpQGT27h5L4R+wB2JOjSeJYqJEfTMw52u4xT9WsjGXprrEjK+o+eUSTrdWIoAj/Vlqt8GxjqtAWgJj27u07TufHZ/UoM7BtYyZtFMNVgmjqjfkiNWKPD0J40QnrFu6wZD3OWtAJ3oJchhROKkParHT1ANXrQ0mkmyC1flb8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=aoGj60zs; arc=none smtp.client-ip=158.69.130.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="aoGj60zs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1771879461; bh=KyTEEaoXAAyCQz7ZsgcVYW88Dh1Bs2/KiZ/NYa4dnJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aoGj60zs4KFIYxAUrRWU6lEvNVCe3z+VyrASWTHF+XgH58FbnH/OrB8z+3vOzmvP8 JMsxujoo9dt8RcFHa5fxdRwn80Lc9s9Y93bCTENVz/WqCwliCOiQDS0bXovc2us1FV ncGIF3lsVuR2iLlwm2pya7s+JXnESfpkoeQo3DIoWcyQgHF+ZKJUM0DUae8Qz8Xxm1 XH2sQ0IA4rSLNY4uksDZ/2lh2aUOL4orhYx8pXWyy/rEfJBkZ5vequihw1xAFNy3WK 7RKqWoXx8Z4GXP6xaS36EzKG2f4eVdTVa3RmO8LNcOl69uV07hUyUEoEOTS6e05rDo +XtYiSzPTdszw== Received: from thinkos.internal.efficios.com (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4fKXs12rh7zHyx; Mon, 23 Feb 2026 15:44:21 -0500 (EST) From: Mathieu Desnoyers To: Boqun Feng Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Nicholas Piggin , Michael Ellerman , Greg Kroah-Hartman , Sebastian Andrzej Siewior , "Paul E. McKenney" , Will Deacon , Peter Zijlstra , Alan Stern , John Stultz , Linus Torvalds , Andrew Morton , Frederic Weisbecker , Joel Fernandes , Josh Triplett , Uladzislau Rezki , Steven Rostedt , Lai Jiangshan , Zqiang , Ingo Molnar , Waiman Long , Mark Rutland , Thomas Gleixner , Vlastimil Babka , maged.michael@gmail.com, Mateusz Guzik , Jonas Oberhauser , rcu@vger.kernel.org, linux-mm@kvack.org, lkmm@lists.linux.dev Subject: [RFC PATCH v5 2/2] hazptr: Add refscale test Date: Mon, 23 Feb 2026 15:44:18 -0500 Message-Id: <20260223204418.1429025-3-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260223204418.1429025-1-mathieu.desnoyers@efficios.com> References: <20260223204418.1429025-1-mathieu.desnoyers@efficios.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add the refscale test for hazptr to measure the reader side performance. Signed-off-by: Mathieu Desnoyers Co-developed-by: Boqun Feng --- kernel/rcu/refscale.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c index c158b6a947cd..7d64dfe78327 100644 --- a/kernel/rcu/refscale.c +++ b/kernel/rcu/refscale.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -1210,6 +1211,47 @@ static const struct ref_scale_ops typesafe_seqlock_ops = { .name = "typesafe_seqlock" }; +static void ref_hazptr_read_section(const int nloops) +{ + static void *ref_hazptr_read_section_ptr = ref_hazptr_read_section; + int i; + + for (i = nloops; i >= 0; i--) { + struct hazptr_ctx ctx; + void *addr; + + addr = hazptr_acquire(&ctx, &ref_hazptr_read_section_ptr); + hazptr_release(&ctx, addr); + } +} + +static void ref_hazptr_delay_section(const int nloops, const int udl, const int ndl) +{ + static void *ref_hazptr_delay_section_ptr = ref_hazptr_delay_section; + int i; + + for (i = nloops; i >= 0; i--) { + struct hazptr_ctx ctx; + void *addr; + + addr = hazptr_acquire(&ctx, &ref_hazptr_delay_section_ptr); + un_delay(udl, ndl); + hazptr_release(&ctx, addr); + } +} + +static bool ref_hazptr_init(void) +{ + return true; +} + +static const struct ref_scale_ops hazptr_ops = { + .init = ref_hazptr_init, + .readsection = ref_hazptr_read_section, + .delaysection = ref_hazptr_delay_section, + .name = "hazptr" +}; + static void rcu_scale_one_reader(void) { if (readdelay <= 0) @@ -1524,6 +1566,7 @@ ref_scale_init(void) &sched_clock_ops, &clock_ops, &jiffies_ops, &preempt_ops, &bh_ops, &irq_ops, &irqsave_ops, &typesafe_ref_ops, &typesafe_lock_ops, &typesafe_seqlock_ops, + &hazptr_ops, }; if (!torture_init_begin(scale_type, verbose)) -- 2.39.5