From mboxrd@z Thu Jan 1 00:00:00 1970 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 C2F6BC02192 for ; Mon, 3 Feb 2025 19:07:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5054C6B0082; Mon, 3 Feb 2025 14:07:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 48EA46B0085; Mon, 3 Feb 2025 14:07:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32F16280001; Mon, 3 Feb 2025 14:07:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 111ED6B0082 for ; Mon, 3 Feb 2025 14:07:38 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id ADE2EC03EF for ; Mon, 3 Feb 2025 19:07:37 +0000 (UTC) X-FDA: 83079567354.24.E173A04 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf21.hostedemail.com (Postfix) with ESMTP id 05BA81C000C for ; Mon, 3 Feb 2025 19:07:35 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=erTS1JfU; spf=pass (imf21.hostedemail.com: domain of "SRS0=AmN0=U2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 147.75.193.91 as permitted sender) smtp.mailfrom="SRS0=AmN0=U2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org"; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738609656; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ctuvjWzNJwM6AsannvgJRJupEe08/fBaT+VX+oce/VM=; b=B7CuMvmPEkfo1ElNtDQ0A3Flfk/B0Ud9fp/311QIfu7XWdmCIQ8nalaNWhZo6iW2iC3+Gc 5rREUAaYk5VR23/hChMpMGxLNONO31t4QfSSzRd68DODDCA39MhWTT4B0g1EZVoTuwIB9N kYpKta1SjrZwvcrZyGrLwgGIzi8Hw3Y= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=erTS1JfU; spf=pass (imf21.hostedemail.com: domain of "SRS0=AmN0=U2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 147.75.193.91 as permitted sender) smtp.mailfrom="SRS0=AmN0=U2=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org"; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1738609656; a=rsa-sha256; cv=none; b=B1qEGDJ44i5SExOADOw0lPf6P4PWwAxrbUsxv86R2VnjPFVTxRIxBVfp3Spo9yQDJQxClH 7+i/lcU7n5Q0C+sHiGSmchq1evKtjiR83HJaQgwDNdfSeiLCXjxZRZVcMcQRKJuMZq/JbK wPTTfh6kQ2ofVVfmHXR5qcriPw3L/Ys= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 00616A41B1F; Mon, 3 Feb 2025 19:05:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDCD6C4CED2; Mon, 3 Feb 2025 19:07:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738609654; bh=sFECFljIY8hF7UElYtjTLnwB8NoqEp0fdysI/bokdY4=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=erTS1JfURzghn+eQafn/1AmUyM1NIcwS3pRwMpvV3PbK4wu+FLUplWEpFkPV6Gc1j LlPqEm3MRQHM0Lr3mXn+RYf3hx/mjSeLHOyHhInAH3WUAxRRJfA8erImWzwnVNjtsZ 2MMQDqYRylPEg9ute5/qbmf3yr7mSMHRVlNMfVM2m8sws+xz6nyiMO5KdOzbg7uw2X tdViHk8GexZ+Pn7Y2ojPky7VqnsZX3jmJUz+XCi5pdaIXw6lRQO0d+mCE9KhMBC1g4 jcG//CU65LLyOjG5angJ+ygCmOVKgqYyR6wnprnzHmTszbasePyBaeglFzeUXKhpML JT5yYTgU4ecpw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 7F405CE00C4; Mon, 3 Feb 2025 11:07:34 -0800 (PST) Date: Mon, 3 Feb 2025 11:07:34 -0800 From: "Paul E. McKenney" To: Vlastimil Babka Cc: Christoph Lameter , David Rientjes , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , rcu@vger.kernel.org Subject: Re: [PATCH 0/4] slab, rcu: move and consolidate TINY_RCU kvfree_rcu() to SLAB Message-ID: <5ee3321c-417a-4638-8d9e-77faa5f07462@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20250203-slub-tiny-kfree_rcu-v1-0-d4428bf9a8a1@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250203-slub-tiny-kfree_rcu-v1-0-d4428bf9a8a1@suse.cz> X-Rspamd-Queue-Id: 05BA81C000C X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: x9st8a5dg8emyxmexqekrm9677qx1nt8 X-HE-Tag: 1738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ET/7mgCT0jKqDQn7ANU4Br8ajbaOeCwdi+kCU5B96HO+1MpR4FJb05eGJACbyMHHeHi8Gxp8AWP2Fn7U4jayYxjcKFIqbn5j7s0Tfnih+2PA6HiTzU7lg== 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: On Mon, Feb 03, 2025 at 10:28:46AM +0100, Vlastimil Babka wrote: > Following the move of the TREE_RCU batching kvfree_rcu() implementation > to slab, we still have the simple non-batching implementation in tiny > RCU, and RCU implementation specific ifdefs in slab code. > > Finish the move and integration into slab. Allow using the simple > call_rcu() based implementation also with tree RCU when SLUB_TINY is > enabled, as its goal is also to limit memory footprint with less concern > for top performance. > > In order to avoid RCU having to recognize the fake callback function > pointers (__is_kvfree_rcu_offset()) when handling call_rcu(), implement > a callback that can calculate the object's address from the embedded > rcu_head pointer without knowing the specific offset (previously SLOB > would not have made it possible, but it's gone now). > > After this series, AFAIK only the following kvfree_rcu specific code > remains in RCU: > > - a call to kfree_rcu_scheduler_running() from rcu_set_runtime_mode() > > - probably necessary and a generic registration interface would be > unnecessary bloat? I am OK with this calling directly. Alternatively, you could create a core_initcall() that did nothing but invoke kfree_rcu_scheduler_running(), and then drop that call from rcu_set_runtime_mode(). Up to you guys! > - declarations of kfree_rcu() API in include/linux/rcupdate.h > > - could be moved to slab.h after checking for/fixing up potential > missing includes It would be good to move them, but no real hurry from this end. > git tree: > https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=b4/slub-tiny-kfree_rcu > > Changes since RFC [1]: > - Rebased to v6.14-rc1 > - Fixed build errors reported by bots. > - Changed where kvfree_call_rcu() is moved to in patch 1 to avoid another > move in patch 4. > - R-b's by Ulad and Joel > - Fix a memory leak in kvfree_rcu_list() thanks to Ulad > - Various comments' improvements and fixes (Joel, Ulad) > - Rename config to CONFIG_KFREE_RCU_BATCHED (Ulad) > > Due to changes, didn't keep Paul's Tested-by (but thanks!) I re-ran the tests, so feel free to add it back in. ;-) Thanx, Paul > Will include in slab/for-next if no objection. > > [1] https://lore.kernel.org/all/20250123-slub-tiny-kfree_rcu-v1-0-0e386ef1541a@suse.cz/ > > To: Christoph Lameter > To: David Rientjes > Cc: Andrew Morton > Cc: Roman Gushchin > Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com> > Cc: linux-mm@kvack.org > To: "Paul E. McKenney" > To: Joel Fernandes > To: Josh Triplett > To: Boqun Feng > To: Uladzislau Rezki > Cc: Steven Rostedt > Cc: Mathieu Desnoyers > Cc: Lai Jiangshan > Cc: Zqiang > Cc: rcu@vger.kernel.org > > Signed-off-by: Vlastimil Babka > --- > Vlastimil Babka (4): > slab, rcu: move TINY_RCU variant of kvfree_rcu() to SLAB > rcu: remove trace_rcu_kvfree_callback > rcu, slab: use a regular callback function for kvfree_rcu > slab: don't batch kvfree_rcu() with SLUB_TINY > > include/linux/rcupdate.h | 33 ++++++++++++++++++--------------- > include/linux/rcutiny.h | 36 ------------------------------------ > include/linux/rcutree.h | 3 --- > include/linux/slab.h | 14 ++++++++++++++ > include/trace/events/rcu.h | 34 ---------------------------------- > kernel/rcu/tiny.c | 25 ------------------------- > kernel/rcu/tree.c | 9 ++------- > mm/Kconfig | 4 ++++ > mm/slab.h | 2 ++ > mm/slab_common.c | 33 +++++++++++++++++++++++++++------ > mm/slub.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ > 11 files changed, 113 insertions(+), 126 deletions(-) > --- > base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b > change-id: 20250123-slub-tiny-kfree_rcu-bd65bfe222f2 > > Best regards, > -- > Vlastimil Babka >