From patchwork Tue Sep 3 14:20:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13788787 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 8AAD1CD343A for ; Tue, 3 Sep 2024 14:22:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA2748D017B; Tue, 3 Sep 2024 10:22:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C55348D0151; Tue, 3 Sep 2024 10:22:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACD568D017B; Tue, 3 Sep 2024 10:22:37 -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 830438D0151 for ; Tue, 3 Sep 2024 10:22:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 405F8A85BB for ; Tue, 3 Sep 2024 14:22:37 +0000 (UTC) X-FDA: 82523642754.13.C95BB49 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf18.hostedemail.com (Postfix) with ESMTP id 85DA31C001C for ; Tue, 3 Sep 2024 14:22:35 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="lnwsuY/D"; spf=pass (imf18.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=1725373261; 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=Mve8L0Ir7YTQzYWI8ceHCLtQR3JmgpY233DDCqEobOc=; b=BXDoa2I6At+4jcTUs7ocOs8/5i1f6i3m07AX5P+IW/U3t8sk/4CyOgcU9aGURA6u0TFGgg x0E/dkuKqe7cY0+XwgGVBPI2jPr97Y/9fe7VSBS97rxnMHl8FJnv1AtZyTfMN/ap+71TYc 7pXGzJDdgDdSX2VoPMTg5v4oGHSraXg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725373261; a=rsa-sha256; cv=none; b=2xBu36QjWrE329pzSwndc2lICRcraD6n/7fW9oT+YbUbwz+M5zJ3tPqmM19N0aAEkn/lTf TL0j7hQlJpdYcfDeDIIQ1xYFEA6QFruUDHtoIcL9BlUEYvG/I6yguBz8iQ75qIyOfA+xQv o4MXZMv9xD/RDFMduzJMo+x0hpxatCo= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="lnwsuY/D"; spf=pass (imf18.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 988A4A43662; Tue, 3 Sep 2024 14:22:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D591C4CECA; Tue, 3 Sep 2024 14:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725373354; bh=qZgCti9Uoopmu2of9/KPoTLyubqgNTKqAU6SyDZvCz4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lnwsuY/Dm0ZSsZkzBUqNed0O6oKMY249pFL4KNk8UDjxunv1NStiWR9awREnGzVT3 KBca6yWLYFHtQw02kRp1g6S93mGZZkvCh5SMf91cFE7Mul25Dqh4HgLh5x7QqOwd+a IASO+TMGu/s62B+KpNVrBsap/j/xFtqNvZeb+reXcuH6Akbp9Civ9Iho/TgGCsQpCA aS9Sl+/mzHzSVEnoGfBPXOvJcKIw76woMywoZxaL0W32AZxRLrz0Pnc7TYIap5nl7y A8+0eYI0Q8g9DM/vln56yslETXQgU1VF6SjvAlSG5UkpgA16SsQBPb+vrEyZK6c+6g lX57Vb026CJPA== From: Christian Brauner Date: Tue, 03 Sep 2024 16:20:46 +0200 Subject: [PATCH v2 05/15] slab: port kmem_cache_create_usercopy() to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240903-work-kmem_cache_args-v2-5-76f97e9a4560@kernel.org> References: <20240903-work-kmem_cache_args-v2-0-76f97e9a4560@kernel.org> In-Reply-To: <20240903-work-kmem_cache_args-v2-0-76f97e9a4560@kernel.org> To: Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds , Mike Rapoport Cc: 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=1887; i=brauner@kernel.org; h=from:subject:message-id; bh=qZgCti9Uoopmu2of9/KPoTLyubqgNTKqAU6SyDZvCz4=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRdl55dWRq+dU34k3mzC1vupey0rti+eO9s/2fNCoxHp X382RXfdZSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAEykKpPhr7Qby4t/pje7HY9u d25SzA3LY3tX8d15WbGbx7uqade+TGJkeHz0ycy1v7eviJaabRm/Ruw2154d1/h0nodxKkyfx73 3DRcA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: 85DA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1iS86OmeT 8SKF7hfi hhCx0vTD4Zic0Lnt40GWSgZoMQGP9jIJxn3i/a+SzyznhN+DrQlKFH1GfShk1fcZ2AlFvravpkyAREDhRYUSbngqKwgXJkaAgNjUb9ghkldbPKJ1iRqJvY6M6TtdkzaMrE04XfMmRB0glgsfu0vZmJzFOCogvq9r4qj4dNrIS04aQ/BB2kQGS4mq8KFxv9HXeLQaRFdt4rt/y09zhbbpJtVviiGRrYCalh8sjfYJ3/mDD1602kBzcAkScAPex1LdbDjqUTHlEcif4LoT9YXyVphZc3fYQMQJqFe3SI14xCSXPEW8= 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: Pprt kmem_cache_create_usercopy() to struct kmem_cache_args and remove the now unused do_kmem_cache_create_usercopy() helper. Signed-off-by: Christian Brauner Reviewed-by: Mike Rapoport (Microsoft) --- 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);