Skip to contentSkip to conversation

cpufreq governors broken with !CONFIG_SMP?

DISCUSSION Steve Muckle 4 participants 8 messages May 5, 2016 – May 6, 2016 Scheduler

lore
Share & tools
lore
#0 lore raw

While working on a few patches for schedutil I noticed that the CFS cpufreq hooks depend on PELT, which depends on CONFIG_SMP.

I compiled and ran a UP kernel with intel_pstate. Running a cpu-bound task did not result in the frequency increasing beyond fmin. For some reason ondemand is working for me with the same test, not sure why yet.

It appears dbs/intel-pstate/schedutil have a dependency on CONFIG_SMP now. Or am I missing something?

#1 lore raw
Quoted 9 lines · Steve Muckle

While working on a few patches for schedutil I noticed that the CFS cpufreq hooks depend on PELT, which depends on CONFIG_SMP.

I compiled and ran a UP kernel with intel_pstate. Running a cpu-bound task did not result in the frequency increasing beyond fmin. For some reason ondemand is working for me with the same test, not sure why yet.

It appears dbs/intel-pstate/schedutil have a dependency on CONFIG_SMP now. Or am I missing something?

You're right AFAICS.

For governors other than schedutil fixing that would be a matter of adding a !CONFIG_SMP variant of update_load_avg() that will call cpufreq_update_util() and do nothing else. It doesn't matter what is passed via util and max then.

In turn, schedutil should probably depend on CONFIG_SMP.

Peter?

#2 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 9 lines · Steve Muckle

While working on a few patches for schedutil I noticed that the CFS cpufreq hooks depend on PELT, which depends on CONFIG_SMP.

I compiled and ran a UP kernel with intel_pstate. Running a cpu-bound task did not result in the frequency increasing beyond fmin. For some reason ondemand is working for me with the same test, not sure why yet.

It appears dbs/intel-pstate/schedutil have a dependency on CONFIG_SMP now. Or am I missing something?

Quoted 6 lines

You're right AFAICS.

For governors other than schedutil fixing that would be a matter of adding a !CONFIG_SMP variant of update_load_avg() that will call cpufreq_update_util() and do nothing else. It doesn't matter what is passed via util and max then.

Maybe something like the below, FWIW, as a quick fix for 4.6?

---
 kernel/sched/fair.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/sched/fair.c +8 -1
Index: linux-pm/kernel/sched/fair.c
===================================================================
@@ -3030,7 +3030,14 @@ static int idle_balance(struct rq *this_
 
 #else /* CONFIG_SMP */
 
-static inline void update_load_avg(struct sched_entity *se, int update_tg) {}
+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));
+}
+
 static inline void
 enqueue_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) {}
 static inline void
maintainer
#3 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 8 lines · Rafael J. Wysocki
Quoted 2 lines · Steve Muckle

While working on a few patches for schedutil I noticed that the CFS cpufreq hooks depend on PELT, which depends on CONFIG_SMP.

For governors other than schedutil fixing that would be a matter of adding a !CONFIG_SMP variant of update_load_avg() that will call cpufreq_update_util() and do nothing else. It doesn't matter what is passed via util and max then.

Maybe something like the below, FWIW, as a quick fix for 4.6?

Right; I suppose that'll have to do for 4.6.

Quoted 25 lines
---
 kernel/sched/fair.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux-pm/kernel/sched/fair.c
===================================================================

kernel/sched/fair.c +8 -1
@@ -3030,7 +3030,14 @@ static int idle_balance(struct rq *this_
 
 #else /* CONFIG_SMP */
 
-static inline void update_load_avg(struct sched_entity *se, int update_tg) {}
+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));
+}
+
 static inline void
 enqueue_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *se) {}
 static inline void
#4 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 4 lines · Rafael J. Wysocki
Quoted 3 lines · Rafael J. Wysocki
Quoted 2 lines · Steve Muckle

While working on a few patches for schedutil I noticed that the CFS cpufreq hooks depend on PELT, which depends on CONFIG_SMP.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

For governors other than schedutil fixing that would be a matter of adding a !CONFIG_SMP variant of update_load_avg() that will call cpufreq_update_util() and do nothing else. It doesn't matter what is passed via util and max then.

Maybe something like the below, FWIW, as a quick fix for 4.6?

Right; I suppose that'll have to do for 4.6.

OK, thanks!

I'll resend it with a changelog and stuff then.

#5 lore raw
In reply to Rafael J. Wysocki
Quoted 1 line · Rafael J. Wysocki

In turn, schedutil should probably depend on CONFIG_SMP.

In the long term I wonder if it's worth putting PELT under its own separate feature or just removing #ifdef CONFIG_SMP.

Aside from task migration CPU frequency updates there's also task creation and deletion which would apply on UP. The tunable infrastructure being created for scheduler-guided frequency may be of interest on UP also.

#6 lore raw
Quoted 10 lines · Steve Muckle
Quoted 1 line · Rafael J. Wysocki

In turn, schedutil should probably depend on CONFIG_SMP.

In the long term I wonder if it's worth putting PELT under its own separate feature or just removing #ifdef CONFIG_SMP.

Aside from task migration CPU frequency updates there's also task creation and deletion which would apply on UP. The tunable infrastructure being created for scheduler-guided frequency may be of interest on UP also.

I agree, but I was talking short-term. :-)

We need to fix this for 4.6 (which most likely is 2 weeks away only) and I don't think it hurts anyone if schedutil depends on CONFIG_SMP to start with.

maintainer
#7 lore raw
In reply to Steve Muckle
Quoted 5 lines · Steve Muckle
Quoted 1 line · Rafael J. Wysocki

In turn, schedutil should probably depend on CONFIG_SMP.

In the long term I wonder if it's worth putting PELT under its own separate feature or just removing #ifdef CONFIG_SMP.

Probably should do that eventually yeah. It started out with being smp&&cgroup only, then we started using it for regular balancing and it became smp, and since we're now wanting to use it for pretty much everything we should just remove that.