From patchwork Mon Sep 2 15:31: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: 13787435 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 06178CA0ED3 for ; Mon, 2 Sep 2024 15:31:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F2C468D00F1; Mon, 2 Sep 2024 11:31:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EDB268D00EF; Mon, 2 Sep 2024 11:31:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D307D8D00F1; Mon, 2 Sep 2024 11:31:36 -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 B16628D00EF for ; Mon, 2 Sep 2024 11:31:36 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 34C6E41D63 for ; Mon, 2 Sep 2024 15:31:36 +0000 (UTC) X-FDA: 82520187792.12.DD01B4C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf27.hostedemail.com (Postfix) with ESMTP id 6014E40021 for ; Mon, 2 Sep 2024 15:31:34 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jaDjvsS0; spf=pass (imf27.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=1725291001; 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=g6e7KFPpIG16PWwOpKpL70u5HNRx4HzsGFpd8uMNSfY=; b=xvN56QkR+oaZyiTfLMmsr8TUxb2MY4DxQSYqeNta5wZuoQx5LPAYfINxPMXLzG5ZJm0JSu OHDRWWGQYc0D6gF8oDRdm+0/IEaiALlBvZrGaFik9Efdn1QX49qrOWeFIHB2Ks66vAW+8V a4JYZBFsUrAges4PTWSIDiDxiuT0ba4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725291001; a=rsa-sha256; cv=none; b=sApXo2m/xkq2d6+cXPfnPQPhwVFwMvPoB23yyhTcVO3CfwVY9uFGl73jlOAlGnoTjZZt06 aiO3nuVez1y3oaMEMyih2i55gPVsLC7TIRphNX+u7gL9njjP/0kv/ozFQY7eK6yts9Ut9c 8jsSY+H2cv92m81X3DadtMlsis1TGUs= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=jaDjvsS0; spf=pass (imf27.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 31D475C5889; Mon, 2 Sep 2024 15:31:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDE8DC4CEC4; Mon, 2 Sep 2024 15:31:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725291093; bh=8MUKMhMzsFM3WWroXnvZDyHiTunVSLADhoPf2rz6oVc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jaDjvsS0AW7vl0F9GWeOgsadz73XLD6YlDKkzpDmqKyVgQLWISiKOjPkNeLl6N+yP rJAn3zi2ejL37DIwplBVZA8BVXYi9gUkDIjnSZSM1MaXvpTEPhg+IJiVkKT4TNrj0v 1hiBPhas3N4NV3niFVfqhbgUn1ULSOnbgySHkoyHjkpVbkdpx8KrMxWPPa76a/EcCP joG25y+qmPYSNPzO72Q+ulGyhFLVHVsaRui5I0IAc/CQW16+n8avhE1B5A6Ok0ONmF WZbX1N/J9xuxVcf4q4Y6zSeMBJ8a9Q6SUaF1e2DXFQCq1FDIaJhEHwUGxSKTfJY/i+ qiWa1H+wt8miQ== From: Christian Brauner Date: Mon, 02 Sep 2024 17:31:16 +0200 Subject: [PATCH RFC 6/6] io_uring: port to kmem_cache_setup() MIME-Version: 1.0 Message-Id: <20240902-work-kmem_cache_args-v1-6-27d05bc05128@kernel.org> References: <20240902-work-kmem_cache_args-v1-0-27d05bc05128@kernel.org> In-Reply-To: <20240902-work-kmem_cache_args-v1-0-27d05bc05128@kernel.org> To: Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds Cc: linux-mm@kvack.org, Christian Brauner X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=1267; i=brauner@kernel.org; h=from:subject:message-id; bh=8MUKMhMzsFM3WWroXnvZDyHiTunVSLADhoPf2rz6oVc=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaRdveWhvmTLqpOPj134OeHWuYZ35yct1rDwt/sxcX2vV cGeXT2fJTpKWRjEuBhkxRRZHNpNwuWW81RsNsrUgJnDygQyhIGLUwAm8pSdkeH8Qp8/aWffucfx WGWdWFyZX52z8PnWC1+4nnSdPdwlHviFkWFxy4O3DQZMyyQ9WxZPXTJzdm+xO1db4Kqv3YdYNlt fbOADAA== X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: 6014E40021 X-Stat-Signature: usmq5g4913wp35mn3q17w6bq19wk3bj1 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725291094-268893 X-HE-Meta: U2FsdGVkX18Hxqh0N04CeY2coRxejWEvWboEDgxGqnjEwwJoI94yErZgabnSS9VOupRmo3jgzvexZCFrbAdSZnTfdZlWPVI9ZD6+b2PKUrKRXWoSK0jg0KZ98qZyAVYC4XdB6+3ZHCUy+EaLe7jgcdLeW0qORNSySk9ifkncpWwTHpQBcjTOKXK4KF4FyRZ4I5Bmh/7nABJ1dXO6a1IBgxOgXDmf09i6EgOGT6VVyVhHBJga10/RBTpOyXEVg0nAuKlBMZpWavTZKwMCvYAfrDNGYXl+KHv7aLruw27jVaoJRRxg1jyOjjeCEl5VEZIzQjdo79mbdaQsK+PQOIuboA/muOeCrKRrv8IIjghGh2ve0wDa6edFilzkq+6esJclhF8Hh85fNuhYVa5QZe6kWq6JeDWY94tQdcHJ4/+kaQ5at2titPYDw/IiGZouFD7zJZirwBvXcwx/ywXzsnMTDoOeaoIaLaa1F6rkaqGgITZuH2nmYF53o7sey/TX12FD5eWVlHqK9HbYs88oc2BBkqfNp8eZsCo5dhl4XA+txmoPA2rIORvNiBnfbK2GlFJU91yNhssDOcZXD/motpA2wFV0UBGgCa64OrRYIChhCmcMxxehVLWLRMC0JslHGiGcM89nIITja23rTnvUjJuAr5THvEkRkeblobsUIKLNj+hAUerL12zYtTAySTA6GHvDkhg/6t9iIK45zealoWMKXepRzTVnX7LVVHh3sN18tFJwId/AYW1ShB5O5v9HjA6eF5pp4zDJMJ03YRDHI+COO+OY1CU5tRSRN8n88K6/62SlauyEiKdrkG7SRRD6aKSVE+y+QizJ1d0N1lrwEmsdPZlMwuY6iByp5h4VYVORMZ9W9X+bl9TfH44rqQQ7AyoufOXS6+ocVfTNsQ6y2mRfz4DkI/3hNi6elVYjUTfJTbYV30gaVZlWr43AVRe52tXdj3Cl6yfCQZupf76GIza ezLmiO0X Rbecvz4iym3JELw5I/c8B06qL/QFemNCo5GQpz5KUa2XA7TSVpQbQht8J5D65hPv8MuuI7bi4XwUHnjysYQQj6VsnMdlxMH/2LIpYH+7KCaWqT4ZsBexkx0vAeQc5CqAT0ifCXqbd772+agsERovDEA4gIIFGG81FuL1k+kguVJriXoWtl0T9K9SUzF+0CZCojGhDaRaa/ndW68bM0LyorKzLfATANZERiHj7dzKFBxNx+CkSEQGKcDnsiORk66sNdZlrEtUPK4Ko07Sf82rNREMnl4wfdKtRbEGZnor0FdcT5zs= 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: Replace kmem_cache_create_usercopy() with a call to the new kmem_cache_setup() function. Signed-off-by: Christian Brauner --- io_uring/io_uring.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 3942db160f18..092a43a63236 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -3722,12 +3722,15 @@ 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_setup("io_kiocb", sizeof(struct io_kiocb), + &(struct kmem_cache_args) { + .useroffset = offsetof(struct io_kiocb, cmd.data), + .usersize = sizeof_field(struct io_kiocb, cmd.data), + }, + 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);