|
@@ -1952,7 +1952,7 @@ static int dl_overflow(struct task_struct *p, int policy,
|
|
|
{
|
|
{
|
|
|
|
|
|
|
|
struct dl_bw *dl_b = dl_bw_of(task_cpu(p));
|
|
struct dl_bw *dl_b = dl_bw_of(task_cpu(p));
|
|
|
- u64 period = attr->sched_period;
|
|
|
|
|
|
|
+ u64 period = attr->sched_period ?: attr->sched_deadline;
|
|
|
u64 runtime = attr->sched_runtime;
|
|
u64 runtime = attr->sched_runtime;
|
|
|
u64 new_bw = dl_policy(policy) ? to_ratio(period, runtime) : 0;
|
|
u64 new_bw = dl_policy(policy) ? to_ratio(period, runtime) : 0;
|
|
|
int cpus, err = -1;
|
|
int cpus, err = -1;
|
|
@@ -3661,13 +3661,14 @@ SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param)
|
|
|
* @pid: the pid in question.
|
|
* @pid: the pid in question.
|
|
|
* @uattr: structure containing the extended parameters.
|
|
* @uattr: structure containing the extended parameters.
|
|
|
*/
|
|
*/
|
|
|
-SYSCALL_DEFINE2(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr)
|
|
|
|
|
|
|
+SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
|
|
|
|
|
+ unsigned int, flags)
|
|
|
{
|
|
{
|
|
|
struct sched_attr attr;
|
|
struct sched_attr attr;
|
|
|
struct task_struct *p;
|
|
struct task_struct *p;
|
|
|
int retval;
|
|
int retval;
|
|
|
|
|
|
|
|
- if (!uattr || pid < 0)
|
|
|
|
|
|
|
+ if (!uattr || pid < 0 || flags)
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (sched_copy_attr(uattr, &attr))
|
|
if (sched_copy_attr(uattr, &attr))
|
|
@@ -3786,7 +3787,7 @@ static int sched_read_attr(struct sched_attr __user *uattr,
|
|
|
attr->size = usize;
|
|
attr->size = usize;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ret = copy_to_user(uattr, attr, usize);
|
|
|
|
|
|
|
+ ret = copy_to_user(uattr, attr, attr->size);
|
|
|
if (ret)
|
|
if (ret)
|
|
|
return -EFAULT;
|
|
return -EFAULT;
|
|
|
|
|
|
|
@@ -3804,8 +3805,8 @@ static int sched_read_attr(struct sched_attr __user *uattr,
|
|
|
* @uattr: structure containing the extended parameters.
|
|
* @uattr: structure containing the extended parameters.
|
|
|
* @size: sizeof(attr) for fwd/bwd comp.
|
|
* @size: sizeof(attr) for fwd/bwd comp.
|
|
|
*/
|
|
*/
|
|
|
-SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
|
|
|
|
|
- unsigned int, size)
|
|
|
|
|
|
|
+SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
|
|
|
|
|
+ unsigned int, size, unsigned int, flags)
|
|
|
{
|
|
{
|
|
|
struct sched_attr attr = {
|
|
struct sched_attr attr = {
|
|
|
.size = sizeof(struct sched_attr),
|
|
.size = sizeof(struct sched_attr),
|
|
@@ -3814,7 +3815,7 @@ SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr,
|
|
|
int retval;
|
|
int retval;
|
|
|
|
|
|
|
|
if (!uattr || pid < 0 || size > PAGE_SIZE ||
|
|
if (!uattr || pid < 0 || size > PAGE_SIZE ||
|
|
|
- size < SCHED_ATTR_SIZE_VER0)
|
|
|
|
|
|
|
+ size < SCHED_ATTR_SIZE_VER0 || flags)
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
rcu_read_lock();
|
|
rcu_read_lock();
|
|
@@ -7422,6 +7423,7 @@ static int sched_dl_global_constraints(void)
|
|
|
u64 period = global_rt_period();
|
|
u64 period = global_rt_period();
|
|
|
u64 new_bw = to_ratio(period, runtime);
|
|
u64 new_bw = to_ratio(period, runtime);
|
|
|
int cpu, ret = 0;
|
|
int cpu, ret = 0;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Here we want to check the bandwidth not being set to some
|
|
* Here we want to check the bandwidth not being set to some
|
|
@@ -7435,10 +7437,10 @@ static int sched_dl_global_constraints(void)
|
|
|
for_each_possible_cpu(cpu) {
|
|
for_each_possible_cpu(cpu) {
|
|
|
struct dl_bw *dl_b = dl_bw_of(cpu);
|
|
struct dl_bw *dl_b = dl_bw_of(cpu);
|
|
|
|
|
|
|
|
- raw_spin_lock(&dl_b->lock);
|
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&dl_b->lock, flags);
|
|
|
if (new_bw < dl_b->total_bw)
|
|
if (new_bw < dl_b->total_bw)
|
|
|
ret = -EBUSY;
|
|
ret = -EBUSY;
|
|
|
- raw_spin_unlock(&dl_b->lock);
|
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&dl_b->lock, flags);
|
|
|
|
|
|
|
|
if (ret)
|
|
if (ret)
|
|
|
break;
|
|
break;
|
|
@@ -7451,6 +7453,7 @@ static void sched_dl_do_global(void)
|
|
|
{
|
|
{
|
|
|
u64 new_bw = -1;
|
|
u64 new_bw = -1;
|
|
|
int cpu;
|
|
int cpu;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
|
|
|
def_dl_bandwidth.dl_period = global_rt_period();
|
|
def_dl_bandwidth.dl_period = global_rt_period();
|
|
|
def_dl_bandwidth.dl_runtime = global_rt_runtime();
|
|
def_dl_bandwidth.dl_runtime = global_rt_runtime();
|
|
@@ -7464,9 +7467,9 @@ static void sched_dl_do_global(void)
|
|
|
for_each_possible_cpu(cpu) {
|
|
for_each_possible_cpu(cpu) {
|
|
|
struct dl_bw *dl_b = dl_bw_of(cpu);
|
|
struct dl_bw *dl_b = dl_bw_of(cpu);
|
|
|
|
|
|
|
|
- raw_spin_lock(&dl_b->lock);
|
|
|
|
|
|
|
+ raw_spin_lock_irqsave(&dl_b->lock, flags);
|
|
|
dl_b->bw = new_bw;
|
|
dl_b->bw = new_bw;
|
|
|
- raw_spin_unlock(&dl_b->lock);
|
|
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&dl_b->lock, flags);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -7475,7 +7478,8 @@ static int sched_rt_global_validate(void)
|
|
|
if (sysctl_sched_rt_period <= 0)
|
|
if (sysctl_sched_rt_period <= 0)
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
- if (sysctl_sched_rt_runtime > sysctl_sched_rt_period)
|
|
|
|
|
|
|
+ if ((sysctl_sched_rt_runtime != RUNTIME_INF) &&
|
|
|
|
|
+ (sysctl_sched_rt_runtime > sysctl_sched_rt_period))
|
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
return 0;
|
|
return 0;
|