Message ID | cover.1680187408.git.asml.silence@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1241273vqo; Thu, 30 Mar 2023 09:11:08 -0700 (PDT) X-Google-Smtp-Source: AK7set9uwIBOQ88lzbLlDZmcVdyRPvjXqRaPudOMVyPQaip/nFVlnOJGXNX5+hqSOVZmAhW95MDk X-Received: by 2002:a05:6a20:671f:b0:d8:f312:b3b with SMTP id q31-20020a056a20671f00b000d8f3120b3bmr19724585pzh.3.1680192667766; Thu, 30 Mar 2023 09:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680192667; cv=none; d=google.com; s=arc-20160816; b=CI6C7tquDD9rxGhI2VJrGoj89mM97lrEREEX9XnvuWoexd3WYVRiZLA6VMgDGfozec H3dquU7kTye6H11MfGC0HNiORnETNOc8O6Cw98vvPWw9Iu4p2mZpVNXxud8lq0Xz3tO0 wImJxz71AWKgMphrLJzum0keuCSHIzLJlXldbdGr+rYf1YAE/Gh45mGoTOVyYzJ/rwnQ cXedKSf5s+uEGK11Rfg1MWidoFjvOQTLXNc02vBSQ1FJU/trqNebtv419VzCXhGA73Kc 9Hsg6drPSz69jpppqMk0OABLFH8pAFRzCoBFHY7ndWPyfYEzne2NgXx1BmTUBlwAonZf 1j6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1NUshns2dscT6D5x4+uShM+Ig+SNAzrFgP7zqcTDRxs=; b=pASj13CWcxZsx0GYgXdhcgAkvnsESok66DRy9+cJFk5qjYx1WOytO63gXKmIKTmRg2 h+lmqlXXx2jmStCCuLLSoiWyqEZY/Z2ReMxvPLnInWgrvCEhSGOdPtglc/FbbiYNUZqL mhfH2uj0ElX+fRw0jZid9hAocQu4BSXUZCywSlyWkUHcgDcpICMamBnVUfqh3wxPjaik dQmLetqY1wtIY/b87tY5yP0Xq+IIXCrMPI5tSgVheaZ4rBpk8pI89dD4L+9Hc1UPv5b3 L4hg3+L22bvGnt9feRPzBDADyqJtMiKB9795+eUq6VoejToYioVqXFgCE5N9nWLh1y/X pvyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V+FBz09j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q85-20020a632a58000000b0050f818e900dsi27706137pgq.761.2023.03.30.09.10.53; Thu, 30 Mar 2023 09:11:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=V+FBz09j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232526AbjC3Oyg (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 10:54:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231157AbjC3Oye (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 10:54:34 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18CA011F; Thu, 30 Mar 2023 07:54:33 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id v1so19392124wrv.1; Thu, 30 Mar 2023 07:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680188071; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1NUshns2dscT6D5x4+uShM+Ig+SNAzrFgP7zqcTDRxs=; b=V+FBz09jGww1eKaFOA8kJcaU380vqkij86H7jC1nKira3uA/za6mLPBuuzUwrwIhOT ojDVU6dnneSn3OStz5NtEoAs0aWtOgW0eGCQBU6JEjmMep3hyf74j6g0WuJBczYUK/N8 YE6PUu4eXTmkyi5CRpLjDetHni9mUtSt5mk7Tp2JXVvTqul67m0UxCIrnl9L/MpoIMqw RO25qwIRfN2vGvGPehsP3l6S8sn8oJY1Y2SoTncQjAGoj//JW2LkEoAd2rAt4/Iq37SB ngpguHPBEOFejD54eEyJMuartKKnfhpuYmJ+Gf/2bY34HzzuKwswCXh8P/D7w7sZeD+Z JCBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680188071; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1NUshns2dscT6D5x4+uShM+Ig+SNAzrFgP7zqcTDRxs=; b=oQmuO7dSEta9cQ7C7zvOugaxoEpzTSALJru1LnRdEoDHD1u2oB4cZW9EaHTJLqJd0P N7BdB5ycMYcQiBN42sY4UVq8BuqU/3ghcdenWrKclFZSn4ACOQ7Fqqs5531ZPgdF394l IW+sqnEGib367N0U+u0GsE0/DTAqvYWWanjqygoQVdqFKAb/fcNFlFYT89Y68fjFObFE jKQynRDikC5TfAKNouA23gY9QBrc4h6coeQoNAt6rC90+tlzUhHbPu4y2puMzhayior0 E91reyWatJfYLW4siXPbhkadmDkGEjHi2Y42eqqvspektzGRQhKmEuySOjuL2FdQUA9E QT4Q== X-Gm-Message-State: AAQBX9d1tm/yxfEk1iGgA4bDM1vOVng9ZrnYSqjdEVgLDvZp6Ql6HOEO ZVDyVfTo7KzIlU3t9XPpIK1Kn5P7itw= X-Received: by 2002:adf:d08f:0:b0:2e4:c0b5:fdce with SMTP id y15-20020adfd08f000000b002e4c0b5fdcemr2348736wrh.4.1680188071234; Thu, 30 Mar 2023 07:54:31 -0700 (PDT) Received: from 127.0.0.1localhost (82-132-231-234.dab.02.net. [82.132.231.234]) by smtp.gmail.com with ESMTPSA id d7-20020adffbc7000000b002d5a8d8442asm28727962wrs.37.2023.03.30.07.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 07:54:30 -0700 (PDT) From: Pavel Begunkov <asml.silence@gmail.com> To: io-uring@vger.kernel.org Cc: Jens Axboe <axboe@kernel.dk>, asml.silence@gmail.com, linux-kernel@vger.kernel.org Subject: [RFC 00/11] optimise registered buffer/file updates Date: Thu, 30 Mar 2023 15:53:18 +0100 Message-Id: <cover.1680187408.git.asml.silence@gmail.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761809706824199167?= X-GMAIL-MSGID: =?utf-8?q?1761809706824199167?= |
Series |
optimise registered buffer/file updates
|
|
Message
Pavel Begunkov
March 30, 2023, 2:53 p.m. UTC
Updating registered files and buffers is a very slow operation, which makes it not feasible for workloads with medium update frequencies. Rework the underlying rsrc infra for greater performance and lesser memory footprint. The improvement is ~11x for a benchmark updating files in a loop (1040K -> 11468K updates / sec). The set requires a couple of patches from the 6.3 branch, for that reason it's an RFC and will be resent after merge. https://github.com/isilence/linux.git optimise-rsrc-update Pavel Begunkov (11): io_uring/rsrc: use non-pcpu refcounts for nodes io_uring/rsrc: keep cached refs per node io_uring: don't put nodes under spinlocks io_uring: io_free_req() via tw io_uring/rsrc: protect node refs with uring_lock io_uring/rsrc: kill rsrc_ref_lock io_uring/rsrc: rename rsrc_list io_uring/rsrc: optimise io_rsrc_put allocation io_uring/rsrc: don't offload node free io_uring/rsrc: cache struct io_rsrc_node io_uring/rsrc: add lockdep sanity checks include/linux/io_uring_types.h | 7 +- io_uring/io_uring.c | 47 ++++++---- io_uring/rsrc.c | 152 +++++++++++---------------------- io_uring/rsrc.h | 50 ++++++----- 4 files changed, 105 insertions(+), 151 deletions(-)
Comments
Pavel, Pavel Begunkov <asml.silence@gmail.com> writes: > Updating registered files and buffers is a very slow operation, which > makes it not feasible for workloads with medium update frequencies. > Rework the underlying rsrc infra for greater performance and lesser > memory footprint. > > The improvement is ~11x for a benchmark updating files in a loop > (1040K -> 11468K updates / sec). Nice. That's a really impressive improvement. I've been adding io_uring test cases for automated performance regression testing with mmtests (open source). I'd love to take a look at this test case and adapt it to mmtests, so we can pick it up and run it frequently. is it something you can share?
On 3/30/23 8:53 AM, Pavel Begunkov wrote: > Updating registered files and buffers is a very slow operation, which > makes it not feasible for workloads with medium update frequencies. > Rework the underlying rsrc infra for greater performance and lesser > memory footprint. > > The improvement is ~11x for a benchmark updating files in a loop > (1040K -> 11468K updates / sec). > > The set requires a couple of patches from the 6.3 branch, for that > reason it's an RFC and will be resent after merge. Looks pretty sane to me, didn't find anything immediately wrong. I do wonder if we should have a conditional uring_lock helper, we do have a few of those. But not really related to this series, as it just moves one around.
On 3/31/23 14:35, Gabriel Krisman Bertazi wrote: > Pavel, > > Pavel Begunkov <asml.silence@gmail.com> writes: >> Updating registered files and buffers is a very slow operation, which >> makes it not feasible for workloads with medium update frequencies. >> Rework the underlying rsrc infra for greater performance and lesser >> memory footprint. >> >> The improvement is ~11x for a benchmark updating files in a loop >> (1040K -> 11468K updates / sec). > > Nice. That's a really impressive improvement. > > I've been adding io_uring test cases for automated performance > regression testing with mmtests (open source). I'd love to take a look > at this test case and adapt it to mmtests, so we can pick it up and run > it frequently. > > is it something you can share? I'll post it later. The test is quite stupid and with the patches less than 10% of CPU cycles go to the update machinery (against 90+ w/o), the rest is spend for syscalling, submitting update requests, etc., so it almost hits the limit. Another test we can do is to measure latency b/w the point we asked a rsrc to be removed and when it actually got destroyed/freed, e.g. tags will help with that. It should've been improved nicely as well as it removes the RCU grace period and other bouncing.