From patchwork Tue Sep 3 14:20:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13788797 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 8CABCCD343A for ; Tue, 3 Sep 2024 14:23:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 109818D0185; Tue, 3 Sep 2024 10:23:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 093CA8D0151; Tue, 3 Sep 2024 10:23:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4F338D0185; Tue, 3 Sep 2024 10:23:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C084C8D0151 for ; Tue, 3 Sep 2024 10:23:00 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 7E1421A04AE for ; Tue, 3 Sep 2024 14:23:00 +0000 (UTC) X-FDA: 82523643720.14.AF2CE1C Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf08.hostedemail.com (Postfix) with ESMTP id B767216001A for ; Tue, 3 Sep 2024 14:22:58 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NIA6dpiB; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 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=1725373273; 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=+U6+eSzUgYqIrunxVNxrQuJEbLQ5FZEq/qMkeBfPNDA=; b=PvyjdAZcVB56jNHHPd2kMl8vPm0T1PV05F1XA2rYCxWbQooJR14UCHf9bpmy03aa76/RfG anises8Ke//CkIIjRda8+1e1jeXK9a35A6o0ia/WUlnIM52Yc6xJqE/Brj1SSjFO/dEmoC Q564Ya5W7LyUujxvlG6lOmgEapP/6go= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725373273; a=rsa-sha256; cv=none; b=QYPteouwi3GrCL+yFD1vGWWdhEFqOSoHu2lopSB5Jl32ZNLxc1TXpCzIpSaGShIiINnWoL K41x2+06c14Xm5OdWFY1mMXb0TO5AczNYD3fARaYwsf3df4GCl2J4FhhITpygLlMv7RiVe fEGwgnH9GLUroi/0FpzxFC5orh4IOdM= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=NIA6dpiB; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf08.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=brauner@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 97860A4367D; Tue, 3 Sep 2024 14:22:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F4DEC4CEC7; Tue, 3 Sep 2024 14:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725373377; bh=3NCbIt7AK7tmjnKZtBo4rWvQELZGRKFxzNKzdNzEh+o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=NIA6dpiBbsE1OC9ubpMKp8jNcztrTDTatRxf5KWQbTjlNRL0XSoikHaYH8dpBad/t iQBWjOPBYr7F2hJIqWh1KHWyMLwTc0gaC0RunIT+Q0oQpZeoyPB8GGLUdhOw8irtF1 qbFVjlRZyEH7VMZ5Hv9JDpnK4Juc44MJqJh+uEOCaA5uPgtMgFvRdNmL+tmDM2VBuY Qxs7Y18c2eph5xk6SFRgiA6bR5BNORsx5hVl9nMzKNJSEjVWLvwjFklxT+weT11XLP YK1t4W5byhRnzilQiwcL7dGKwUnB0ES3FHG7KVbxBVKZQeyzZdkJf/fnMPTDWCmOuf lPTPbpjdMIbig== From: Christian Brauner Date: Tue, 03 Sep 2024 16:20:56 +0200 Subject: [PATCH v2 15/15] io_uring: port to struct kmem_cache_args MIME-Version: 1.0 Message-Id: <20240903-work-kmem_cache_args-v2-15-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=1540; i=brauner@kernel.org; h=from:subject:message-id; bh=3NCbIt7AK7tmjnKZtBo4rWvQELZGRKFxzNKzdNzEh+o=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRdl56jXCmdfbbN7sLDswvvtcefsxDlmOklJvBbS3OD1 g+uz2oVHaUsDGJcDLJiiiwO7Sbhcst5KjYbZWrAzGFlAhnCwMUpABPp4Wb4X7suxbHyXNDclqBt H/cV3d8rIrLblltMhat0pdlFZwOnSYwMZx3/pP+Yc9oxtfXD0wXrz8w0cVhxRmBV4tHgZbnpa58 wcgAA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Server: rspam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BNo ATq1ZOePHJP9O/PeRwm4oZvOv6c5Y+dY+ujaO23T/kNAbUhSzee8JFaTAd5nlFtnx3+yijFe8mTISrf81de09ntXToXeyn6lkMvBoZN++iizO0gR4A4J8JRSMChxsZ9CYEF+xZUnCd/wDw1XH2ldKOGeJkK7I73a2aBnO2M7YYecvMQQCqXmHgrZtwG7rGOVc1yghUQ7b5hQOqn3oYNsP7pXYmXnH07ewl8fzvf+O950kb+fQf3u5zpOMviLxi6giMwWoPg3JhHpPNffQtgGAuqgIC/WHYo8MUdhI 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 req_cachep to struct kmem_cache_args. Signed-off-by: Christian Brauner Reviewed-by: Mike Rapoport (Microsoft) --- io_uring/io_uring.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 3942db160f18..d9d721d1424e 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3638,6 +3638,11 @@ SYSCALL_DEFINE2(io_uring_setup, u32, entries, static int __init io_uring_init(void) { + struct kmem_cache_args kmem_args = { + .useroffset = offsetof(struct io_kiocb, cmd.data), + .usersize = sizeof_field(struct io_kiocb, cmd.data), + }; + #define __BUILD_BUG_VERIFY_OFFSET_SIZE(stype, eoffset, esize, ename) do { \ BUILD_BUG_ON(offsetof(stype, ename) != eoffset); \ BUILD_BUG_ON(sizeof_field(stype, ename) != esize); \ @@ -3722,12 +3727,9 @@ static int __init io_uring_init(void) * range, and HARDENED_USERCOPY will complain if we haven't * correctly annotated this range. */ - req_cachep = kmem_cache_create_usercopy("io_kiocb", - sizeof(struct io_kiocb), 0, - SLAB_HWCACHE_ALIGN | SLAB_PANIC | - SLAB_ACCOUNT | SLAB_TYPESAFE_BY_RCU, - offsetof(struct io_kiocb, cmd.data), - sizeof_field(struct io_kiocb, cmd.data), NULL); + req_cachep = kmem_cache_create("io_kiocb", sizeof(struct io_kiocb), &kmem_args, + SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT | + SLAB_TYPESAFE_BY_RCU); io_buf_cachep = KMEM_CACHE(io_buffer, SLAB_HWCACHE_ALIGN | SLAB_PANIC | SLAB_ACCOUNT);