Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10048116rwr; Fri, 12 May 2023 03:06:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6VF0RZ/xJjaAs94BL5oREZsTHEVYvw+i7/A6BE4J7BaseI5ZltBGHH/bKPu5XhHx5zjCMm X-Received: by 2002:a05:6a00:2396:b0:646:6c71:ee13 with SMTP id f22-20020a056a00239600b006466c71ee13mr20678293pfc.24.1683885963106; Fri, 12 May 2023 03:06:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683885963; cv=none; d=google.com; s=arc-20160816; b=rJoBf1nDeUsefBOxiDHu5YxfAOWi3ezdM5h8MZq8UuA7mKOWZECJSf82/KIMdklnL9 Ny7PSFRmNI/LlJ6Q2TxAZgzUTppJYLQoii+VN4hWNtxe2oFUs9IrvN4KVUm/yKRLCuZD ayJvE6JGNVWa6YJqeF8u9G+C2CCNQvcQE0A7/Acn4TaQ4zCm1aoCNvTYKVWsC63VHILl eVLAz/XCekvHgJtLtk8TrkX498rg1NQ14Vq3pXlVn2XZPingfj+pybAgjRrWNS0x4ZbA kM+mD94LYh19iyYXUDN/0sieqlWB73lLgWCPel9ajNBopDKv0JiZyEdeax86fr+MSu8g jsPA== 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:from :content-language:references:cc:to:subject:mime-version:date :dkim-signature:message-id; bh=n0JL1nhvy2ngw84v1yQfJqMPUYFftdCNHh/mrNVJuFQ=; b=M/LeFfeqThgcLgoFelTDiGXhShhyxWyBabgkOzN2B9fYszk4nVs+4OhwKB0Y1JnQ/N CGcOrcSUThrSoQUE+q5SGA+smR2NGvVlUQnVOICbq6fz4MzUOotup1oNCggttF45/sIB +iD+4jG/QORrC+raS9gM6v2pBY3BZZu7mQQI8jhmn8xP6pW6enttKnfom3EpvxpcFcij 4CQANQevjA/4wHageF6TRZEBzmd3mahpCdUqAyk6FWzPwjJl1dyYsIic54wB0vR5cl6S 3etutYlidl+zdUN3xw4v4vSLgz9M/moTD40+d53msYG1lQ2CheRaF7uWA4j4eNeOq0Uu 89Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=VDZwyA0Y; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w190-20020a6230c7000000b006439d34a090si9529004pfw.238.2023.05.12.03.05.49; Fri, 12 May 2023 03:06: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; dkim=pass header.i=@linux.dev header.s=key1 header.b=VDZwyA0Y; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240733AbjELKBf (ORCPT + 99 others); Fri, 12 May 2023 06:01:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240627AbjELKA5 (ORCPT ); Fri, 12 May 2023 06:00:57 -0400 Received: from out-16.mta1.migadu.com (out-16.mta1.migadu.com [IPv6:2001:41d0:203:375::10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9446E11DBA for ; Fri, 12 May 2023 03:00:14 -0700 (PDT) Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683885592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n0JL1nhvy2ngw84v1yQfJqMPUYFftdCNHh/mrNVJuFQ=; b=VDZwyA0YGJ/KFhQoo2GxCv9LWe6GedDa244Vnxy7pKf6QEG79Gt2/sr6tAxJrwxzZcNPWs QDt/mNnzz+oKFvV7NGkJ8SX0kjUYCzDYmspt8qaTPfv9nvEcUrNeuOJh2kbyKy7tt7dS3n RzyAvowXz/3bqX6dDj5/n2CPMr2Kpc4= Date: Fri, 12 May 2023 17:59:43 +0800 MIME-Version: 1.0 Subject: Re: [PATCH -next v2 1/6] blk-wbt: fix that wbt can't be disabled by default To: Yu Kuai Cc: hch@lst.de, tj@kernel.org, josef@toxicpanda.com, axboe@kernel.dk, yukuai3@huawei.com, lukas.bulwahn@gmail.com, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com References: <20230512093554.911753-1-yukuai1@huaweicloud.com> <20230512093554.911753-2-yukuai1@huaweicloud.com> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20230512093554.911753-2-yukuai1@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 2023/5/12 17:35, Yu Kuai wrote: > From: Yu Kuai > > commit b11d31ae01e6 ("blk-wbt: remove unnecessary check in > wbt_enable_default()") removes the checking of CONFIG_BLK_WBT_MQ by > mistake, which is used to control enable or disable wbt by default. > > Fix the problem by adding back the checking. This patch also do a litter > cleanup to make related code more readable. > > Fixes: b11d31ae01e6 ("blk-wbt: remove unnecessary check in wbt_enable_default()") > Reported-by: Lukas Bulwahn > Link: https://lore.kernel.org/lkml/CAKXUXMzfKq_J9nKHGyr5P5rvUETY4B-fxoQD4sO+NYjFOfVtZA@mail.gmail.com/t/ > Signed-off-by: Yu Kuai > --- > block/blk-wbt.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/block/blk-wbt.c b/block/blk-wbt.c > index e49a48684532..9ec2a2f1eda3 100644 > --- a/block/blk-wbt.c > +++ b/block/blk-wbt.c > @@ -730,14 +730,16 @@ void wbt_enable_default(struct gendisk *disk) > { > struct request_queue *q = disk->queue; > struct rq_qos *rqos; > - bool disable_flag = q->elevator && > - test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags); > + bool enable = IS_ENABLED(CONFIG_BLK_WBT_MQ); > + > + if (q->elevator && > + test_bit(ELEVATOR_FLAG_DISABLE_WBT, &q->elevator->flags)) > + enable = false; Why not just early return, so "enable" is not needed at all? I have another question that CONFIG_BLK_WBT_MQ is not much flexible, can we just get rid of it? (I'm not sure when to disable it in the config) Thanks. > > /* Throttling already enabled? */ > rqos = wbt_rq_qos(q); > if (rqos) { > - if (!disable_flag && > - RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT) > + if (enable && RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT) > RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT; > return; > } > @@ -746,7 +748,7 @@ void wbt_enable_default(struct gendisk *disk) > if (!blk_queue_registered(q)) > return; > > - if (queue_is_mq(q) && !disable_flag) > + if (queue_is_mq(q) && enable) > wbt_init(disk); > } > EXPORT_SYMBOL_GPL(wbt_enable_default);