Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1481960ybk; Sun, 10 May 2020 18:32:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2HHNRcT+qRI7sZGn8RnXrzMtV9T6zqh+a8wBIh87VFaORW8+vJeBVSIZ5egP9bTm8K86p X-Received: by 2002:a17:906:848e:: with SMTP id m14mr662048ejx.344.1589160725989; Sun, 10 May 2020 18:32:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589160725; cv=none; d=google.com; s=arc-20160816; b=QdVrwe4FH+GaOSkDe6P09piyZlkrP1+CQRVPYHNNBYwQ9X6XdypJAKzNC4nH8vPzyj y8R0BJlz144Vm0WzcSGJFvrYBSoXv8mxrmPqus0HD/LvAtZSbEWP/KB1PRFNk+9Ry7LD 5JwGQMmM5S8NoFxwMSz1IHgAE2mqC7tkndiKEAwQB0p59GT1nnyhW7ac0E+muSSDDig/ qVVPxqL9IFjhEcHKUYv3ky44W8HWFLY0kX6lkpPveDZwXpilMPehMfeTvUbY8mlUhlVo AF+U9yY3DWuTVPHVsAuPuGls2Yn35VtrZrsTnpl/XSWV3xw66pmTdCXaCV7AjX0CeU9M BIow== 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=dC309k+ibsw/3VjV9/ejnOFqXLiqMyJIRDkc+VSBHTM=; b=fPzfy6z3OY0MKCQSdAKTejj6Q3GdUdmfkbaFGoIQNz8gtgOd2r2E41bTcblLy9m4mq ngpbw/zbJ4aFFYJ5dM+F4SQhftvgp6fvyS2D48nBtF3QOfk63+0o6TU9nnY5weCdemIR bl6ZRO1a3DZuBE74t0DnLljN+zztRb02eqPfT8TYhnYFGV7vB9JPnioVHEe68oamYqhY 85PxdNOkQkQxkxo+brN1CtVrazIMVEQQhbCj0lr17BplTK+tljqzXW0WfuSkLtyw+Ldd 9Pxzazn3J5TfU4JYEK2DHuCv85AA+/J7hgiFDOWCMyAnXuRkoSfGGTJValZqIBSUBPHw tC7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=im2FUEp8; 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 p90si4909786edd.215.2020.05.10.18.31.37; Sun, 10 May 2020 18:32:05 -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=im2FUEp8; 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 S1729207AbgEKBaE (ORCPT + 99 others); Sun, 10 May 2020 21:30:04 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:39678 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728630AbgEKBaE (ORCPT ); Sun, 10 May 2020 21:30:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589160602; 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=dC309k+ibsw/3VjV9/ejnOFqXLiqMyJIRDkc+VSBHTM=; b=im2FUEp83BBZWIpaKy8lyQOT/K0aVZnVArLn/pEv94CqB8DD9hZMHccVp9mXSJpvRqiLN5 ZT26q3Fl0/zEBzWE5X46GgUKqrLxPoLIkM2dXtkP5ZhpT7Cbo+rt88Csv86Fd+7teF+11D yFEv/MMMRZbEu3X9KAM9LJ+UnKaYpnM= 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-350-L0Dlu4ofNQ2Eftgkm3b_uA-1; Sun, 10 May 2020 21:29:58 -0400 X-MC-Unique: L0Dlu4ofNQ2Eftgkm3b_uA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65B2880058A; Mon, 11 May 2020 01:29:56 +0000 (UTC) Received: from T590 (ovpn-13-75.pek2.redhat.com [10.72.13.75]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CEB425D77B; Mon, 11 May 2020 01:29:46 +0000 (UTC) Date: Mon, 11 May 2020 09:29:42 +0800 From: Ming Lei To: Sagi Grimberg Cc: Baolin Wang , Christoph Hellwig , axboe@kernel.dk, Ulf Hansson , Adrian Hunter , Arnd Bergmann , Linus Walleij , Paolo Valente , Orson Zhai , Chunyan Zhang , linux-mmc , linux-block , LKML Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing Message-ID: <20200511012942.GA1418834@T590> References: <20200427154645.GA1201@infradead.org> <20200508214639.GA1389136@T590> <20200508232222.GA1391368@T590> <20200509094306.GA1414369@T590> <6579459b-aa98-78f2-f805-a6cd46f37b6c@grimberg.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6579459b-aa98-78f2-f805-a6cd46f37b6c@grimberg.me> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 10, 2020 at 12:44:53AM -0700, Sagi Grimberg wrote: > > > > > > 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/ > > > > Basically, my idea is to dequeue request one by one, and for each > > dequeued request: > > > > - we try to get a budget and driver tag, if both succeed, add the > > request to one per-task list which can be stored in stack variable, > > then continue to dequeue more request > > > > - if either budget or driver tag can't be allocated for this request, > > marks the last request in the per-task list as .last, and send the > > batching requests stored in the list to LLD > > > > - when queueing batching requests to LLD, if one request isn't queued > > to driver successfully, calling .commit_rqs() like before, meantime > > adding the remained requests in the per-task list back to scheduler > > queue or hctx->dispatch. > > Sounds good to me. > > > One issue is that this way might degrade sequential IO performance if > > the LLD just tells queue busy to blk-mq via return value of .queue_rq(), > > so I guess we still may need one flag, such as BLK_MQ_F_BATCHING_SUBMISSION. > > Why is that degrading sequential I/O performance? because the specific Some devices may only return BLK_STS_RESOURCE from .queue_rq(), then more requests are dequeued from scheduler queue if we always queue batching IOs to LLD, and chance of IO merge is reduced, so sequential IO performance will be effected. Such as some scsi device which doesn't use sdev->queue_depth for throttling IOs. For virtio-scsi or virtio-blk, we may stop queue for avoiding the potential affect. > device will do better without batching submissions? If so, the driver It isn't related with batching submission, IMO. Thanks, Ming