Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp143112ybk; Fri, 8 May 2020 16:24:37 -0700 (PDT) X-Google-Smtp-Source: APiQypKCtYt/31EGAeLWkoCyoNmkoANCY/y1Z97Rp9dTNKfUo6BHZbi0qQ55wcgdJMzsNSKAw+V6 X-Received: by 2002:a05:6402:1297:: with SMTP id w23mr4230423edv.151.1588980277499; Fri, 08 May 2020 16:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588980277; cv=none; d=google.com; s=arc-20160816; b=S8WOK/UJh1JOsy5Dr7zlmzhrlKSPhM42/u8JMkE4Dhp/ymUORK0zV56awBzax/gWX9 aPWtK0tqJ04MCPo5uP/HLZ3mqDSXErM4scJB6h75Z+liG5qvpfozbrI2bkSuVjMaeXlW UXEIWoa0uRSCofXn19NVsSeF7ye/GxhUl9AICVG8RN9RCQKFqV+2gL/kiL6nDoENOSjc T22HkDl4LvOk/F97zGtsq3YheAn2A+cftNn/k5SavtzuhAE1IZvcZCg6Wb7i98Q90NDT CqITXcOWjKca9O43L3ReHh8tlroJQYP5Ya0EFxU7J65d7kn+H/NE1yu+yZdoWcLRKK06 3SrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KpHdTC3gwhEr9wVRJUc1Ku1W95y0jfMFFIn5VnQTYpQ=; b=ZG8EIZESFFt8z4peOAxSz6kaemHyb+wFq1Z4H2Gln2mPgOT4iEfyvE1O0xROc7N0L+ OnxrphwmHLdEJeKfD8ix+ov4yUjk7/ofNcjZsYzEhXvinDEjaYvhnrS+ih5tjrIFcFIE MeJDDxwusqcQD5zIVTYu2dwAydeoqoIeuro+b8IndMX2tBcUieZ5dpiEDz5bF8RuQPxW mgXY40F3yG3goje/8UdIbgDmJkY8Q9n4OG3bxp61O+Uwrt8MyOQYYT4kFfe4zL6ZNhKj Ve2xfAIccW54wCFykmahH0mQFbXUpS5IFSeofqKV7Z6jMiKf/o54Rr327H2PRMd1rfmq tvVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=YPxuMMDs; 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=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c2si1723043edm.499.2020.05.08.16.24.14; Fri, 08 May 2020 16:24:37 -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=@redhat.com header.s=mimecast20190719 header.b=YPxuMMDs; 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=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728281AbgEHXWt (ORCPT + 99 others); Fri, 8 May 2020 19:22:49 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:36435 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727984AbgEHXWq (ORCPT ); Fri, 8 May 2020 19:22:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588980164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KpHdTC3gwhEr9wVRJUc1Ku1W95y0jfMFFIn5VnQTYpQ=; b=YPxuMMDsjXhCkVZryFRIl7UNncb3uBLTFL+/EhRXm5yhMAG4Wb49ExIng+KqeglakidsQ5 6lGYe0hQw/D7xfpNipetBLXSDULj4LtJneofwHNWm/0YuVSQvVMJvT2AgSgXBb/iT73+As d38kixAyDokOoXKevoIOfu7liPk0Ptw= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-412-C6J1zO2PN5WKjnTJY3LGGw-1; Fri, 08 May 2020 19:22:40 -0400 X-MC-Unique: C6J1zO2PN5WKjnTJY3LGGw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 38A09800687; Fri, 8 May 2020 23:22:38 +0000 (UTC) Received: from T590 (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5BCD41C8; Fri, 8 May 2020 23:22:27 +0000 (UTC) Date: Sat, 9 May 2020 07:22:22 +0800 From: Ming Lei To: Sagi Grimberg Cc: Christoph Hellwig , Baolin Wang , axboe@kernel.dk, ulf.hansson@linaro.org, adrian.hunter@intel.com, arnd@arndb.de, linus.walleij@linaro.org, paolo.valente@linaro.org, orsonzhai@gmail.com, zhang.lyra@gmail.com, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing Message-ID: <20200508232222.GA1391368@T590> References: <20200427154645.GA1201@infradead.org> <20200508214639.GA1389136@T590> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Ming