Received: by 2002:ab2:1347:0:b0:1f4:ac9d:b246 with SMTP id g7csp189439lqg; Wed, 10 Apr 2024 22:19:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3wtu9OROXZ2LLIMVoltn5X+WlWnG/Bex/usZWwLK5MLBwjrzm1ldBWAVKKpjh1jmaCHZEJaaH/WSVAkerLJt/fgtAlyh2mqpaNHcVwA== X-Google-Smtp-Source: AGHT+IHO2bjs4+EYspkHru56p0l+5rJniqeSwBg8QkRNkHwdzy1yPE7pxuWU5vBNhPeoTpnmiW/K X-Received: by 2002:a17:906:7308:b0:a51:885a:c0a with SMTP id di8-20020a170906730800b00a51885a0c0amr3058406ejc.61.1712812766872; Wed, 10 Apr 2024 22:19:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712812766; cv=pass; d=google.com; s=arc-20160816; b=sJ2LIEMN3xkAgUqojC1Kgazf1Byn+Ta4r4QrMeMDdcmpKNlkaOQvcyC+oUfCyRfDLs GooOsDj5HIh2ufSNDNDQf7k1HUleSiOue0ClnBCrqA1N8aOo0tK4x7706BPW3RueHcC6 yPVGPNejEELQx71ehjA7z2M9QnkTDNRHSuXOjZ6so2w8JNeV/PprYd9PWtRcEmTUNBjj XhJcmJFaw0c3Qy6MVmmxscZ2PwJ1H/EYAXnwJhZIf/Gut4WvqnKtPHZB7TDOZIdO3LVe 9GfVJplkCN1cas8AgeTaWw+R7YjRFhrN2WiTAw+Vbd3R5NePRiIbYKRQZqATM/NAMusF /j3w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:content-language :from:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=dzpo6CA1AXXuEOS+PPsdbCM+Z2yjOBqMy+ywvNi2NFQ=; fh=UQtEazW56HGgDrDEmJLwe/VcAG9Oh6jJBTV3/XhHSuQ=; b=nqp7m7SxGpMjSd7opCeaWXtwZthPohY6Bb+KTHbnW7G11qyAPOlBhxK246J/Hs2kTF IESYcAfozJJatmbjV7096ydwI7l4dAPL/t6vVOa/pGr5OPWb8iXjItljI4fs/VGptgIR rGP+MWMdztBikS2XUwBzwrKE+pOorD43ANn6euJgaZjpRzVFTYvqqeW+obEbrYxlGW4S XkzlR9OBwNv5frDoqlD/3H+QsxxDtMaoREB+FtCKm8QP0NuRjQ+HaQMuThbpjMlVLlG5 TQerf5pkGJz3PGmWRNYPoxiydCJrnmFkPJu96O55Ulx72tscyQnSalrnaGev0gld7wuQ Ag7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EkC/P1S8"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id l22-20020a1709065a9600b00a4e287d7603si371003ejq.335.2024.04.10.22.19.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 22:19:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="EkC/P1S8"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 95B1B1F24C8C for ; Thu, 11 Apr 2024 05:19:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF72113C8E7; Thu, 11 Apr 2024 05:19:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EkC/P1S8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BAC613C838; Thu, 11 Apr 2024 05:19:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712812744; cv=none; b=GBE9jNqdSA95NWJywCZsJmK4e3kNWI1ooYH6ZGy/8mBoJRE3tG3nx1KI/3UGySQfo2ANMBhNcVIip4sAwMHgnvjfnOULeTXOohqI3N0q6mNa4xMEnAS7sBoenipi5qA7vQx4rpkk/YMSUrJyJeWQIJSMFOkIxk7rswhyEOBjN8g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712812744; c=relaxed/simple; bh=XgFUk20c57p70PXg9xZ1MkCgiZA4e9NkJIiIFaVCIWs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=msg312gdaiOoGPgnpupLAZBVPut+6AlasUop1pC2L2FlptVkbshYlTxy9S+3mYbyGn5nNTVJRyv2qDrn27L5pgpygGYRot32EHQmB5UVUnqiDIdplVtjMDPThYEyxoX/QP48oF0W5Z7yVyHfx2ocucRWCo4Qn9VXjjR8mDK2hkU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EkC/P1S8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77BCCC433C7; Thu, 11 Apr 2024 05:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712812743; bh=XgFUk20c57p70PXg9xZ1MkCgiZA4e9NkJIiIFaVCIWs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=EkC/P1S8ZLFmo/55ZH+2juxzh/cOeAJu6NiJ9nZ+sdOxBtcGPd3gaKhQLIWqmX7Jq DzNKWvBaC/aQORzZPQLfhl5PkomYFyn6jkV1zgRut5qJNjyNpZYiH8GZ+ssmoeLw1l mC+RZwRxWT+6EtvRY1e/Yzsvu9fO8rDrvcGkL/G82PZm2Lg0IKZUarM70yzGbOfkm9 YJQZFProYuohwqrJIq8/b+TnHY1bS1OTwvRNLZcKaUTuJE9W/Nu27L2UC70qadZ/fM gUYyMLLnPBP3lswkTcFKA24y9zf3MtVvyh7U/j1pSzcEnAq/ccSxh8NIgKNWva+9Sj EeCVh9OtbFVWQ== Message-ID: <5a83c1f7-3ab8-486a-b633-33b44858d290@kernel.org> Date: Thu, 11 Apr 2024 14:19:00 +0900 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] block: add max_dispatch to sysfs To: Jens Axboe , Dongliang Cui Cc: ke.wang@unisoc.com, hongyu.jin.cn@gmail.com, niuzhiguo84@gmail.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, cuidongliang390@gmail.com References: <20240410101858.1149134-1-dongliang.cui@unisoc.com> <5a67c4f7-4794-45b4-838c-7b739372d3a5@kernel.dk> From: Damien Le Moal Content-Language: en-US Organization: Western Digital Research In-Reply-To: <5a67c4f7-4794-45b4-838c-7b739372d3a5@kernel.dk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/10/24 22:17, Jens Axboe wrote: > On 4/10/24 4:18 AM, Dongliang Cui wrote: >> The default configuration in the current code is that when the device >> is not busy, a single dispatch will attempt to pull 'nr_requests' >> requests out of the schedule queue. >> >> I tried to track the dispatch process: >> >> COMM TYPE SEC_START IOPRIO INDEX >> fio-17304 R 196798040 0x2005 0 >> fio-17306 R 197060504 0x2005 1 >> fio-17307 R 197346904 0x2005 2 >> fio-17308 R 197609400 0x2005 3 >> fio-17309 R 197873048 0x2005 4 >> fio-17310 R 198134936 0x2005 5 >> ... >> fio-17237 R 197122936 0x0 57 >> fio-17238 R 197384984 0x0 58 >> <...>-17239 R 197647128 0x0 59 >> fio-17240 R 197909208 0x0 60 >> fio-17241 R 198171320 0x0 61 >> fio-17242 R 198433432 0x0 62 >> fio-17300 R 195744088 0x2005 0 >> fio-17301 R 196008504 0x2005 0 >> >> The above data is calculated based on the block event trace, with each >> column containing: process name, request type, sector start address, >> IO priority. >> >> The INDEX represents the order in which the requests are extracted from >> the scheduler queue during a single dispatch process. >> >> Some low-speed devices cannot process these requests at once, and they will >> be requeued to hctx->dispatch and wait for the next issuance. >> >> There will be a problem here, when the IO priority is enabled, if you try >> to dispatch "nr_request" requests at once, the IO priority will be ignored >> from the scheduler queue and all requests will be extracted. >> >> In this scenario, if a high priority request is inserted into the scheduler >> queue, it needs to wait for the low priority request in the hctx->dispatch >> to be processed first. >> >> --------------------dispatch 1st---------------------- >> fio-17241 R 198171320 0x0 61 >> fio-17242 R 198433432 0x0 62 >> --------------------dispatch 2nd---------------------- >> fio-17300 R 195744088 0x2005 0 >> >> In certain scenarios, we hope that requests can be processed in order of io >> priority as much as possible. >> >> Maybe max_dispatch should not be a fixed value, but can be adjusted >> according to device conditions. >> >> So we give a interface to control the maximum value of single dispatch >> so that users can configure it according to devices characteristics. > > I agree that pulling 'nr_requests' out of the scheduler will kind of > defeat the purpose of the scheduler to some extent. But rather than add > another knob that nobody knows about or ever will touch (and extra queue > variables that just take up space), why not just default to something a > bit saner? Eg we could default to 1/8 or 1/4 of the scheduler depth > instead. Why not default to pulling what can actually be executed, that is, up to the number of free hw tags / budget ? Anything more than that will be requeued anyway. -- Damien Le Moal Western Digital Research