Skip to contentSkip to conversation

sched/pelt: Use or not add in update_irq_load_avg()

PATCH In review Tao Zhou 2 participants 2 messages Oct 9, 2021 Scheduler

lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/1 sched/pelt: Use or not add in update_irq_load_avg()

The ret value of update_irq_load_avg() can be 2. And this value is used in __update_blocked_others(). It should be 0 or 1. Use OR operation in update_irq_load_avg().

---
 kernel/sched/pelt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/pelt.c +1 -1
index a554e3bbab2b..7edf21f7977c 100644
@@ -458,7 +458,7 @@ int update_irq_load_avg(struct rq *rq, u64 running)
 				0,
 				0,
 				0);
-	ret += ___update_load_sum(rq->clock, &rq->avg_irq,
+	ret |= ___update_load_sum(rq->clock, &rq->avg_irq,
 				1,
 				1,
 				1);
Signature · 1 line
2.32.0
maintainer
#1 lore raw
Quoted 3 lines · Tao Zhou

The ret value of update_irq_load_avg() can be 2. And this value is used in __update_blocked_others(). It should be 0 or 1. Use OR operation in update_irq_load_avg().

AFAICT it doesn't matter one way or the other, but you're probably right in that |= makes more sense.

No Signed-off-by tag...

Quoted 20 lines
---
 kernel/sched/pelt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/pelt.c +1 -1
index a554e3bbab2b..7edf21f7977c 100644
@@ -458,7 +458,7 @@ int update_irq_load_avg(struct rq *rq, u64 running)
 				0,
 				0,
 				0);
-	ret += ___update_load_sum(rq->clock, &rq->avg_irq,
+	ret |= ___update_load_sum(rq->clock, &rq->avg_irq,
 				1,
 				1,
 				1);
Signature · 1 line
2.32.0