lkml.org 
[lkml]   [2021]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] sched/pelt: Remove redundant variable in __accumulate_pelt_segments
Date
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.

Signed-off-by: Tang Yizhou <tangyizhou@huawei.com>
---
kernel/sched/pelt.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index a554e3bbab2b..3584df2a0b8e 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -60,7 +60,7 @@ static u64 decay_load(u64 val, u64 n)

static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3)
{
- u32 c1, c2, c3 = d3; /* y^0 == 1 */
+ u32 c1, c2;

/*
* c1 = d1 y^p
@@ -78,7 +78,7 @@ static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3)
*/
c2 = LOAD_AVG_MAX - decay_load(LOAD_AVG_MAX, periods) - 1024;

- return c1 + c2 + c3;
+ return c1 + c2 + d3; /* d3: y^0 == 1 */
}

/*
--
2.17.1
\
 
 \ /
  Last update: 2021-11-25 03:35    [W:0.057 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site