[PATCH 02/14] sched: cpufreq: Use sched_set_deadline() from sugov

From: Quentin Perret
Date: Thu May 07 2020 - 14:11:18 EST


sched_set_deadline() is an exported symbol, use it instead of
sched_setattr_nocheck() to elevate the sugov kthreads to DL.

Signed-off-by: Quentin Perret <qperret@xxxxxxxxxx>
---
kernel/sched/cpufreq_schedutil.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
index 7fbaee24c824..ebd5d30f0861 100644
--- a/kernel/sched/cpufreq_schedutil.c
+++ b/kernel/sched/cpufreq_schedutil.c
@@ -654,20 +654,6 @@ static void sugov_policy_free(struct sugov_policy *sg_policy)
static int sugov_kthread_create(struct sugov_policy *sg_policy)
{
struct task_struct *thread;
- struct sched_attr attr = {
- .size = sizeof(struct sched_attr),
- .sched_policy = SCHED_DEADLINE,
- .sched_flags = SCHED_FLAG_SUGOV,
- .sched_nice = 0,
- .sched_priority = 0,
- /*
- * Fake (unused) bandwidth; workaround to "fix"
- * priority inheritance.
- */
- .sched_runtime = 1000000,
- .sched_deadline = 10000000,
- .sched_period = 10000000,
- };
struct cpufreq_policy *policy = sg_policy->policy;
int ret;

@@ -685,7 +671,9 @@ static int sugov_kthread_create(struct sugov_policy *sg_policy)
return PTR_ERR(thread);
}

- ret = sched_setattr_nocheck(thread, &attr);
+ /* Fake (unused) bandwidth; workaround to "fix" priority inheritance. */
+ ret = sched_set_deadline(thread, 1000000, 10000000, 10000000,
+ SCHED_FLAG_SUGOV);
if (ret) {
kthread_stop(thread);
pr_warn("%s: failed to set SCHED_DEADLINE\n", __func__);
--
2.26.2.526.g744177e7f7-goog