From patchwork Wed Oct 2 01:02:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mathieu Desnoyers X-Patchwork-Id: 13819083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25CCECF318C for ; Wed, 2 Oct 2024 01:04:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46998680045; Tue, 1 Oct 2024 21:04:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CC5868002B; Tue, 1 Oct 2024 21:04:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E449C680049; Tue, 1 Oct 2024 21:04:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id ACDEB68002B for ; Tue, 1 Oct 2024 21:04:43 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 6DEDFA0701 for ; Wed, 2 Oct 2024 01:04:43 +0000 (UTC) X-FDA: 82626867246.09.87D90C8 Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) by imf06.hostedemail.com (Postfix) with ESMTP id C6871180004 for ; Wed, 2 Oct 2024 01:04:40 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=TGhD7H5X; spf=pass (imf06.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727831016; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=4hBN7q7r/USTgMB8tQmDAaOl/T0ZYeRa7dl2ifblfUk=; b=Eg2XJMPq/ZUMLBic6ytimssc5oDXvOq02QbA2Fiz1CETUCgU+AxXujmGIuNE+oTkT5dk+M mHsTZe0j2g0hKDDnLALbK0N2q5HfgkvClwWvXP6Svx2AjsMsOJ9J5SI3iNBHjQWHnwqhrL XEus6U9wNM8+Tk1AMPAYMDyUAHX11VY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=efficios.com header.s=smtpout1 header.b=TGhD7H5X; spf=pass (imf06.hostedemail.com: domain of mathieu.desnoyers@efficios.com designates 167.114.26.122 as permitted sender) smtp.mailfrom=mathieu.desnoyers@efficios.com; dmarc=pass (policy=none) header.from=efficios.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727831016; a=rsa-sha256; cv=none; b=wbO5sxBpwnk1o4FUrSI2BcAQ89bnsQloljvhyrHtsvPcNolEWIh9BsVBwtDY7Kz1wQP/MQ DfBGRpi5sW9WlXWgayr3aJVC/WFuVIcrbNKhXMmfXd/38lsh5LJE2Gy3PCEnzECXiFGD9v cbKU+t3XnTHxVUnWBnyZ9J9YcZueWQA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1727831079; bh=J51FMx4u1uRwSJbEetHZdnjtpXGbFPkERKfeCfiiqus=; h=From:To:Cc:Subject:Date:From; b=TGhD7H5XV7sXJ2UOhd0QN1oCgZ4X3l3FJkSwgCDmK2mSObo/ze5XmJ4d8HPy9YAo/ vNyCiu3tAQQyRumTv0VJ8b7L6Q3X+NK6Voe62j22Mh+BlMxyB75hk8bKvUOQnVfBwK HhRhBBhe17phxfKic1PIy0jpLfY0a5g5TVS72Rcslgj2e2gx6emKYi1ErXgxGL6o/d h5E1+a94T0qou4+pMkXA6n6vg/aAiummFJKDdwWmZZaZ8JRzdFFphPzFLaqidd33JQ UQpeY8wou7/5x0/Vm4GcEFMCA9hxmxnXMu1K90cWpCR6BorSYelOZ3Ile+6sXnrq3n s12Q+UJZ2FBnA== Received: from thinkos.internal.efficios.com (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4XJGml3JF0zjVM; Tue, 1 Oct 2024 21:04:39 -0400 (EDT) From: Mathieu Desnoyers To: Linus Torvalds , Andrew Morton , Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , Nicholas Piggin , Michael Ellerman , Greg Kroah-Hartman , Sebastian Andrzej Siewior , "Paul E. McKenney" , Will Deacon , Boqun Feng , Alan Stern , John Stultz , Neeraj Upadhyay , 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 0/4] sched+mm: Track lazy active mm existence with hazard pointers Date: Tue, 1 Oct 2024 21:02:01 -0400 Message-Id: <20241002010205.1341915-1-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: C6871180004 X-Stat-Signature: kufjpr7qqmndh48zpu44m1nw5csgsikc X-HE-Tag: 1727831080-422946 X-HE-Meta: U2FsdGVkX18RmLRASEgVt409vGZSbMGvzs5qr+6N5aF/oDs65MHzGWIRQEGSv5yfAUBmq7nHrhgXqJf9Y0rivPBSxQ+nnvl7SJgM615Nyx7yyz3oIYGuFq1Sc5Alkh3HvpEn7zYy37xG/SEhR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JiDwbmENbPQFVohB1inak3K5Kg1nlid/qT6eLW0hy55QPBAaEyMD/LDJiqltoSt5UPWuCisl3ofn4eeBImgq23sncXZEVAOII+EOY+FoaFw2zZkA6ospQw9CY4N+VC7xMnn2qeI9OGhyWbi/kx0/vXGJ2NcfvEVJiXgsvWeHK+mmMvuLU+ZMJWu9Zh3VDH2z1LFD8RHPdtJpzz/AdfbvQr0lMm8L53ZzrQGByPep5PGMhIQDEt0tOB3qBW+I/z/gNegC65NM1bfuFFVSSSw0zUgvvDEnBHgikMSXCBf2PnotEFiV2P1PZ6sf6ze2HKwcygooYAGATc4x5OH1jkeDQdNDxFYuPYmwxSZ2R6DNyQG4WL4pp0Kp9KSrBHWKzZErdx4zwL9vdd2ifWTYaPOj1X1z2k3p+mB/A7VZ4yaBsMk/8MFJVV7J/EK6qlFMbeDdOTC2FX0tPrCFkHPkzZeKdB0h3kuuOjxNoDXwInF2P45zMp4/hiNQ32idSS14j7syYkTdaiyqH3u3aAIM/egCdU0DYTITK2SNiY4uv7pXBC5HJNjlB02h5bndYnj+F5Cbpqbiio5dFjDha0oe/syIyEY23YAlZFeUJtilKeAyjMPIEnsPwlhQku1Wb0YPL6MuTeJg95m5iiyWRTuy+UBrw+tjt1GI1EKQXX7TgqDGXJ7o/t8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hazard pointers appear to be a good fit for replacing refcount based lazy active mm tracking. Highlight: will-it-scale context_switch1_threads nr threads (-t) speedup 24 +3% 48 +12% 96 +21% 192 +28% I'm curious to see what the build bots have to say about this. This series applies on top of v6.11.1. Signed-off-by: Mathieu Desnoyers Cc: Nicholas Piggin Cc: Michael Ellerman Cc: Greg Kroah-Hartman Cc: Sebastian Andrzej Siewior Cc: "Paul E. McKenney" Cc: Will Deacon Cc: Boqun Feng Cc: Alan Stern Cc: John Stultz Cc: Neeraj Upadhyay Cc: Boqun Feng 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 (4): compiler.h: Introduce ptr_eq() to preserve address dependency Documentation: RCU: Refer to ptr_eq() hp: Implement Hazard Pointers sched+mm: Use hazard pointers to track lazy active mm existence Documentation/RCU/rcu_dereference.rst | 38 ++++++- Documentation/mm/active_mm.rst | 9 +- arch/Kconfig | 32 ------ arch/powerpc/Kconfig | 1 - arch/powerpc/mm/book3s64/radix_tlb.c | 23 +--- include/linux/compiler.h | 63 +++++++++++ include/linux/hp.h | 154 ++++++++++++++++++++++++++ include/linux/mm_types.h | 3 - include/linux/sched/mm.h | 71 +++++------- kernel/Makefile | 2 +- kernel/exit.c | 4 +- kernel/fork.c | 47 ++------ kernel/hp.c | 46 ++++++++ kernel/sched/sched.h | 8 +- lib/Kconfig.debug | 10 -- 15 files changed, 346 insertions(+), 165 deletions(-) create mode 100644 include/linux/hp.h create mode 100644 kernel/hp.c