Hi Peter,
here is a patch that should fix the rare div0 crashes reported by
Jingfeng, and a second patch for a div32-with-64-bit-divisor issue
spotted during code review.
Can you please take a look and route them through the scheduler tree?
Thanks!
kernel/sched/psi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
The psi window size is a u64 an can be up to 10 seconds right now,
which exceeds the lower 32 bits of the variable. We currently use
div_u64 for it, which is meant only for 32-bit divisors. The result is
garbage pressure sampling values and even potential div0 crashes.
Use div64_u64.
Signed-off-by: Johannes Weiner <[email protected]>
Reviewed-by: Suren Baghdasaryan <[email protected]>
---
kernel/sched/psi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c
index 970db4686dd4..ce8f6748678a 100644
--- a/kernel/sched/psi.c
+++ b/kernel/sched/psi.c
@@ -482,7 +482,7 @@ static u64 window_update(struct psi_window *win, u64 now, u64 value)
u32 remaining;
remaining = win->size - elapsed;
- growth += div_u64(win->prev_growth * remaining, win->size);
+ growth += div64_u64(win->prev_growth * remaining, win->size);
}
return growth;
--
2.24.0
On Tue, Dec 03, 2019 at 01:35:22PM -0500, Johannes Weiner wrote:
> Hi Peter,
>
> here is a patch that should fix the rare div0 crashes reported by
> Jingfeng, and a second patch for a div32-with-64-bit-divisor issue
> spotted during code review.
>
> Can you please take a look and route them through the scheduler tree?
Will do, Thanks!