Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1714711ybk; Mon, 11 May 2020 02:27:39 -0700 (PDT) X-Google-Smtp-Source: APiQypK3RDLcf8iqJ9UvdgFTJUQb0/VIhhjHi9qfcuuKHuhFYcqUTilmngCPx2S7FXN/Hg4WfbgW X-Received: by 2002:a17:906:4317:: with SMTP id j23mr12078069ejm.377.1589189258862; Mon, 11 May 2020 02:27:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589189258; cv=none; d=google.com; s=arc-20160816; b=yUqzXJc2eGf7cc5XBDj7chUXvyWU1MUrscghqaA5Jykpk550VJTZSaGP851BG3t/T1 UQhRVidLlr5F9XdbEPr0GVWISzKaefkT+qc98LPJ4ZyYD6ToZ6F9/fpQX13Ae4n74p47 ZKu50ZqS1df5cXW5tWODp2kl6pJA7gAKWkpbTqKTleiXwGzwvgmF+PnnDryiA4B8eGfR KWLWWxrfTLerocVhqWPQiHbVnODpDoW2aNIKw6hP/ndJn/H00466abQug+6twZzdQROb zURDCHmdI6IheAPxTgNgp8RYvEmmK84r8EF8G0vxPRLMLUt1wBVpOLfwhzkIpnqfu0p7 Y4DA== 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:cc:to:subject; bh=YMRVaoGd7XDxLJTKtDh7pUXdfydxobundGlGWCD7a4s=; b=A6p4iwBetbDFbzpeu0Nx+FJ09ACCwLBeWl9skC+YU5u2E905azqdMarfb6MO8/TTFc Gyk+efhZ9pyu7ZpAwlRBLjedAm3Yw1VHKv8QJ7gW6bQBLx4QXkUYX1s6vzQEjixvc8Ql N3qINiwIdSs7l4BxEaMvwRBSLIWpsDeJaSLYe8zdS0PKxS+4CCXaDytQFBAcbQQK7mu+ YKYpIlArM/9peTs/+gEhOB8pAZs8JeM4LwWOdliNVcZkHLr+8PZlTwvht9011ATclWC7 s+P21Lsh2Euhk3V0D4IgHNKaez69lNT//E+8CrgIlGZ87Tns3LZic/57Hd4YRBm30ucP dfuA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce18si4521326edb.26.2020.05.11.02.27.16; Mon, 11 May 2020 02:27:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729376AbgEKJXY (ORCPT + 99 others); Mon, 11 May 2020 05:23:24 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36334 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725790AbgEKJXY (ORCPT ); Mon, 11 May 2020 05:23:24 -0400 Received: by mail-wr1-f68.google.com with SMTP id y16so2803524wrs.3; Mon, 11 May 2020 02:23:22 -0700 (PDT) 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=YMRVaoGd7XDxLJTKtDh7pUXdfydxobundGlGWCD7a4s=; b=nTOc/m/J4picsnNW86nkUrTZ4oLjvFNmsnyHLZRuu5IFv7smiG+k54AKFI86cp7iDI j/6Fi3ZuXZzVEuC+Fzwr/1jEGuWLY70fb2jwurQzVH90htd9TSiRBTIYkVIRq9CtN+GB C9u9L9xuUxzBofMsXG2QVVwpXVOELjlkcYN+AtWZHxSSGH/4rAkc9Eo4sVaYfMAfBRuX PCXqJ5csLMtCAefIFR+DXCeyFHCbf4dbV9C+A0abLavXOu2Rc0Ldv6brcjvuHFHva0+K hd9QpyHmkhibLXbcjYKQovb7Ou+JKDtFF8pn4v4ToyM9gd1NqI/UnQ9ez7slmf3xLYrH qZEQ== X-Gm-Message-State: AGi0Pub7sUR5FuqGzGaxzboguMY0MF5TJbop6s6BcncnF74sVesvy7KL C/+SXEeYVrg2DMXP42VwRJFlKuBG X-Received: by 2002:adf:e38b:: with SMTP id e11mr18080351wrm.343.1589189001351; Mon, 11 May 2020 02:23:21 -0700 (PDT) Received: from ?IPv6:2601:647:4802:9070:59c:65b4:1d66:e6e? ([2601:647:4802:9070:59c:65b4:1d66:e6e]) by smtp.gmail.com with ESMTPSA id b12sm5741106wrq.82.2020.05.11.02.23.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 May 2020 02:23:20 -0700 (PDT) Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing To: Ming Lei 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 References: <20200427154645.GA1201@infradead.org> <20200508214639.GA1389136@T590> <20200508232222.GA1391368@T590> <20200509094306.GA1414369@T590> <6579459b-aa98-78f2-f805-a6cd46f37b6c@grimberg.me> <20200511012942.GA1418834@T590> From: Sagi Grimberg Message-ID: <8f2ddabc-01d0-dae9-f958-1b26a6bdf58c@grimberg.me> Date: Mon, 11 May 2020 02:23:14 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200511012942.GA1418834@T590> Content-Type: text/plain; charset=utf-8; format=flowed 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 >>> 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. Do we have a way to characterize such devices? I'd assume that most devices will benefit from the batching so maybe the flag needs to be inverted? BLK_MQ_F_DONT_BATCHING_SUBMISSION?