From patchwork Thu Sep 5 07:56:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13791893 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 C953FCD4F5B for ; Thu, 5 Sep 2024 07:57:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F3936B02A9; Thu, 5 Sep 2024 03:57:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4A2EC6B02AC; Thu, 5 Sep 2024 03:57:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 344236B02AE; Thu, 5 Sep 2024 03:57:58 -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 0A9E86B02A9 for ; Thu, 5 Sep 2024 03:57:58 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BD5BC1A19EB for ; Thu, 5 Sep 2024 07:57:57 +0000 (UTC) X-FDA: 82529930994.29.4F91462 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf29.hostedemail.com (Postfix) with ESMTP id 0F3E4120006 for ; Thu, 5 Sep 2024 07:57:55 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mYkXOr7x; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725522968; 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:in-reply-to:references:references:dkim-signature; bh=QKJqJIYSilEM9Rvj2Blf0Qwwr2GZV8/aEuTuKNLevjE=; b=UP91xEZwB2U911rVfZfvZEKbcPkZLiggB/G7yx8mtgp0dd5BQtJlEabD35nHxcYY1prW3u 7rfbHIqlFSKcuEwasDtzibsROCD+4/GJDbL0Nc0voTGtNFzOP1LyGoaf0ch4p0kJyHJvqe ytLgl0Qxc7edTh4js4ZeHV50XET1Tb4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725522968; a=rsa-sha256; cv=none; b=KCy2uekYqvK4ULF5BB1h2Gx0fskyi/uezP2mutrurh07j99QRKvxm+64/h4vrpehHa6WzS au/Ds0AW2gki8+YFLhEV23qSJyLqV0NCxwg5hw7RZpkRbyWZYpD02UQOILllutO8JapvPy yz84eUj6lJ/lJhR2+y10fpz0DIrRztI= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mYkXOr7x; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf29.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=brauner@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 369ABA44372; Thu, 5 Sep 2024 07:57:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B1F7C4AF09; Thu, 5 Sep 2024 07:57:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725523075; bh=i+qfsAgWogADWXKIX6Ox+SamBJe0NAxzXt2tozWQS4Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=mYkXOr7xS4Z4mkCbI0v9BXGFcdBL//failIOy4yeoCV0iFHDbwEGNpZ5lUT96/2rM FzuwjOabbXeq4zn+r6w1OuIBW8p/DnVBT7j6rukPS3OyCyC6AN3aWf49VSYSpI0VML 2UJwPFaz4/GJtXg4EXkPaof4zAh7spKsPz8nMcqahR/WVWwLm8l8FFx+JZP5Lh/HoQ 24x+U2rzZbmqfLeIKcCBfI3DZenROsICqGWZKO5nWoZIuP2vAt3nRO1ffbjo2ZXPYA MR/QICqC6xGnAAmxZyKiOcMTZ+C0BBDqJXU9I69e63Eh/30cpfHZvxcjNz43rgheQ3 CgE25VlJ6vPAQ== From: Christian Brauner Date: Thu, 05 Sep 2024 09:56:56 +0200 Subject: [PATCH v4 13/17] file: port to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240905-work-kmem_cache_args-v4-13-ed45d5380679@kernel.org> References: <20240905-work-kmem_cache_args-v4-0-ed45d5380679@kernel.org> In-Reply-To: <20240905-work-kmem_cache_args-v4-0-ed45d5380679@kernel.org> To: Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds , Mike Rapoport Cc: Kees Cook , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christian Brauner X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1128; i=brauner@kernel.org; h=from:subject:message-id; bh=i+qfsAgWogADWXKIX6Ox+SamBJe0NAxzXt2tozWQS4Y=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdTPFeMkFxdeKVKz5uTZv//oozC6j/eSV1QtD8yNSbF 3dazFPS6ihlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZiIawrDPzX+vdEdqptkD+78 32r3fWVw3YzH7oZLj54zjVh1yzvumwnDP+UO2TWtxg38Rrvuz43yCxZ9w/I3XOsE35Oppb7yIhl /+QE= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0F3E4120006 X-Stat-Signature: m14rnbm7xquz873p5w7jenuqzq3bg7du X-Rspam-User: X-HE-Tag: 1725523075-979954 X-HE-Meta: U2FsdGVkX19SJNiZl1Q4ZISFbqXq2pS+b/2rf2RjyLSILxiOYcpe87qnvuxp0FWKiJrfaHj5tM1kZ5ZUloqWBMcrROazfHpxSoR8GEj53mcOsKcNd9tA+IYWulMVWSeKk1Qg6omEC4eQG/mrVkIL2ikk8960kXQYqVFiOF3FGDTO2LzUa8nCBj4l7sM2DdAq+IBxgvEVklEUnGc+6UbuaY1eilizaMBKtTLs+v4rbwLKl19o5ELDh5QAI0EXWU5YfacaXemRADTnD/4yl8KAuf7yWOjj0wsTp/SYncjS27pVe9qvGY93xgfWC3YRElOjc8dS07EiMm/ko1nwdaU88POtv9Qk12biqn3RxjG+ktZLdAkNfNXdL96YCGNgX26hGNncLk7RaFiFE/FqNdf0YiRPLZqCIt2DuMp9jpsRUSz9Sd+OelBDM0YboqvOkq+6vmsu+IHqYtumnkZIdaXYq397tQKRVrAP5hcgnGgZAwX6+94Hh9wvrRDx9BEVS0pOdm1EcnFmFjqI+GEOdz55MRDVrmb+NBhDSFt+plWNAPYuVbbYjRLbp8oSA/5e3ULBA1+pEBdQ52fAvSQPhjtA32RzPYgUXZGdpgHKZfIsG1s4hsfU4f0+BDEFgWWxEQjMkiQ84CpvIbMWmVlI7v2ZVyXZFeocu1s+2hjnKKJ8ION8UVwSoXMONCmjVLyIQmfK3o5mMwV4ejRYUF5LgHWrBdrhcXG4s6rwfn31v+xoD0+GP6q5sdfMvx8f4n45JuHASEvSuuoyUArswu59kvt23PXy62r5lC9wJ98Xub3iOqj6HbUbyddXZrAO4oBmGxuLvYlpyE8t/CheFzz7uYkVpxeJe9KWZy+jAj7bM4Z95IKCwbnhvPu8rBArgAvoc1Oh4wjohWPK4nseVAVGy/0ilIHlxvl9dW8n1bUAmmIIqxFFUaetBiLcun5DQpzqE7npyQeBs2KfH5KZh/SRA2E kMVwOmhD xRX+0PwXEteiX2E6R346SX0njL4f8TuysqcUkwRDGDt3atZd3tch5LvpNfz6Y7bmR74iQ3GP4ZpDW76PcgtOFHlITsvLPqXGwTmsUvYlE3Y4HSKuW2vuTMPZwD172krVvxDeUrHhrPXyIAXpJEVHJU1bk9vy7YR5ZG6slWnxXeFKqoomOnaKaufhTRnQARRAnWInZwBW3SogOx81EGJBL5Gf9u0EXIMsdS2VdOVE9bdIlHBDupk6aqh9Aa+QtouHO51ZEDZqAHDH15ByifR61IU1UvzF4vXPQqtjIIYZjAH1arVgcj4eNlWMiYjxSw81lcJEI3YteSZi1ZBMYqjX8X7DbBd5LWiiDrg7/jTY6a9dPi27K6wIkBkflXCyvFujrFWPne6iG3UUlO7M= 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: Port filp_cache to struct kmem_cache_args. Reviewed-by: Kees Cook Reviewed-by: Jens Axboe Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner Reviewed-by: Roman Gushchin --- fs/file_table.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 3ef558f27a1c..861c03608e83 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -511,9 +511,14 @@ EXPORT_SYMBOL(__fput_sync); void __init files_init(void) { - filp_cachep = kmem_cache_create_rcu("filp", sizeof(struct file), - offsetof(struct file, f_freeptr), - SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT); + struct kmem_cache_args args = { + .use_freeptr_offset = true, + .freeptr_offset = offsetof(struct file, f_freeptr), + }; + + filp_cachep = kmem_cache_create("filp", sizeof(struct file), &args, + SLAB_HWCACHE_ALIGN | SLAB_PANIC | + SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU); percpu_counter_init(&nr_files, 0, GFP_KERNEL); }