Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3419199ioa; Tue, 26 Apr 2022 03:23:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkMi2T6uAYU7OaVL7sYVoU9vSV0h+njRJpITl/LABl8CrWTUSVkJNLRjQIA563+Ovdp6P7 X-Received: by 2002:a17:907:6e05:b0:6f2:48a0:7148 with SMTP id sd5-20020a1709076e0500b006f248a07148mr19011855ejc.34.1650968602908; Tue, 26 Apr 2022 03:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650968602; cv=none; d=google.com; s=arc-20160816; b=ri3VNWTEBXOs03GKyA4pFvmuyjrPZ9Qw6p/hk76W0VxkLpT0IJSOp3+YHo7qEHn1AS MK+lGfIzUQCjG04t8CutMm9ak2B3s0Uug174AIMREIqgvarKRL19xi3WhKLYUbbFvRos Y/JMiI1cnFEXOM65KICgruimJVXVtx9vrYGSBhjkesK4soMX0BK42geh4wSWsTD1LgiC NGZiMSXSU5/AWCZU8VJqerg8diK0Xh9o7cEA3Wt5scYwF4r8ToKg+ewxtIkVyQfBNDmN a3lnOYYT0GBxL37Qz9U9iGEXSdXgss2UprBveCuK3kCm07x/Q8mXJMuit38lqbP8Vqa+ Khuw== 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=aQeN6fJsutF19csMgy4/yXuPyDCcM1H4fWBl2ZqwbTo=; b=yqH9bH7+ROZUubESckOf2Y19kqsUYpXGbu4lsolAyFn8qgiMBs2pvcNVsXIfrmCmPE Alhq4qTn1V/UPu9j6zz1+cDt+0IBDanAizrpCIlyso8ydFpMPPnqzYvLP3TzXQ0cp3AF nAGBd8HRY1gq8/c50FMLt6GfRkvrYBmtiKuY3QXdM3Spz+nS2LvvX12cqHvNnvLwswC0 qLbsyGeXfNjA6P8nvnVzNu4QPNjJUioUQfRdJTTstomwb+lvld93/38m1eSD5ej5kJse oSuHIsTuQFZoUO8h4jH6ZX4ayYVjBNxJVO5BDjGl6i0yH46n97PT9flxdhhcJTZcq+ra 28SQ== 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 m19-20020a056402511300b00418c2b5bdedsi17058692edd.207.2022.04.26.03.22.59; Tue, 26 Apr 2022 03:23:22 -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 S241452AbiDZBwT (ORCPT + 99 others); Mon, 25 Apr 2022 21:52:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241577AbiDZBwQ (ORCPT ); Mon, 25 Apr 2022 21:52:16 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDB09124DAA; Mon, 25 Apr 2022 18:49:07 -0700 (PDT) Received: from kwepemi100023.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KnPqp26QDzGpS3; Tue, 26 Apr 2022 09:46:30 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by kwepemi100023.china.huawei.com (7.221.188.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 26 Apr 2022 09:49:05 +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; Tue, 26 Apr 2022 09:49:05 +0800 Subject: Re: [PATCH -next v2 2/5] block, bfq: add fake weight_counter for weight-raised queue To: Jan Kara CC: , , , , , , References: <20220416093753.3054696-1-yukuai3@huawei.com> <20220416093753.3054696-3-yukuai3@huawei.com> <20220425094856.qgkhba2klguduxot@quack3.lan> <20220425161650.xzyijgkb5yzviea3@quack3.lan> From: "yukuai (C)" Message-ID: <4591d02d-1f14-c928-1c50-6e434dfbb7b2@huawei.com> Date: Tue, 26 Apr 2022 09:49:04 +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: <20220425161650.xzyijgkb5yzviea3@quack3.lan> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.176.73] 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=-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/26 0:16, Jan Kara 写道: > Hello! > > On Mon 25-04-22 21:34:16, yukuai (C) wrote: >> 在 2022/04/25 17:48, Jan Kara 写道: >>> On Sat 16-04-22 17:37:50, Yu Kuai wrote: >>>> Weight-raised queue is not inserted to weights_tree, which makes it >>>> impossible to track how many queues have pending requests through >>>> weights_tree insertion and removel. This patch add fake weight_counter >>>> for weight-raised queue to do that. >>>> >>>> Signed-off-by: Yu Kuai >>> >>> This is a bit hacky. I was looking into a better place where to hook to >>> count entities in a bfq_group with requests and I think bfq_add_bfqq_busy() >>> and bfq_del_bfqq_busy() are ideal for this. It also makes better sense >>> conceptually than hooking into weights tree handling. >> >> bfq_del_bfqq_busy() will be called when all the reqs in the bfqq are >> dispatched, however there might still some reqs are't completed yet. >> >> Here what we want to track is how many bfqqs have pending reqs, >> specifically if the bfqq have reqs are't complted. >> >> Thus I think bfq_del_bfqq_busy() is not the right place to do that. > > Yes, I'm aware there will be a difference. But note that bfqq can stay busy > with only dispatched requests because the logic in __bfq_bfqq_expire() will > not call bfq_del_bfqq_busy() if idling is needed for service guarantees. So > I think using bfq_add/del_bfqq_busy() would work OK. Hi, I didn't think of that before. If bfqq stay busy after dispathing all the requests, there are two other places that bfqq can clear busy: 1) bfq_remove_request(), bfqq has to insert a new req while it's not in service. 2) bfq_release_process_ref(), user thread is gone / moved, or old bfqq is gone due to merge / ioprio change. I wonder, will bfq_del_bfqq_busy() be called immediately when requests are completed? (It seems not to me...). For example, a user thread issue a sync io just once, and it keep running without issuing new io, then when does the bfqq clears the busy state? Thanks, Kuai > > Honza >