Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1514103ybf; Sun, 1 Mar 2020 11:15:52 -0800 (PST) X-Google-Smtp-Source: APXvYqziEkdUEneWWCXRbDXX6KEimT0Lgqivrtfb0Icsg6Ts1KAdUVTItk3yeOi24MbfWoCykAlh X-Received: by 2002:a05:6808:ab2:: with SMTP id r18mr9549004oij.129.1583090152259; Sun, 01 Mar 2020 11:15:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583090152; cv=none; d=google.com; s=arc-20160816; b=idPTYQL05zKgPKomuU2uJ62aWGq8ET9zApY9G0IgxGXDuysB+iTIgTI2WI6hVSquuG 58Jsu6xcewU0bbfnZr4y/Sp4D3AmkzASiY4VQMr7e5KfdjvOTb2uB69jRAYj8bElBOFr 96XRqEkMQv0Quo7lfg7OKHPE/ZlBvFTlDqerNEts4kfGbYeQ/MLQ0mKMM8o+PpZDxWWD rGjTXQ0ptuVxeiZIenlCym23vKRywj8cfC0fojVI3AzpGyca5XZxQGsZ6EhMlBnmv3tc qptWev7vrMlM4gDZ1Eh+ahy7ChMGTTA703YiofQfs76FQnRlsYPcONDW+RGtYslermbR HUfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=lnwCBfe1zZuQobxAOQZzSQec0D6ylnT+NKbdGoIZA+4=; b=GJfOb2K2bKeYSzLX3PWmfNXrZmvPyVG5dBgX1v3FFJZfr74U4F9stBkLCk9LpKL+Je 4k3Z4qYGiDwTBLOHNtdWwR5PvOZAxzaTo748ZdHV2Oy0EBQILJu1BipMCfkBVH2LGSUB laRdcGMgroSWUhCIWbSkIA0ylCjaUaOUl5UbzMKH+pwMD0FIg6pHybC30pXxCscIrwY0 Rd6p3lhh5H3iaiCQeYFJLUAPYXYj7tAHgAa4P1l8JZ1cGmSMxS/R7Shcy/NKZx9fcPoT Uldz9Ni7iSOqpXVc1d6oYUT14cHG++1fe/pUnTqOSbX8TuwSP/U/s462ncGFir/6gsmz WmDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=UKtFK4Ej; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k205si4961791oib.64.2020.03.01.11.15.40; Sun, 01 Mar 2020 11:15:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=UKtFK4Ej; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726658AbgCATOh (ORCPT + 99 others); Sun, 1 Mar 2020 14:14:37 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:32943 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726418AbgCATOg (ORCPT ); Sun, 1 Mar 2020 14:14:36 -0500 Received: by mail-pl1-f195.google.com with SMTP id ay11so3306053plb.0 for ; Sun, 01 Mar 2020 11:14:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=lnwCBfe1zZuQobxAOQZzSQec0D6ylnT+NKbdGoIZA+4=; b=UKtFK4Ej05UmGNRtJ6At8dFluyaZwv3CO7nBIb2TVzN+c829X9sKd2865+VFlRo0tz GsTO2f/vNLNkkk6W4Y1R121Pm5p3zKPQwpk7RU4Vo/swxo1FvHpdKQIPbx7AN00p14aU P1/+83+JK+xABEM3FPHZnlSQTCpKzXZzu0MIaRMDJ4QlB09WS9+p74TnqzKi0l6+oe/V 26Csh5abjDfZfPasEKA6NFPu3f7gVqfZHQy6drTLZrVP/5dTw/2OKIuvBQhGX7Mj2lnn /Tp2dnINxau6hBNrubIRyXxAigj0tdRJVzADCXZtbCavacjrfLnUT4eFs+lcIaRO6rF/ gemg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lnwCBfe1zZuQobxAOQZzSQec0D6ylnT+NKbdGoIZA+4=; b=X7VZxPS4kXtZYRTOA91VDHKLqnZiR+qOZ9e66wCJ1JSOEnl7IbZGCl4/3q9KW2eGup BIUeDtwOZ8NW/Apvul9+sQe+4d79FcYKB9pwWLs9R5q4BGUHyc2HsPlE/TcDGAopUmea nygdcrpg/jr+1foZs0FK3eKyMoMiD22agqGa4FBEeuOHIeMJUBiAMtePZ4UzfyoPDRKX ao+oyj/Mu1l3OSCnVWR7amJOmHtP2d9QxSQtcVj9Bzd/k0sj0FG9o100fDFSnX68r1kW DY1vLGUL6ippbMcH+1MKoeM786NG2THit5tRMn1rr8lvHWiLJ885LxvgjTtQ7WYh3ORm awpw== X-Gm-Message-State: APjAAAVLbwil8+cTOQ+oAL+wP05G3oz0RoCPM7D104KbpkSmCBfwYsh5 o2aCUIAqJmK9EOGJd+AdZq8voH8+b6M= X-Received: by 2002:a17:90a:d081:: with SMTP id k1mr17440983pju.57.1583090075021; Sun, 01 Mar 2020 11:14:35 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id x18sm6135837pfo.148.2020.03.01.11.14.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Mar 2020 11:14:33 -0800 (PST) Subject: Re: [PATCH RFC 0/9] nxt propagation + locking optimisation To: Pavel Begunkov , io-uring@vger.kernel.org, linux-kernel@vger.kernel.org References: From: Jens Axboe Message-ID: Date: Sun, 1 Mar 2020 12:14:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 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 3/1/20 9:18 AM, Pavel Begunkov wrote: > There are several independent parts in the patchset, but bundled > to make a point. > 1-2: random stuff, that implicitly used later. > 3-5: restore @nxt propagation > 6-8: optimise locking in io_worker_handle_work() > 9: optimise io_uring refcounting > > The next propagation bits are done similarly as it was before, but > - nxt stealing is now at top-level, but not hidden in handlers > - ensure there is no with REQ_F_DONT_STEAL_NEXT > > [6-8] is the reason to dismiss the previous @nxt propagation appoach, > I didn't found a good way to do the same. Even though it looked > clearer and without new flag. > > Performance tested it with link-of-nops + IOSQE_ASYNC: > > link size: 100 > orig: 501 (ns per nop) > 0-8: 446 > 0-9: 416 > > link size: 10 > orig: 826 > 0-8: 776 > 0-9: 756 This looks nice, I'll take a closer look tomorrow or later today. Seems that at least patch 2 should go into 5.6 however, so may make sense to order the series like that. BTW, Andres brought up a good point, and that's hashed file write works. Generally they complete super fast (just copying into the page cache), which means that that worker will be hammering the wq lock a lot. Since work N+1 can't make any progress before N completes (since that's how hashed work works), we should pull a bigger batch of these work items instead of just one at the time. I think that'd potentially make a huge difference for the performance of buffered writes. Just throwing it out there, since you're working in that space anyway and the rewards will be much larger. -- Jens Axboe