From patchwork Wed Sep 4 10:21:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13790358 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 C858DCD3431 for ; Wed, 4 Sep 2024 10:22:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 603518D0246; Wed, 4 Sep 2024 06:22:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5B16D8D0242; Wed, 4 Sep 2024 06:22:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 47A558D0246; Wed, 4 Sep 2024 06:22:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 221F78D0242 for ; Wed, 4 Sep 2024 06:22:14 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id CDA131C53DD for ; Wed, 4 Sep 2024 10:22:13 +0000 (UTC) X-FDA: 82526665746.15.AA19164 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf19.hostedemail.com (Postfix) with ESMTP id 0BB241A000C for ; Wed, 4 Sep 2024 10:22:11 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="B/f4yXXq"; spf=pass (imf19.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=1725445236; 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=TxJF+O6Ny2o9AWqq7b2DEyhmZ+aOxh+wkvsuHBnSJ04=; b=D4kT+UYV6DRbdV6gAytGOvdekfR6fSj/IKvAeuAUTuuowYeKx8XRwyKYwaAEqN0sTeKdoh Qxb0/CTaN0vz+cpesqxNBPnm6pJdHc/F0ja3vntwl1ZIib88AqB78xHQVVEdG/4Nci/WXF ZbwRf33rw66g9BDAnShKOpYJWCYMIDo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725445236; a=rsa-sha256; cv=none; b=8FUZ64+tG8RZIji+M0y6gTy4orCfsrvWVWogJHuLm1Zb1EoV2DHLm+jvfg4aVUgACPDAaT ZTdH0GhropThEhkijQEJadKGAf8ooTc6yg7ua1Ai1uSr8AVrjGWeHTLmkNLv3e2MQWSpCG Kkhzee946+Tk7YPDGiIE/5TNMHxzAd4= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="B/f4yXXq"; spf=pass (imf19.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 C95175C56EA; Wed, 4 Sep 2024 10:22:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5044C4CEC2; Wed, 4 Sep 2024 10:22:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725445331; bh=t6CjazxfkyG3rY4OORK6/WvzeiMUzf2dJjeC2mkHY5Q=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=B/f4yXXqFQ5vSEkfdHwtQuqANWB/P0R8vg2RYv1QfjxFiwI6B4jTz9W2XYox8RnVm Z6ewd99jp6fgqA4fe65Io6FD7qgiSiDkoiTXmBf6KQAdODA+gNEda0V4kozGjVNG7j XrcNweG+qb00+grRhqri5Ak6yVTy0XlpAlwXoabLBVfBSMQHAppX4uZyDY5mTfdNFn aOQmTTDICjs94eG6xNLw+AOQMGtqXvxNW+oE2qg9v1HRbwngViSuLWVKB+Zr0I6gR4 nO0V1WPSENxkaRMm12hnLq0+uJCw9w2ian4gZdTotnfz2H2FKSVqYzFbGgp8mo2iAf 0mxWu5/Dzs2eg== From: Christian Brauner Date: Wed, 04 Sep 2024 12:21:10 +0200 Subject: [PATCH v3 05/17] slab: port kmem_cache_create_usercopy() to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240904-work-kmem_cache_args-v3-5-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=1992; i=brauner@kernel.org; h=from:subject:message-id; bh=t6CjazxfkyG3rY4OORK6/WvzeiMUzf2dJjeC2mkHY5Q=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdMNmV7rWmntNfIcDgadi0xuMKx5YKclqElxXs2/fBb sYCi6UHOkpZGMS4GGTFFFkc2k3C5ZbzVGw2ytSAmcPKBDKEgYtTACbC8oOR4a3j0sVZ1x/0LDOz P6LpWNzw3OpOs+thuVsvmm91hH3ffZGRYYHB01rVNsnGvdNNOYtfLrpoyTK/SMLTavONcpd8T/8 X7AA= X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0BB241A000C X-Stat-Signature: d4uoeadpb5px8z6igdz7h4zbf6pb4k5k X-HE-Tag: 1725445331-619379 X-HE-Meta: U2FsdGVkX1+tIzLuPtsEDcaFBJPtOaGttiLB6Wn6hfo3MGjmmYsJVcuOOEgBmDIeX0oyHYO55qycszP9ZCeQsXGMsFEigmKI4HfhCtEraucMPVpOFOkHltXkiaYHUxalDIbpTpZBHFvb6OgkVbyI+pqiPhkGMaXgF8ocRUdcLBGU+/qryqdMeMrZcWY92waNINKTGGhgcJKDOkLPM7fhw1VGTOkEsjcnLKfTcLtvf/u/rjpugSRQXD5p5fKDZr2kIhRIIajDPAB/+92IvQjOrNQD3DqTqXsEcdjPuQgxhXsX8ZPealcHFTncS+mOhKEGXJ1+gN+pamB5Jgt2/FHJammRDJqKf0zxsw9+J/j/JmVzSOZRP4SarEsiPUvxkmiDD/gx1iOEQmjeWsoFGGpsGs7GiYmnMi1SfQiQELqEPFVkZDvQBvGxBr4NoBLtiD1ztNXaRlczV7h/rNeqPFD9FdLYtXvN6tuMF8vfwLica60DPz0Qtw6i57Y1Hkuz/18aih0wzeXhO6OBo+p7q5vgkq51I1qB/efrWfrgHjfHJFTmg4DUuYPYNFk2b9HpNUu7jf8H+mQvLuTn3JA0ctNcVsACdmLioJxoGg/qSkM7gqusmVpC5RTR/GlEOY1/84VJlQ++Po/nFUBvq9Kz1IE/qzGqLTowSn5cF0PQx8wd2E5+8FKtGoT9PmAOQAX8h/jHRETpYiQyOJ0GFoRmLovc0+gleNRh2pBcNshc1uk+6foeq8CsBP0KeRyko+1pPzlftTn2l0celn/RcmdjXXeZ1BpYaPZgQnUO5j6Bu8fsv76HvQlDcAJgrmPWkS5wyvzFn+Kza4L2f34fXGuaMM1t+yOKBpII8Aa63fBv/j5xNoGVKeHbXsWzhB9mRPFf0Bniz393IOgzHUdBYMpM32jgJlhIVys0xSWm1ZrO0/IkR3Tw1UXJNcU7EoLYiyBENpMye7Uhw3I+YEtsa0Ep7l1 PkdmUbfC Iv6sqYIK9em0oSXMaNUkw4Huof90diEPERkum5/YvPMS80l5cLJKiMV9992w1ybIt08i09BW2NKHsun0qgM52C7OqYU5tg27ON4gfgNCTLJMQ9KJdYvvSeRKWXm4m5h3oKptnLA/HmMQMt8g3mYo1CHzaJIYmr9Dkk9JZHbjB6PoMTsfBi41rX7xEe9+BRKVEAseUwOR1i83YDkckE6gihjBFxPWwEbNGddm4/Rp1Fh0cGMnlqLcK28ZIG838wd8wYso9+T7np38RxEiuRoupqBqjSnffPorNdaZn4Hq2FMHmgNn/gChGH+zo6sffeiVomWGjW9FdRtf1ETfPzwBpK0h/2gw9HH7Jd6dv/e0K/5wSxGY= 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: Port kmem_cache_create_usercopy() to struct kmem_cache_args and remove the now unused do_kmem_cache_create_usercopy() helper. Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner --- mm/slab_common.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index da62ed30f95d..16c36a946135 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -351,26 +351,6 @@ struct kmem_cache *__kmem_cache_create_args(const char *name, } EXPORT_SYMBOL(__kmem_cache_create_args); -static struct kmem_cache * -do_kmem_cache_create_usercopy(const char *name, - unsigned int size, unsigned int freeptr_offset, - unsigned int align, slab_flags_t flags, - unsigned int useroffset, unsigned int usersize, - void (*ctor)(void *)) -{ - struct kmem_cache_args kmem_args = { - .align = align, - .use_freeptr_offset = freeptr_offset != UINT_MAX, - .freeptr_offset = freeptr_offset, - .useroffset = useroffset, - .usersize = usersize, - .ctor = ctor, - }; - - return __kmem_cache_create_args(name, size, &kmem_args, flags); -} - - /** * kmem_cache_create_usercopy - Create a cache with a region suitable * for copying to userspace @@ -405,8 +385,14 @@ kmem_cache_create_usercopy(const char *name, unsigned int size, unsigned int useroffset, unsigned int usersize, void (*ctor)(void *)) { - return do_kmem_cache_create_usercopy(name, size, UINT_MAX, align, flags, - useroffset, usersize, ctor); + struct kmem_cache_args kmem_args = { + .align = align, + .ctor = ctor, + .useroffset = useroffset, + .usersize = usersize, + }; + + return __kmem_cache_create_args(name, size, &kmem_args, flags); } EXPORT_SYMBOL(kmem_cache_create_usercopy);