From patchwork Thu Jan 23 10:37:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13948129 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 DE4EDC02182 for ; Thu, 23 Jan 2025 10:38:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6DB316B0085; Thu, 23 Jan 2025 05:38:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4229E6B0083; Thu, 23 Jan 2025 05:38:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA9D76B007B; Thu, 23 Jan 2025 05:38:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 901116B0083 for ; Thu, 23 Jan 2025 05:38:00 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1BEA91A0E46 for ; Thu, 23 Jan 2025 10:38:00 +0000 (UTC) X-FDA: 83038366320.21.25BCF81 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf19.hostedemail.com (Postfix) with ESMTP id BF1B51A000D for ; Thu, 23 Jan 2025 10:37:57 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XsItYHK9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ZvHlEfVV; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XsItYHK9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ZvHlEfVV; spf=pass (imf19.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1737628678; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=HcOzQzth9ZYVbnoeeavKSigPkt8n9O5lbZ1q+vP3920=; b=Hhtdd4l1rO9X5beN3LulPPN2DmowAgF+3HMRZ/eLvFbwdlwu51oBheKw3O6eg327y5wdjl 0NMov66WKYBAZGC05tskZdyWkhMLXHCBabcJhmx5zH+3wJj8TNjeZ0Fpdp2Sw/0d73jJCf 0KgfcTyCGcguGPWbpv6w944K6EXgRvE= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XsItYHK9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ZvHlEfVV; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=XsItYHK9; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=ZvHlEfVV; spf=pass (imf19.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.130 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737628678; a=rsa-sha256; cv=none; b=2wWb+VZu2NxpZa6zh8UsuS+B6yu8eQTSNUH8OxNpvoWzHlsbkZ+G9UHADpXYxgrvzxPK2D MEYfk6QRX7VIvwd2mfSUybcEG8EN7ecGoFmKwxbO8vWgD6ytIsQM63W21oz9HcaRqC3d4e VM/7COQ5+vupLa5AvziWB+hi5jVF5gM= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 1B3322117C; Thu, 23 Jan 2025 10:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1737628676; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HcOzQzth9ZYVbnoeeavKSigPkt8n9O5lbZ1q+vP3920=; b=XsItYHK9y4TtcrydA+aWqkQPH5k8MA+CVDk5yWHJrQV5C8mTi27g+6lrO0HrrQ7ycYJ8yy JnOIw80PvQqAtc5OiVVPleHoxYSrY3f6A4BQ/JfFh1KLrcRwHYiv1gv+oTN1PF/7vWyfkm A1O3PIXJYCTN5JOV4jVq+flTOVhZnQA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1737628676; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HcOzQzth9ZYVbnoeeavKSigPkt8n9O5lbZ1q+vP3920=; b=ZvHlEfVVr1R65JrxUfvu9AvVvPy3iNOA7OLNy1ArkIjSMJKxB4Bp8xNDFmgMPHGQiiMJCo 5rhsD+6CzX2qEpAw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1737628676; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HcOzQzth9ZYVbnoeeavKSigPkt8n9O5lbZ1q+vP3920=; b=XsItYHK9y4TtcrydA+aWqkQPH5k8MA+CVDk5yWHJrQV5C8mTi27g+6lrO0HrrQ7ycYJ8yy JnOIw80PvQqAtc5OiVVPleHoxYSrY3f6A4BQ/JfFh1KLrcRwHYiv1gv+oTN1PF/7vWyfkm A1O3PIXJYCTN5JOV4jVq+flTOVhZnQA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1737628676; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=HcOzQzth9ZYVbnoeeavKSigPkt8n9O5lbZ1q+vP3920=; b=ZvHlEfVVr1R65JrxUfvu9AvVvPy3iNOA7OLNy1ArkIjSMJKxB4Bp8xNDFmgMPHGQiiMJCo 5rhsD+6CzX2qEpAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F1332136A1; Thu, 23 Jan 2025 10:37:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id ew54OgMckmdrAQAAD6G6ig (envelope-from ); Thu, 23 Jan 2025 10:37:55 +0000 From: Vlastimil Babka Subject: [PATCH RFC 0/4] slab, rcu: move and consolidate TINY_RCU kvfree_rcu() to SLAB Date: Thu, 23 Jan 2025 11:37:17 +0100 Message-Id: <20250123-slub-tiny-kfree_rcu-v1-0-0e386ef1541a@suse.cz> MIME-Version: 1.0 X-B4-Tracking: v=1; b=H4sIAN0bkmcC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDI1MDQyNj3eKc0iTdksy8St3stKLU1Pii5FLdpBQz06S0VCMjozQjJaDOgqL UtMwKsKnRSkFuzkqxtbUAzChBqmoAAAA= X-Change-ID: 20250123-slub-tiny-kfree_rcu-bd65bfe222f2 To: Christoph Lameter , David Rientjes , "Paul E. McKenney" , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki Cc: 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, Vlastimil Babka X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3111; i=vbabka@suse.cz; h=from:subject:message-id; bh=jOnO+3feYxqGfo6cg3dZ2QN1txBcqa83UHGveWbkMhI=; b=owEBbQGS/pANAwAIAbvgsHXSRYiaAcsmYgBnkhv15Pugh4Hb+6+FauqIMVEf11O10wYENj4VZ Gt68i2PvESJATMEAAEIAB0WIQR7u8hBFZkjSJZITfG74LB10kWImgUCZ5Ib9QAKCRC74LB10kWI mhwrB/4vpFrTnVhgpR3cksXtvnBQVQDNk6zCa7u1RCJ29uFsCG8MyTBW5wrdkbRFIFe/tlatv1f MFmQZss0tG4vZpONxWjvzBZdx2D6JhbB71Ljo5RjuWgx7hWU2WOuZLZtbkBMmMOtOGR389Xv92i y8v+G7R3uXYeEVMRXf0QVESPe05N6vYPJOsY1WuHEdr4qy4dtYAqTj1Jyc8OAPBtsxWzVuMj8LQ Vs5okCXVSLZN9/3qXOM1KxXHqkaz6IjIzq1T4byEKmyZz7HXO6RJvXu4rNKl/XjMS9tpZei2CgY TsEIrODr5Z04pSR0XOo4ehiuDRbPxv2LzA0v+9qz3KEpWJvm X-Developer-Key: i=vbabka@suse.cz; a=openpgp; fpr=A940D434992C2E8E99103D50224FA7E7CC82A664 X-Rspamd-Queue-Id: BF1B51A000D X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: mqshzitn31akynhis77wen684e7wx8rs X-HE-Tag: 1737628677-822287 X-HE-Meta: U2FsdGVkX1/OPweodrxVjymuf3RpI8h3qmS/z7gsjgSCSwR5+pX1PT5Md0pfTgi3q8tTP9BJv3iS9bnzaNIEXR2PAIlw1Ik4qN1M64drLva/6zuK7R2yQmTbxjOxMQQeS/Iwn1d+z7Zx2QPArwrpMLSl+Up4rxG3R96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KmErSBwtGFvMvpfDgJvWl2Cg9i2jEXkm/avvIx5/St5HGwURvOFy223Nh8+OkpCxDXvQX0kYCpvdEIvDUfQ/Ldksboeye6sGZTZ/vtsoniiR2j/lznhZXDkB/hIn9LOYC68f5ZrF4ADq0LN7VRhc3r49J57dT25f7yr5TCFlpiR/lmubsRyHUy3zBAq/JpZweEEzmY4T9FsbAJL7Af3n3O8xzaxJXYs0QodETHgS2yINOtFbCl/UcFXzmJCeMy2zPZDRhJLiYq3aHdwOQyARIlcMtMiS0ohd97mFMm2k19xb43RoI1yFX4lF1Deiu4FF2zxEPJkqSeVSIvQullwsxRzb2+tyPXkI6jSiXoxHL2zB/f+20Q+ioaCp5VpGVTEwv8lj7p5Vuba+mMvFRFRY2Gkjsgyq6TcOuv9rdCyZMynSt/3bPug9mOw6+bQ2/SKEuFxyAATC6FaGmFko3xxRrOiOAwXtw3a+aOSH6PjySCa0caFRXnENePSO2GzTJ8GkdrQHcTXVgePf9mSqb1Yx4Jv5B2fyYwFF9s+bUKuQh2/KWWMtjYDwySbCHZOks82ZrH4gnW6bXYd6/76lpOAuNR7E3anW46LLJ/CyB1R/WT2Ln 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: 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? - declarations of kfree_rcu() API in include/linux/rcupdate.h - could be moved to slab.h after checking for/fixing up potential missing includes git tree: https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=b4/slub-tiny-kfree_rcu 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 Reviewed-by: Joel Fernandes (Google) Tested-by: Paul E. McKenney --- 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 | 29 ++++++++++++++--------------- 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 | 24 ------------------------ kernel/rcu/tree.c | 9 ++------- mm/Kconfig | 4 ++++ mm/slab.h | 2 ++ mm/slab_common.c | 32 +++++++++++++++++++++++++------- mm/slub.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 103 insertions(+), 126 deletions(-) --- base-commit: e492fac3657b60b8dd78a6e8ca26d1d14706c7b3 change-id: 20250123-slub-tiny-kfree_rcu-bd65bfe222f2 Best regards,