From: "zhenglifeng (A)" <zhenglifeng1@huawei.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: <rafael@kernel.org>, <linux-pm@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linuxarm@huawei.com>,
<jonathan.cameron@huawei.com>, <zhanjie9@hisilicon.com>,
<lihuisong@huawei.com>, <yubowen8@huawei.com>,
<zhangpengjie2@huawei.com>, <wangzhi12@huawei.com>,
<linhongye@h-partners.com>
Subject: Re: [PATCH v2 2/2] cpufreq: cpufreq_boost_trigger_state() optimization
Date: Tue, 2 Dec 2025 14:24:46 +0800 [thread overview]
Message-ID: <9590b0fb-f297-4e6a-9265-ba7a17abef31@huawei.com> (raw)
In-Reply-To: <a6p3btn4ykt6rzdduww6ozunusfubv2dmczqfr4uuttgcnyjqh@kevefkumtidj>
On 2025/12/2 12:58, Viresh Kumar wrote:
> On 02-12-25, 09:32, zhenglifeng (A) wrote:
>> On 2025/12/1 11:42, Viresh Kumar wrote:
>>> On 28-11-25, 17:13, Lifeng Zheng wrote:
>>>> Simplify the error handling branch code in cpufreq_boost_trigger_state().
>>>>
>>>> Signed-off-by: Lifeng Zheng <zhenglifeng1@huawei.com>
>>>> ---
>>>> drivers/cpufreq/cpufreq.c | 11 +++--------
>>>> 1 file changed, 3 insertions(+), 8 deletions(-)
>>>>
>>>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>>>> index a4399e5490da..a725747572c9 100644
>>>> --- a/drivers/cpufreq/cpufreq.c
>>>> +++ b/drivers/cpufreq/cpufreq.c
>>>> @@ -2824,18 +2824,13 @@ static int cpufreq_boost_trigger_state(int state)
>>>>
>>>> ret = policy_set_boost(policy, state);
>>>> if (ret)
>>>> - goto err_reset_state;
>>>> + break;
>>>> }
>>>>
>>>> - if (ret)
>>>> - goto err_reset_state;
>>>> -
>>>> cpus_read_unlock();
>>>>
>>>> - return 0;
>>>> -
>>>> -err_reset_state:
>>>> - cpus_read_unlock();
>>>> + if (!ret)
>>>
>>> Maybe we can make this `if (likely(!ret))`
>>
>> For the platforms which are not boost supported, this will never be
>> matched. Is `likely` OK in this situation?
>
> Ideally they won't have a `boost` file in sysfs, and if they have it, we don't
> really need to optimize the failure case.
I see. Then I think the `if (ret)` in the loop should be
`if (unlikely(ret))` too.
next prev parent reply other threads:[~2025-12-02 6:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 9:13 [PATCH v2 0/2] cpufreq: Return -EOPNOTSUPP if no policy is boost supported Lifeng Zheng
2025-11-28 9:13 ` [PATCH v2 1/2] " Lifeng Zheng
2025-12-01 3:43 ` Viresh Kumar
2025-11-28 9:13 ` [PATCH v2 2/2] cpufreq: cpufreq_boost_trigger_state() optimization Lifeng Zheng
2025-12-01 3:42 ` Viresh Kumar
2025-12-02 1:32 ` zhenglifeng (A)
2025-12-02 4:58 ` Viresh Kumar
2025-12-02 6:24 ` zhenglifeng (A) [this message]
2025-12-02 6:46 ` Viresh Kumar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9590b0fb-f297-4e6a-9265-ba7a17abef31@huawei.com \
--to=zhenglifeng1@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=lihuisong@huawei.com \
--cc=linhongye@h-partners.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=wangzhi12@huawei.com \
--cc=yubowen8@huawei.com \
--cc=zhangpengjie2@huawei.com \
--cc=zhanjie9@hisilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox