From patchwork Mon Sep 2 15:31:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13787431 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 69AA9CA0ED3 for ; Mon, 2 Sep 2024 15:31:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A6BC6B02A2; Mon, 2 Sep 2024 11:31:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 458EC8D00EE; Mon, 2 Sep 2024 11:31:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 280188D00ED; Mon, 2 Sep 2024 11:31:29 -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 08F106B02A2 for ; Mon, 2 Sep 2024 11:31:29 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B2EC5AA0CB for ; Mon, 2 Sep 2024 15:31:28 +0000 (UTC) X-FDA: 82520187456.28.13FE92E Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf11.hostedemail.com (Postfix) with ESMTP id 05BE540014 for ; Mon, 2 Sep 2024 15:31:26 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZKNohXwN; 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=1725290993; 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=egUh6GR5wZg3MtEyM/sPaqQeCgeGapkObqZI9iCMGNc=; b=Z2Cg0jeBRNPAISD1tu2Fv6QTnkbL0tzmRnQRb4ABejpRw9OGOR5LZmyLWjos6PGTz1WOK5 IJsDdvJoqvpQe4ky4trqes6SdkfuKOq78ythYO2akoTgsIuJtYpNU6yCDS92SMJl+eSrIC Ida8db036W45txrW95ruv+xM8T/t5fU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725290993; a=rsa-sha256; cv=none; b=J7fHf9RZxeuuX0kB3Xa6u7Xt5pNuySRJS2dsVbTeFnccdgeunPZ08CQ3ZN9NketPnXh9pX dkHgwNkNf+MkA1KnkqthLOz/RyrsBXWiE9QgGXIpKhS/awo87EtHrs++/UhkWVIROeaCGE X4kEhoi1ah4Kv2vixoiepMOVi0emjCU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ZKNohXwN; 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 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 40101A426E8; Mon, 2 Sep 2024 15:31:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0877C4CECC; Mon, 2 Sep 2024 15:31:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725291086; bh=HEPcw9oVQsLcGOdntDQpdEMJb74lNJy6nBGCOOTirx0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ZKNohXwNn1ekDhwosaSFu7EriBUtgV9TVlnh9wsrXJ4N5z34ajsbbm18WbvM1LD3p 61neHkswomPcxqIiUCO6IkbRLDOutv0YxBZFSRdbltz3lBB8hduP/sQt1I2w/07FXB WPTNgFCqJqTC5p9XusQjvhRQgtmn7HQEcwcstDcq3wzuCdzodkgzeJg9Uz9CqkWCWU NlKUmYrbCDhuUVEAF2shxTAyehV7qgfVvRo5KdgpXYMDqj0yFLpQB2jDCfuSHfOSsb fA0darp5MKUwANPmFXlGyowyr963SCvs3SFp6SKLvxQQjN5ePhDsUOXSmsuGMocoK6 86t8xu3w6gn4g== From: Christian Brauner Date: Mon, 02 Sep 2024 17:31:12 +0200 Subject: [PATCH RFC 2/6] slab: port KMEM_CACHE() to kmem_cache_setup() MIME-Version: 1.0 Message-Id: <20240902-work-kmem_cache_args-v1-2-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=1199; i=brauner@kernel.org; h=from:subject:message-id; bh=HEPcw9oVQsLcGOdntDQpdEMJb74lNJy6nBGCOOTirx0=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRdveXR08P3fefEOb+mzQv3/HHzY5HJsvMT66Zv13n5m VN588rZ7zpKWRjEuBhkxRRZHNpNwuWW81RsNsrUgJnDygQyhIGLUwAm8syCkaEjodNASmnftBg+ RS1ng6KtYpWyv9SkeuO3PPjUY5i2dyojw0aOLkVDm65X/GuVuKtbYizNWqqW3Dn2yS/hJ+vSp9t 9WAA= 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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g3 1vhi6IiT IgFjA9eiDrSiTzFUcEDh5Yt4vKEUNrMGFI67LYf8DBWrX2z6Bmgj0kIGsjWJBGN1+btZuAqzDmQ5eGWo+AfRueXmICweJADVzCsOf3F90VyfVW2aayi94+MytxZQGHjknoKhRuMEgY9Iodxrb77pmK0K0C839OSMHorneECc/M0+6Xv93KoH3i2F8ye7XOtgI95AsID66cPhDqrmU0ob0p+HdTC8H89+t8dAZatgJw9pK83Oxx1Oogvq3E+xJ32CR0KhSeBK6j1mK0PEBzw9mIq75FSSkoJPFXSPx 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: Make KMEM_CACHE() use the new kmem_cache_setup() helper. Signed-off-by: Christian Brauner --- include/linux/slab.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 41135ea03299..79f4799b7083 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -283,9 +283,13 @@ int kmem_cache_shrink(struct kmem_cache *s); * f.e. add ____cacheline_aligned_in_smp to the struct declaration * then the objects will be properly aligned in SMP configurations. */ -#define KMEM_CACHE(__struct, __flags) \ - kmem_cache_create(#__struct, sizeof(struct __struct), \ - __alignof__(struct __struct), (__flags), NULL) +#define KMEM_CACHE(__struct, __flags) \ + kmem_cache_setup(#__struct, sizeof(struct __struct), \ + &(struct kmem_cache_args){ \ + .align = __alignof__(struct __struct), \ + .ctor = NULL, \ + }, \ + (__flags)) /* * To whitelist a single field for copying to/from usercopy, use this