From patchwork Mon Sep 2 15:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13787433 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 1D84BCA0ED3 for ; Mon, 2 Sep 2024 15:31:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB84D8D00EE; Mon, 2 Sep 2024 11:31:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E3E936B02A5; Mon, 2 Sep 2024 11:31:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C91F58D00EE; Mon, 2 Sep 2024 11:31:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A259A6B02A4 for ; Mon, 2 Sep 2024 11:31:32 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 637E341D80 for ; Mon, 2 Sep 2024 15:31:32 +0000 (UTC) X-FDA: 82520187624.02.25C52F1 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf24.hostedemail.com (Postfix) with ESMTP id A842F18001D for ; Mon, 2 Sep 2024 15:31:30 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="E/0Uh88Q"; spf=pass (imf24.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=1725290997; 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=5FYPr4aCNzWDRXbqqPdO9GN4olE+iA/3H9/0livHsY4=; b=u31tucXW0eLbp9oWTPdAeZnSSwE1QolVeu8vdM3s3/7ExYRd6nX4u3VRNMBAQ34rWdoCXk XUU/YJzVTXM4kDDKJV+GPq17M0FRsJEdQn8HUjAW4p6SbV8cXxSFQmI2NC+xBYoD9K73gS ehrEZY8NFglvNKu5tnms9hkznDtZxc8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725290997; a=rsa-sha256; cv=none; b=fLLj6dCT6huNccsKHCp4RhKyg/CljYQ1o4knL742EshT2v7Y2czTxe6R/f6a6BaskUqt9z aJgWiDHye6m2yABnSNVpUkgX1OltDRFmA9cq/v7Gz/bbDTds5gxLZL0Lev8FpsVS53iqmm Y0COtn/H1ozujIg4wZvTpxS4qOlpCyE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="E/0Uh88Q"; spf=pass (imf24.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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 7F9E25C5887; Mon, 2 Sep 2024 15:31:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 484DBC4CECB; Mon, 2 Sep 2024 15:31:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725291089; bh=732txxnzLhoaBjRvRLxjSsmpCvQWD20I2MzPm2IaCbc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E/0Uh88Qt6/BNLSu/A9HFA+HxI4Erhpv0jFPPMZkLgEZwccyV4J740jIjPb7CYm4f kIP+N0fx9lEg5jBmiotFoiLjnTImW8tEyKRI8SB9Bn1teW+8MZxhr44rZ+KnMB6qx6 +aGxZEcQYUjY1LPBptAKC1CDCsYNe7adGxyREFseQVaaIH/1K4ozvjAoBQZ5ehbjmm zISmukooxmX4sleHVzfNm0dEFUo+1kwDK45rOiHPKF1Tq5FKjdR1hrlUj4YGMbDh17 fwmk9DZGXKa+mzWCb+Vliaq6ZKBZsQz4IUxW+z46Fqd+RMIjqLzYsP8GsIyyH+RSTU 3IuRIUsZfNtqA== From: Christian Brauner Date: Mon, 02 Sep 2024 17:31:14 +0200 Subject: [PATCH RFC 4/6] file: port to kmem_cache_setup() MIME-Version: 1.0 Message-Id: <20240902-work-kmem_cache_args-v1-4-27d05bc05128@kernel.org> References: <20240902-work-kmem_cache_args-v1-0-27d05bc05128@kernel.org> In-Reply-To: <20240902-work-kmem_cache_args-v1-0-27d05bc05128@kernel.org> To: Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds Cc: linux-mm@kvack.org, Christian Brauner X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1000; i=brauner@kernel.org; h=from:subject:message-id; bh=732txxnzLhoaBjRvRLxjSsmpCvQWD20I2MzPm2IaCbc=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRdveXBJNfCcHMTl+vumzWWegtmbfi/aULHG71Z3x8/D NduXKS/uqOUhUGMi0FWTJHFod0kXG45T8Vmo0wNmDmsTCBDGLg4BWAiK74w/M/x4L2eYLb41Jeb 7ncWCEt8ejApul35vM+umGtezBoyCj8Z/td9/ydozfdu5jQnhefXvNfGLNHUWrHmQHq89oKNlx/ UTWMAAA== X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id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XdOP9B21XfifSOVr9JJH95zPvQMUBKRqxMAtzyQH8FPRhVU5HXe/hyhPn+Edz2bmeR4xdF6AroCQRFjrBIszNh4L99FKNV7gUDr64Csr9WbHiG9ILs1c5c+HoXw9bWvHMKRr6czZCCm8EHC4Asuw63iI+6DnS4+Ox2e/301wm0XQzB2jzyVMKMxMn3FRBGLcyrJ9LzE5dPPblKdZ+A6Ie8sXreBkbhYiSz9CNaNREEX2TpkoYXWyN0GGaNtOn0nGmX1EjiQUlVAKSlUIy/eINXE4qik+g 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: Replace the custom kmem_cache_create_rcu() method with a regular call to the new kmem_cache_setup() function. Signed-off-by: Christian Brauner --- fs/file_table.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 3ef558f27a1c..c20066b3f677 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -511,9 +511,15 @@ 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); + filp_cachep = kmem_cache_setup("filp", sizeof(struct file), + &(struct kmem_cache_args) { + .use_freeptr_offset = true, + .freeptr_offset = offsetof(struct file, f_freeptr), + }, + SLAB_HWCACHE_ALIGN | + SLAB_PANIC | + SLAB_ACCOUNT | + SLAB_TYPESAFE_BY_RCU); percpu_counter_init(&nr_files, 0, GFP_KERNEL); }