[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200507181012.29791-2-qperret@google.com>
Date: Thu, 7 May 2020 19:09:59 +0100
From: Quentin Perret <qperret@...gle.com>
To: linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org
Cc: tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
hpa@...or.com, sudeep.holla@....com, gregkh@...uxfoundation.org,
rafael@...nel.org, viresh.kumar@...aro.org, peterz@...radead.org,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, mcgrof@...nel.org, keescook@...omium.org,
yzaikin@...gle.com, fweisbec@...il.com, tkjos@...gle.com,
kernel-team@...roid.com, qperret@...gle.com
Subject: [PATCH 01/14] sched: Provide sched_set_deadline()
As all the sched_setscheduler*() exports have been removed, introduce
sched_set_deadline() on the model of sched_set_fifo() to enable modules
to create SCHED_DEADLINE tasks.
Signed-off-by: Quentin Perret <qperret@...gle.com>
---
include/linux/sched.h | 2 ++
kernel/sched/core.c | 17 +++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index c0da93a26f62..63c8ae7a0dd8 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1630,6 +1630,8 @@ extern int sched_setscheduler_nocheck(struct task_struct *, int, const struct sc
extern void sched_set_fifo(struct task_struct *p);
extern void sched_set_fifo_low(struct task_struct *p);
extern void sched_set_normal(struct task_struct *p, int nice);
+extern int sched_set_deadline(struct task_struct *p, u64 runtime, u64 deadline,
+ u64 period, u64 flags);
extern int sched_setattr(struct task_struct *, const struct sched_attr *);
extern int sched_setattr_nocheck(struct task_struct *, const struct sched_attr *);
extern struct task_struct *idle_task(int cpu);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7324f3b0f8d2..dbaf3f63df22 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5136,6 +5136,23 @@ void sched_set_normal(struct task_struct *p, int nice)
}
EXPORT_SYMBOL_GPL(sched_set_normal);
+int sched_set_deadline(struct task_struct *p, u64 runtime, u64 deadline,
+ u64 period, u64 flags)
+{
+ struct sched_attr attr = {
+ .size = sizeof(struct sched_attr),
+ .sched_policy = SCHED_DEADLINE,
+ .sched_flags = flags,
+ .sched_nice = 0,
+ .sched_priority = 0,
+ .sched_runtime = runtime,
+ .sched_deadline = deadline,
+ .sched_period = period,
+ };
+ return sched_setattr_nocheck(p, &attr);
+}
+EXPORT_SYMBOL_GPL(sched_set_deadline);
+
static int
do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)
{
--
2.26.2.526.g744177e7f7-goog
Powered by blists - more mailing lists