Received: by 2002:a05:6512:3a82:0:0:0:0 with SMTP id q2csp558380lfu; Mon, 25 Apr 2022 04:38:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJxQhUZmmz1ExNwBnLGLV6c3fARi5O7X8RgWgowQb+yPC0Pj9gZ97+GMKB5wJJne9P8rNw X-Received: by 2002:a17:902:7045:b0:157:144:57c5 with SMTP id h5-20020a170902704500b00157014457c5mr17626597plt.86.1650886719557; Mon, 25 Apr 2022 04:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650886719; cv=none; d=google.com; s=arc-20160816; b=XMjVJvQoqdWP+gTomVHSh9BaH4js72T00MBCKtXoouGA5ogmWVM+TgB2fkv35+iMZV 0HT/DkQoHaH54LXhVklDL0YoyPYc2mNEHqxWpIBylv4ciAfFJ8NsnLy6d8MDLjgciDnl +ExKcNXRrrAGqVzrxTmVhAUma/iVh8jrvZDY+QdNbC8hS2X3nQbyZWPjTGlzEGqS+cr0 fTEtUg8fTOXO1Hc4LyVa9vx+IBfwC5hPUPEjB0ceSwuYYLl/BYr1A3vS5xCDUNXKuhkl hXMTABP23xPW8En9x22OXY8yJZ8LHPOX94BCsu4lIvNI4Ew3QHMg39hwE1BAK/rJ0GIn vZiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=XKzPZSZjl/CuIwENsnn/SueNKmgq+oSUkjLiGdxjrMA=; b=kEVM3cQteUqTDgrfxyss7Unb4jfvtGnDqVj5NnOi736JztGtkULHlm/St3QMzi0kx2 MiH1zPXcse5Pp9jEddOn0bfmhjPJ8K+JiQp1OSvB5CpI3hlSx53gAMgoGC3PdwYeX+5+ jrCIsfVx3jh2uTzVW4xOnQT8LpwyLP6sye3HHuSlWZRaaD0KTInAE6Ho6uWeFy82G+15 GE+yyjKDU//TFljcAeB6LdklXECLye0pUD9SEY1eM3WeI5RVztYB+pACUmKjrUeew+jn jdOR6CHPDdDjxvDXedyQSQhMTvFI8HFBtoHkB4PhSE+RiXLKp7U8kadIgmARifnx99oa QAKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=RjxNMVpI; dkim=neutral (no key) header.i=@suse.cz; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w21-20020a1709027b9500b00158d6dbbfc2si14216103pll.145.2022.04.25.04.38.24; Mon, 25 Apr 2022 04:38:39 -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; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=RjxNMVpI; dkim=neutral (no key) header.i=@suse.cz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240629AbiDYJmD (ORCPT + 99 others); Mon, 25 Apr 2022 05:42:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240617AbiDYJlY (ORCPT ); Mon, 25 Apr 2022 05:41:24 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0BD017051; Mon, 25 Apr 2022 02:37:20 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id BCF1D210E5; Mon, 25 Apr 2022 09:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1650879438; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XKzPZSZjl/CuIwENsnn/SueNKmgq+oSUkjLiGdxjrMA=; b=RjxNMVpIYiZeOVcck2OTzhAgsn/etT3h6srkKhwtsjKo6HtUVxvjbuDwIT/0mg/Ua7fJhw pwGeeIon9y/cWp9fs9hZEVH0l18cIBdAxdS8K9797rxvkDQQ2isqTAxrS2x0hpNK/UFOUP RGgmMyPduVR6UIsFmKaxYgqsTkQgI9g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1650879438; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XKzPZSZjl/CuIwENsnn/SueNKmgq+oSUkjLiGdxjrMA=; b=BhZGwetAzIrrfnZsS/+C5b2Y8bNuVhmDcP2dSQuLjyce8OsHoOrcFx6hWf9hmrOcKEF5Is bxCyxSbQic/PapAA== Received: from quack3.suse.cz (unknown [10.100.224.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 9AC792C142; Mon, 25 Apr 2022 09:37:18 +0000 (UTC) Received: by quack3.suse.cz (Postfix, from userid 1000) id 35574A0620; Mon, 25 Apr 2022 11:37:15 +0200 (CEST) Date: Mon, 25 Apr 2022 11:37:15 +0200 From: Jan Kara To: Yu Kuai Cc: jack@suse.cz, paolo.valente@linaro.org, axboe@kernel.dk, tj@kernel.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com Subject: Re: [PATCH -next v2 1/5] block, bfq: cleanup bfq_weights_tree add/remove apis Message-ID: <20220425093715.5ufwrgqrtyoqzjp3@quack3.lan> References: <20220416093753.3054696-1-yukuai3@huawei.com> <20220416093753.3054696-2-yukuai3@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220416093753.3054696-2-yukuai3@huawei.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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 On Sat 16-04-22 17:37:49, Yu Kuai wrote: > They already pass 'bfqd' as the first parameter, there is no need to > pass 'bfqd->queue_weights_tree' as another parameter. > > Signed-off-by: Yu Kuai Nice cleanup. Feel free to add: Reviewed-by: Jan Kara Honza > --- > block/bfq-iosched.c | 14 +++++++------- > block/bfq-iosched.h | 7 ++----- > block/bfq-wf2q.c | 16 +++++----------- > 3 files changed, 14 insertions(+), 23 deletions(-) > > diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c > index 2e0dd68a3cbe..2deea2d07a1f 100644 > --- a/block/bfq-iosched.c > +++ b/block/bfq-iosched.c > @@ -862,9 +862,9 @@ static bool bfq_asymmetric_scenario(struct bfq_data *bfqd, > * In most scenarios, the rate at which nodes are created/destroyed > * should be low too. > */ > -void bfq_weights_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq, > - struct rb_root_cached *root) > +void bfq_weights_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq) > { > + struct rb_root_cached *root = &bfqd->queue_weights_tree; > struct bfq_entity *entity = &bfqq->entity; > struct rb_node **new = &(root->rb_root.rb_node), *parent = NULL; > bool leftmost = true; > @@ -936,13 +936,14 @@ void bfq_weights_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq, > * See the comments to the function bfq_weights_tree_add() for considerations > * about overhead. > */ > -void __bfq_weights_tree_remove(struct bfq_data *bfqd, > - struct bfq_queue *bfqq, > - struct rb_root_cached *root) > +void __bfq_weights_tree_remove(struct bfq_data *bfqd, struct bfq_queue *bfqq) > { > + struct rb_root_cached *root; > + > if (!bfqq->weight_counter) > return; > > + root = &bfqd->queue_weights_tree; > bfqq->weight_counter->num_active--; > if (bfqq->weight_counter->num_active > 0) > goto reset_entity_pointer; > @@ -1004,8 +1005,7 @@ void bfq_weights_tree_remove(struct bfq_data *bfqd, > * has no dispatched request. DO NOT use bfqq after the next > * function invocation. > */ > - __bfq_weights_tree_remove(bfqd, bfqq, > - &bfqd->queue_weights_tree); > + __bfq_weights_tree_remove(bfqd, bfqq); > } > > /* > diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h > index 3b83e3d1c2e5..072099b0c11a 100644 > --- a/block/bfq-iosched.h > +++ b/block/bfq-iosched.h > @@ -969,11 +969,8 @@ struct bfq_queue *bic_to_bfqq(struct bfq_io_cq *bic, bool is_sync); > void bic_set_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq, bool is_sync); > struct bfq_data *bic_to_bfqd(struct bfq_io_cq *bic); > void bfq_pos_tree_add_move(struct bfq_data *bfqd, struct bfq_queue *bfqq); > -void bfq_weights_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq, > - struct rb_root_cached *root); > -void __bfq_weights_tree_remove(struct bfq_data *bfqd, > - struct bfq_queue *bfqq, > - struct rb_root_cached *root); > +void bfq_weights_tree_add(struct bfq_data *bfqd, struct bfq_queue *bfqq); > +void __bfq_weights_tree_remove(struct bfq_data *bfqd, struct bfq_queue *bfqq); > void bfq_weights_tree_remove(struct bfq_data *bfqd, > struct bfq_queue *bfqq); > void bfq_bfqq_expire(struct bfq_data *bfqd, struct bfq_queue *bfqq, > diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c > index f8eb340381cf..a1296058c1ec 100644 > --- a/block/bfq-wf2q.c > +++ b/block/bfq-wf2q.c > @@ -707,7 +707,6 @@ __bfq_entity_update_weight_prio(struct bfq_service_tree *old_st, > struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); > unsigned int prev_weight, new_weight; > struct bfq_data *bfqd = NULL; > - struct rb_root_cached *root; > #ifdef CONFIG_BFQ_GROUP_IOSCHED > struct bfq_sched_data *sd; > struct bfq_group *bfqg; > @@ -770,19 +769,15 @@ __bfq_entity_update_weight_prio(struct bfq_service_tree *old_st, > * queue, remove the entity from its old weight counter (if > * there is a counter associated with the entity). > */ > - if (prev_weight != new_weight && bfqq) { > - root = &bfqd->queue_weights_tree; > - __bfq_weights_tree_remove(bfqd, bfqq, root); > - } > + if (prev_weight != new_weight && bfqq) > + __bfq_weights_tree_remove(bfqd, bfqq); > entity->weight = new_weight; > /* > * Add the entity, if it is not a weight-raised queue, > * to the counter associated with its new weight. > */ > - if (prev_weight != new_weight && bfqq && bfqq->wr_coeff == 1) { > - /* If we get here, root has been initialized. */ > - bfq_weights_tree_add(bfqd, bfqq, root); > - } > + if (prev_weight != new_weight && bfqq && bfqq->wr_coeff == 1) > + bfq_weights_tree_add(bfqd, bfqq); > > new_st->wsum += entity->weight; > > @@ -1686,8 +1681,7 @@ void bfq_add_bfqq_busy(struct bfq_data *bfqd, struct bfq_queue *bfqq) > > if (!bfqq->dispatched) > if (bfqq->wr_coeff == 1) > - bfq_weights_tree_add(bfqd, bfqq, > - &bfqd->queue_weights_tree); > + bfq_weights_tree_add(bfqd, bfqq); > > if (bfqq->wr_coeff > 1) > bfqd->wr_busy_queues++; > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR