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 984C4C02194 for ; Tue, 4 Feb 2025 11:41:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2851F6B0089; Tue, 4 Feb 2025 06:41:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 233C26B008A; Tue, 4 Feb 2025 06:41:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14B296B008C; Tue, 4 Feb 2025 06:41:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id EAEB96B0089 for ; Tue, 4 Feb 2025 06:41:15 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 973D312095E for ; Tue, 4 Feb 2025 11:41:15 +0000 (UTC) X-FDA: 83082071310.24.EC7E4D5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id C5D088000C for ; Tue, 4 Feb 2025 11:41:13 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=p4eQzOkV; spf=pass (imf02.hostedemail.com: domain of "SRS0=ooiQ=U3=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=ooiQ=U3=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=1738669273; 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=uhB70N31pYmDohYpBAccHy+tQJZLRqZSXz5MYwyddx0=; b=JqfFKh2X4VrAGWt3NILPyGm3Ses+AXHkZQNB8r/y+WhBkQr5su7+BwGuGYQkNB99dzQlyD futTQkiLb8zjfW8F74dCZV5xfxxOONi/YQhoxsirEKNXtiXd1a8hNYf4LJsPMlbjz/yChF Um8xilBzn7PXu3NHG3F2FEf5vj9nwjk= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=p4eQzOkV; spf=pass (imf02.hostedemail.com: domain of "SRS0=ooiQ=U3=paulmck-ThinkPad-P17-Gen-1.home=paulmck@kernel.org" designates 139.178.84.217 as permitted sender) smtp.mailfrom="SRS0=ooiQ=U3=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=1738669273; a=rsa-sha256; cv=none; b=8YZmHrAeLEomMVOV2vz5EMJQz4llc8LVc0bJqENSU46N+vCSHREGlPOOWhbSqYKjUNIz8O 10DFHps9ZeZsK2EbErfIiUYaU62p4ZmzfAal9DMRzkVP+G+G4Uo6Jky2xIDi0q5KWCCeP4 FYYDogGPHkCS8iUuv0Dyi0UJb4cIWyM= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 03C0D5C1187; Tue, 4 Feb 2025 11:40:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 841BCC4CEDF; Tue, 4 Feb 2025 11:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738669272; bh=cfJ2o9rwKkPq6C1hg1fCFc5QY15KpS/o+rOFhbNs27w=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=p4eQzOkV3pLzSEaAuUAKKCvLAEQVocUKMMXiarsBBs8UFShaiHg0oOoNct2d6fSeF DIQBCFtrL0qMEjp3DqJyplQSDdkadDJCJl2gGeA/R0SW8KVpx113gjJGs2mcgFoiBd XwuaNflmXXVb5R4pxhHHAvoFISFVpn+NrDf1iErwyrM6TD2Aun3OWzf36VU8Isy2mm Y/bHZHTUJdJbgIFYj/C4ZaPbr1fTvCgljfg+Rkfh8rMeijWMKP1k9cOkkkIaJzOD0i rJukkMX6ElkWsDaq8kHAQ2jSSv55FzoZ1P43E84qAOF+N3lR5ay7AZANuv0EFRNyTj v3gmBQcm0yQCg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 13212CE028A; Tue, 4 Feb 2025 03:41:12 -0800 (PST) Date: Tue, 4 Feb 2025 03:41:12 -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: <65af727a-55d9-43fd-a6b8-d6d4ef5fbca6@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20250203-slub-tiny-kfree_rcu-v1-0-d4428bf9a8a1@suse.cz> <5ee3321c-417a-4638-8d9e-77faa5f07462@paulmck-laptop> <4fdbb91c-df21-4dab-a165-a4e864625628@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4fdbb91c-df21-4dab-a165-a4e864625628@suse.cz> X-Rspamd-Queue-Id: C5D088000C X-Rspam-User: X-R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nezfhcWVGWINhuZUwJ80622FNCU/9vfMe6RLGo3pdWBuVS11MXpvfdzctRn3W2u/IChEGqUSqv8ZjMZ7LfL6ILhgytg5/KugmuLs4nRHFVSBFTFyjlIgT2/CtDF5TVhdupgsrNwijIALVDVZEgudU4VPR4EjIg3/kYYpJpfa8ZsMhaqbBq88nYKM/BeAmvU68jXQDi1jBALPwUAAWa95b0a9rjeqYzCYuV+VzTlvffOBJqfzkW1EG9cOS3WlhyhUdd+FaHWikL/yQ6mqIXjBfsDNs51BzeC3mTljoU6ZN2kPmD5jU/SuIF/Jh4X0VEypFrhdpJhad+6wZncOJv4LB09m9JWcx2TVQyegit8TYGDAscH9aukGQfSG+eVj1YU/zBXyQjC4TW2cnFAqXNPzvmsOThsoU+Z+DcHi6VzNl51yUGNQFxHtgIJWF961iXfZHvuR9ti9Bg0GwDGiCn6yQ2+ikJG9BTP5HMBYMO0Giu2I6+yFRi1AJn4lJWArDZUoDBtGe4XeGEEV30exzPDSdtFNkfI+sLlqtR64YftZ2R8gsYXB0/e/rE/rwd94kpMu5YRTa4Sgoz1aExGr7Nsp6K2rdLebPA+S+M027Eti7E8zQqNGCxIqDvKoCSyYgqisYDfPNozhHAxj9hZc80zvHySTNbE5ZJBpeiiIbMmE7fx+8+I6gFhaQmH+XT8h21eQsRqaHcojP01aD2ZG9Ds24BhqMe2RJahbqg1G2Gea4NIceSBNLVmrW0ssy3LgIIxK1fXGVj2GmvqYgWn8E8LUB1P9x+ 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 Tue, Feb 04, 2025 at 11:02:47AM +0100, Vlastimil Babka wrote: > On 2/3/25 20:07, Paul E. McKenney wrote: > > 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! > > I was afraid there's some ordering necessary with the rest of what > rcu_set_runtime_mode() does, but perhaps there's actually not. I *think* that they are independent, but I agree that it would be good to carefully double-check. The basis for my belief is that it is OK to invoke call_rcu() long before rcu_init() is invoked, let alone the scheduler being ready. Thanx, Paul > >> - 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. ;-) > > Thanks, will do :) > >