Linux Documentation
 help / color / mirror / Atom feed
From: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
To: Randy Dunlap <rdunlap@infradead.org>,
	wangxiaodong <wangxiaodong827546786@gmail.com>,
	rafael@kernel.org, viresh.kumar@linaro.org
Cc: corbet@lwn.net, skhan@linuxfoundation.org,
	linux-pm@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, zhongqiu.han@oss.qualcomm.com
Subject: Re: [PATCH] Documentation: admin-guide: pm: cpufreq: fix sampling_rate example command
Date: Sun, 21 Jun 2026 13:57:19 +0800	[thread overview]
Message-ID: <f08d5dea-e1c7-4ed3-ba1f-c7ac7cce6c2a@oss.qualcomm.com> (raw)
In-Reply-To: <10a04e7d-31b4-4c51-bf68-298f517fbab6@infradead.org>

On 6/21/2026 11:52 AM, Randy Dunlap wrote:
> 
> 
> On 6/20/26 7:25 PM, wangxiaodong wrote:
>> The example shell command for setting ondemand's sampling_rate wraps an
>> arithmetic expansion $((...)) in command-substitution backticks. The
>> arithmetic result is then executed as a command, which fails and writes
>> an empty value. Drop the surrounding backticks so the computed value is
>> passed to echo as intended.
>>
>> Signed-off-by: wangxiaodong <wangxiaodong827546786@gmail.com>
>> ---
>>   Documentation/admin-guide/pm/cpufreq.rst | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Documentation/admin-guide/pm/cpufreq.rst b/Documentation/admin-guide/pm/cpufreq.rst
>> index 8831cface585..34baf20cc202 100644
>> --- a/Documentation/admin-guide/pm/cpufreq.rst
>> +++ b/Documentation/admin-guide/pm/cpufreq.rst
>> @@ -497,7 +497,7 @@ This governor exposes the following tunables:
>>   	represented by it to be 1.5 times as high as the transition latency
>>   	(the default)::
>>   
>> -	# echo `$(($(cat cpuinfo_transition_latency) * 3 / 2))` > ondemand/sampling_rate
>> +	# echo $(($(cat cpuinfo_transition_latency) * 3 / 2)) > ondemand/sampling_rate
> 
> Ugh. Thanks.
> Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
> 
> and possibly:
> Fixes: e54ac586674d ("cpufreq: editing corrections to cpufreq.rst")


Thanks Randy,

Just to back up Randy's Fixes suggestion, the line evolved as follows
(most recent first):

2025/04/04 e54ac586674d:  #echo `$((.. * 3 / 2))` >  (trailing ` added)
2024/10/17 29dcbea92460:  #echo `$((.. * 3 / 2))  >  (still dangling `)
2017/03/13 2a0e49279850:  #echo `$((.. * 750 / 1000)) > (dangling leading `)

The stray backtick can be traced back to 2a0e49279850, but it was just a
dangling backtick then. The closed command-substitution form fixed here
was only reached after e54ac586674d added the trailing backtick. Note
that the "750/1000 -> 3/2" change in 29dcbea92460 was not just a doc
edit: it reflects an actual change in the kernel's behaviour. So on the
older trees the underlying logic - and hence this documented example -
is genuinely different, and this patch wouldn't apply cleanly there
anyway. Pointing Fixes at 2a0e49279850 therefore wouldn't help
backports.

So using

Fixes: e54ac586674d ("cpufreq: editing corrections to cpufreq.rst")

seems reasonable.

Either way, the fix is fine to me:

Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>




> 
>>   
>>   ``up_threshold``
>>   	If the estimated CPU load is above this value (in percent), the governor
> 


-- 
Thx and BRs,
Zhongqiu Han

      reply	other threads:[~2026-06-21  5:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-21  2:25 [PATCH] Documentation: admin-guide: pm: cpufreq: fix sampling_rate example command wangxiaodong
2026-06-21  3:52 ` Randy Dunlap
2026-06-21  5:57   ` Zhongqiu Han [this message]

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=f08d5dea-e1c7-4ed3-ba1f-c7ac7cce6c2a@oss.qualcomm.com \
    --to=zhongqiu.han@oss.qualcomm.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=skhan@linuxfoundation.org \
    --cc=viresh.kumar@linaro.org \
    --cc=wangxiaodong827546786@gmail.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