Skip to contentSkip to conversation

sched/fair: avoid !CONFIG_SMP cpufreq update callbacks when go idle

PATCH In review Jisheng Zhang 2 participants 3 messages Jun 27, 2016 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/fair: avoid !CONFIG_SMP cpufreq update callbacks when go idle

This is to avoid cpufreq update callbacks when we go idle on UP platforms.

---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index bdcbeea..236ec5b 100644
@@ -3121,7 +3121,8 @@ static inline void update_load_avg(struct sched_entity *se, int not_used)
 	struct cfs_rq *cfs_rq = cfs_rq_of(se);
 	struct rq *rq = rq_of(cfs_rq);
 
-	cpufreq_trigger_update(rq_clock(rq));
+	if (&rq->cfs == cfs_rq)
+		cpufreq_trigger_update(rq_clock(rq));
 }
 
 static inline void
Signature · 1 line
2.8.1
maintainer
#1 lore raw
Quoted 2 lines · Jisheng Zhang

This is to avoid cpufreq update callbacks when we go idle on UP platforms.

How so? the patch only avoids calling the update for (!root) cgroups -- which makes sense, but I'm not seeing how that's related to going idle, or UP at all.

Quoted 23 lines
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index bdcbeea..236ec5b 100644
@@ -3121,7 +3121,8 @@ static inline void update_load_avg(struct sched_entity *se, int not_used)
 	struct cfs_rq *cfs_rq = cfs_rq_of(se);
 	struct rq *rq = rq_of(cfs_rq);
 
-	cpufreq_trigger_update(rq_clock(rq));
+	if (&rq->cfs == cfs_rq)
+		cpufreq_trigger_update(rq_clock(rq));
 }
 
 static inline void
Signature · 1 line
2.8.1
#2 lore raw

Dear Peter,

Quoted 7 lines · On Mon, 27 Jun 2016 10:37:21 +0200 Peter Zijlstra wrote:
Quoted 2 lines · Jisheng Zhang

This is to avoid cpufreq update callbacks when we go idle on UP platforms.

How so? the patch only avoids calling the update for (!root) cgroups -- which makes sense, but I'm not seeing how that's related to going idle, or UP at all.

oops, I may mis-understand below comment at cfs_rq_util_change()

* It will not get called when we go idle, because the idle
* thread is a different class (!fair),

I mis-read the comment as:

it's the "&rq->cfs == cfs_rq" check to prevent the calling when go idle.

So the patch still make sense, but I need to update the commit msg?

Thanks,
Jisheng

Quoted 24 lines
Quoted 24 lines
---
 kernel/sched/fair.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/fair.c +2 -1
index bdcbeea..236ec5b 100644
@@ -3121,7 +3121,8 @@ static inline void update_load_avg(struct sched_entity *se, int not_used)
 	struct cfs_rq *cfs_rq = cfs_rq_of(se);
 	struct rq *rq = rq_of(cfs_rq);
 
-	cpufreq_trigger_update(rq_clock(rq));
+	if (&rq->cfs == cfs_rq)
+		cpufreq_trigger_update(rq_clock(rq));
 }
 
 static inline void
Signature · 1 line
2.8.1