Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp354544iob; Thu, 28 Apr 2022 04:07:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVk3Kqe/lhy/xag7MAh/GbZKptBIOnVLtpfSF80sVryiR4Et6s08FDfuZ/j4db8/9TXiGj X-Received: by 2002:a17:907:3f07:b0:6f3:c0ee:d6a3 with SMTP id hq7-20020a1709073f0700b006f3c0eed6a3mr8512198ejc.410.1651144023899; Thu, 28 Apr 2022 04:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651144023; cv=none; d=google.com; s=arc-20160816; b=I9XgfoqEzy9gHltaO0Xitk247uKTrCWzXurOQmMuHs64CIyeAI/mCQAH9fayt5wXOE Ar3LL5buLgfY/gRsYVw0d45wdQ1vo5x4Czv80nvrbb9HSubA8qX56/TlztShw2mUFpOc Xshfn6lmHfz3ztR3iAo6QsEvB8X8YtvZ6KatjfpQHZsiVCDM1laEI/P/hpoE6Q+819PG sI14Dn6BtG3X70fIVnj4G+gBCJW/8t2jdZcDGDQC3KMv4EZoXqsomrNtPFJNpCX0B5fg tYmnAehtcLMWq/rmK0UpBeAOH013zhz1i4LzU+XYLk6zbQ0JO8RfYxpn1naku+eEAMjQ PifQ== 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 :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=pc9MVMK4krZSHWgHh4eJLqVuxzwJHeXGNIRXW3bAHnE=; b=YDW8GBsg9HqLDD8qyn30ybyanQ+rtpxNRRZu6Mo5y42oUCY2Cg8ldigu2R/d3JsU58 hNr9Lr8cQoJk0VnjNyyM1xlsNqsYHjrS5Qs5AXcYcQABudG5aB22K3qI9vxHqe4D9I4R k4F0R6tf2ibE/t1tdS9v0ieUZJlNCu2/OxFHfQV1SpOt+yBc+7Hg35NBL9iDnwdTChur 8doBrp+J1BLDJGIW/vOIf90XP+yu22SIqNRxFbCMaH9lZbivLLg4s5XbUpxXMZBKqoek SPJw8zvfYy5fPa2pY6jSODIoq3qi59J3c3h6vWc4xZeLE1lrlu9siXOjEYFqHuJFGz4c Ei7Q== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ha15-20020a170906a88f00b006df76385ce8si3513505ejb.392.2022.04.28.04.06.36; Thu, 28 Apr 2022 04:07:03 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234954AbiD1BLd (ORCPT + 99 others); Wed, 27 Apr 2022 21:11:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbiD1BLb (ORCPT ); Wed, 27 Apr 2022 21:11:31 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F020772457; Wed, 27 Apr 2022 18:08:17 -0700 (PDT) Received: from kwepemi100025.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4KpcnV2knLzCs7X; Thu, 28 Apr 2022 09:03:42 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by kwepemi100025.china.huawei.com (7.221.188.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 28 Apr 2022 09:08:15 +0800 Received: from [10.174.176.73] (10.174.176.73) 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; Thu, 28 Apr 2022 09:08:14 +0800 Subject: Re: [PATCH -next v3 1/3] block, bfq: record how many queues are busy in bfq_group To: Jan Kara CC: , , , , , , References: <20220427124722.48465-1-yukuai3@huawei.com> <20220427124722.48465-2-yukuai3@huawei.com> <20220427125251.yl7ff4ti33w6ktrf@quack3.lan> From: "yukuai (C)" Message-ID: <4c783fa9-f01b-1f9e-9bcb-0e26431d0d24@huawei.com> Date: Thu, 28 Apr 2022 09:08:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20220427125251.yl7ff4ti33w6ktrf@quack3.lan> Content-Type: text/plain; charset="gbk"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600009.china.huawei.com (7.193.23.164) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 ?? 2022/04/27 20:52, Jan Kara ะด??: > On Wed 27-04-22 20:47:20, Yu Kuai wrote: >> Prepare to refactor the counting of 'num_groups_with_pending_reqs'. >> >> Add a counter 'busy_queues' in bfq_group, and update it in >> bfq_add/del_bfqq_busy(). >> >> Signed-off-by: Yu Kuai > > ... > >> diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c >> index f8eb340381cf..53826797430f 100644 >> --- a/block/bfq-wf2q.c >> +++ b/block/bfq-wf2q.c >> @@ -218,6 +218,14 @@ static bool bfq_no_longer_next_in_service(struct bfq_entity *entity) >> return false; >> } >> >> +static void bfq_update_busy_queues(struct bfq_queue *bfqq, bool is_add) >> +{ >> + if (is_add) >> + bfqq_group(bfqq)->busy_queues++; >> + else >> + bfqq_group(bfqq)->busy_queues--; >> +} >> + >> #else /* CONFIG_BFQ_GROUP_IOSCHED */ > > I think the bool argument here unnecessarily hurts readability (it's > difficult to see what the argument means without looking into the > implementation). I'd rather create two functions bfq_{inc,dec}_busy_queues() > or if you really insist on a single function, we can have > bfq_add_busy_queues() and have 'int' argument that will be +1 or -1. Thanks for the suggestion, I'll create two functions in next iteration. > > Honza >