[PATCH v1 1/2] arm64: topology: fix arch_freq_get_on_cpu() overflow above 4.19 GHz
Oleg Keri
okerixx at gmail.com
Wed Sep 9 12:18:16 PDT 2026
Good point - that reads much better than reusing scale as scratch. Taken
for v2:
scale = arch_scale_freq_capacity(cpu);
freq = (scale * arch_scale_freq_ref(cpu)) >> SCHED_CAPACITY_SHIFT;
Same semantics, and it makes it obvious that both the multiply and the
shift stay in 64 bits and only the final value is narrowed - which is the
whole point of the fix.
Agreed on leaving arch_scale_freq_capacity() out of the expression too.
This file is arm64 only, so unsigned long is 64 bits and it would be safe
here, but it stops being self-evident to the reader and the cast that
would make it evident is worse than keeping the temporary.
Thanks for the review.
More information about the linux-arm-kernel
mailing list