Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1116999pxb; Fri, 27 Aug 2021 01:22:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5u61l4Ey7SBQ7sCoS99jXY/j8N5uRV3Zh97hWEYex+N4S6rovQhEfVxIhApaSPubsSXoB X-Received: by 2002:a50:ff03:: with SMTP id a3mr8597607edu.100.1630052530648; Fri, 27 Aug 2021 01:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630052530; cv=none; d=google.com; s=arc-20160816; b=BCkYASZOE2prAgs9EMKveVEmUuLxWLxGWpQJJxzbOKJrLAbBtizsX/2GjwB9WCAet1 CXPe0+ppnju9dodYfhJBb1blUs4RT90+babGv42jrw9DW8JE66MCOpb5EOtf7mbYAbs5 HNmNrN9/5szkIZtkL42HVbUfrvFxxkHn1Jql0F5mNVVgMfpNkjf2gXdAkIv4vBK/2Uju dKPKBxT8HzbBtbdqJPzcYfU1d1a+IrSCIYZsOBBN/XUugtpGpvNvXLQpV2A9dNpxvFbb VDyLldhMvyWaG+302Dkg1+Qfu/d3EDyPRnW3IUw0m60ZUPCq/eM45l5lyr01RoASljFH QV7w== 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:dkim-signature; bh=eaFxkrp8637fDlTGehGI7DBObUsAO7Nljqd1BKOyGTI=; b=CMcUaxi5NTjEmD3pIf0yPipZFwyD2UULRQCHGKr9QEDu/OwAObIN2OXU8dhKoFdlOo nGmpON+pMblecuBH5D3aRi7rnovERNFlR6tzzDiyblNkpET1ZDE36z2axbT4xl6/vIsp Vn0V3zsSIGlTmo47z/LuLArxG9zdFsha/DUAMGpX1VFBXPwJP30pP1AkYwpBe/Ew+6pn 9Wi80Um74IW644Bt3JtWJsx+ddruemKuYOljbWMxgU20NTf+lEjMnQmCF0kpjqQAVhIb p/x/zm/zffAcKvcLwJJXL8HQRHy9+ppfkhQK6xrsOVEaHeqnA8bq3rQTmpYKRDGSlNDU ncKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aqx1grMt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si5865722edd.12.2021.08.27.01.21.45; Fri, 27 Aug 2021 01:22:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aqx1grMt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232758AbhH0ITL (ORCPT + 99 others); Fri, 27 Aug 2021 04:19:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbhH0ITF (ORCPT ); Fri, 27 Aug 2021 04:19:05 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39077C061757; Fri, 27 Aug 2021 01:18:16 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id s15so1352032qta.10; Fri, 27 Aug 2021 01:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eaFxkrp8637fDlTGehGI7DBObUsAO7Nljqd1BKOyGTI=; b=aqx1grMt8XhxjrHajA6bw0uLj4AuxUGSReY1puQ9R0R1RPOYgJsUzZCNeokiDZPMdU aPGfOuiALnhRjQsl3+obyf6gRxsczyvK7QJOs1R/QlX5Gb7ty6TGfNcPBTp+1m0OdxhS StZ24YLSTfbW/J5STgjxmjZvfN3SsUFqH/3ctp30RsP5WVAVm2TW9RqvvSGJSjuzxYiE fZ1c7N+CdbUP1krhwdlvo1a3SwF6fxTzxVgenf+kgGtI3YgTlUOW/peajVasfImBVrSL tn3DFPPqeVXEcSMpzafFeeuQrufcfj0b0JJZV+35MJbjiJuuOPd0sZYWpGe3G7+n4vWP vAnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=eaFxkrp8637fDlTGehGI7DBObUsAO7Nljqd1BKOyGTI=; b=hPyk/4t7gpUkntilQJ9wJRLp+fn7jlWBOl0gmY04DLyG+ZtIZPPYSIcUS9yNQQpqSW I5hI2nHt1fDP3SyuhabPEBcK11XItn97GnIrEU7mPcqL9K8bA8SEe8HYBcX8M8Dq+4Dx 47O+60ka2ylPHIVWWaxhrGb9wa6wbG5QtVKw7dQ6hWKHgaJm/l1xpXxTNNzpIQBB4obU FG+4rPCkXzroqK1X8ffmCaNOxU2RzpcFDaQ+TvDuxNQa4fK8C2QRKUdR6qUjJk3TIWiW 8Bx1GUruZ61DqtbTU/9qNLWcRRQ42txY1QfEljbr9Xef/sfdpN4gHbRweq58HgLqKnMI UEwA== X-Gm-Message-State: AOAM5327BM4/lFLlY9UOvCJ8w6yj4vByENHiK/TRAWZhg4+4Z5m2n91i FwBLfWUvzX+ysj7GW6miTSM= X-Received: by 2002:a05:622a:102:: with SMTP id u2mr7349253qtw.149.1630052295383; Fri, 27 Aug 2021 01:18:15 -0700 (PDT) Received: from localhost (ec2-3-142-145-253.us-east-2.compute.amazonaws.com. [3.142.145.253]) by smtp.gmail.com with UTF8SMTPSA id g1sm4318360qkd.89.2021.08.27.01.18.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Aug 2021 01:18:15 -0700 (PDT) From: schspa To: rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, schspa Subject: [PATCH] cpufreq_ondemand: fix bad auto calculated frequency. Date: Fri, 27 Aug 2021 16:17:53 +0800 Message-Id: <20210827081752.54337-1-schspa@gmail.com> X-Mailer: git-send-email 2.29.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We can litmit cpufreq range by change min & max from cpufreq_policy. So cpu frequency target should be in range [policy->min, policy->max]. Signed-off-by: schspa --- drivers/cpufreq/cpufreq_ondemand.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index ac361a8b1d3b..8afb2c84c38c 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c @@ -151,8 +151,8 @@ static void od_update(struct cpufreq_policy *policy) /* Calculate the next frequency proportional to load */ unsigned int freq_next, min_f, max_f; - min_f = policy->cpuinfo.min_freq; - max_f = policy->cpuinfo.max_freq; + min_f = policy->min; + max_f = policy->max; freq_next = min_f + load * (max_f - min_f) / 100; /* No longer fully busy, reset rate_mult */ -- 2.29.0