Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2436210ioo; Sat, 28 May 2022 13:37:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyQFgrPgRh5hcRGJq28i9SB68X0+Wj7IwgKsAximb3iHLpS+Ce1xRVBWfGRd9bhfCGlz0d X-Received: by 2002:a17:90b:4fc6:b0:1e0:6535:c7a1 with SMTP id qa6-20020a17090b4fc600b001e06535c7a1mr15222102pjb.168.1653770259648; Sat, 28 May 2022 13:37:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770259; cv=none; d=google.com; s=arc-20160816; b=p/B6tMS6iTEoyREEnfUPIuWy6EoYPG2P1QaR3DJmhP70H5Ux3Op1EU6Gov+cadB4nS EhDvJ47+Hw/kHdL3SugCkr+MXJtwhMZbWMkmQg43uoo+11sU1bG+pkZ2GbqT0GWw1eQM h3iFHB7epCIV8mCo/KeCoCV0oIRy1fMyI384hs3pEkTWFhBY+HIz2iXu9vPNk1J6aqp1 ++Sm51/Dgj2gnFczL+m7TmhhoBGN066+XEwcL1LaJsjjlOESC++24i0k9B6pIK8chFNi GaNhH1N9JaRZYz/IiTOT/zObCCM6hcK8tEmKDMRo8UJM95bG917dgPs2whu0e9kLHv4N Gjeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=zKQyiSCqOmFTXYg1oyMhrbRM1Y8cO4uyy6QdrPFWc8E=; b=trzsouN2ewSNA7g0ivnq2uMLzwzL4gf5wvK/Cu5zElzEWv47WzDlYyHERGtkT89dfW 03lKOR6eY15Y4+Joc0qtgCek90lhRQbjX3kewbXxkLoPHkjYxlj//737WpDoYVALBFHG VkVlZthDQNojcCZB4XHM438cf5mUEHHWmr7K0TZnZq2BjemNB0HXZG+vuZk59BNF+Iij vmUTKdSH5suTOY1qXK0lBEUUb+py5wIgkpLondX+aWDF4yYFTUF6WMjBEXvqMI/4ZSx9 p2ZSMFZXdpDTME2WOdS+1w+O2Bkk6poDSElpcwnFCorIJ4RMgTPItegpq4eobrt26OkO hqXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Frk0CGa6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h12-20020a63f90c000000b003c27c449666si10115540pgi.231.2022.05.28.13.37.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:37:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Frk0CGa6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 957761257BB; Sat, 28 May 2022 12:40:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354973AbiE1ISY (ORCPT + 99 others); Sat, 28 May 2022 04:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354062AbiE1ISR (ORCPT ); Sat, 28 May 2022 04:18:17 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6ACCBF62 for ; Sat, 28 May 2022 01:18:14 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id v19so535569edd.4 for ; Sat, 28 May 2022 01:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zKQyiSCqOmFTXYg1oyMhrbRM1Y8cO4uyy6QdrPFWc8E=; b=Frk0CGa66mdgvvN98mA9x6NKT/Z+nOGLGMG5bYj54sZE8Lhp9JhuJvuNY8yJL6EsZI J3KIhCqyxlqhcg12/bSe/job0NO779KynECC8rcca8uR6CiSMYGeq+csLaG62ntXqacJ dES90AYO7hHJd/EBXB70EazwxzZAxQ/XqUC68IfGd/viKP5tX3k5dd7+J3dFugplJ0ZL HCtaNmUK65p5QGjx9s99ZizndE/FKgUz8a6LdwkrXWbXo8MBz6hq33pm7UTq4M7V0Qgp HStjHM0DBPi2iLS3eYgBuKVtopPlt2JeDZsqhPmHs5vRh2cFRTyoyDGf+vcfRFuYNDFQ jvNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=zKQyiSCqOmFTXYg1oyMhrbRM1Y8cO4uyy6QdrPFWc8E=; b=x5xHbHyB+w3IGTWsonNIFPV7kLxWC5E7I5I5yZv71b4z+DjP/L9Ir9628HKGv7ApGu ddU0/wQaOOLsPS7tmtc4B84AvuxRmhofLl2FxiHOZuzc0Vv+CUdgi+56+z3eP2NR8HJx PzCZJHkhZnVcQM2bXQHMyH3FLsd8EXxxoz8Y5ZLVLWW7Jy5G5w2DI/wiegb9MbsOEEkj D8S4z2gP2ncVn2ph+rzdduBycDtXT3CGckFq2YW0N48M9kDkGURN+Vlh7/S19qbhH3vn GEWSK1N9i5t52dbuq07l2gBOIHsN5ZQVZPRlCqMv7afIJgfbFc96Qk6omdEegjlndxQ1 6U+Q== X-Gm-Message-State: AOAM530qS2tWjAqMHl2zzV37Pv3339gjP1CmQN0uajZjLau7FtGr5pem Bv5wl+ju9tN+vEC6jBHSgAbO8w== X-Received: by 2002:a05:6402:1d50:b0:42b:6da9:ed34 with SMTP id dz16-20020a0564021d5000b0042b6da9ed34mr29184832edb.333.1653725892829; Sat, 28 May 2022 01:18:12 -0700 (PDT) Received: from mbp-di-paolo.station (net-93-144-98-177.cust.vodafonedsl.it. [93.144.98.177]) by smtp.gmail.com with ESMTPSA id g20-20020a170906955400b006feec47dae9sm2126208ejy.157.2022.05.28.01.18.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 28 May 2022 01:18:12 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH -next v6 1/3] block, bfq: record how many queues are busy in bfq_group From: Paolo Valente In-Reply-To: <20220523131818.2798712-2-yukuai3@huawei.com> Date: Sat, 28 May 2022 10:18:11 +0200 Cc: Jan Kara , Tejun Heo , Jens Axboe , cgroups@vger.kernel.org, linux-block , LKML , yi.zhang@huawei.com Content-Transfer-Encoding: quoted-printable Message-Id: <8D29A46A-4B8A-4F05-BCE3-D9D0F0D2DD5A@linaro.org> References: <20220523131818.2798712-1-yukuai3@huawei.com> <20220523131818.2798712-2-yukuai3@huawei.com> To: Yu Kuai X-Mailer: Apple Mail (2.3445.104.11) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 > Il giorno 23 mag 2022, alle ore 15:18, Yu Kuai ha = scritto: >=20 > Prepare to refactor the counting of 'num_groups_with_pending_reqs'. >=20 > Add a counter 'busy_queues' in bfq_group, and update it in > bfq_add/del_bfqq_busy(). >=20 > Signed-off-by: Yu Kuai > Reviewed-by: Jan Kara > --- > block/bfq-cgroup.c | 1 + > block/bfq-iosched.h | 2 ++ > block/bfq-wf2q.c | 20 ++++++++++++++++++++ > 3 files changed, 23 insertions(+) >=20 > diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c > index 09574af83566..4d516879d9fa 100644 > --- a/block/bfq-cgroup.c > +++ b/block/bfq-cgroup.c > @@ -557,6 +557,7 @@ static void bfq_pd_init(struct blkg_policy_data = *pd) > */ > bfqg->bfqd =3D bfqd; > bfqg->active_entities =3D 0; > + bfqg->busy_queues =3D 0; > bfqg->online =3D true; > bfqg->rq_pos_tree =3D RB_ROOT; > } > diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h > index 978ef5d6fe6a..3847f4ab77ac 100644 > --- a/block/bfq-iosched.h > +++ b/block/bfq-iosched.h > @@ -906,6 +906,7 @@ struct bfq_group_data { > * are groups with more than one active @bfq_entity > * (see the comments to the function > * bfq_bfqq_may_idle()). > + * @busy_queues: number of busy bfqqs. > * @rq_pos_tree: rbtree sorted by next_request position, used when > * determining if two or more queues have interleaving > * requests (see bfq_find_close_cooperator()). > @@ -942,6 +943,7 @@ struct bfq_group { > struct bfq_entity *my_entity; >=20 > int active_entities; > + int busy_queues; >=20 > struct rb_root rq_pos_tree; >=20 > diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c > index f8eb340381cf..d9ff33e0be38 100644 > --- a/block/bfq-wf2q.c > +++ b/block/bfq-wf2q.c > @@ -218,6 +218,16 @@ static bool bfq_no_longer_next_in_service(struct = bfq_entity *entity) > return false; > } >=20 > +static void bfq_inc_busy_queues(struct bfq_queue *bfqq) > +{ > + bfqq_group(bfqq)->busy_queues++; > +} > + > +static void bfq_dec_busy_queues(struct bfq_queue *bfqq) > +{ > + bfqq_group(bfqq)->busy_queues--; > +} > + > #else /* CONFIG_BFQ_GROUP_IOSCHED */ >=20 > static bool bfq_update_parent_budget(struct bfq_entity = *next_in_service) > @@ -230,6 +240,14 @@ static bool bfq_no_longer_next_in_service(struct = bfq_entity *entity) > return true; > } >=20 > +static void bfq_inc_busy_queues(struct bfq_queue *bfqq) > +{ > +} > + > +static void bfq_dec_busy_queues(struct bfq_queue *bfqq) > +{ > +} > + > #endif /* CONFIG_BFQ_GROUP_IOSCHED */ >=20 > /* > @@ -1660,6 +1678,7 @@ void bfq_del_bfqq_busy(struct bfq_data *bfqd, = struct bfq_queue *bfqq, > bfq_clear_bfqq_busy(bfqq); >=20 > bfqd->busy_queues[bfqq->ioprio_class - 1]--; > + bfq_inc_busy_queues(bfqq); >=20 Why do you increment the number of busy queues for the group on a del_bfqq_busy, instead of an add_bfqq_busy? Besides, the name of the function bfq_inc_busy_queues does not mention the target of the update, namely the group. This creates a little confusion at a first sight, as one sees this function invoked right after the update of a field with the same name: bfqd->busy_queues. > if (bfqq->wr_coeff > 1) > bfqd->wr_busy_queues--; > @@ -1683,6 +1702,7 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, = struct bfq_queue *bfqq) >=20 > bfq_mark_bfqq_busy(bfqq); > bfqd->busy_queues[bfqq->ioprio_class - 1]++; > + bfq_dec_busy_queues(bfqq); Same pair of comments as above. Thanks, Paolo >=20 > if (!bfqq->dispatched) > if (bfqq->wr_coeff =3D=3D 1) > --=20 > 2.31.1 >=20