@@ -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);
@@ -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)
{
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@google.com> --- include/linux/sched.h | 2 ++ kernel/sched/core.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+)