On Thu, 7 Nov 2024, Ankur Arora wrote:
quoted
Calling the clock retrieval function repeatedly should be fine and is
typically done in user space as well as in kernel space for functions that
need to wait short time periods.
The problem is that you might have multiple CPUs polling in idle
for prolonged periods of time. And, so you want to minimize
your power/thermal envelope.
On ARM that maps to YIELD which does not do anything for the power
envelope AFAICT. It switches to the other hyperthread.
For instance see commit 4dc2375c1a4e "cpuidle: poll_state: Avoid
invoking local_clock() too often" which originally added a similar
rate limit to poll_idle() where they saw exactly that issue.
Looping w/o calling local_clock may increase the wait period etc.
For power saving most arches have special instructions like ARMS
WFE/WFET. These are then causing more accurate wait times than the looping
thing?