Re: [PATCH] sched: Align rq->avg_idle and rq->avg_scan_cost
From: Peter Zijlstra
Date: Mon Mar 30 2020 - 09:35:15 EST
On Mon, Mar 30, 2020 at 10:01:27AM +0100, Valentin Schneider wrote:
>
> """
> The result of E1 >> E2 is E1 right-shifted E2 bit positions. [...] If E1
> has a signed type and a negative value, the resulting value is
> implementation-defined.
True; but the kernel uses -fwrapv, which would mandate 2s complement,
which then gets us to the next point:
> """
>
> Not only this, but (arithmetic) right shifting a negative value (using 2's
> complement) is *not* equivalent to dividing it by the corresponding power
> of 2.
True; good catch.