From patchwork Thu Sep 5 07:56:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13791890 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 CAA7ACD4F59 for ; Thu, 5 Sep 2024 07:57:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5B7666B00C5; Thu, 5 Sep 2024 03:57:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F0016B00E1; Thu, 5 Sep 2024 03:57:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 392B86B027C; Thu, 5 Sep 2024 03:57:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 146106B00C5 for ; Thu, 5 Sep 2024 03:57:46 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BDFF7819FD for ; Thu, 5 Sep 2024 07:57:45 +0000 (UTC) X-FDA: 82529930490.02.E2017CF Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf09.hostedemail.com (Postfix) with ESMTP id 10700140005 for ; Thu, 5 Sep 2024 07:57:43 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KYwRNlCa; spf=pass (imf09.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=1725522966; 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=xduX72Kh/2IKT4jxLVbqqUzZkl1nUopJtgcqKapU4zI=; b=QPPV2ovgNV1P+u2i+cFwtluSuoJ4X+1RhUBiPtKw/ty84aDL2aeQvRsOeOtFnor2Pnw+FF UNCCtCdljHZBfA0UJBjrmoR7ab7PFl9755LgV0taI63h5D9PFlCp4VKRD2B2Ngt94GK0c8 h2nLNx3XMe5d/87tOtIUDQab8V5FrbA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725522966; a=rsa-sha256; cv=none; b=ZqXhXGHP1aSmecEFvLMSoYHGIRrF8Es6lzpOunwoq+yUA3Cg/Kgc7lLC/lgOjAu9I8YY76 I2sO9qBy1jpnWu4mbnyZ5/aMnw3pnxB+ggsQiMO30kAdXnLACf/Ao7K8pZxfYarvBc+2He dGtW9f1OD6eNZ8/4oR8YL3GJ4OyhGk4= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=KYwRNlCa; spf=pass (imf09.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 3A7FEA442EA; Thu, 5 Sep 2024 07:57:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE3E7C4CEC9; Thu, 5 Sep 2024 07:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725523063; bh=R+pPpbtSd7TpTn7/geWedM/ETd5BwUD/V+znBniHb4Y=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KYwRNlCarPHqMLpahTJxt9QurLzF3yW5roIRbxWkYPvzJJeQxMBhK7l4eQPQ+zUht M35sBmieTcbswH4nzib0mhw8RkFBbOqAVbwmmHU/OoHbSo+qB5RbqoTlg5LgtpiJe2 ZxpUT6My1K+7df/sHXZRyMCZD2v3O1xaGGVp+MqlJnCgWYQ/wIJGJMqKmACLK3cJ+u G4sRZDQEHpyvN7XmyRv1T/t4BPteuRlJefS4jEDwUV2FT73yONODrCuVq7wpcJM1ys YdyCNYyN9RhyV2tdcMgFXEMBTQ52q883ZbY4PYRf8JCyL/s/t7Lrf31llAmmhfYMSL dBWL4YbTmXV/w== From: Christian Brauner Date: Thu, 05 Sep 2024 09:56:53 +0200 Subject: [PATCH v4 10/17] slab: port KMEM_CACHE() to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240905-work-kmem_cache_args-v4-10-ed45d5380679@kernel.org> References: <20240905-work-kmem_cache_args-v4-0-ed45d5380679@kernel.org> In-Reply-To: <20240905-work-kmem_cache_args-v4-0-ed45d5380679@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=1255; i=brauner@kernel.org; h=from:subject:message-id; bh=R+pPpbtSd7TpTn7/geWedM/ETd5BwUD/V+znBniHb4Y=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdTPEOPOFxrsVP6W3YHb7n2U915Ges537TFGG2fOPb8 1fEzcPNOkpZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACbSac/wP3tipJtDqcTMiBy3 Uz/2yU1fupp34Z1bnKeOmxTYdm70vsPIMF3joN7yQj2NZT5p5Yv6JDZw2WS0GUv95Lu0YtZkqcX izAA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Stat-Signature: ikmcwm6ekrpuo7ufytfo71ot8rf59qbe X-Rspamd-Queue-Id: 10700140005 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1725523063-8294 X-HE-Meta: U2FsdGVkX18Z4a+L47bsUFmRkH5CstB7SuRFxJo8DX54yjMhhteM+vFuvrERfx9og8M0M0IbGcqZXgr9S6CN7wcIGmpMylnqych3DNwtQ3x3egG3AKTUlAq4BtQmDwsyKiyALXWz5ilRtuvYas87/ctss6xP6iVGHqMH0s6rNo5jJ8ILHr+Q9OXvZqzjtLikGxizUCrX5DYNmFawkZy/mMTFW4KahboUGIRLVFN72b0/+1xbttm+fdwp1lAvUVhMGgg3AIR+cwHnn2HfLR9qkb178OPXxWdcROrk0nmcECwpt2248PRleCQVO+f7FC0FEsE0SumN5axMVfAO4Ddp21ClqWmkeyEt+kylGInt3B9/Vu0serDO82Cvzam4wE0lz4ZaU5KkPdVjS97HQRev7Gz9ZvQ/pYs5uESdJhxxcwMvP26a1q8axbIHEjj6MILBmmRjrYP88tELFZDyip40LBz4PEQ+dCHggCOsc4kaOAfjgQ8WTRMEH6iDZ0MJxE6QzsSVTe/jlni/0YvZ2cs0NF7+DkTid5xEac1iFN/iuxMJJ+cMpXsv3QXs0wnp5zF5MDYGTLHO/fMF8iXjMkjHMDhXiXDlV7VPVA7Kq5VL/0zsxtdL2v99Dz7hnHsHcdU7LGQSJ1tjoHBkfesq7RECxIsULiedtLVJr6+3AIYaH6FYmVUy6Iy5JVwyHLXnF/Y6iz2b2s6p3rykwbuTo6akR0F+JhUy9FYIu2ozrYE1pPk4NWSXN78kmNwSQV1dHQl0RejDSVkEHd9JGZCXgIdBHS14SSRQNr6R0o3DckvaO/d5AIOQateKOX4VgDLKrYgZnX2x1ntDNx73JJa0H4CnCujf9SPU4owvXa37Jy5YVIWf0zU4+YO4WGpy3LXnO61y72FS/aOR/HsE45ODpd7/SCanXOYvzo2poFeQ3DAaIgoB8BOat4HA/+STrUYV5/X88ji3DJzkblXYSu+ynMe YK2TL1yj Mc4YHkVcndg0eH2R5DEWIpZIkdbWSs8ScTKVjCgKTYvRuPgi3nwB2oq7j1OLrVIcNzID9S/T4vGWL80/id9gMZPtfhJw6OGgbUKU6joDdqeWkttdzVJClNkJVv8XQkHYmqbQB9pxxkn7ynqLaTVoXs+S99cMX74gRPlXKF0gqPYexnecn7WjN7ZRGIhSMKBM6q8K48s5l/MjZtonmgBHREU68ND6S55ydi4A3Jvu8aUQEOcGpRZd8KMTMfGIv6aBTT+0V6WZIexpV3kYxl/a4qPppALV1fNT9Ti2SCI9YsvYxlTQCzzLZh49t34RCSm/7Oty4bhSVECAQy3aX3pb8xAPR5bp+/ORInsavsf3e2g891RlZklRaZE49XHR533TFzHDNm2NijyY28ns= 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: Kees Cook Reviewed-by: Jens Axboe Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner Reviewed-by: Roman Gushchin --- include/linux/slab.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 79d8c8bca4a4..97117a2fcf34 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -283,9 +283,11 @@ 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), \ + }, (__flags)) /* * To whitelist a single field for copying to/from usercopy, use this