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 322843793CD; Mon, 23 Feb 2026 20:44:28 +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=1771879471; cv=none; b=u8Hrs1HVvwWsfoKyX1LanS2LP/rcvzGJ6xjVliwb00ZO27w99EB3DizjGfYyCwno4vqCVpVhUuJL1ytCE5OJM345JyhC0ZtU0868atFxBxYlPiT5XkqtvQNm8UxL5ytcwy8hZD4qkyBTApn+TAKsZ6UUxeZOrAia81EP2p+q8jQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771879471; c=relaxed/simple; bh=g+FaGF4g9w6n1f27Rf1cUEUGTAf2ELZ5LZvlfDFrTtk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=t0qpKpBP/vXQXPgX6KN1YHYqGjBatKdrbMfC8pv8uzlOxAbb13MJinmVPB/zchhHZk59Xnuis1bMUn0N24Snj/CzYcv6UClNkVFDptRWtSZCPwsb+RG0d2uTZwAX/mbaaZ13RLbBvZYB+81Pyum1uUXzehQGcjvKBGhLDRL8MwY= 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=g58SLHS1; 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="g58SLHS1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1771879461; bh=LzrTBUBA9Xan0G/6dErkCnhzk9YByLdnZjMaMmM4OD0=; h=From:To:Cc:Subject:Date:From; b=g58SLHS1WmcC/+tCAn/vwRtUYUR4EZ2G+eGA0Mm7zzs/IussNdmSyMeyLoFZ8Kn5F XUB8ixuMvQDjZaYpxqzzezrqkImKDTttx9YQoKIjKaKPjnGjs5uzSDK+YAQkiC71GY BmOkvqpJ3JwovwqCqCS2uQv3mEuylEA9nRYly6n8Bmnes8Tvn8rDlkdNhws98NBd1A RTiIB4o0E7k8/t1nxbZRt3EbxASXbrj5kyNFLitbO/fv0kggeeqvHQUSvk4hXXoRI8 1UbdHbXT1gXNPgJS7Q6xvrSwmo9FU/uz2qS4XZRnF1HL2GRcQJeGbT7pKzYWa/yEl+ T1yceLaLrW/jA== Received: from thinkos.internal.efficios.com (mtl.efficios.com [216.120.195.104]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4fKXs10WhhzGXN; 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 0/2] Hazard Pointers Date: Mon, 23 Feb 2026 15:44:16 -0500 Message-Id: <20260223204418.1429025-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Here is a v5 of my Hazard Pointers series. I know Boqun has a use case for it for lockdep. This new version has those significant changes since v4: - Fold scheduler integration. - Actually set ctx slot to backup slot on context switch. - Remove CONFIG_PREEMPT_HAZPTR config option. - Use per-cpu ctx pointers for context switch slot tracking rather than per-task lists. This accelerates the hazptr acquire/release fast-path. - Guarantee scan forward progress with two-lists scheme. - Reimplement the hazptr acquire with a temporary wildcard to eliminate a dependency on the addr_p load, likely to cause a pipeline stall due to the needed memory barrier. This simplifies the algorithm, removes the need for pointer re-load + comparison, and is expected to be faster on some architectures. - Reduce number of percpu slots to 4, introduce a hazptr_slot_item struct to contain both the slot and ctx pointers. Reducing number of slots to 4 makes sure all the slot and ctx pointers fit in a single cache line. - Rebased on v7.0-rc1. Feedback is welcome, Thanks, Mathieu Cc: Nicholas Piggin Cc: Michael Ellerman Cc: Greg Kroah-Hartman Cc: Sebastian Andrzej Siewior Cc: "Paul E. McKenney" Cc: Will Deacon Cc: Peter Zijlstra Cc: Boqun Feng Cc: Alan Stern Cc: John Stultz Cc: Linus Torvalds Cc: Andrew Morton Cc: Frederic Weisbecker Cc: Joel Fernandes Cc: Josh Triplett Cc: Uladzislau Rezki Cc: Steven Rostedt Cc: Lai Jiangshan Cc: Zqiang Cc: Ingo Molnar Cc: Waiman Long Cc: Mark Rutland Cc: Thomas Gleixner Cc: Vlastimil Babka Cc: maged.michael@gmail.com Cc: Mateusz Guzik Cc: Jonas Oberhauser Cc: rcu@vger.kernel.org Cc: linux-mm@kvack.org Cc: lkmm@lists.linux.dev Mathieu Desnoyers (2): hazptr: Implement Hazard Pointers hazptr: Add refscale test include/linux/hazptr.h | 197 +++++++++++++++++++++++++++++++++ init/main.c | 2 + kernel/Makefile | 2 +- kernel/hazptr.c | 242 +++++++++++++++++++++++++++++++++++++++++ kernel/rcu/refscale.c | 43 ++++++++ kernel/sched/core.c | 2 + 6 files changed, 487 insertions(+), 1 deletion(-) create mode 100644 include/linux/hazptr.h create mode 100644 kernel/hazptr.c -- 2.39.5