Message ID | 20200507181012.29791-14-qperret@google.com (mailing list archive) |
---|---|
State | RFC, archived |
Headers | show |
Series | Modularize schedutil | expand |
Hi Quentin On Thu, May 07, 2020 at 07:10:11PM +0100, Quentin Perret wrote: > The IS_ENABLED() macro evaluates to true when an option is set to =y or > =m. As such, it is a good fit for tristate options. > > In preparation for modularizing schedutil, change all the related ifdefs > to use IS_ENABLED(). > > Signed-off-by: Quentin Perret <qperret@google.com> > --- > include/linux/cpufreq.h | 2 +- > include/linux/sched/sysctl.h | 2 +- > kernel/sched/sched.h | 4 ++-- > kernel/sched/topology.c | 4 ++-- > kernel/sysctl.c | 2 +- > 5 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index 267cc3b624da..c1176b8a0f61 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -983,7 +983,7 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) > } > #endif > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > void sched_cpufreq_governor_change(struct cpufreq_policy *policy, > struct cpufreq_governor *old_gov); > #else > diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h > index d4f6215ee03f..704d971f204f 100644 > --- a/include/linux/sched/sysctl.h > +++ b/include/linux/sched/sysctl.h > @@ -94,7 +94,7 @@ extern int sysctl_schedstats(struct ctl_table *table, int write, > void __user *buffer, size_t *lenp, > loff_t *ppos); > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > extern unsigned int sysctl_sched_energy_aware; > extern int sched_energy_aware_handler(struct ctl_table *table, int write, > void __user *buffer, size_t *lenp, > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 60592cde80e8..087508723e58 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -217,7 +217,7 @@ static inline void update_avg(u64 *avg, u64 sample) > > static inline bool dl_entity_is_special(struct sched_dl_entity *dl_se) > { > -#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL > +#if IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > return unlikely(dl_se->flags & SCHED_FLAG_SUGOV); > #else > return false; > @@ -2459,7 +2459,7 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned > } > #endif > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > > #define perf_domain_span(pd) (to_cpumask(((pd)->em_pd->cpus))) > > diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c > index b905f2e8d9b2..5f49d25730bd 100644 > --- a/kernel/sched/topology.c > +++ b/kernel/sched/topology.c > @@ -201,7 +201,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) > return 1; > } > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > DEFINE_STATIC_KEY_FALSE(sched_energy_present); > unsigned int sysctl_sched_energy_aware = 1; > DEFINE_MUTEX(sched_energy_mutex); > @@ -2287,7 +2287,7 @@ void partition_sched_domains_locked(int ndoms_new, cpumask_var_t doms_new[], > ; > } > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > /* Build perf. domains: */ > for (i = 0; i < ndoms_new; i++) { > for (j = 0; j < n && !sched_energy_update; j++) { Now that scheduler does not have any references to schedutil_gov and cpufreq has want_eas flag, do we need this CONFIG_CPU_FREQ_GOV_SCHEDUTIL checks here? Thanks, Pavan
On Friday 08 May 2020 at 11:00:53 (+0530), Pavan Kondeti wrote: > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > > /* Build perf. domains: */ > > for (i = 0; i < ndoms_new; i++) { > > for (j = 0; j < n && !sched_energy_update; j++) { > > Now that scheduler does not have any references to schedutil_gov and cpufreq > has want_eas flag, do we need this CONFIG_CPU_FREQ_GOV_SCHEDUTIL checks here? Right, they're not absolutely required, but given that sugov is the only one to have 'want_eas' set I guess there is no need to compile that in without it, no? Cheers, Quentin
On Fri, May 08, 2020 at 02:21:29PM +0100, Quentin Perret wrote: > On Friday 08 May 2020 at 11:00:53 (+0530), Pavan Kondeti wrote: > > > -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > > > +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) > > > /* Build perf. domains: */ > > > for (i = 0; i < ndoms_new; i++) { > > > for (j = 0; j < n && !sched_energy_update; j++) { > > > > Now that scheduler does not have any references to schedutil_gov and cpufreq > > has want_eas flag, do we need this CONFIG_CPU_FREQ_GOV_SCHEDUTIL checks here? > > Right, they're not absolutely required, but given that sugov is the only > one to have 'want_eas' set I guess there is no need to compile that in > without it, no? > Right. Since you removed all compile time dependencies on schedutil, I thought the #ifdef check around schedutil can be removed too. Thanks, Pavan
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 267cc3b624da..c1176b8a0f61 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -983,7 +983,7 @@ static inline bool policy_has_boost_freq(struct cpufreq_policy *policy) } #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) void sched_cpufreq_governor_change(struct cpufreq_policy *policy, struct cpufreq_governor *old_gov); #else diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index d4f6215ee03f..704d971f204f 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -94,7 +94,7 @@ extern int sysctl_schedstats(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos); -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) extern unsigned int sysctl_sched_energy_aware; extern int sched_energy_aware_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 60592cde80e8..087508723e58 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -217,7 +217,7 @@ static inline void update_avg(u64 *avg, u64 sample) static inline bool dl_entity_is_special(struct sched_dl_entity *dl_se) { -#ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL +#if IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) return unlikely(dl_se->flags & SCHED_FLAG_SUGOV); #else return false; @@ -2459,7 +2459,7 @@ unsigned long scale_irq_capacity(unsigned long util, unsigned long irq, unsigned } #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) #define perf_domain_span(pd) (to_cpumask(((pd)->em_pd->cpus))) diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index b905f2e8d9b2..5f49d25730bd 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -201,7 +201,7 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) return 1; } -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) DEFINE_STATIC_KEY_FALSE(sched_energy_present); unsigned int sysctl_sched_energy_aware = 1; DEFINE_MUTEX(sched_energy_mutex); @@ -2287,7 +2287,7 @@ void partition_sched_domains_locked(int ndoms_new, cpumask_var_t doms_new[], ; } -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) /* Build perf. domains: */ for (i = 0; i < ndoms_new; i++) { for (j = 0; j < n && !sched_energy_update; j++) { diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8a176d8727a3..e115bf26cdb0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -475,7 +475,7 @@ static struct ctl_table kern_table[] = { .extra1 = SYSCTL_ONE, }, #endif -#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) +#if defined(CONFIG_ENERGY_MODEL) && IS_ENABLED(CONFIG_CPU_FREQ_GOV_SCHEDUTIL) { .procname = "sched_energy_aware", .data = &sysctl_sched_energy_aware,
The IS_ENABLED() macro evaluates to true when an option is set to =y or =m. As such, it is a good fit for tristate options. In preparation for modularizing schedutil, change all the related ifdefs to use IS_ENABLED(). Signed-off-by: Quentin Perret <qperret@google.com> --- include/linux/cpufreq.h | 2 +- include/linux/sched/sysctl.h | 2 +- kernel/sched/sched.h | 4 ++-- kernel/sched/topology.c | 4 ++-- kernel/sysctl.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)