aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched/core.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r--kernel/sched/core.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 18a6966567da..e74f0a5a8647 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -16,6 +16,7 @@
16#include <linux/init_task.h> 16#include <linux/init_task.h>
17#include <linux/context_tracking.h> 17#include <linux/context_tracking.h>
18#include <linux/rcupdate_wait.h> 18#include <linux/rcupdate_wait.h>
19#include <linux/compat.h>
19 20
20#include <linux/blkdev.h> 21#include <linux/blkdev.h>
21#include <linux/kprobes.h> 22#include <linux/kprobes.h>
@@ -5098,13 +5099,11 @@ SYSCALL_DEFINE1(sched_get_priority_min, int, policy)
5098 * Return: On success, 0 and the timeslice is in @interval. Otherwise, 5099 * Return: On success, 0 and the timeslice is in @interval. Otherwise,
5099 * an error code. 5100 * an error code.
5100 */ 5101 */
5101SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, 5102static int sched_rr_get_interval(pid_t pid, struct timespec64 *t)
5102 struct timespec __user *, interval)
5103{ 5103{
5104 struct task_struct *p; 5104 struct task_struct *p;
5105 unsigned int time_slice; 5105 unsigned int time_slice;
5106 struct rq_flags rf; 5106 struct rq_flags rf;
5107 struct timespec t;
5108 struct rq *rq; 5107 struct rq *rq;
5109 int retval; 5108 int retval;
5110 5109
@@ -5128,15 +5127,40 @@ SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
5128 task_rq_unlock(rq, p, &rf); 5127 task_rq_unlock(rq, p, &rf);
5129 5128
5130 rcu_read_unlock(); 5129 rcu_read_unlock();
5131 jiffies_to_timespec(time_slice, &t); 5130 jiffies_to_timespec64(time_slice, t);
5132 retval = copy_to_user(interval, &t, sizeof(t)) ? -EFAULT : 0; 5131 return 0;
5133 return retval;
5134 5132
5135out_unlock: 5133out_unlock:
5136 rcu_read_unlock(); 5134 rcu_read_unlock();
5137 return retval; 5135 return retval;
5138} 5136}
5139 5137
5138SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid,
5139 struct timespec __user *, interval)
5140{
5141 struct timespec64 t;
5142 int retval = sched_rr_get_interval(pid, &t);
5143
5144 if (retval == 0)
5145 retval = put_timespec64(&t, interval);
5146
5147 return retval;
5148}
5149
5150#ifdef CONFIG_COMPAT
5151COMPAT_SYSCALL_DEFINE2(sched_rr_get_interval,
5152 compat_pid_t, pid,
5153 struct compat_timespec __user *, interval)
5154{
5155 struct timespec64 t;
5156 int retval = sched_rr_get_interval(pid, &t);
5157
5158 if (retval == 0)
5159 retval = compat_put_timespec64(&t, interval);
5160 return retval;
5161}
5162#endif
5163
5140void sched_show_task(struct task_struct *p) 5164void sched_show_task(struct task_struct *p)
5141{ 5165{
5142 unsigned long free = 0; 5166 unsigned long free = 0;