sched/deadline: Change sched_getparam() behaviour vs SCHED_DEADLINE
authorPeter Zijlstra <[email protected]>
Mon, 12 May 2014 20:50:34 +0000 (22:50 +0200)
committerIngo Molnar <[email protected]>
Thu, 22 May 2014 08:21:26 +0000 (10:21 +0200)
The way we read POSIX one should only call sched_getparam() when
sched_getscheduler() returns either SCHED_FIFO or SCHED_RR.

Given that we currently return sched_param::sched_priority=0 for all
others, extend the same behaviour to SCHED_DEADLINE.

Requested-by: Michael Kerrisk <[email protected]>
Signed-off-by: Peter Zijlstra <[email protected]>
Acked-by: Michael Kerrisk <[email protected]>
Cc: Dario Faggioli <[email protected]>
Cc: linux-man <[email protected]>
Cc: "Michael Kerrisk (man-pages)" <[email protected]>
Cc: Juri Lelli <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
kernel/sched/core.c

index cdefcf7c5925346782c6af4da3dcbeb2708fb261..f3f08bf943552e2faae9560e8e8fd73b0b385aaa 100644 (file)
@@ -3713,7 +3713,7 @@ SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid)
  */
 SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
 {
-       struct sched_param lp;
+       struct sched_param lp = { .sched_priority = 0 };
        struct task_struct *p;
        int retval;
 
@@ -3730,11 +3730,8 @@ SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param)
        if (retval)
                goto out_unlock;
 
-       if (task_has_dl_policy(p)) {
-               retval = -EINVAL;
-               goto out_unlock;
-       }
-       lp.sched_priority = p->rt_priority;
+       if (task_has_rt_policy(p))
+               lp.sched_priority = p->rt_priority;
        rcu_read_unlock();
 
        /*