Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp108160ybk; Fri, 8 May 2020 15:22:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJqR9GUWJhm9Wkp7yMhJJsICG2zpXZuIHxbC1bEbFHfEYtfMjHI4yNgX2SKjnBBlADFFiNf X-Received: by 2002:aa7:df0a:: with SMTP id c10mr4149777edy.306.1588976522948; Fri, 08 May 2020 15:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588976522; cv=none; d=google.com; s=arc-20160816; b=cju9dIN40vCRc5zKAl68VwPeu7WFY6TzK7XXhVcY5BDzyz/o0VhyiJzSAQnuiGJ1JB g2RzQRxJx9QaTpYueM6Q9E11fVIrpaDKOWHkJq+OvA5P6aaaE66d8YVp+cYLycWlTeks SA8XopYW4F3/CnDKDn+d9dFT5Tz8IHWoue6zNQW+ekslXfrIOMt/q+N6gKWRZz9uWQoI I79kz46KW+R+CqD6Kvy4l5eHTUM7z51nfXgN7WD7Hky4MxKCts3jCHk6v2tEP9463Dld vITZymIg8dSwLBznxJWUAAcBDpSKg/Wh6Y33dHogj3K+x6YTl/Nb0GcpZXY61/taEol/ s4KA== 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=agEiPPMNgwyK2BliOmzqFg2hxzKUzHpkr6vduFi84gQ=; b=PTIFk4uDL7N4XXScJxhK8bkIth1WnveBg2jfhqZFhESX6r3gqdfbS8M8XDK6C8+2Pt IaqBV2oS2T6OGp0Dvlawm0OYGOB4ZAysH5+XlLxzVXzo4r+KripAUM/omffv4YyuwGFy ES3Dq2Pv465B6AoMjm7jfrOMUd7lXdvQtuL02B3PzVxaCwiaaOGelaXR+j0qNFpfrgV2 kUHwqzL3ds/p+sNi0D1l+VMTDcstuqVUcf18ltyZg77qyJ6rs1gFZUuCvsftixPRLTz7 RXSINnLHhZvVZly+O/OZTgksmhcuuz9p8Igj9E/+QsGUHUpWtAnycAj3umSGR2VdUmww evJw== 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 f16si1825072eds.152.2020.05.08.15.21.36; Fri, 08 May 2020 15:22:02 -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 S1727983AbgEHWTu (ORCPT + 99 others); Fri, 8 May 2020 18:19:50 -0400 Received: from mail-pj1-f67.google.com ([209.85.216.67]:34454 "EHLO mail-pj1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727082AbgEHWTt (ORCPT ); Fri, 8 May 2020 18:19:49 -0400 Received: by mail-pj1-f67.google.com with SMTP id h12so5717752pjz.1; Fri, 08 May 2020 15:19:49 -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=agEiPPMNgwyK2BliOmzqFg2hxzKUzHpkr6vduFi84gQ=; b=g009fLPX477tOlQmG7l4KRZh5Xah8g5B+/OID4YVwp9l4sl0JKY1w1QXORb6h9LIXc we1Ls8BadeLgc8FTwgyWXFazXmXlDnmsWwQ62wyyxViWE6CnvIdalaOqaCzAx1Hd+05k BGDHH+Qc+/8H+uFajj4pC3oizbPieoRxlft7KE2NBOL4w4ha1NY3Z2e/V6vyCrLAGfJh 1mX+/3sQuJngiGq3fHtUVF2U5dz+BvQid04+m+lzU0AC4wds/+1E4870KkqWDQupYKB1 0ES98w68POyEZBfZM6x+vXkycWNlAVozPfkpXfN/V8QFpF4XQn1m7lk73Nun+fqJhO9O GrgA== X-Gm-Message-State: AGi0PuZ/o10RsWxwcPlYdjy58DZyPzq8IPkqZ5rtiU8WS+zpkw0Qjwhx pt6GZg9OxdrhccVf1z0uTtU2jio7 X-Received: by 2002:a17:90a:730a:: with SMTP id m10mr8915600pjk.9.1588976388140; Fri, 08 May 2020 15:19:48 -0700 (PDT) Received: from ?IPv6:2601:647:4802:9070:bc73:49fb:3114:443? ([2601:647:4802:9070:bc73:49fb:3114:443]) by smtp.gmail.com with ESMTPSA id a16sm2135918pgg.23.2020.05.08.15.19.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 May 2020 15:19:47 -0700 (PDT) Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch processing To: Ming Lei 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 References: <20200427154645.GA1201@infradead.org> <20200508214639.GA1389136@T590> From: Sagi Grimberg Message-ID: Date: Fri, 8 May 2020 15:19:45 -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: <20200508214639.GA1389136@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 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. > 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. > 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.