Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/fair: Use full weight to __calc_delta()

Since we now use the full weight for avg_vruntime(), also make
__calc_delta() use the full value.

Since weight is effectively NICE_0_LOAD, this is 20 bits on 64bit.
This leaves 44 bits for delta_exec, which is ~16k seconds, way longer
than any one tick would ever be, so no worry about overflow.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: Shubhang Kaushik <shubhang@os.amperecomputing.com>
Link: https://patch.msgid.link/20260219080625.183283814%40infradead.org

+7
+7
kernel/sched/fair.c
··· 225 225 update_sysctl(); 226 226 } 227 227 228 + #ifndef CONFIG_64BIT 228 229 #define WMULT_CONST (~0U) 229 230 #define WMULT_SHIFT 32 230 231 ··· 284 283 285 284 return mul_u64_u32_shr(delta_exec, fact, shift); 286 285 } 286 + #else 287 + static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight *lw) 288 + { 289 + return (delta_exec * weight) / lw->weight; 290 + } 291 + #endif 287 292 288 293 /* 289 294 * delta /= w