From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F299C2D0D3 for ; Sat, 21 Dec 2019 17:01:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 76A98206EF for ; Sat, 21 Dec 2019 17:01:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="kEG9PFRG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727169AbfLURBK (ORCPT ); Sat, 21 Dec 2019 12:01:10 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:37995 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726900AbfLURBK (ORCPT ); Sat, 21 Dec 2019 12:01:10 -0500 Received: by mail-pf1-f193.google.com with SMTP id x185so6961854pfc.5 for ; Sat, 21 Dec 2019 09:01:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=EfhtVqbfRNchJXGKYNnjK189Wzr7z0ljLBenvVe83Bg=; b=kEG9PFRG9Uvdbot3yMEjUmv3moIuUezSLDNHOAIixNkkHFJXpSNIRVmICZgWU8NZEv nJDnkPrcfJejWqIJbxwZ7YrESHetwJa437nxiTD6E+tm1Gs47bmdGjfrZWHHnp9IZqrI juv4rK7JUzqxpA9C9ls1wqFREP9WtcoqlZ3+h2H55xeTZ2vTvwoPhyy+MseCX7+R7/fS a2MnX1cOJVbdUI78I52WllUVXcOxKrDqInDw/plgj2bORSNLbsxwzZuhh0QG3ayppOej QXsocBfLfudKEZKmAGpvX5bhN8pb0j2zn8MBicJvXV2pk57flO5/uGqMi+rOrVwAcYQA OhBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=EfhtVqbfRNchJXGKYNnjK189Wzr7z0ljLBenvVe83Bg=; b=Z/+tGGd9mBDpAIPKG/Dwot7gG4KRS7VQFho59hGJCkHp8A/9FapZ0F2Y/chMXgvJ7d HBqGDd2s1iRVNNtdbIkwICG/022Ln0o89+rJxgf047UGHSDBGMjdZ29bkrN5Ge7rAVgq M8oe0hAD+4GqbaFamNOGTs2q90cOGGZFu6CiBx9L0UmhTUvlfLNCWOQP9VbqZSwacBxA eMoFqmYA9b9mmIY1dfX6Nmc0EU5QS/A3/5FROkqHQc1NATKUeP8CPoPFQtZ4YVDRTlhy A7WbgFI9ktR1hjaksyjyDZipkf7R9JB/4Y6V3ErjYsbQyU18s/j7sNoKYzaOwIeYGNii dwfg== X-Gm-Message-State: APjAAAWRlI7JwqfI0sTakqLAwPfnZBhB3Yotn8dvM0lpkeE0wJdFk3so aG44a3gYB4vEC1yXZWZH3Bm4vw== X-Google-Smtp-Source: APXvYqzL9SlCQt49ptIpUkigX4FhPLwOhk0xJThIen+rDzELZJAXyqvGnAF3NxdNPB5zhtAaTGBeYw== X-Received: by 2002:aa7:85d3:: with SMTP id z19mr23130341pfn.62.1576947669033; Sat, 21 Dec 2019 09:01:09 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id c199sm18140362pfb.126.2019.12.21.09.01.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 21 Dec 2019 09:01:08 -0800 (PST) Subject: Re: [PATCH RFC v2 3/3] io_uring: batch get(ctx->ref) across submits To: Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tejun Heo , Dennis Zhou , Christoph Lameter References: <925d8fe5406779bbfa108caa3d1f9fd16e3434b5.1576944502.git.asml.silence@gmail.com> From: Jens Axboe Message-ID: Date: Sat, 21 Dec 2019 10:01:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/21/19 9:48 AM, Pavel Begunkov wrote: > On 21/12/2019 19:38, Jens Axboe wrote: >> On 12/21/19 9:20 AM, Pavel Begunkov wrote: >>> On 21/12/2019 19:15, Pavel Begunkov wrote: >>>> Double account ctx->refs keeping number of taken refs in ctx. As >>>> io_uring gets per-request ctx->refs during submission, while holding >>>> ctx->uring_lock, this allows in most of the time to bypass >>>> percpu_ref_get*() and its overhead. >>> >>> Jens, could you please benchmark with this one? Especially for offloaded QD1 >>> case. I haven't got any difference for nops test and don't have a decent SSD >>> at hands to test it myself. We could drop it, if there is no benefit. >>> >>> This rewrites that @extra_refs from the second one, so I left it for now. >> >> Sure, let me run a peak test, qd1 test, qd1+sqpoll test on >> for-5.6/io_uring, same branch with 1-2, and same branch with 1-3. That >> should give us a good comparison. One core used for all, and we're going >> to be core speed bound for the performance in all cases on this setup. >> So it'll be a good comparison. >> > Great, thanks! For some reason, not seeing much of a change between for-5.6/io_uring and 1+2 and 1+2+3, it's about the same and results seem very stable. For reference, top of profile with 1-3 applied looks like this: + 3.92% io_uring [kernel.vmlinux] [k] blkdev_direct_IO + 3.87% io_uring [kernel.vmlinux] [k] blk_mq_get_request + 3.43% io_uring [kernel.vmlinux] [k] io_iopoll_getevents + 3.03% io_uring [kernel.vmlinux] [k] __slab_free + 2.87% io_uring io_uring [.] submitter_fn + 2.79% io_uring [kernel.vmlinux] [k] io_submit_sqes + 2.75% io_uring [kernel.vmlinux] [k] bio_alloc_bioset + 2.70% io_uring [nvme_core] [k] nvme_setup_cmd + 2.59% io_uring [kernel.vmlinux] [k] blk_mq_make_request + 2.46% io_uring [kernel.vmlinux] [k] io_prep_rw + 2.32% io_uring [kernel.vmlinux] [k] io_read + 2.25% io_uring [kernel.vmlinux] [k] blk_mq_free_request + 2.19% io_uring [kernel.vmlinux] [k] io_put_req + 2.06% io_uring [kernel.vmlinux] [k] kmem_cache_alloc + 2.01% io_uring [kernel.vmlinux] [k] generic_make_request_checks + 1.90% io_uring [kernel.vmlinux] [k] __sbitmap_get_word + 1.86% io_uring [kernel.vmlinux] [k] sbitmap_queue_clear + 1.85% io_uring [kernel.vmlinux] [k] io_issue_sqe -- Jens Axboe