From patchwork Wed Sep 4 10:21:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13790364 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 34C3DCD3431 for ; Wed, 4 Sep 2024 10:22:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A979E8D0249; Wed, 4 Sep 2024 06:22:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A489F8D0242; Wed, 4 Sep 2024 06:22:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8E7E38D0249; Wed, 4 Sep 2024 06:22:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 6742F8D0242 for ; Wed, 4 Sep 2024 06:22:37 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 23506A0F96 for ; Wed, 4 Sep 2024 10:22:37 +0000 (UTC) X-FDA: 82526666754.16.C614FC5 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 71FA0C0012 for ; Wed, 4 Sep 2024 10:22:35 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="VftW6h/4"; spf=pass (imf22.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=1725445259; 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=cr+zJef9rFi1LPaZQhRMtjM8emHx5yay7S/2k3Dhjp0=; b=IIO9QqmQTq0UX/p3gKy4QgT1fDHV9PsFIJIZORkpAnsGZhOsq2Qrb5Du3X9AGs+jMM02cF u1EnPG/WKxvm/wXugU6VRJ/bNIktBQ7Vt6BoUfiNzSniOlxpbetWjvf2jShhRUKn/yQ/19 0ikZmMQfx+qy8zPQI4Df4UZfL+orOg0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725445259; a=rsa-sha256; cv=none; b=tnPYHa7u7Fe1VwUE/Mi5bH5RGx8ZGvqDMG/E/NcqOucfzfzZ0FgiHjIjIRggoBhkn6gNaS zcWSjeyqUaDrflNN2EhzUOpErnCM7Pa/zhEtA3/xTNagEVKUJAqnXGkqJkYl0mJvq4yFpF OScrSN0djhIOmDyqbE0r7zJWqZpi2Zw= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="VftW6h/4"; spf=pass (imf22.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 4B9355C56EA; Wed, 4 Sep 2024 10:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6A98C4CEC8; Wed, 4 Sep 2024 10:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725445354; bh=82J8Bf3LCC365/T9k9A+CuN1jBmnIwSLQl/UyUW6uSk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=VftW6h/4nP22SErP4ZUBode4BsdoX/rn/Oe2nrMJfHyJqoUNq9k9mqtieylVbFrTu /Rb5LHSBVEgxWAM9gIifQg79JG+qOOzP/g8cwhWLXPwoc2WzvHbr5OZHPRpVixzW2l AKWOunLfQ9TRuoKUIG3mnHOxjlmDxnng0QCl05BKY5qCy8L+XRktHVZKA3DXb3867Y HA8zx3rGwx39UgKzj3y6Fg+yIsXcKDa9dbmI2AxaEY1xfFE/EvGXLNN+qYq/I6Hf11 PRy9tXEt6NHf3W0hoe9oDsg4S12TYYAPavNlvJK0s6nenxgW6T+/4NtAYHxdE4LVYl 9ZURfLw0qrAuQ== From: Christian Brauner Date: Wed, 04 Sep 2024 12:21:16 +0200 Subject: [PATCH v3 11/17] slab: port KMEM_CACHE_USERCOPY() to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240904-work-kmem_cache_args-v3-11-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=1417; i=brauner@kernel.org; h=from:subject:message-id; bh=82J8Bf3LCC365/T9k9A+CuN1jBmnIwSLQl/UyUW6uSk=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdMNllvcm9/S2D0dtHnVb2ptY3cvLiTpxk4XvUvaP8Z 0LVsbwTHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABM5e5uRYUHpdQ8euaUhvDaS vbvYfR1nHDyetjnWZVWPwKNH2bXGwgz/w2R25VxKdOL6q/okJ5z7zd4zAb46QseLvVh5ah5X/Jn JCAA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 71FA0C0012 X-Stat-Signature: za3fawej7te6zdkprs9h9x6p9yypqgzp X-HE-Tag: 1725445355-884450 X-HE-Meta: U2FsdGVkX19ddY5eX6A8nfyd5J2M0XukFROl6seGQN7WANZQgDA6RDUJphVmVH17LfwmBxnIcuN4kQSzUNaRQ/ytmrViKguqKwecuBQ1pKS0u35T+lgHTMRDxtTTBNj+SDn5eks5mAeDK4plAfDfCIDqykz9XnlLOqCKpWS3+OaM6zsGTWg8hqtaNhodBpSQluWtTc5zBgtubuQCScZ9avFCVcXX2jvNFlDP21wUu98QPSBHe2fzrWHYL5bLEeuiiYhzp7uLLGSe5ooAL2GgRbheIINykF4MyScuMKW9DlMYJNffNUvvXMCpv1/SWWHGBN6p3avtWJu23jreYHzHtZ0W4FGzQkuxdli8sQj3/6gS1SqybzsGCbVAhOjq4qqgsU8xONKShDC/HV5FlSQn/P0v1x71L/k5v3ESp9GpHBD0Ixstj3mFSdCVakk69nh4rnnm1yv6fRBewzEY24VbKDGxthqmfspRESSZRtWZgVUwaR5oxW4pDbrhY1K+xK/L3NDBIO6xJmkMF9Gu9BZ610wYhcl6Lh0E7C7OnnSA9ee8befaeBXlZ+8YPcT1Q1kc+AbIQ1Mp9HrLfEIrJqRogtKZYf0hB/OMdoazQhBSbqgqy1WddV0viiwBkCMoLSJr/15zPocG41egjiPF8XcTYhIIykCpKp/0Vn9pPAdbujBta1pkadJzIz2m66bQrLDMbR/Y/XCz9tUYrFHWBzmub37O3SrlcMB4h8R1KKCDbG+pnZa1UMJ8R/7Q1EV04/2OqVhyQK8q2PxXl3mdnfIuyINGr+CGXKc3KjHgo3CSrXgH0YqRecIhnhIN7hhj/VXYICyGiLxhZRCEAwBw/Diop9dQYAT/Qqr7DRvEDv2mn1rs5Su40TCJrKRXhi/Zm34QW/8JRXJEX9bSitObX9JCaHD0O6hQ1TVrJKgS34TM/4fwGUiJYvBj2P6Gf177JLpVpCqvsh064hbTn797jd7 5qS1b4kn 6otHOCbmmVIb+X59wd9YiaC6C87lxJR5TdT2to8G4osZi+uhFqlsVkg638g6W2N+U6rE+jgpByTOf6nW64TsQv3CmFsUj4qiRiz9EPXj3TFRkBnjjl6T1tfZOAUwSDgqR65NYXzxrdqliMlTqzS/G6kDHJ3YCc41Pz1XMYyPPCl2ygEnyGzhjPqKCgExwCBEMtLgTF5vuSqPt5b7QbeY96mvhyE9goJeAPZCggf6N4VFILGoFzfvwTKNou9iXMJu9TV+w0aTHx97A20kO1haKx2tg95oSKTZthj02CDNWRH6RhbosRYFA0IChmxsUdAnB7VwBHn5cbf0qgh54dzQOl5NK3WniTcCjh1gEj+9Lw66guQaHhF86dlerQg== 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_USERCOPY() use struct kmem_cache_args. Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner --- include/linux/slab.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index d9c2ed5bc02f..aced16a08700 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -294,12 +294,14 @@ int kmem_cache_shrink(struct kmem_cache *s); * To whitelist a single field for copying to/from usercopy, use this * macro instead for KMEM_CACHE() above. */ -#define KMEM_CACHE_USERCOPY(__struct, __flags, __field) \ - kmem_cache_create_usercopy(#__struct, \ - sizeof(struct __struct), \ - __alignof__(struct __struct), (__flags), \ - offsetof(struct __struct, __field), \ - sizeof_field(struct __struct, __field), NULL) +#define KMEM_CACHE_USERCOPY(__struct, __flags, __field) \ + __kmem_cache_create_args(#__struct, sizeof(struct __struct), \ + &(struct kmem_cache_args) { \ + .align = __alignof__(struct __struct), \ + .useroffset = offsetof(struct __struct, __field), \ + .usersize = sizeof_field(struct __struct, __field), \ + .ctor = NULL, \ + }, (__flags)) /* * Common kmalloc functions provided by all allocators