psi-pressure-stall-information-for-cpu-memory-and-io-fix-fix-fix
Subsystems (2)
PATCH 1/1 psi-pressure-stall-information-for-cpu-memory-and-io-fix-fix-fix
The addition of do_div() did not do the right thing, as it assigned the result of the multiplication to an 'unsigned long', which truncates it before the division. GCC warns in various ways about this depending on the architecuture, e.g.
arch/arm/include/asm/div64.h:33:45: note: expected 'uint64_t *' {aka 'long long unsigned int *'} but argument is of type 'long unsigned int *'
This uses div_u64() instead. This is probably still a bad idea since we should avoid 64-bit division altogether in the scheduler, but at least it does the correct calculation.
---
Please fold into the fix
--- kernel/sched/psi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/sched/psi.c +2 -3
@@ -173,11 +173,10 @@ void __init psi_init(void)static void calc_avgs (unsigned long avg[3 ],u64 time,int missed_periods) { -unsigned long pct; +u64 pct;/* Sample the most recent active period */ - pct = time *100 ; -do_div (pct, psi_period); + pct =div_u64 (time *100 , psi_period); pct *=FIXED_1 ; avg[0 ] =calc_load (avg[0 ], EXP_10s, pct); avg[1 ] =calc_load (avg[1 ], EXP_60s, pct);
Signature · 1 line
2.9.0
Peter Zijlstra
maintainerQuoted 7 lines · Arnd Bergmann
The addition of
do_div()did not do the right thing, as it assigned the result of the multiplication to an 'unsigned long', which truncates it before the division. GCC warns in various ways about this depending on the architecuture, e.g.
arch/arm/include/asm/div64.h:33:45: note: expected 'uint64_t*' {aka 'long long unsigned int *'} but argument is of type 'long unsigned int *'
Quoted 8 lines
This uses
div_u64()instead. This is probably still a bad idea since we should avoid 64-bit division altogether in the scheduler, but at least it does the correct calculation.Fixes 13a67bcb35f5 ("psi-pressure-stall-information-for-cpu-memory-and-io-fix-fix")Signed-off-by Arnd Bergmann <[email protected]>---
Please fold into the fix
Please drop the entire PSI series instead.