From nobody Sun May 24 20:33:07 2026 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B6E1255F2C for ; Fri, 22 May 2026 04:19:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779423565; cv=none; b=MnS/njIAdHXIPX4ck0t1Gdp0xu5MQd3voZj3rqknui16zsiNz+tz/IPiwnNYmSOz7ft0lUScNfcbRD3qEN1BQSYuXMAJv2d7sU87r+HTvVR8PKVQa7rNB5XwYBtrTfhH/zV3b+OeHwmCelGT5KYg+twrUbyxGk6zqrZg0IgK4Sg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779423565; c=relaxed/simple; bh=X+OMHpg8btcTwn/3SgI5X5ZbFvp8zQhW9sq8l8+v24Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qXG5XP++EDNSlacFaQrK+viI4Q8vBS0gn79ZBDispxBm9lbxOYrsW7NqxBI4QzHeDg7s9yKK1RDqGu5jjCC86zF2siGCb6R/f5mIrVhyp1mdaViazxsx64K+aX248rN2HlRzPG8R0X+ZQ9h1o87NrRekpaIswXNMwLz3Wc+Bhdk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wK/O1b6q; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wK/O1b6q" Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-82fa8d6425bso3156838b3a.0 for ; Thu, 21 May 2026 21:19:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1779423563; x=1780028363; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hvPRe9hOtVwaxWBgyXeepmou3/2lXZNBTxSJL7S6tjw=; b=wK/O1b6qBZ8jp5stpUMj30osEDwiGg6wmYJA3H3ddwM5870/QeQyyzbfCMOKc06iK6 oTdQXoAsWDjIOulgzan/l7f+iGxrlASWL3PDCv39oeYlVsGtoumTcsHRzgKQsyG7SPK8 K1JyZgsUPAWGPcJ7qSd0boSAz6nP/aPJ+GTvRnpD69UPQV3AxdlZyvc0asFrI7PEu//I g5gQK/pd+VJjxE9elDfXEiR4Cz66uTW0VXyjKvVvxZsZMmh66u2DNGewDTWQN841jUkI 1oA7JQUpYqGpRQY8QaZIW11g/fXaFZTff4dJtCLvCYBpHweuk4yIz5cOqMXzG7rw8UZ5 EZMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779423563; x=1780028363; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=hvPRe9hOtVwaxWBgyXeepmou3/2lXZNBTxSJL7S6tjw=; b=bKkC2HhtJCCfL23Yby7+Q44QxNUmnZbm3xaW89VBdqJIJl8Usl6UmY6bBK/2nkIp3t dVEArvsPSSqOrRSRFQxPQivq3anfGETG/6cXlNg9a4V53RJGDYPnWsaAmF8C9Okmzn/A R2EGUx6Qcn/EmBDhEow+7kKQBtgCtk75oqzi5/1CYpwVJazOB96t81aaGe9Ik1uHmsW8 sovWVSCMzTamDKZcy91LzzvnD6De5/gEkuOGJZ1NEhvjEdgFdlFl3Jpux4C6ZYnK1Mvd U+njmeWei5B8VO1mxEc+J6jsPLSjGerMiKSu2RCIiUb5fjqAicSyjT6uPCqfyAwz1ZOp KJQQ== X-Forwarded-Encrypted: i=1; AFNElJ9fvV/So97N4I3RSFt9BJtyZu9qQxwZhJ8OzqvBHibVoLyAl1AtxkCmWZC4yuPLMQmJqubXnj4pRKSTkss=@vger.kernel.org X-Gm-Message-State: AOJu0Yz73ZSpv8cJGOB355qgfDLG4clUlJZQo2VyRUpFwxI1tGLXHVhp e4j6xWUB0dx35HmsR0eaRdGnrihDQsyYwxJg8F3j6Z8Q/9wEOb1a/DGycEwy4kDMLRE= X-Gm-Gg: Acq92OEWl3Eo/L+PeY2MKEv/bnKEDuu26uZFnK6WALOMEeKZGlH8D1yexm+bZIO7HMW 8Zo3VGniOdqzNbAYCV6y5yDzD1ib0RNPGzKWn5pa6qfJ4j0Hw27ku5qtct9prxGKaUCvrOvMM9z UGr3rO3Jj03o0HYWe9TMLfk/U8l4ZsT/vDcis/Jme9SbZhAFpLoq0s5Rihl9CU7kp+yKIMdz7uW pY0fpNAI52KhO0Gt98Wdb+O8kU2E6E3qb1WZwvUvxbgPAz84RTdukDp9fM9y6TNx8Jajgujl6R4 6N9yfYYrLWBblfVbkkrbeNpHedYV44pogx9JqEWqzOFJ1/BJinTRH1imRpDtaaivwmJZRuT/fVd y+DNuCNcN8Yi8Y+LWRgB8bd7nlGyfYUXdVL2NEsBhWYPcoTvvPAjE3zLS0+WhOxcO8m0BQikr1p QrqS9RgGft4GKIo1+wruTvqF0= X-Received: by 2002:a05:6a00:1c8a:b0:834:e092:2631 with SMTP id d2e1a72fcca58-8415f2ddc83mr2132366b3a.8.1779423563208; Thu, 21 May 2026 21:19:23 -0700 (PDT) Received: from localhost ([122.172.82.94]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84165009761sm503948b3a.60.2026.05.21.21.19.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 21:19:22 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Sumit Semwal , Lifeng Zheng , Zhongqiu Han , linux-kernel@vger.kernel.org Subject: [PATCH V2 1/3] cpufreq: Fix typo in comment Date: Fri, 22 May 2026 09:49:08 +0530 Message-Id: <396f64411431ffbb5b4f07d1f2e0bbf9763d468f.1779423281.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Replace "diver" with "driver" in the comment describing CPUFREQ_NEED_UPDATE_LIMITS. Signed-off-by: Viresh Kumar Reviewed-by: Zhongqiu Han Reviewed-by: Lifeng Zheng --- include/linux/cpufreq.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 2ab691828e48..4d4b4ed24b30 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -434,7 +434,7 @@ struct cpufreq_driver { /* * Set by drivers that need to update internal upper and lower boundaries = along * with the target frequency and so the core and governors should also inv= oke - * the diver if the target frequency does not change, but the policy min o= r max + * the driver if the target frequency does not change, but the policy min = or max * may have changed. */ #define CPUFREQ_NEED_UPDATE_LIMITS BIT(0) --=20 2.31.1.272.g89b43f80a514 From nobody Sun May 24 20:33:07 2026 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 646BE1DA60D for ; Fri, 22 May 2026 04:19:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779423572; cv=none; b=PyfLCuNXESeq9tEIGXlXBHk4oF+ZfxVWAse8mXIHfo8xvYyOBlYouIGFWq8Q7i2eWKZCr9yT8czzGCcWtbSL2A2tVjw2IWMGs/p69uUTUV85CoFxF+dzVNw0qh5g8lVqBc1TXDrB5fLxI5DqPJ7XinbJ7OW0eEFDE1vH5ycPw+Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779423572; c=relaxed/simple; bh=18MmaV5xr2ThwoQ2TPzXDnYl8fpUMUsNy/8B7Nk7jqc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VkWb/cndSUA+Ixb5BH1hVhLmAqxPNm2S42z07yYSMitBZqZwKcKUXzmGR6O2zVApdBrlPf2HxV91N0rVgCY4J5WCwjLIpMhvJexGYhxITO/5G9I+YrtzOlbWuPPFNioctGvL+0JiY18bIudmKAmdpL85nvZymK4cv+slfFfLPTM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=y5tfumFG; arc=none smtp.client-ip=209.85.210.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="y5tfumFG" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-83ec36a13e9so3342835b3a.0 for ; Thu, 21 May 2026 21:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1779423568; x=1780028368; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MlnszKvaLYniJylzFLq6RdE/rVHviJLfN/ZjcktsGLA=; b=y5tfumFGLhHlkvcAnKurVV10IR6yUIUVvdkji615TSwLn3f0VxrHKGqATySVV/5P59 8BVDGlB70y75U40HICCfYOkVmmDCDHE3yT6JnQz/M33JvdQhVOwMmhWmPmgjyATJT3Rl E4o3jqfPFF7stSo26uZ8mYJY6iyQGTVWnI9N49cfY7k+FbERYiRrPhK1xx4QAo6IQxNd Ju6CyY4ELSdCK/8/NQYullQeA/Ady0a6lzTp0pdu6W7jjYfMMZaAlnAX/y1Zlm3wZvgb nTt4dFhxq3nlGWW5T+gDuNRJxyxZCTgFG0IC09fdBA6kDIK+dFw6i4HHAAB1mFbqxExh ogeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779423568; x=1780028368; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MlnszKvaLYniJylzFLq6RdE/rVHviJLfN/ZjcktsGLA=; b=A9kMOYBO5/dr254CoTMszjHBEx42l8RgxzxMgjtgmwujRKFEPZbpN5cAYJYlbYMQfa DrlgJDmYjiKidxrc2ULvmn842zYaAj2nWHC/r4KFs4r5gOYzMglzHUN45LKILpfE7Z+D 4Iym0JGiFqsmdmQrQ3fBWWyV3J9prFFLf5I2hKnAgz9PoyGNCiqEI2WESW4ohcNwg64G TqjEy7sLXFa3MITQYkaPs7/Kz86N0aaz/vR24Ayx2EdZmhILfrahn/ZJZ3UJm/hxKi5e XG7oRXgfVvIiJWu0Vymw1+wnEeiLAIcVAtJkEY50VGpql2YEmSEf8OtdtRE6brdgRTxZ JgCg== X-Forwarded-Encrypted: i=1; AFNElJ+fLQzgIq6swt13QNH/feirxvsJHRxiRVlKoK6xOllU1li5IxaOFd673Flbiodz0HuuIX9imIb1cgXMpBw=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1BQjCGFq4micfpczod5Gf4aleUo8CKLzEt0b61unXIxfmuaEy 2HScqdPW+vpI+F8ybGR7XFjQJRTOQr3hHRZxCqwjrILd1g9V2DV6wtN4SpEHCak7/S4= X-Gm-Gg: Acq92OE0IPo6P7IW7PE2OEa60KXHeMIAVWrBCBbwltFy1yXXvT3odTCQvvOi5tacx68 nffZmJeG8vxZO/SLNFcBXEIaf7yT26PVu/VFVESLUYPrCJQs/KWAE8smXKC93GvOWU2AVLpgZzK nztZ6Lbrw/OHy/X/vPGJAcVcIfn8wfvRW35/asYGvgqiLEn3H3fHpFQs/fUr/evGlKFIjvYenvQ p6SUxS7h4nGQKkizsFVOWuPSWaaTW0sJdloZstcdqCOPcTb8ghlvhtXEmF8luzHtaqGTv5eDM21 qnd8/wRHdarq3Fe5rrLUYQTzGuCjUEqVEgA2a3fF+HiZHCjBzs9PLw5y7E6GiMeAzM/6RIcyDDd UF58B7SHaND5wcUjdM6pHb2hUyKM8nS0R/geKTsBSf28OwdFyabaBSQQJL0USRGifw4ukDwD2wB g+hdPRqQUEz6Bjiqqv4fDuntQ= X-Received: by 2002:a05:6a00:2e17:b0:82f:abc8:ae0 with SMTP id d2e1a72fcca58-8415f332af0mr1909886b3a.17.1779423568066; Thu, 21 May 2026 21:19:28 -0700 (PDT) Received: from localhost ([122.172.82.94]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84164ad2ca6sm467296b3a.5.2026.05.21.21.19.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 21:19:26 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Sumit Semwal , Lifeng Zheng , linux-kernel@vger.kernel.org Subject: [PATCH V3 2/3] cpufreq: Avoid redundant target() calls for unchanged limits Date: Fri, 22 May 2026 09:49:09 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Drivers setting CPUFREQ_NEED_UPDATE_LIMITS expect target() to be invoked even if the target frequency remains unchanged, so they can update their internal policy limits state. Currently the core invokes target() unconditionally whenever the requested frequency matches policy->cur for such drivers, even if policy->min and policy->max haven't changed since the previous update. Track pending policy limit updates explicitly and skip redundant target() invocations when neither the target frequency nor the effective limits changed. Signed-off-by: Viresh Kumar Reviewed-by: Lifeng Zheng Reviewed-by: Zhongqiu Han --- drivers/cpufreq/cpufreq.c | 31 ++++++++++++++++++++++--------- include/linux/cpufreq.h | 3 +++ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 44eb1b7e7fc1..225228e9f4ed 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2366,9 +2366,13 @@ int __cpufreq_driver_target(struct cpufreq_policy *p= olicy, * exactly same freq is called again and so we can save on few function * calls. */ - if (target_freq =3D=3D policy->cur && - !(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS)) - return 0; + if (target_freq =3D=3D policy->cur) { + if (!(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS) || + !policy->update_limits) + return 0; + + policy->update_limits =3D false; + } =20 if (cpufreq_driver->target) { /* @@ -2620,6 +2624,7 @@ static int cpufreq_set_policy(struct cpufreq_policy *= policy, { struct cpufreq_policy_data new_data; struct cpufreq_governor *old_gov; + unsigned int freq; int ret; =20 memcpy(&new_data.cpuinfo, &policy->cpuinfo, sizeof(policy->cpuinfo)); @@ -2652,12 +2657,20 @@ static int cpufreq_set_policy(struct cpufreq_policy= *policy, * compiler optimizations around them because they may be accessed * concurrently by cpufreq_driver_resolve_freq() during the update. */ - WRITE_ONCE(policy->max, __resolve_freq(policy, new_data.max, - new_data.min, new_data.max, - CPUFREQ_RELATION_H)); - new_data.min =3D __resolve_freq(policy, new_data.min, new_data.min, - new_data.max, CPUFREQ_RELATION_L); - WRITE_ONCE(policy->min, new_data.min > policy->max ? policy->max : new_da= ta.min); + freq =3D __resolve_freq(policy, new_data.max, new_data.min, new_data.max, + CPUFREQ_RELATION_H); + if (freq !=3D policy->max) { + WRITE_ONCE(policy->max, freq); + policy->update_limits =3D true; + } + + freq =3D __resolve_freq(policy, new_data.min, new_data.min, new_data.max, + CPUFREQ_RELATION_L); + freq =3D min(freq, policy->max); + if (freq !=3D policy->min) { + WRITE_ONCE(policy->min, freq); + policy->update_limits =3D true; + } =20 trace_cpu_frequency_limits(policy); =20 diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 4d4b4ed24b30..ae9d1ce4f49c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -146,6 +146,9 @@ struct cpufreq_policy { /* Per policy boost supported flag. */ bool boost_supported; =20 + /* Pending policy->min/max update for the driver */ + bool update_limits; + /* Cached frequency lookup from cpufreq_driver_resolve_freq. */ unsigned int cached_target_freq; unsigned int cached_resolved_idx; --=20 2.31.1.272.g89b43f80a514 From nobody Sun May 24 20:33:07 2026 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB2C134B437 for ; Fri, 22 May 2026 04:19:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779423579; cv=none; b=GcX9OyCgKs76Twhe61ox0JKTKk9Y3T4x/wsiAVPJGA1w1D806Jufdldlxrhx/EEHq48j1ISdkosLpvYSbTOttQRww9N+zFh4lpy2JXhgae8HS/tNM9Igww7e/CZXSCe9el7fRQk0Dc6DpGdMt/iTYyBpABEb+l3V5ebNQn8mSXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779423579; c=relaxed/simple; bh=Our/gfkfRbhQdh2DDIlx11+pI9CmQ6fn4czDbJq0OMc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Iua6hcDCzRYFhl83Y8uGmXu2Mrr5yHmHrw/Z/roYNUTdP2uUtrtI9XfvrI8645Yc4JJ/Ea7NYxEdd8zjZ+OeJOCnreXep1XpJZ2tm4Y7MwJMdldqQwOoew/dxm9RxlEvCID/8aLBqDIGk4NbDSOLlsGAu8oLg0p28ZbB8+/Z34s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=n05PqfGP; arc=none smtp.client-ip=209.85.210.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="n05PqfGP" Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-82fa8d6425bso3156885b3a.0 for ; Thu, 21 May 2026 21:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1779423572; x=1780028372; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=n1RSHyMXOLN00W1XKagDrGlcaq3EJ8WQKXscx0rEp7A=; b=n05PqfGPr09L07tK27Yu1c7wom2bYYq+cvt22fpt8rX25jtvp/IvMeuVh1T1UELFU1 fKgFwVZKcr5oqZQkNUhig5aaA4LXo0InoPLncV3HTPsnPOI0b8XrwqrSTj7gxVbCI1Sa +DC++QR4zbD4dD0XMGslfGbRIgqbDnnkDJbT7uP4qgLU2/h7BPZ9nxxOBPJRbCCyfpkV SuQNX/DqE4AWtouWMyx61UOgLtnqTP8lqhF30VNZBORCxq4rygAwoXCtPHK7fsFBnvni H4+lORVkLFiX9ITF9Iai4ypsY4w8LK04jrfOlsJQjpIYJEN4arudBnC16/KOWP9qAYuy 1XYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779423572; x=1780028372; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=n1RSHyMXOLN00W1XKagDrGlcaq3EJ8WQKXscx0rEp7A=; b=r/jAj7eIyndVJj4gcBpxzvKdcXcA2L0+ZSDrz2SM+yiOX3CS0OpQZfU73As558hM+K VeAMLaK9fXUmV6K/whhPS7ixL7Xzk1e+rvxpU/nNpy9E8ZXsFH/YsWUmLUNy3M8A2Eps 9UQU81ah1d2ia3npybpthZdszCVHCD1hOBW5gduHjFgdsfz6DheodHSvM/5BQE5yZ/Gv obmTWovXjRq1ZZszoIlAFj/fCTaS/8NyHTubtsDrg033G9l7b9zxw5745vuMLoR3dd7h PtX700qdQJ9EnoMUNUJKTT14zZ0yJbYRH6KIhwroOrTpP7q1zqk0mqw5d9HDFgDmNvA5 Mhzg== X-Forwarded-Encrypted: i=1; AFNElJ+aEGivObxMWwMgFMVuppGh2u5frdx6ekLGz6CqMvVkiOFbytXkTd29ZOYh3M/G7XF4xZHhmCP5Ukh20IA=@vger.kernel.org X-Gm-Message-State: AOJu0YzEHJZYAFtoCSdosGTl9dnmRZ2IUXMpGBbSIN5Y/ivym1yQPmx4 smLIXFmDH5wrW5Acocp9McEVaJL+0aNti3jouTRpvSYBdClDiuEG0TkauhztZlSkxCA= X-Gm-Gg: Acq92OFcQZr85ZRe5rkdzqM6SNLobAkcvzB6ijqyiX9UR1nle8ASf1RCNBCJK7c+SQq JUcSTXSVYZGFL79hGiDyjQNSA1e8DGnDN3gRHra5jRhNVCNb7YCrkZp9XaOIcv9w4Wmy7/7Y3s6 7IBoKdaVohDggL0xTJUsC6Yz9ODQDBLQU7DMuWmS9uyTdPmLVAb6H4qbWOgZqohlFKlgdsI0wE5 ltWmS3YA6nUeMI+tivhMLqnjmYlhVEgrc3oNd0Eg122NLNTqPYzhf9xufuMn4vfciwfjVzegXlj tU6VxCgOTL1QGjMcoBf/bG2X7JWC4qZyrDyIGD6f27ud+uSo71gU6oHxHr3StwrGPro8pdDJRfL 0DBwEpmJjMn7kf/cLTjaCUQIg6z41OvUF9tcLNJtUMn8N4xdrMQxvb+b88oJyHoptOF/xyXKQ8H qptMHGefl6nZ8yYAqcr4/u3t4= X-Received: by 2002:a05:6a00:1d9b:b0:837:f79d:909 with SMTP id d2e1a72fcca58-8415f5459f4mr2150184b3a.39.1779423572261; Thu, 21 May 2026 21:19:32 -0700 (PDT) Received: from localhost ([122.172.82.94]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84164ac9df3sm529288b3a.9.2026.05.21.21.19.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 21:19:31 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar , Stratos Karafotis Cc: linux-pm@vger.kernel.org, Vincent Guittot , Sumit Semwal , Lifeng Zheng , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org Subject: [PATCH V2 3/3] cpufreq: conservative: Simplify frequency limit handling Date: Fri, 22 May 2026 09:49:10 +0530 Message-Id: <292e6d937890f135e30ec0d2107eaad47cb9a976.1779423281.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lifeng Zheng cs_dbs_update() performs explicit checks against policy->min/max before updating the target frequency. These checks are redundant as __cpufreq_driver_target() already clamps the requested frequency to the valid policy limits. Remove the unnecessary boundary checks and simplify the update logic. This also fixes an issue introduced by commit 00bfe05889e9 ("cpufreq: conservative: Decrease frequency faster for deferred updates"), where stale target comparisons could cause frequency updates to be skipped entirely after deferred adjustments. Closes: https://lore.kernel.org/all/20260421123545.1745998-1-zhenglifeng1@h= uawei.com/ Fixes: 00bfe05889e9 ("cpufreq: conservative: Decrease frequency faster for = deferred updates") Signed-off-by: Lifeng Zheng Co-developed-by: Viresh Kumar Signed-off-by: Viresh Kumar Reviewed-by: Zhongqiu Han --- drivers/cpufreq/cpufreq_conservative.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufr= eq_conservative.c index df01d33993d8..0b32ae28ec85 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c @@ -103,10 +103,6 @@ static unsigned int cs_dbs_update(struct cpufreq_polic= y *policy) if (load > dbs_data->up_threshold) { dbs_info->down_skip =3D 0; =20 - /* if we are already at full speed then break out early */ - if (requested_freq =3D=3D policy->max) - goto out; - requested_freq +=3D freq_step; if (requested_freq > policy->max) requested_freq =3D policy->max; @@ -124,13 +120,7 @@ static unsigned int cs_dbs_update(struct cpufreq_polic= y *policy) =20 /* Check for frequency decrease */ if (load < cs_tuners->down_threshold) { - /* - * if we cannot reduce the frequency anymore, break out early - */ - if (requested_freq =3D=3D policy->min) - goto out; - - if (requested_freq > freq_step) + if (requested_freq > policy->min + freq_step) requested_freq -=3D freq_step; else requested_freq =3D policy->min; --=20 2.31.1.272.g89b43f80a514