From patchwork Wed Sep 4 10:21:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13790363 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 47B71CD3431 for ; Wed, 4 Sep 2024 10:22:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBA748D0248; Wed, 4 Sep 2024 06:22:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C69158D0242; Wed, 4 Sep 2024 06:22:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0C7E8D0248; Wed, 4 Sep 2024 06:22:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 91B678D0242 for ; Wed, 4 Sep 2024 06:22:33 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 49F46A9F1C for ; Wed, 4 Sep 2024 10:22:33 +0000 (UTC) X-FDA: 82526666586.29.935BE0F Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf13.hostedemail.com (Postfix) with ESMTP id 7F2F820011 for ; Wed, 4 Sep 2024 10:22:31 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ng4+fX0s; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725445273; a=rsa-sha256; cv=none; b=RU2s5cByYla1zB+u8rh8QozTRI+U2Eaqkqd99lj/X07ZxuQ5FKlQ4kPuRMcUlbRc2Se1XL 6mI03+l4BK1mynDhY3iUQ4FVIqSuMEzUDN3O7CIPcZWb6Up5WzmVg5FkChfbkVpD2pVbwq Viit+avwoXd2tWdwMPlhYIoVfQFzx6E= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Ng4+fX0s; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf13.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 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=1725445273; 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=4vks5PaaGEf3b57hflqOzeumZWaV2BauV/HHHP12jDA=; b=7Hze9gGay6JiftDPOcvUVJhbJHpNgR/PXD/3eYxixRG2U0GfE6ve/frW33zBlmxPCjlPlU RIfGb5XwZdWHdjrgq3Q7aEhFjKBlQr6UW1es513Il75gz8lShMsxn8ipTgL0HFNC9z3oXL s0xFooQo8X/Sj0U4cQ6vU46m1j4yjDU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 55CD25C5706; Wed, 4 Sep 2024 10:22:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F8C5C4CECA; Wed, 4 Sep 2024 10:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725445350; bh=/U/EdH2xjh8wlswrDAib0TyvkUltBmXomIATwtZQzXM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ng4+fX0s+8DqSHCR5z9UFG82jzXO8WDWHFkEdHUi9jQ+e6ydvcsUhDcnPzOss7yio dLO4oWouJTmhgVH/3C4C6a9ju/RIGsmQiuDTcIqUwxTrzQqI/+RQ/777jJQpjGiLSB A+/xoiff9qLDxM/465PUiXMat7Lr3YyFKz8b0fmKKk4fs39EMdvIj7ewjAbOl3w/x5 0Z0kfj9Ohvs2pLp/lty6ljCM24y3jD1VnWrq7IjWzVavn53N15ekpNeJIst9gJ62Jo xR03wiqIsnNZsFzHH10rsWoMeZs7UJCsvQJ6xyckYgxCOKnTlfYjYFUa0f3lOK+gnM 17/RgHPMb0kEQ== From: Christian Brauner Date: Wed, 04 Sep 2024 12:21:15 +0200 Subject: [PATCH v3 10/17] slab: port KMEM_CACHE() to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240904-work-kmem_cache_args-v3-10-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=1217; i=brauner@kernel.org; h=from:subject:message-id; bh=/U/EdH2xjh8wlswrDAib0TyvkUltBmXomIATwtZQzXM=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdMNl1oG5JPOf83ttis7ZNrFp7sPrsoz65lH2ntZ427 Zh+zOjevI5SFgYxLgZZMUUWh3aTcLnlPBWbjTI1YOawMoEMYeDiFICJeBUxMvx76K26/FDZJaco 2x96nI93rMk6O7OU9/2r7Sv46r59qw9nZNi5vaQsb84tv0tfMpQaD03zbGLs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S2DipTXGx8mcs3lOx9Mn+LuydTAK9M9JvxhI+B9jm1lzm6yIAUz41SOEcleAVXIMv6JA1u8yH8zvF/JcNG6/oIOkXeKAR/4ev4o09lD4GD1uq91G/uFzZmWvOu7swfNFiIH Riw2UwMA pbMF5Ce+wqZBVTFLHLsJdOC1+zVdOWhaSnobqW6XOvsjsngE2tcqGoJSG5IMmMKWFKvzR2dT0X0mfNfyiw1Dbxu+SGulwwrtryjyevW/RfZMBnZq2/p/aSX2B0qVcl9v7BmbXYJ9DJOceNpApzMoYWpWYcPRUcg34SPbdstZJge0VlsTffdtA3Sc0ATq5fBG3b9t4Wu/P8QukUUcqr4I+OsEV3Y+Heu5P23to1jy/Bc7F7T/OCFvgjlkCsTMfbnbtNwfkzpi9OBV6k8io01mAlGao1gNyz7H1Tunzttl717Oz0BD4Ba1+TiXvjeA6aH4g1Ilwb+BhvW8eraP3NX2rpIYSuMg78oaE6ORoboT3PUJrSixyrionMya2KQ== 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 struct kmem_cache_args. Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner --- include/linux/slab.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 79d8c8bca4a4..d9c2ed5bc02f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -283,9 +283,12 @@ 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_create_args(#__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