From patchwork Tue Sep 3 14:20:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13788795 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 990A8CD343A for ; Tue, 3 Sep 2024 14:23:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F3A568D0183; Tue, 3 Sep 2024 10:22:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EEB618D0151; Tue, 3 Sep 2024 10:22:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D62CF8D0183; Tue, 3 Sep 2024 10:22:55 -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 AE8FE8D0151 for ; Tue, 3 Sep 2024 10:22:55 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 745A0C03FC for ; Tue, 3 Sep 2024 14:22:55 +0000 (UTC) X-FDA: 82523643510.03.C29FFEB Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf11.hostedemail.com (Postfix) with ESMTP id B9F0B40035 for ; Tue, 3 Sep 2024 14:22:53 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="YuWuHWX/"; spf=pass (imf11.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 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=1725373350; 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=VH4A81EcWeI7SjiZUTFfJdLq0A4n/ig0LZiMLrKE94g=; b=aI/mwFCb8G83HZ+W4UIw7dW/Cu/n+LmLi9lBA70miNov3RM+dCSgkt7vdlXffcnEvq+tZ0 QOQwwziTnPxnfCrkTE0BuBJW2lYSq07146gkfYloPY0Nxhi/fpzJox0eUaLt3XKsCk0HtJ kPkNrWeLEuqc2DlWuar9RQtJiqrDjzg= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="YuWuHWX/"; spf=pass (imf11.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 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=1725373350; a=rsa-sha256; cv=none; b=K+9c14ejJvrvsV5BxoffnQCqrORuyUD1QTR+PyHePXclh0Yo8AfKHAXFMWGV64xNFEW7Ep XZHKe8Yoscx6+giPqCrnuAkAB4xIdexfyJti9MOAEESOuc2H8TISJplHp8YEA3FZRN4oFM oQYbqv7x/d1vmhzuz5Na9aOpdCYOOQ4= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id EF563A4363C; Tue, 3 Sep 2024 14:22:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0689BC4CEC8; Tue, 3 Sep 2024 14:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725373372; bh=CebY+vup8RjtcJO3CTsKAhV3jVPnEJg6xeCeD64qYmg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=YuWuHWX/bnShus2D9Wt4BPKhUFKhBoC2JuQHtpngis5DVhaSb80K8nhQ7YjfXM6eh ORHEfli3aPbBAyZDCOUv2avSMT8I4L/rZ9xbwqotShJf22bkmi/Rrsr1ksNZo8p2qB yhroIQSw/texBgSHn0y8XTPp/cu68rNXCymuGLjwkwRXwemv4lgxsurtLDaQ3C2FcE nT4hqV+8d3IuYjkB/SMfnwpTItI3r2Jc1KdztM38vzHm7i2WH/1vYsE6bbTaTwJBuL 6MbnkTx1QYYLjTqBqXuZXney+PfSi40v/QowMB35c1MvlznDbvrPeAYZ3tsEVPZt74 WRm/04WjO8UeQ== From: Christian Brauner Date: Tue, 03 Sep 2024 16:20:54 +0200 Subject: [PATCH v2 13/15] file: port to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240903-work-kmem_cache_args-v2-13-76f97e9a4560@kernel.org> References: <20240903-work-kmem_cache_args-v2-0-76f97e9a4560@kernel.org> In-Reply-To: <20240903-work-kmem_cache_args-v2-0-76f97e9a4560@kernel.org> To: Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds , Mike Rapoport Cc: 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=938; i=brauner@kernel.org; h=from:subject:message-id; bh=CebY+vup8RjtcJO3CTsKAhV3jVPnEJg6xeCeD64qYmg=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRdl55zJ6dM2VhKS2/H/aW9Vbv7r6Yer3jIki0R3z/h6 +JyRfGojlIWBjEuBlkxRRaHdpNwueU8FZuNMjVg5rAygQxh4OIUgIko7GP4n2CVvqcx/IdlwHwL uX0fojbs3pu1ckf6cjH7jpOqtgznjzP807PtnHyx7T3v4Y1ySXwx8dNiSjMPyfivrI0JePt9s70 tBwA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspam-User: X-Stat-Sign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L/GAv //sAOH+w +lLqKDttoJ0T6bilgSrjKUv5LC8CgZYuonBtLxig8qUUDRjEk1rvAIjygFykE8p+nrHOeHT0TxJ/LN9aFTFRr/7uaKQCFqj5l2QbPI+RiQBztvs1Xseg2InB2PpUSa1pLV6Q2QnnOdgXpnGZHiiv/EqClhnxPzJpa5vPs6PndGrnRDLP47M3yf72v0+PERmFoHKhzwK8ukBzperQn3IhldENecYQVU91W3J3TsR9LXC4yfk+4H91khDeHh94ryxnW1FW7KsnD0MqPNpL7XQiqa0YyLWMj/p3QZkGQ 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. Signed-off-by: Christian Brauner Reviewed-by: Mike Rapoport (Microsoft) --- 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); }