On Thu, Sep 17, 2026 at 05:55:44PM +0200, Dietmar Eggemann wrote:
On 17.09.26 17:32, Peter Zijlstra wrote:
quoted
On Thu, Sep 17, 2026 at 02:51:11PM +0200, Oleg Keri wrote:
[...]
quoted
quoted
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 709a2dcf4c73..0a4ee12a98d5 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -351,4 +351,6 @@ static inline unsigned long topology_get_cpu_scale(int cpu)
void topology_set_cpu_scale(unsigned int cpu, unsigned long capacity);
+#define cap_scale(v, s) ((v)*(s) >> SCHED_CAPACITY_SHIFT)
This might not be a very good generic helper, since it relies on either
of the variables to be u64 for correctness.
So moving it to a static inline function instead?
static inline u64 cap_scale(u64 value, u64 scale)
{
return value * scale >> SCHED_CAPACITY_SHIFT;
}
Yes, that would be much better defined.