Re: [PATCH] sched/fair: Use 'unsigned long' for group_shares,group_runnable

From: Peter Zijlstra
Date: Mon Apr 15 2019 - 08:46:27 EST


On Sat, Apr 13, 2019 at 03:32:34AM +0000, Cheng Jian wrote:
> group_share and group_runnable are tracked as 'unsigned long',
> however some functions using them as 'long' which is ultimately
> assigned back to 'unsigned long' variables in reweight_entity.
>
> Since there is not scope on using a different and signed type,
> this change improves code consistency and avoids further type
> conversions. More important, to prevent undefined behavior
> caused by overflow.

There is no undefined behaviour due to overflow. UBSAN is broken,
upgrade to GCC8 or later.