Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2384234rdb; Mon, 11 Sep 2023 23:12:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH+yUSQZ0KAs4MDD9Lc6Hc0V70cK387XDLmnnOpUtdTyU2jE28oH/FOPlLWwDsE0I7y7OaP X-Received: by 2002:a05:6a21:3292:b0:13b:b4bb:8b18 with SMTP id yt18-20020a056a21329200b0013bb4bb8b18mr12810294pzb.1.1694499148857; Mon, 11 Sep 2023 23:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694499148; cv=none; d=google.com; s=arc-20160816; b=0yHS1gpxGlxbiaBWOVzvzbemdKlbu349mQwdKDecEQeF6P9Z8CGhNfcxl0vAsIGcG9 UvtOeczSLIzdLnc+XFZBGhnUdiysONH+Vx8G5YVflBcZzmJB71lZ8/ps6Jm1gGPM4tnm GqOavezJef0rQ+q0UmtH4zoT6mtJze4LDj0Xbb2SXwYIVisunVtqAyPkBX90V07ntcgj ht8kiGV0JFP/Ut0b9+GjN9Va/qWcsX+vzr2JI+8/vaa3npzG6z7hRuoSu7eNSk8esYbB LRStNWXH6/uQE0NpoEP2olJKZaeqBx/uGGQO9+oA5kkx5kFJtFIwemcLA03ZrhqJhIXt dKTQ== 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 :message-id:date:subject:cc:to:from; bh=XVXxQd/6zqFCy3IonIVym14lEBk7s3rUaO7xDKZVRJ0=; fh=0vaYOzzn3Z5SQEjgoqvxffIotvjIeDSv5QGTvx6cK/U=; b=ukWkgvmpcoBgTjvaddfyBMs1QZ78/vOkQrDoMLeN5xubLobDUkLlh4627kwSq7CTKh ZfHEEX+A1Cj9AWZ+/u1HL8r76mMeN1l0lzRPP/hEieaT8cktKzlqYIvBl+S5KojkxmOS sW7Y+DBpsbyDkZEXuGzqjNhuO+2MY9gzoWbp4m4Y/k6ycfMU4vY85KMGUfNuvxdc9qcz Kk9qz3jxVa30Ar3/LhN90z1qKjzKGDsO2mnLSk4s8gRtE8TBGtS40kNFmYYyXLg6Hnqz tT9mVaJwdmuu3kJeGUe+WkWq4sXMSUmj8MExBJNwQPi90ANM1d0tYF/6DrEzBvFhsqNP Rq6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id bu7-20020a056a00410700b0068fe9f23becsi495955pfb.261.2023.09.11.23.12.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 23:12:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A825A801BAA4; Mon, 11 Sep 2023 23:12:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.8 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229704AbjILGMX (ORCPT + 99 others); Tue, 12 Sep 2023 02:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229625AbjILGMV (ORCPT ); Tue, 12 Sep 2023 02:12:21 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E432DE78; Mon, 11 Sep 2023 23:12:17 -0700 (PDT) Received: from kwepemd200002.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RlCn518WPztQSC; Tue, 12 Sep 2023 14:08:09 +0800 (CST) Received: from huawei.com (10.67.174.28) by kwepemd200002.china.huawei.com (7.221.188.186) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1258.23; Tue, 12 Sep 2023 14:12:14 +0800 From: Liao Chang To: , CC: , Subject: [PATCH] cpufreq: conservative: Ensure requested_freq is greater than min frequency Date: Tue, 12 Sep 2023 06:09:57 +0000 Message-ID: <20230912060957.2516790-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.28] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemd200002.china.huawei.com (7.221.188.186) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 11 Sep 2023 23:12:26 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email The governor ensures that the requested frequency is greater than the minimum frequency when the condition for decreasing frequency is satisfied. This is done by either reducing the frequency step from the current frequency if the current frequency is greater than the sum of the frequency step and the minimum frequency, or setting the frequency to the minimum one otherwise. Signed-off-by: Liao Chang --- drivers/cpufreq/cpufreq_conservative.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 56500b25d77c..54e09242b2e2 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -130,7 +130,7 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy) if (requested_freq == policy->min) goto out; - if (requested_freq > freq_step) + if (requested_freq > policy->min + freq_step) requested_freq -= freq_step; else requested_freq = policy->min; -- 2.34.1