From patchwork Tue Sep 12 06:09:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liao Chang X-Patchwork-Id: 722453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D48B8CA0EC9 for ; Tue, 12 Sep 2023 06:12:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229653AbjILGMW (ORCPT ); Tue, 12 Sep 2023 02:12:22 -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 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-pm@vger.kernel.org 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;