Re: [PATCH 1/2] sched/pelt: Remove redundant variable in __accumulate_pelt_segments

From: Peter Zijlstra
Date: Thu Nov 25 2021 - 04:55:41 EST


On Thu, Nov 25, 2021 at 11:00:18AM +0800, Tang Yizhou wrote:
> As the comment of function accumulate_sum() describes the equation clearly,
> There is no need to use a redundant variable c3. Let's make a comment for
> d3 directly.

Why bother? Surely the compiler is clever enough to figure out the same
and avoid instantiating the variable. All you've done is made the code
less obvious.