Received: by 2002:a19:771d:0:0:0:0:0 with SMTP id s29csp1246505lfc; Wed, 1 Jun 2022 12:59:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAbvfwAp1QxZmcr+ect/hrffC+SVMNJah7Mgn3uT3sbTdVLr1iU3LV8TyOEpaltn0H8zJ8 X-Received: by 2002:a17:90b:4c06:b0:1e3:17fa:e387 with SMTP id na6-20020a17090b4c0600b001e317fae387mr15528456pjb.53.1654113559251; Wed, 01 Jun 2022 12:59:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654113559; cv=none; d=google.com; s=arc-20160816; b=Pq321a9M9jqMK6WG8MCxyKTKbPib7N8KmeGwwdduF6Qb6KVtTteu1r2bpuDqtn1D9/ 8m8HXnCHPpbxg1owQ1i9NiTPr3VuEu7f1IQLtEI3yEYV+ivr9hwu7gtS6qTrwZlJZATy LJmTw72Iu3EmVtx2Qx3YvuG9RIGsIyQdQqu0pN7lG4KL3RZTIQHj86Q/K/K9YuYOem/t 1gidXDWnakpmII+eaI/q2r8wrrPdnmAYnvz23f2vQ8o8de2i6CkvAC/ODnBcsFyFxlVd pk2Wq0YINaQedChzqQrFCNDsK9ecgkPs+TWTlfivfdfVPYG/jM9Iy0g/pa1RRFtayvw7 Kuug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ayTeI5wsopaSX5zCnvCTyNZXlpF+psdP9WEIS8dVDNo=; b=oq3fKgMLtQ3cQAl5d2j5hj1fr/vnIwxph3OgmYWYVN67hhZIM40N/NywcINoTYneAL ImwQTAu54wJWhQ5r8rKfYsaeYj9FWECbY3C7vOtyxT3EBvD3dSPb+LTCrPnHty+xXmkp FZRjx809q5CUMTJ+Vc5pcI2uHjxkiZtq2K+hNLrCZxA2JxhEVrPwOEfsS+1FzKql3clQ D+07VhXvc7hQAgdt7PZkk57gUWkMLc4pezfRtVOrOFtQIn6yVPp7AktMStpcbwBbvhRI oBdh2BsQoyoHroekDhhVylEs08EUuIx5fCtbD5NPlLGop9H90biwQKJZlbEJ9scDsPVS X8OQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m18-20020a170902f21200b00163539b9430si2884096plc.434.2022.06.01.12.59.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 12:59:19 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B98D321AC5B; Wed, 1 Jun 2022 12:18:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345135AbiEaN4O (ORCPT + 99 others); Tue, 31 May 2022 09:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344766AbiEaNzm (ORCPT ); Tue, 31 May 2022 09:55:42 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ACD53B6; Tue, 31 May 2022 06:55:36 -0700 (PDT) Received: from kwepemi500015.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LCDHK0P2qzRhWW; Tue, 31 May 2022 21:52:29 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by kwepemi500015.china.huawei.com (7.221.188.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 31 May 2022 21:55:34 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 31 May 2022 21:55:33 +0800 From: Yu Kuai To: , , , CC: , , , , Subject: [PATCH -next v8 2/4] block, bfq: record how many queues have pending requests Date: Tue, 31 May 2022 22:08:56 +0800 Message-ID: <20220531140858.3324294-3-yukuai3@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220531140858.3324294-1-yukuai3@huawei.com> References: <20220531140858.3324294-1-yukuai3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600009.china.huawei.com (7.193.23.164) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, 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 Prepare to refactor the counting of 'num_groups_with_pending_reqs'. Add a counter in bfq_group, and update it while tracking if bfqq have pending requests. Signed-off-by: Yu Kuai --- block/bfq-cgroup.c | 1 + block/bfq-iosched.h | 1 + block/bfq-wf2q.c | 12 ++++++++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 09574af83566..0954a258a107 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 = bfqd; bfqg->active_entities = 0; + bfqg->num_queues_with_pending_reqs = 0; bfqg->online = true; bfqg->rq_pos_tree = RB_ROOT; } diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 3b9b1a0e7c1c..a5f7c0c1a3b3 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -943,6 +943,7 @@ struct bfq_group { struct bfq_entity *my_entity; int active_entities; + int num_queues_with_pending_reqs; struct rb_root rq_pos_tree; diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index 12d20f26ad69..b533e17e9f0c 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c @@ -1651,16 +1651,24 @@ static void bfq_add_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq) { struct bfq_entity *entity = &bfqq->entity; - if (!entity->in_groups_with_pending_reqs) + if (!entity->in_groups_with_pending_reqs) { entity->in_groups_with_pending_reqs = true; +#ifdef CONFIG_BFQ_GROUP_IOSCHED + bfqq_group(bfqq)->num_queues_with_pending_reqs++; +#endif + } } void bfq_del_bfqq_in_groups_with_pending_reqs(struct bfq_queue *bfqq) { struct bfq_entity *entity = &bfqq->entity; - if (entity->in_groups_with_pending_reqs) + if (entity->in_groups_with_pending_reqs) { entity->in_groups_with_pending_reqs = false; +#ifdef CONFIG_BFQ_GROUP_IOSCHED + bfqq_group(bfqq)->num_queues_with_pending_reqs--; +#endif + } } /* -- 2.31.1