All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Ionela Voinescu <ionela.voinescu@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Quentin Perret <qperret@google.com>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND v2 1/3] sched/topology,schedutil: wrap sched domains rebuild
Date: Fri, 30 Oct 2020 16:26:32 +0100	[thread overview]
Message-ID: <CAJZ5v0gg7dz44s_fjtJKm8Sv87RZypxYe3EwXX74oAuk31GW1Q@mail.gmail.com> (raw)
In-Reply-To: <20201027180713.7642-2-ionela.voinescu@arm.com>

On Tue, Oct 27, 2020 at 7:08 PM Ionela Voinescu <ionela.voinescu@arm.com> wrote:
>
> Add the rebuild_sched_domains_energy() function to wrap the functionality
> that rebuilds the scheduling domains if any of the Energy Aware Scheduling
> (EAS) initialisation conditions change. This functionality is used when
> schedutil is added or removed or when EAS is enabled or disabled
> through the sched_energy_aware sysctl.
>
> Therefore, create a single function that is used in both these cases and
> that can be later reused.
>
> Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com>
> Acked-by: Quentin Perret <qperret@google.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>

For the schedutil part:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

and I'm assuming the patch to be taken care of by Peter.

> ---
>  include/linux/sched/topology.h   |  8 ++++++++
>  kernel/sched/cpufreq_schedutil.c |  9 +--------
>  kernel/sched/topology.c          | 18 +++++++++++-------
>  3 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index 9ef7bf686a9f..8f0f778b7c91 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -225,6 +225,14 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu)
>
>  #endif /* !CONFIG_SMP */
>
> +#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
> +extern void rebuild_sched_domains_energy(void);
> +#else
> +static inline void rebuild_sched_domains_energy(void)
> +{
> +}
> +#endif
> +
>  #ifndef arch_scale_cpu_capacity
>  /**
>   * arch_scale_cpu_capacity - get the capacity scale factor of a given CPU.
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index e254745a82cb..37b303890336 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -899,16 +899,9 @@ struct cpufreq_governor *cpufreq_default_governor(void)
>  cpufreq_governor_init(schedutil_gov);
>
>  #ifdef CONFIG_ENERGY_MODEL
> -extern bool sched_energy_update;
> -extern struct mutex sched_energy_mutex;
> -
>  static void rebuild_sd_workfn(struct work_struct *work)
>  {
> -       mutex_lock(&sched_energy_mutex);
> -       sched_energy_update = true;
> -       rebuild_sched_domains();
> -       sched_energy_update = false;
> -       mutex_unlock(&sched_energy_mutex);
> +       rebuild_sched_domains_energy();
>  }
>  static DECLARE_WORK(rebuild_sd_work, rebuild_sd_workfn);
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index dd7770226086..270bafb73506 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -211,6 +211,15 @@ unsigned int sysctl_sched_energy_aware = 1;
>  DEFINE_MUTEX(sched_energy_mutex);
>  bool sched_energy_update;
>
> +void rebuild_sched_domains_energy(void)
> +{
> +       mutex_lock(&sched_energy_mutex);
> +       sched_energy_update = true;
> +       rebuild_sched_domains();
> +       sched_energy_update = false;
> +       mutex_unlock(&sched_energy_mutex);
> +}
> +
>  #ifdef CONFIG_PROC_SYSCTL
>  int sched_energy_aware_handler(struct ctl_table *table, int write,
>                 void *buffer, size_t *lenp, loff_t *ppos)
> @@ -223,13 +232,8 @@ int sched_energy_aware_handler(struct ctl_table *table, int write,
>         ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
>         if (!ret && write) {
>                 state = static_branch_unlikely(&sched_energy_present);
> -               if (state != sysctl_sched_energy_aware) {
> -                       mutex_lock(&sched_energy_mutex);
> -                       sched_energy_update = 1;
> -                       rebuild_sched_domains();
> -                       sched_energy_update = 0;
> -                       mutex_unlock(&sched_energy_mutex);
> -               }
> +               if (state != sysctl_sched_energy_aware)
> +                       rebuild_sched_domains_energy();
>         }
>
>         return ret;
> --
> 2.17.1
>

WARNING: multiple messages have this Message-ID (diff)
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Ionela Voinescu <ionela.voinescu@arm.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>,
	Quentin Perret <qperret@google.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Linux PM <linux-pm@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Will Deacon <will@kernel.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH RESEND v2 1/3] sched/topology,schedutil: wrap sched domains rebuild
Date: Fri, 30 Oct 2020 16:26:32 +0100	[thread overview]
Message-ID: <CAJZ5v0gg7dz44s_fjtJKm8Sv87RZypxYe3EwXX74oAuk31GW1Q@mail.gmail.com> (raw)
In-Reply-To: <20201027180713.7642-2-ionela.voinescu@arm.com>

On Tue, Oct 27, 2020 at 7:08 PM Ionela Voinescu <ionela.voinescu@arm.com> wrote:
>
> Add the rebuild_sched_domains_energy() function to wrap the functionality
> that rebuilds the scheduling domains if any of the Energy Aware Scheduling
> (EAS) initialisation conditions change. This functionality is used when
> schedutil is added or removed or when EAS is enabled or disabled
> through the sched_energy_aware sysctl.
>
> Therefore, create a single function that is used in both these cases and
> that can be later reused.
>
> Signed-off-by: Ionela Voinescu <ionela.voinescu@arm.com>
> Acked-by: Quentin Perret <qperret@google.com>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>

For the schedutil part:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

and I'm assuming the patch to be taken care of by Peter.

> ---
>  include/linux/sched/topology.h   |  8 ++++++++
>  kernel/sched/cpufreq_schedutil.c |  9 +--------
>  kernel/sched/topology.c          | 18 +++++++++++-------
>  3 files changed, 20 insertions(+), 15 deletions(-)
>
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index 9ef7bf686a9f..8f0f778b7c91 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -225,6 +225,14 @@ static inline bool cpus_share_cache(int this_cpu, int that_cpu)
>
>  #endif /* !CONFIG_SMP */
>
> +#if defined(CONFIG_ENERGY_MODEL) && defined(CONFIG_CPU_FREQ_GOV_SCHEDUTIL)
> +extern void rebuild_sched_domains_energy(void);
> +#else
> +static inline void rebuild_sched_domains_energy(void)
> +{
> +}
> +#endif
> +
>  #ifndef arch_scale_cpu_capacity
>  /**
>   * arch_scale_cpu_capacity - get the capacity scale factor of a given CPU.
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index e254745a82cb..37b303890336 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -899,16 +899,9 @@ struct cpufreq_governor *cpufreq_default_governor(void)
>  cpufreq_governor_init(schedutil_gov);
>
>  #ifdef CONFIG_ENERGY_MODEL
> -extern bool sched_energy_update;
> -extern struct mutex sched_energy_mutex;
> -
>  static void rebuild_sd_workfn(struct work_struct *work)
>  {
> -       mutex_lock(&sched_energy_mutex);
> -       sched_energy_update = true;
> -       rebuild_sched_domains();
> -       sched_energy_update = false;
> -       mutex_unlock(&sched_energy_mutex);
> +       rebuild_sched_domains_energy();
>  }
>  static DECLARE_WORK(rebuild_sd_work, rebuild_sd_workfn);
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index dd7770226086..270bafb73506 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -211,6 +211,15 @@ unsigned int sysctl_sched_energy_aware = 1;
>  DEFINE_MUTEX(sched_energy_mutex);
>  bool sched_energy_update;
>
> +void rebuild_sched_domains_energy(void)
> +{
> +       mutex_lock(&sched_energy_mutex);
> +       sched_energy_update = true;
> +       rebuild_sched_domains();
> +       sched_energy_update = false;
> +       mutex_unlock(&sched_energy_mutex);
> +}
> +
>  #ifdef CONFIG_PROC_SYSCTL
>  int sched_energy_aware_handler(struct ctl_table *table, int write,
>                 void *buffer, size_t *lenp, loff_t *ppos)
> @@ -223,13 +232,8 @@ int sched_energy_aware_handler(struct ctl_table *table, int write,
>         ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
>         if (!ret && write) {
>                 state = static_branch_unlikely(&sched_energy_present);
> -               if (state != sysctl_sched_energy_aware) {
> -                       mutex_lock(&sched_energy_mutex);
> -                       sched_energy_update = 1;
> -                       rebuild_sched_domains();
> -                       sched_energy_update = 0;
> -                       mutex_unlock(&sched_energy_mutex);
> -               }
> +               if (state != sysctl_sched_energy_aware)
> +                       rebuild_sched_domains_energy();
>         }
>
>         return ret;
> --
> 2.17.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-10-30 15:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27 18:07 [PATCH RESEND v2 0/3] condition EAS enablement on FI support Ionela Voinescu
2020-10-27 18:07 ` Ionela Voinescu
2020-10-27 18:07 ` [PATCH RESEND v2 1/3] sched/topology,schedutil: wrap sched domains rebuild Ionela Voinescu
2020-10-27 18:07   ` [PATCH RESEND v2 1/3] sched/topology, schedutil: " Ionela Voinescu
2020-10-30 15:26   ` Rafael J. Wysocki [this message]
2020-10-30 15:26     ` [PATCH RESEND v2 1/3] sched/topology,schedutil: " Rafael J. Wysocki
2020-11-05 14:03     ` Ionela Voinescu
2020-11-05 14:03       ` Ionela Voinescu
2020-11-20 12:34   ` [tip: sched/core] sched/topology,schedutil: Wrap " tip-bot2 for Ionela Voinescu
2020-10-27 18:07 ` [PATCH RESEND v2 2/3] arm64: rebuild sched domains on invariance status changes Ionela Voinescu
2020-10-27 18:07   ` Ionela Voinescu
2020-11-10 17:20   ` Catalin Marinas
2020-11-10 17:20     ` Catalin Marinas
2020-11-20 12:34   ` [tip: sched/core] arm64: Rebuild " tip-bot2 for Ionela Voinescu
2020-10-27 18:07 ` [PATCH RESEND v2 3/3] sched/topology: condition EAS enablement on FIE support Ionela Voinescu
2020-10-27 18:07   ` Ionela Voinescu
2020-11-20 12:34   ` [tip: sched/core] sched/topology: Condition " tip-bot2 for Ionela Voinescu
2020-11-18 11:42 ` [PATCH RESEND v2 0/3] condition EAS enablement on FI support Ionela Voinescu
2020-11-18 11:42   ` Ionela Voinescu
2020-11-18 14:01   ` Peter Zijlstra
2020-11-18 14:01     ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJZ5v0gg7dz44s_fjtJKm8Sv87RZypxYe3EwXX74oAuk31GW1Q@mail.gmail.com \
    --to=rafael@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=ionela.voinescu@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=qperret@google.com \
    --cc=rjw@rjwysocki.net \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.