From patchwork Wed Sep 4 10:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13790366 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 6A98ECA0ED3 for ; Wed, 4 Sep 2024 10:22:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 010FC8D024B; Wed, 4 Sep 2024 06:22:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F02138D0242; Wed, 4 Sep 2024 06:22:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA45D8D024B; Wed, 4 Sep 2024 06:22:45 -0400 (EDT) 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 7F58F8D0242 for ; Wed, 4 Sep 2024 06:22:45 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3F7A7A9E86 for ; Wed, 4 Sep 2024 10:22:45 +0000 (UTC) X-FDA: 82526667090.08.A00E5A1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf03.hostedemail.com (Postfix) with ESMTP id 76AD620015 for ; Wed, 4 Sep 2024 10:22:43 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y5mD2qJI; spf=pass (imf03.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@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=1725445236; 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=+LMT9Pcej4RmatWfBTBFWa1qfI8iZx89qoTMiINgq9o=; b=B8w3Buhx8aLuKtza0C36IUAZelcdRDhBwybA6Cgm4gRuSoTiYEVUGBsDLcbD5YmWB9xOcQ M/eT77H6i2Mjf3bwEDKeEpm50KX7hcEXp72PmUhN1zrXkND89QrQAxzzYieY7rIMrBCXI2 2nGeGh95tdLg9/jUvBw3t2EGfQfsSrg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y5mD2qJI; spf=pass (imf03.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725445236; a=rsa-sha256; cv=none; b=dOLr+M7rcgq3COK2to+8lzvfHGeEANwryuopQzCPGtYc98hiuovbw5kcbF/jKoA9BrunNM hikgEU2aYUkG3mpn667FjD3Py2NiqhpaUrNJWDRLwYHXa+MaWrLvWhObALOSm/UF8SJ/d1 meANR1ntGmXHUk5t4Lw1glE/z06UIoI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4BD115C5706; Wed, 4 Sep 2024 10:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15AE3C4CEC6; Wed, 4 Sep 2024 10:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725445362; bh=MhdNhrflcCHIlYw4WJW1aVuEAIulx0BazYlkdUtItAE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Y5mD2qJIqza8xUSaKCniqGT6GyvL5XOqqUqSen1zwDmgse53XxgDkB/IaZ6OsdYYY HYib9vb7fhSa0D2q4dqzyj/8xC1BxXzCl4IA1dLaiKDhsnZ+025pBjcaYYIt56ewzj ImyELYiUYXyDW0VEvr/BVWQpJGlLykJqI7wS3YOuAMzGJDRvoCGiHtUw2UzduwguzR 940m3KaGmUe9hQRpBz8qObWAKghEKOZLvzpTjFxNZAyCcxk3DlWHiHrlgM1BkhzusM Ae1/8K1zvEazD1LkNYQfJJ85PlwjmAy3UoiuSb8kDBKXmGvelED+4HYUZVLErZA8O1 nniIQcrF4IcHQ== From: Christian Brauner Date: Wed, 04 Sep 2024 12:21:18 +0200 Subject: [PATCH v3 13/17] file: port to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240904-work-kmem_cache_args-v3-13-05db2179a8c2@kernel.org> References: <20240904-work-kmem_cache_args-v3-0-05db2179a8c2@kernel.org> In-Reply-To: <20240904-work-kmem_cache_args-v3-0-05db2179a8c2@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=1043; i=brauner@kernel.org; h=from:subject:message-id; bh=MhdNhrflcCHIlYw4WJW1aVuEAIulx0BazYlkdUtItAE=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdMNn1OddWmEttJccRu4daT9PNdz/3OvbG1UZGZaKCS 9Ckp24WHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABMpcWD4n7e4eGv9V5XWu/md cffOJzq8mfAveRnXW84XuW2nErR+iDD8FV3y7dXBLL7PUvqJBmJsp52Yuva55RXdt1xyuPSwDXM hNwA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 76AD620015 X-Stat-Signature: gutg55ui63ctfndahsex6x3ebxpyuzoe X-Rspam-User: X-HE-Tag: 1725445363-852560 X-HE-Meta: U2FsdGVkX1+UN1dEeGEljqmFU9QZSqXlShuvflSdPGlzd/E3bKRKR5IFE9lUrFLfdt4OOEzlrjrCFXfkF41TV29MylHqaXnRkubQcsbd4AXb/SwMC0+F7cKxtqxHL3tD/QHcFqKJZqDRhejUqQ2oW3bZjATrHxJKpIuByMDjxpUSlRBgPzxMoG/dn7+P79OLyoj2RGc5rPFv3z8EcPkBkGrMO8UZYcwBYOZhBhpw5rPtY6YJMyHWgeXmp4vIqH4pZK4sm0YcTg0kXCniQjPUm4UVsByKIbvvrvjGem3e0RHCFpTfC5xH3rCrA456lx0UKTc0HeoJTkyHgBbcc77ERj22OPkHGZnkkNHEWJtgw9VZMul9O6NLGS+swASSToWTqb8Tc+ydb4q72z0kD3zmSm0QVfkNZNl32j41unTJHp5DNZpFG6S+NwDo8VYPlKU/S1vRF0a5owErMJMkr8xrifDXEWgx6GByz3TvfURP5wADGsyCQb2qsfef1WdYugiRLm+/U1CCM7M5SC5guV8f7NfeGjiq63WTWkpbXjP/t18nNnro2HguN7n5TlEdlXdPyXJI2UOk70YEodWlNkkJJ3bqskkRCCOwOD9yaRv0HlvzGkkqVIkGZYkHBfFLirFBW+TN2ntT+dobVyTYak2D7okiXsdqefBxxXzDbPR47XEpYF8rDl0feLuyORB0QVb7eoTI0DWFbGQBNYB+/uLuu9iB9LPbXl425ofk7QHWGFoqmApbUNnhpb8+mOX4bTblaqq5hfZhAdIk1MLWTw2aRT4XDweQ2YUFchA/PhLuLgZn78Jejf/oBKF6lRmS3Jtqv8eMB/bo3mAqvnhH9FfZwsOAfboVdC1oomIzKWLLl3qN9jn5OfdU1DoMKSXQ/YVYykjeV9qwDLCXVcpVpUjL+ZJ/uXytSthLSewbA6/3ZTDjeqPzvlWYxnjRb7y0gTPCiByjKuA0JmxumIY7fSK Tt/T9sCY NGPhT0H1vh3bkq+BtT3MDJs+l8NIfvCUC3IcOO6Qb3/YQewd2Eeqw+8dAkOXwASQmL7tE8bYbjGrmkcM44xhrXsgnDSvZZbOhTDWCbW2N4AtZvroNueLuBtetgkTnqR279UBdVI35+7Uffv3OHqNQ0Ls9jgfV4vREdRfpIPrltB9fBeJfO8kv3qOg4NIEy2jAKBXZi1MtQDbJkqNBQh6auK+jN+MY9UtlUR1v5Aa4/VAcb232IP5OhpxeUE02zkVn1HSmInzBcNv4Ydv1nkA1pa0/Suxo7b/k4BNV4IXP2fJlq8cmZPUu4i4OG7J85AMEKsi1LUlBBeOb2DD/qil6le0BLpulBISPnErXPU1G1RKmeL8= 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: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner --- 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); }