diff mbox

[1/2] cpufreq: schedutil: Don't restrict kthread to related_cpus unnecessarily

Message ID 8dd297a6ed05ed3f6c33aeb3059e71a1d270c530.1502338812.git.viresh.kumar@linaro.org (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Viresh Kumar Aug. 10, 2017, 4:20 a.m. UTC
Utilization update callbacks are now processed remotely, even on the
CPUs that don't share cpufreq policy with the target CPU (if
dvfs_possible_from_any_cpu flag is set).

But in non-fast switch paths, the frequency is changed only from one of
policy->related_cpus. This happens because the kthread which does the
actual update is bound to a subset of CPUs (i.e. related_cpus).

Allow frequency to be remotely updated as well (i.e. call
__cpufreq_driver_target()) if dvfs_possible_from_any_cpu flag is set.

Reported-by: Pavan Kondeti <pkondeti@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/sched/cpufreq_schedutil.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Pavan Kondeti Aug. 10, 2017, 6:58 a.m. UTC | #1
On Thu, Aug 10, 2017 at 9:50 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> Utilization update callbacks are now processed remotely, even on the
> CPUs that don't share cpufreq policy with the target CPU (if
> dvfs_possible_from_any_cpu flag is set).
>
> But in non-fast switch paths, the frequency is changed only from one of
> policy->related_cpus. This happens because the kthread which does the
> actual update is bound to a subset of CPUs (i.e. related_cpus).
>
> Allow frequency to be remotely updated as well (i.e. call
> __cpufreq_driver_target()) if dvfs_possible_from_any_cpu flag is set.
>
> Reported-by: Pavan Kondeti <pkondeti@codeaurora.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  kernel/sched/cpufreq_schedutil.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 2e74c49776be..504d0752f8f2 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -487,7 +487,11 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
>         }
>
>         sg_policy->thread = thread;
> -       kthread_bind_mask(thread, policy->related_cpus);
> +
> +       /* Kthread is bound to all CPUs by default */
> +       if (!policy->dvfs_possible_from_any_cpu)
> +               kthread_bind_mask(thread, policy->related_cpus);
> +

LGTM. Your other patch in this series is also nice. Thanks for doing it.

Thanks,
Pavan
Rafael J. Wysocki Aug. 22, 2017, 1:26 p.m. UTC | #2
On Thursday, August 10, 2017 6:20:55 AM CEST Viresh Kumar wrote:
> Utilization update callbacks are now processed remotely, even on the
> CPUs that don't share cpufreq policy with the target CPU (if
> dvfs_possible_from_any_cpu flag is set).
> 
> But in non-fast switch paths, the frequency is changed only from one of
> policy->related_cpus. This happens because the kthread which does the
> actual update is bound to a subset of CPUs (i.e. related_cpus).
> 
> Allow frequency to be remotely updated as well (i.e. call
> __cpufreq_driver_target()) if dvfs_possible_from_any_cpu flag is set.
> 
> Reported-by: Pavan Kondeti <pkondeti@codeaurora.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  kernel/sched/cpufreq_schedutil.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 2e74c49776be..504d0752f8f2 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -487,7 +487,11 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
>  	}
>  
>  	sg_policy->thread = thread;
> -	kthread_bind_mask(thread, policy->related_cpus);
> +
> +	/* Kthread is bound to all CPUs by default */
> +	if (!policy->dvfs_possible_from_any_cpu)
> +		kthread_bind_mask(thread, policy->related_cpus);
> +
>  	init_irq_work(&sg_policy->irq_work, sugov_irq_work);
>  	mutex_init(&sg_policy->work_lock);
>  
> 

Applied, thanks!
diff mbox

Patch

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 2e74c49776be..504d0752f8f2 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -487,7 +487,11 @@  static int sugov_kthread_create(struct sugov_policy *sg_policy)
 	}
 
 	sg_policy->thread = thread;
-	kthread_bind_mask(thread, policy->related_cpus);
+
+	/* Kthread is bound to all CPUs by default */
+	if (!policy->dvfs_possible_from_any_cpu)
+		kthread_bind_mask(thread, policy->related_cpus);
+
 	init_irq_work(&sg_policy->irq_work, sugov_irq_work);
 	mutex_init(&sg_policy->work_lock);