On Fri, Apr 16, 2021 at 08:32:16PM +0530, Charan Teja Reddy wrote: > psi_group_cpu->tasks, represented by the unsigned int, stores the number > of tasks that could be stalled on a psi resource(io/mem/cpu). > Decrementing these counters at zero leads to wrapping which further > leads to the psi_group_cpu->state_mask is being set with the respective > pressure state. This could result into the unnecessary time sampling for > the pressure state thus cause the spurious psi events. This can further > lead to wrong actions being taken at the user land based on these psi > events. > Though psi_bug is set under these conditions but that just for debug > purpose. Fix it by decrementing the ->tasks count only when it is > non-zero. > > Signed-off-by: Charan Teja Reddy <[email protected]>
The subject should be psi: handle potential task count underflow bugs more gracefully since it's not fixing a known bug at this point. Otherwise, Acked-by: Johannes Weiner <[email protected]>

