Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2019563rwb; Thu, 15 Dec 2022 18:16:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Iiq4dBR+GI/mZ5cbmTVLR+Q8dXd45otOJ2aPYPOgq6QHfzS5MeNSoT3ZtqfOSljibiPhj X-Received: by 2002:a05:6a21:2d8a:b0:a5:cc8f:cd14 with SMTP id ty10-20020a056a212d8a00b000a5cc8fcd14mr38120471pzb.35.1671156989870; Thu, 15 Dec 2022 18:16:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671156989; cv=none; d=google.com; s=arc-20160816; b=dLhipYb15zNrXDv4ZdcwZtwWcpJMf1HVdHnW9D1xcPViASRK+RacEQ3WodHnwHiL2d fxPAoX2pKyPYFcU34JtLhrAIQF5MpGl8K0njQf/QBYvjekq55Ta4lwlIv+JzprTl78Bw 98zkHRy35gSjOVW3AinyvQ6/6tP+2HLe/7Co89snmxWN9fezhnG7oHZB1uivryS/uV++ KsqFiEFgjDD+x3Ce7e3LQ6lEVtYMhxF8T47PLDzsvTNN+sAreRpIVyzy4ZCVxqgUln3l ByWKEsx0fWmdK4YYVXRdGlkeIn8I+YL0bJGvgciV245teR8mrozN36467mpzBUVId5th sq5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature :wdcironportexception:ironport-sdr:ironport-sdr:dkim-signature; bh=V/+/lycrxZ/XV/0z8BvHx/Dmq7GG0W2y1LyktIDcT5E=; b=ehZQogIp9hEFJtil+fy5El/27VpKozPVv5LzlBEn8+n14Dw/5j4TDkNJO25u1Q2CCg y0J1B9XU90c3CBuKgiQdeCZH+Pks1hm5JqqYJzabyBQLnBDVygykg2QpSSnK3nXkRmyp /TkXOwnNzlDyUMYl9NSW2fCpmVatXS1rn4+NhsZv3gsVdvytV0D3bImTUQPcmKH+y+Fg s8ZZCURaf8DvJYAbJV8KCY8TndqMWQICgXmPIh8WLTfzlrQF7eDXzwXG7+kfWdGhmr9v EI6wMwyfPW179dlccPMgh+vhJ5mTX92/G80xhPG2ayyut/hUNoSEsyKGtJg27JgxNPeF sDew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=e2XoyqtT; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=smhASSGx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h65-20020a636c44000000b00478b13ff34bsi1217278pgc.419.2022.12.15.18.16.21; Thu, 15 Dec 2022 18:16:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=e2XoyqtT; dkim=pass header.i=@opensource.wdc.com header.s=dkim header.b=smhASSGx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=opensource.wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbiLPBhL (ORCPT + 69 others); Thu, 15 Dec 2022 20:37:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbiLPBhD (ORCPT ); Thu, 15 Dec 2022 20:37:03 -0500 Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E6632F026 for ; Thu, 15 Dec 2022 17:37:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1671154621; x=1702690621; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=R3LMaKP/CM5OTKDx/LYRMNxUfE2LzWDEN0GY7X/wPpA=; b=e2XoyqtTBaT+Z/tS3VMzHxaImNdjZbtfrejo13fDLhMTCYc3WHpOIbWC abU8VrFicTrszzkV+il3SI4RegrlxqJPf2bm/XAmBtVA1bx5fagNjujQL WD5+na1BT9fYA0ocszd/DqYE8AF5wM1FxqPesYw6OXwcyDPAsMvdF+c1R ejmcplAjCfcZ4RFhe9n1TdFOnpgA2cx+fXNOewK7LYqsZd5Dn3Y3FVqkZ gNJ85T3LhOqqFXyEMnLhMCVpIHneO8hrWr5bcN7oPRHZZcGtRTM04xP8i HJJdu38ImlkLtePetIIqclUB9UVPFD/lvMiT3A7gWFokJi9dHwQbJ8j3P Q==; X-IronPort-AV: E=Sophos;i="5.96,248,1665417600"; d="scan'208";a="216993582" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 16 Dec 2022 09:37:00 +0800 IronPort-SDR: s82+dmxXAheRzcKuD48PJi4BwAwOeW3ijagbny9juf53ntL63RVTF79+PVqdqyrFdi5hxH9aEo agOzqLizxqu2IfqRUtHpjAPrUo6q+JxRmfrorD0aiDqOpJnR9cW0zthYOS9eAtS7dWwatQkmqf hFaln7kRmuTIOrhVXlIvdDZuIQKmIzPQj4BL0s6WOOztSr21xTSgnlzJ7L+NQ4+0K+kbwqe1q/ 4vHCjDe7d5DCQzPvQNERXXbChUb4TMGK0DOVg9cd3xzsRUSCaoZOiZLo1WKFOuOl4Pk+hcHuwO MuY= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 15 Dec 2022 16:49:36 -0800 IronPort-SDR: NAc52oDWYeTmWD22lcJw0oXWon8G3OenVuOpa0uy+OPBHA1DVTcncTZzL6WpYdubOzn6zVAnMF gLfVcyiXLnPeS6X861EoH6pylxMSsuhfBTljQV1X9gJdt1B1ge+icjP41RhvvpN71OXCbJOrDU ytWTAPdjbRDv+AYaw+XV9TGUoQZgUfx8x3XxKts3PWs2QQmmm2OpDTtpm9MLo6f+kUWVqh8aXb 52coQ7xiENRKhM79G4Zd7ccKvzC+LMSlHOaI4G/eOudmrxHsnTwGT6a2K567d4Bb5yMA2V/RFh /Sw= WDCIronportException: Internal Received: from usg-ed-osssrv.wdc.com ([10.3.10.180]) by uls-op-cesaip01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 15 Dec 2022 17:37:01 -0800 Received: from usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTP id 4NYBXr2652z1RvTp for ; Thu, 15 Dec 2022 17:37:00 -0800 (PST) Authentication-Results: usg-ed-osssrv.wdc.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=opensource.wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= opensource.wdc.com; h=content-transfer-encoding:content-type :in-reply-to:organization:from:references:to:content-language :subject:user-agent:mime-version:date:message-id; s=dkim; t= 1671154619; x=1673746620; bh=R3LMaKP/CM5OTKDx/LYRMNxUfE2LzWDEN0G Y7X/wPpA=; b=smhASSGxMWHQQllMaOPC+tDqASAmhtjBeW5+TMpbuw0YDuXqseE 4JBxwSoKpHufX3gk6+FuRS0u55Yexba6VHq1MFo3UoRR5Nk+GjJ644BWJqbQ2RgG DTy0BF+UtrylveMLPmzOOpwh5BEcFBnO/xZE+1d4PBESDHYPk/C+++cLPvLmIOiP eBqg82OpQDHgudi07EgEfqRx9FX5Jr6jzvSZ2SL/xiaUjFrxMKyDDJVflgRwc4eh JabChcGp+TnEk/MrCirDZZ7u+6PKoJlvQraTaP+9os1/ldbf5BL3b2yxDBsgW/bO Wdm1b7ELuoSKui76033T3nptuBGYh4ektLA== X-Virus-Scanned: amavisd-new at usg-ed-osssrv.wdc.com Received: from usg-ed-osssrv.wdc.com ([127.0.0.1]) by usg-ed-osssrv.wdc.com (usg-ed-osssrv.wdc.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WCwa4Ik7XnKr for ; Thu, 15 Dec 2022 17:36:59 -0800 (PST) Received: from [10.149.53.254] (washi.fujisawa.hgst.com [10.149.53.254]) by usg-ed-osssrv.wdc.com (Postfix) with ESMTPSA id 4NYBXp0lcnz1RvLy; Thu, 15 Dec 2022 17:36:57 -0800 (PST) Message-ID: <958736d1-918b-d1a0-d6f2-0841f4470803@opensource.wdc.com> Date: Fri, 16 Dec 2022 10:36:56 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 Subject: Re: [PATCH V10 8/8] block, bfq: balance I/O injection among underutilized actuators Content-Language: en-US To: Paolo Valente , Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, arie.vanderhoeven@seagate.com, rory.c.chen@seagate.com, glen.valante@linaro.org, Davide Zini References: <20221209094442.36896-1-paolo.valente@linaro.org> <20221209094442.36896-9-paolo.valente@linaro.org> From: Damien Le Moal Organization: Western Digital Research In-Reply-To: <20221209094442.36896-9-paolo.valente@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/9/22 18:44, Paolo Valente wrote: > From: Davide Zini > > Upon the invocation of its dispatch function, BFQ returns the next I/O > request of the in-service bfq_queue, unless some exception holds. One > such exception is that there is some underutilized actuator, different > from the actuator for which the in-service queue contains I/O, and > that some other bfq_queue happens to contain I/O for such an > actuator. In this case, the next I/O request of the latter bfq_queue, > and not of the in-service bfq_queue, is returned (I/O is injected from > that bfq_queue). To find such an actuator, a linear scan, in > increasing index order, is performed among actuators. > > Performing a linear scan entails a prioritization among actuators: an > underutilized actuator may be considered for injection only if all > actuators with a lower index are currently fully utilized, or if there > is no pending I/O for any lower-index actuator that happens to be > underutilized. > > This commits breaks this prioritization and tends to distribute > injection uniformly across actuators. This is obtained by adding the > following condition to the linear scan: even if an actuator A is > underutilized, A is however skipped if its load is higher than that of > the next actuator. > > Signed-off-by: Paolo Valente > Signed-off-by: Davide Zini > --- > block/bfq-iosched.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c > index 527def05ce44..0ec8310331e1 100644 > --- a/block/bfq-iosched.c > +++ b/block/bfq-iosched.c > @@ -4830,10 +4830,16 @@ bfq_find_active_bfqq_for_actuator(struct bfq_data *bfqd, int idx) > > /* > * Perform a linear scan of each actuator, until an actuator is found > - * for which the following two conditions hold: the load of the > - * actuator is below the threshold (see comments on actuator_load_threshold > - * for details), and there is a queue that contains I/O for that > - * actuator. On success, return that queue. > + * for which the following three conditions hold: the load of the > + * actuator is below the threshold (see comments on > + * actuator_load_threshold for details) and lower than that of the > + * next actuator (comments on this extra condition below), and there > + * is a queue that contains I/O for that actuator. On success, return > + * that queue. > + * > + * Performing a plain linear scan entails a prioritization among > + * actuators. The extra condition above breaks this prioritization and > + * tends to distribute injection uniformly across actuators. > */ > static struct bfq_queue * > bfq_find_bfqq_for_underused_actuator(struct bfq_data *bfqd) > @@ -4841,7 +4847,9 @@ bfq_find_bfqq_for_underused_actuator(struct bfq_data *bfqd) > int i; > > for (i = 0 ; i < bfqd->num_actuators; i++) { > - if (bfqd->rq_in_driver[i] < bfqd->actuator_load_threshold) { > + if (bfqd->rq_in_driver[i] < bfqd->actuator_load_threshold && > + (i == bfqd->num_actuators - 1 || > + bfqd->rq_in_driver[i] < bfqd->rq_in_driver[i+1])) { > struct bfq_queue *bfqq = > bfq_find_active_bfqq_for_actuator(bfqd, i); > Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research