Repository navigation
Conversation
CPU PD's target residency is 10 ms and its exit latency 10 us, on every
Apple SoC this driver binds to. On a J514S (MacBook Pro 14", M3 Pro), a
running desktop rarely predicts 10 ms of idle: with the usual applications
open and the display off, the cores spent only 62-76% of their idle time
in CPU PD under menu, and menu counted two thirds of its CPU PD entries
"too deep". Those short CPU PD periods save power all the same: teo, which
avoids them, kept the cores in CPU PD 9% of the time and drew 0.9 W more.
On the J514S, set the target residency to 500 us and the exit latency to
20 us. The values were switched at runtime on this commit, alternating
with the old ones, two rounds each; power is the SMC's total system power:
display off, usual applications open, an audio stream active (medians):
10 ms / 10 us 4.78, 4.77 W (CPU PD 62-63% of idle time)
500 us / 20 us 3.88, 3.86 W (CPU PD 94%)
1080p60 software-decoded video, 55 s (mean), no dropped frames in any:
10 ms 14.09, 13.61 W; 500 us 12.71, 12.73 W; 100 us 12.39, 12.31 W
A quiet desktop with the display off saved less: about 0.1-0.2 W at
500 us (with a 10 us exit latency) and 0.24 W at 100 us.
100 us was evaluated as well and saved slightly more power, but costs
more where a wakeup from CPU PD sits on the critical path. Averages of
two rounds, 10 ms / 500 us / 100 us:
fio 4k random read, QD1, O_DIRECT 10344 / 9709 / 9018 IOPS
pgbench TPC-B, 1 client (fsync) 1341 / 1369 / 1256 tps
pgbench select-only, 1 client 16525 / 16875 / 15927 tps
500 us is the balanced choice: about 75% of the saving at half the QD1
cost and none to single-client database throughput. With 8 pgbench
clients, redis-benchmark at one client, a three-pass kernel build,
hackbench and Wi-Fi ping, results matched within run-to-run noise, and
a PipeWire stream with a 64-frame quantum saw 0-1 xruns in 30 s either
way.
A 1 ms timer woke 57 -> 68 us late (p50) and a pipe round trip to an
idle core took 10-20 us longer once CPU PD was used; the p99 and maximum
varied as much between runs of one setting as between settings. A PM
QoS request below 20 us keeps the cores in WFI. suspend-to-idle picks
the deepest state regardless of these values. Other Apple SoCs keep the
defaults: only this machine was measured.
Assisted-by: Claude:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Ilyas Akin <ashnwor@gmail.com>
This was referenced Nov 18, 2026
|
Tested on a second J514S. Not tested: power on its own, and battery runtime. Test setup
Testing and write-up assisted by Claude Code. |
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes and why
cpuidle-applegives CPU PD a 10 ms target residency and a 10 us exit latency on every Apple SoC it binds to. On the J514S (MacBook Pro 14", M3 Pro, T6030), a running desktop rarely predicts 10 ms of idle:above).This sets CPU PD's target residency to 500 us and its exit latency to 20 us on the J514S only. Every other Apple SoC keeps the defaults.
Why 500 us (balanced), and what 100 us did
I swept 10 ms / 2 ms / 500 us / 100 us / 20 us and then compared 10 ms, 500 us and 100 us under real workloads. 100 us saved slightly more power, but costs more where a wakeup from CPU PD sits on the critical path:
500 us keeps about 75% of the saving, at half the QD1 cost and with no measurable cost to single-client database throughput. If someone wants the extra power, a power-saver profile could lower it further, but that's a separate change.
What was tested
macsmc_hwmon"Total System Power"), on AC at 100%.A quieter desktop saved less: about 0.1-0.2 W at 500 us and 0.24 W at 100 us. The more short idle periods the system has, the larger the saving.
Unchanged within run-to-run noise:
perf bench sched messaging(hackbench, 0.25 s);Wakeup latency (a 1 ms
clock_nanosleeploop and a pipe ping-pong between two cores, 3000 iterations, p50):The p99 and maximum varied as much between two runs of one setting as between the settings. That 10-20 us is why the exit latency is now 20 us: a PM QoS request below 20 us keeps the cores in WFI.
Host test:
tools/testing/selftests/drivers/gpu/apple-dcp/run.shcompiles this driver into itscpuidle-s2idlereplay. Its results match the base's. Locally that stage fails at the base too, on a newer clang's-Wunused-but-set-globalin the harness. With only that warning off, the replay passes at the base and at this head.Build:
make W=1 drivers/cpuidle/cpuidle-apple.o(clang) is clean. checkpatch is clean apart from the trailers.What was NOT tested
Risk
AI assistance
🤖 Generated with Claude Code