Skip to content

Commit b894d20

Browse files
Vincent Donnefortrafaeljw
authored andcommitted
cpufreq: Use CPUFREQ_RELATION_E in DVFS governors
Let the governors schedutil, conservative and ondemand to work, if possible on efficient frequencies only. Signed-off-by: Vincent Donnefort <[email protected]> Acked-by: Viresh Kumar <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 1f39fa0 commit b894d20

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ static unsigned int __resolve_freq(struct cpufreq_policy *policy,
554554
unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
555555
unsigned int target_freq)
556556
{
557-
return __resolve_freq(policy, target_freq, CPUFREQ_RELATION_L);
557+
return __resolve_freq(policy, target_freq, CPUFREQ_RELATION_LE);
558558
}
559559
EXPORT_SYMBOL_GPL(cpufreq_driver_resolve_freq);
560560

drivers/cpufreq/cpufreq_conservative.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy)
111111
if (requested_freq > policy->max)
112112
requested_freq = policy->max;
113113

114-
__cpufreq_driver_target(policy, requested_freq, CPUFREQ_RELATION_H);
114+
__cpufreq_driver_target(policy, requested_freq,
115+
CPUFREQ_RELATION_HE);
115116
dbs_info->requested_freq = requested_freq;
116117
goto out;
117118
}
@@ -134,7 +135,8 @@ static unsigned int cs_dbs_update(struct cpufreq_policy *policy)
134135
else
135136
requested_freq = policy->min;
136137

137-
__cpufreq_driver_target(policy, requested_freq, CPUFREQ_RELATION_L);
138+
__cpufreq_driver_target(policy, requested_freq,
139+
CPUFREQ_RELATION_LE);
138140
dbs_info->requested_freq = requested_freq;
139141
}
140142

drivers/cpufreq/cpufreq_ondemand.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
120120

121121
if (od_tuners->powersave_bias)
122122
freq = od_ops.powersave_bias_target(policy, freq,
123-
CPUFREQ_RELATION_H);
123+
CPUFREQ_RELATION_HE);
124124
else if (policy->cur == policy->max)
125125
return;
126126

127127
__cpufreq_driver_target(policy, freq, od_tuners->powersave_bias ?
128-
CPUFREQ_RELATION_L : CPUFREQ_RELATION_H);
128+
CPUFREQ_RELATION_LE : CPUFREQ_RELATION_HE);
129129
}
130130

131131
/*
@@ -163,9 +163,9 @@ static void od_update(struct cpufreq_policy *policy)
163163
if (od_tuners->powersave_bias)
164164
freq_next = od_ops.powersave_bias_target(policy,
165165
freq_next,
166-
CPUFREQ_RELATION_L);
166+
CPUFREQ_RELATION_LE);
167167

168-
__cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_C);
168+
__cpufreq_driver_target(policy, freq_next, CPUFREQ_RELATION_CE);
169169
}
170170
}
171171

@@ -184,7 +184,7 @@ static unsigned int od_dbs_update(struct cpufreq_policy *policy)
184184
*/
185185
if (sample_type == OD_SUB_SAMPLE && policy_dbs->sample_delay_ns > 0) {
186186
__cpufreq_driver_target(policy, dbs_info->freq_lo,
187-
CPUFREQ_RELATION_H);
187+
CPUFREQ_RELATION_HE);
188188
return dbs_info->freq_lo_delay_us;
189189
}
190190

include/linux/cpufreq.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ static inline void cpufreq_stats_record_transition(struct cpufreq_policy *policy
283283
/* relation flags */
284284
#define CPUFREQ_RELATION_E BIT(2) /* Get if possible an efficient frequency */
285285

286+
#define CPUFREQ_RELATION_LE (CPUFREQ_RELATION_L | CPUFREQ_RELATION_E)
287+
#define CPUFREQ_RELATION_HE (CPUFREQ_RELATION_H | CPUFREQ_RELATION_E)
288+
#define CPUFREQ_RELATION_CE (CPUFREQ_RELATION_C | CPUFREQ_RELATION_E)
289+
286290
struct freq_attr {
287291
struct attribute attr;
288292
ssize_t (*show)(struct cpufreq_policy *, char *);
@@ -636,9 +640,11 @@ struct cpufreq_governor *cpufreq_fallback_governor(void);
636640
static inline void cpufreq_policy_apply_limits(struct cpufreq_policy *policy)
637641
{
638642
if (policy->max < policy->cur)
639-
__cpufreq_driver_target(policy, policy->max, CPUFREQ_RELATION_H);
643+
__cpufreq_driver_target(policy, policy->max,
644+
CPUFREQ_RELATION_HE);
640645
else if (policy->min > policy->cur)
641-
__cpufreq_driver_target(policy, policy->min, CPUFREQ_RELATION_L);
646+
__cpufreq_driver_target(policy, policy->min,
647+
CPUFREQ_RELATION_LE);
642648
}
643649

644650
/* Governor attribute set */

0 commit comments

Comments
 (0)