Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp257898ybk; Sat, 9 May 2020 01:59:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLgqH9FmOjnjixkDnYpkzfRi0pha9+jLvpx6O5ZyyzlxxV1JNxGMmKxVjA8SZPBsrQscHi/ X-Received: by 2002:a05:6402:17f1:: with SMTP id t17mr5566095edy.239.1589014791236; Sat, 09 May 2020 01:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589014791; cv=none; d=google.com; s=arc-20160816; b=xzYOr55hmrA0oKdmQoJFoQKtZMdDC6w+Mn73Z2c58kAOstxAY6gdcjEga1qhqrjhQE Dw2xReD4nIPXbGQMTCMdWBqTEmKle33ykCmlT/qoxfMDXgLFym9ff6eBznL1uamDg1V3 lYxm5W9nEC7AIMDe4QvW375qhS0VCeG6abaiOHUKYHcZ4E9z1Pm6TChqPMP5klS20cmD GDvqt2VP3LWBGEcEbKfevvFi33cxY4zKJxrjP1z62zPhhIKlxa19XWJey6iaQCh2bdlx 5K2WMM1xJAwMmehVMy3J+ZUHTK8GdorN8jfWkPXJJPFGKMjn2R/1n5YPrEeITnKTD/nn Cn0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6sBoYn3WeTZFCcqj57bcpCNR9WzBcjBDg78zlrXn2Bo=; b=zgpGWwlRsO9mnOb7LI9hm8TauOWjCgtoV501mbbYB/X3cFGrdWRsqUYqhDY6qq4jA8 9x2++RSvELqcTGR1g4bci9Exi4U3vR5zGbx0kUWJYfppIT2wwQz5BbZ5zM8RoYxYKx6W BXnhc+nNSvGGwC2rIe7TAxt+kaOvBW/58EBfqXQoagtoWIF8Iu5wIPUH7sBZ04+nxc6H bhWy1ihrQ6dzxP7c1NhNW503HsQ3i4VRm2iYLDwp+5ESJ6nWVh6/88HzxFfeyO1QwBvL /Obakgga508iSn2+/nCxZ43Rfpaj/gkIkxqOTqj7h7s5Jfh3zVtLKH+r8Ob7Qum4iYrV TyUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IvJi5Oqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b17si585787ejg.258.2020.05.09.01.59.27; Sat, 09 May 2020 01:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=IvJi5Oqf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727785AbgEII6D (ORCPT + 99 others); Sat, 9 May 2020 04:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725989AbgEII6D (ORCPT ); Sat, 9 May 2020 04:58:03 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C65AC061A0C; Sat, 9 May 2020 01:58:01 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id a21so4157685ljb.9; Sat, 09 May 2020 01:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6sBoYn3WeTZFCcqj57bcpCNR9WzBcjBDg78zlrXn2Bo=; b=IvJi5OqftthYrAXQhCGJSEsNr2Ugk0p4lQGhUpMXBi99TyDjBaGPGU98kHtcygIgoM dl7DoUhZYDjjoo87SDHBuPdevJlXBve6Oha7wQhCl6jYtbCM9UE4PSu5hV31mzRsSahr wZLitRfkJMNIvWhTpo4PgkNHNQlioQYMslFX9wyHmSQJOAGx14vlZt3mu0MN/rl9nKqB LtllpntMrN72NK9ou1yLBxOk7PovAncUkEPgztLCKA72CRBehtj6TjqznyxZ1s4vKPlo VYrRD4vlhkowpqWcqeQ2wvZWrnBjVbZvy153zB4K8b+b+cYWX9DQzaiooNv3jWd+5ApN a4pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6sBoYn3WeTZFCcqj57bcpCNR9WzBcjBDg78zlrXn2Bo=; b=Z2HdyHLUexIeF46kIOIvH8nSiNWx6u1bznKgjg7v4Qb1r+iCnGMaeG3Qs39PB/cAsN wgv8yHW2X+s/vd8C50QfHc5APz6nYPFzyWPDu9mUu0CVGK2NgN4anfP80+j0+hT/pxAh MD5riivrw60279ShzSnqVET6Mgzi2BIHTvrJvZ2j02IxdiJdoDoI08SEzBK4F9BIBWnI LZNq4E+EOJKZW///KMfgeEol5tzVWPA53dDeVx6hkJSQu0WFkBmun1Zaj/8kNCR+6kKU ZX/dWNIjsqKB62NL59TPNe8fZaV8qXSOKrbEz+vNHJ/iNtAUbEva0W3SZZiRpvZKp7DC 29zA== X-Gm-Message-State: AOAM533XrzV8Nu4NUp+SKO2xsRiIC6+/oESGso3yeZGtJmuLwS41Z7pw we9TuYNhI6aHUuM8myf395RYJyxx8o+m6coTfdg= X-Received: by 2002:a2e:6c08:: with SMTP id h8mr4048684ljc.48.1589014679642; Sat, 09 May 2020 01:57:59 -0700 (PDT) MIME-Version: 1.0 References: <20200427154645.GA1201@infradead.org> <20200508214639.GA1389136@T590> <20200508232222.GA1391368@T590> In-Reply-To: <20200508232222.GA1391368@T590> From: Baolin Wang Date: Sat, 9 May 2020 16:57:48 +0800 Message-ID: Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing To: Ming Lei Cc: Sagi Grimberg , Christoph Hellwig , axboe@kernel.dk, Ulf Hansson , Adrian Hunter , Arnd Bergmann , Linus Walleij , Paolo Valente , Orson Zhai , Chunyan Zhang , linux-mmc , linux-block , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 9, 2020 at 7:22 AM Ming Lei wrote: > > Hi Sagi, > > On Fri, May 08, 2020 at 03:19:45PM -0700, Sagi Grimberg wrote: > > Hey Ming, > > > > > > Would it make sense to elevate this flag to a request_queue flag > > > > (QUEUE_FLAG_ALWAYS_COMMIT)? > > > > > > request queue flag usually is writable, however this case just needs > > > one read-only flag, so I think it may be better to make it as > > > tagset/hctx flag. > > > > I actually intended it to be writable. > > > > > > I'm thinking of a possibility that an I/O scheduler may be used > > > > to activate this functionality rather than having the driver set > > > > it necessarily... > > > > > > Could you explain a bit why I/O scheduler should activate this > > > functionality? > > > > Sure, I've recently seen some academic work showing the benefits > > of batching in tcp/ip based block drivers. The problem with the > > approaches taken is that I/O scheduling is exercised deep down in the > > driver, which is not the direction I'd like to go if we are want > > to adopt some of the batching concepts. > > > > I spent some (limited) time thinking about this, and it seems to > > me that there is an opportunity to implement this as a dedicated > > I/O scheduler, and tie it to driver specific LLD stack optimizations > > (net-stack for example) relying on the commit_rq/bd->last hints. > > > > When scanning the scheduler code, I noticed exactly the phenomenon that > > this patchset is attempting to solve and Christoph referred me to it. > > Now I'm thinking if we can extend this batching optimization for both > > use-cases. > > Got it, thanks for the sharing. > > > > > > batching submission may be good for some drivers, and currently > > > we only do it in limited way. One reason is that there is extra > > > cost for full batching submission, such as this patch requires > > > one extra .commit_rqs() for each dispatch, and lock is often needed > > > in this callback. > > > > That is not necessarily the case at all. > > So far, all in-tree .commit_rqs() implementation requires lock. > > > > > > IMO it can be a win for some slow driver or device, but may cause > > > a little performance drop for fast driver/device especially in workload > > > of not-batching submission. > > > > You're mostly correct. This is exactly why an I/O scheduler may be > > applicable here IMO. Mostly because I/O schedulers tend to optimize for > > something specific and always present tradeoffs. Users need to > > understand what they are optimizing for. > > > > Hence I'd say this functionality can definitely be available to an I/O > > scheduler should one exist. > > > > I guess it is just that there can be multiple requests available from > scheduler queue. Actually it can be so for other non-nvme drivers in > case of none, such as SCSI. > > Another way is to use one per-task list(such as plug list) to hold the > requests for dispatch, then every drivers may see real .last flag, so they > may get chance for optimizing batch queuing. I will think about the > idea further and see if it is really doable. How about my RFC v1 patch set[1], which allows dispatching more than one request from the scheduler to support batch requests? [1] https://lore.kernel.org/patchwork/patch/1210034/ https://lore.kernel.org/patchwork/patch/1210035/ -- Baolin Wang