[<prev] [next>] [day] [month] [year] [list]
Message-ID: <633c2972-1171-4caa-8825-758d094c0ce9@arm.com>
Date: Wed, 6 Nov 2024 14:55:09 +0000
From: Christian Loehle <christian.loehle@....com>
To: Peter Zijlstra <peterz@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: Ingo Molnar <mingo@...hat.com>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Valentin Schneider <vschneid@...hat.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>
Subject: [RESEND][PATCHv2] cpufreq/schedutil: Only bind threads if needed
Remove the unconditional binding of sugov kthreads to the affected CPUs
if the cpufreq driver indicates that updates can happen from any CPU.
This allows userspace to set affinities to either save power (waking up
bigger CPUs on HMP can be expensive) or increasing performance (by
letting the utilized CPUs run without preemption of the sugov kthread).
Signed-off-by: Christian Loehle <christian.loehle@....com>
Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
Acked-by: Vincent Guittot <vincent.guittot@...aro.org>
Acked-by: Rafael J. Wysocki <rafael@...nel.org>
Acked-by: Juri Lelli <juri.lelli@...hat.com>
---
- RESEND: pick up tags
- v2: Add comment for the dl_task_check_affinity return (Juri)
v2: https://lore.kernel.org/lkml/a4a70646-98a4-4b85-955e-62d66ba68927@arm.com/
v1: https://lore.kernel.org/lkml/480f2140-ea59-4e1d-a68d-18cbcec10941@arm.com/
kernel/sched/cpufreq_schedutil.c | 6 +++++-
kernel/sched/syscalls.c | 7 +++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index c6ba15388ea7..10faab849a3e 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -691,7 +691,11 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
}
sg_policy->thread = thread;
- kthread_bind_mask(thread, policy->related_cpus);
+ if (policy->dvfs_possible_from_any_cpu)
+ set_cpus_allowed_ptr(thread, policy->related_cpus);
+ else
+ kthread_bind_mask(thread, policy->related_cpus);
+
init_irq_work(&sg_policy->irq_work, sugov_irq_work);
mutex_init(&sg_policy->work_lock);
diff --git a/kernel/sched/syscalls.c b/kernel/sched/syscalls.c
index 24f9f90b6574..bd2208dcd15d 100644
--- a/kernel/sched/syscalls.c
+++ b/kernel/sched/syscalls.c
@@ -1177,6 +1177,13 @@ int dl_task_check_affinity(struct task_struct *p, const struct cpumask *mask)
if (!task_has_dl_policy(p) || !dl_bandwidth_enabled())
return 0;
+ /*
+ * The special/sugov task isn't part of regular bandwidth/admission
+ * control so let userspace change affinities.
+ */
+ if (dl_entity_is_special(&p->dl))
+ return 0;
+
/*
* Since bandwidth control happens on root_domain basis,
* if admission test is enabled, we only admit -deadline
--
2.34.1
Powered by blists - more mailing lists