Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
"Misc fixlets: a fair number of them resulting from the new
SCHED_DEADLINE code"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/deadline: Remove useless dl_nr_total
sched/deadline: Test for CPU's presence explicitly
sched: Add 'flags' argument to sched_{set,get}attr() syscalls
sched: Fix information leak in sys_sched_getattr()
sched,numa: add cond_resched to task_numa_work
sched/core: Make dl_b->lock IRQ safe
sched/core: Fix sched_rt_global_validate
sched/deadline: Fix overflow to handle period==0 and deadline!=0
sched/deadline: Fix bad accounting of nr_running

+28 -25
+4 -2
include/linux/syscalls.h
··· 281 281 asmlinkage long sys_sched_setparam(pid_t pid, 282 282 struct sched_param __user *param); 283 283 asmlinkage long sys_sched_setattr(pid_t pid, 284 - struct sched_attr __user *attr); 284 + struct sched_attr __user *attr, 285 + unsigned int flags); 285 286 asmlinkage long sys_sched_getscheduler(pid_t pid); 286 287 asmlinkage long sys_sched_getparam(pid_t pid, 287 288 struct sched_param __user *param); 288 289 asmlinkage long sys_sched_getattr(pid_t pid, 289 290 struct sched_attr __user *attr, 290 - unsigned int size); 291 + unsigned int size, 292 + unsigned int flags); 291 293 asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, 292 294 unsigned long __user *user_mask_ptr); 293 295 asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
+16 -12
kernel/sched/core.c
··· 1952 1952 { 1953 1953 1954 1954 struct dl_bw *dl_b = dl_bw_of(task_cpu(p)); 1955 - u64 period = attr->sched_period; 1955 + u64 period = attr->sched_period ?: attr->sched_deadline; 1956 1956 u64 runtime = attr->sched_runtime; 1957 1957 u64 new_bw = dl_policy(policy) ? to_ratio(period, runtime) : 0; 1958 1958 int cpus, err = -1; ··· 3661 3661 * @pid: the pid in question. 3662 3662 * @uattr: structure containing the extended parameters. 3663 3663 */ 3664 - SYSCALL_DEFINE2(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr) 3664 + SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr, 3665 + unsigned int, flags) 3665 3666 { 3666 3667 struct sched_attr attr; 3667 3668 struct task_struct *p; 3668 3669 int retval; 3669 3670 3670 - if (!uattr || pid < 0) 3671 + if (!uattr || pid < 0 || flags) 3671 3672 return -EINVAL; 3672 3673 3673 3674 if (sched_copy_attr(uattr, &attr)) ··· 3787 3786 attr->size = usize; 3788 3787 } 3789 3788 3790 - ret = copy_to_user(uattr, attr, usize); 3789 + ret = copy_to_user(uattr, attr, attr->size); 3791 3790 if (ret) 3792 3791 return -EFAULT; 3793 3792 ··· 3805 3804 * @uattr: structure containing the extended parameters. 3806 3805 * @size: sizeof(attr) for fwd/bwd comp. 3807 3806 */ 3808 - SYSCALL_DEFINE3(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, 3809 - unsigned int, size) 3807 + SYSCALL_DEFINE4(sched_getattr, pid_t, pid, struct sched_attr __user *, uattr, 3808 + unsigned int, size, unsigned int, flags) 3810 3809 { 3811 3810 struct sched_attr attr = { 3812 3811 .size = sizeof(struct sched_attr), ··· 3815 3814 int retval; 3816 3815 3817 3816 if (!uattr || pid < 0 || size > PAGE_SIZE || 3818 - size < SCHED_ATTR_SIZE_VER0) 3817 + size < SCHED_ATTR_SIZE_VER0 || flags) 3819 3818 return -EINVAL; 3820 3819 3821 3820 rcu_read_lock(); ··· 7423 7422 u64 period = global_rt_period(); 7424 7423 u64 new_bw = to_ratio(period, runtime); 7425 7424 int cpu, ret = 0; 7425 + unsigned long flags; 7426 7426 7427 7427 /* 7428 7428 * Here we want to check the bandwidth not being set to some ··· 7437 7435 for_each_possible_cpu(cpu) { 7438 7436 struct dl_bw *dl_b = dl_bw_of(cpu); 7439 7437 7440 - raw_spin_lock(&dl_b->lock); 7438 + raw_spin_lock_irqsave(&dl_b->lock, flags); 7441 7439 if (new_bw < dl_b->total_bw) 7442 7440 ret = -EBUSY; 7443 - raw_spin_unlock(&dl_b->lock); 7441 + raw_spin_unlock_irqrestore(&dl_b->lock, flags); 7444 7442 7445 7443 if (ret) 7446 7444 break; ··· 7453 7451 { 7454 7452 u64 new_bw = -1; 7455 7453 int cpu; 7454 + unsigned long flags; 7456 7455 7457 7456 def_dl_bandwidth.dl_period = global_rt_period(); 7458 7457 def_dl_bandwidth.dl_runtime = global_rt_runtime(); ··· 7467 7464 for_each_possible_cpu(cpu) { 7468 7465 struct dl_bw *dl_b = dl_bw_of(cpu); 7469 7466 7470 - raw_spin_lock(&dl_b->lock); 7467 + raw_spin_lock_irqsave(&dl_b->lock, flags); 7471 7468 dl_b->bw = new_bw; 7472 - raw_spin_unlock(&dl_b->lock); 7469 + raw_spin_unlock_irqrestore(&dl_b->lock, flags); 7473 7470 } 7474 7471 } 7475 7472 ··· 7478 7475 if (sysctl_sched_rt_period <= 0) 7479 7476 return -EINVAL; 7480 7477 7481 - if (sysctl_sched_rt_runtime > sysctl_sched_rt_period) 7478 + if ((sysctl_sched_rt_runtime != RUNTIME_INF) && 7479 + (sysctl_sched_rt_runtime > sysctl_sched_rt_period)) 7482 7480 return -EINVAL; 7483 7481 7484 7482 return 0;
+3 -3
kernel/sched/cpudeadline.c
··· 70 70 71 71 static void cpudl_change_key(struct cpudl *cp, int idx, u64 new_dl) 72 72 { 73 - WARN_ON(idx > num_present_cpus() || idx == IDX_INVALID); 73 + WARN_ON(!cpu_present(idx) || idx == IDX_INVALID); 74 74 75 75 if (dl_time_before(new_dl, cp->elements[idx].dl)) { 76 76 cp->elements[idx].dl = new_dl; ··· 117 117 } 118 118 119 119 out: 120 - WARN_ON(best_cpu > num_present_cpus() && best_cpu != -1); 120 + WARN_ON(!cpu_present(best_cpu) && best_cpu != -1); 121 121 122 122 return best_cpu; 123 123 } ··· 137 137 int old_idx, new_cpu; 138 138 unsigned long flags; 139 139 140 - WARN_ON(cpu > num_present_cpus()); 140 + WARN_ON(!cpu_present(cpu)); 141 141 142 142 raw_spin_lock_irqsave(&cp->lock, flags); 143 143 old_idx = cp->cpu_to_idx[cpu];
+3 -7
kernel/sched/deadline.c
··· 121 121 122 122 static void update_dl_migration(struct dl_rq *dl_rq) 123 123 { 124 - if (dl_rq->dl_nr_migratory && dl_rq->dl_nr_total > 1) { 124 + if (dl_rq->dl_nr_migratory && dl_rq->dl_nr_running > 1) { 125 125 if (!dl_rq->overloaded) { 126 126 dl_set_overload(rq_of_dl_rq(dl_rq)); 127 127 dl_rq->overloaded = 1; ··· 137 137 struct task_struct *p = dl_task_of(dl_se); 138 138 dl_rq = &rq_of_dl_rq(dl_rq)->dl; 139 139 140 - dl_rq->dl_nr_total++; 141 140 if (p->nr_cpus_allowed > 1) 142 141 dl_rq->dl_nr_migratory++; 143 142 ··· 148 149 struct task_struct *p = dl_task_of(dl_se); 149 150 dl_rq = &rq_of_dl_rq(dl_rq)->dl; 150 151 151 - dl_rq->dl_nr_total--; 152 152 if (p->nr_cpus_allowed > 1) 153 153 dl_rq->dl_nr_migratory--; 154 154 ··· 715 717 716 718 WARN_ON(!dl_prio(prio)); 717 719 dl_rq->dl_nr_running++; 720 + inc_nr_running(rq_of_dl_rq(dl_rq)); 718 721 719 722 inc_dl_deadline(dl_rq, deadline); 720 723 inc_dl_migration(dl_se, dl_rq); ··· 729 730 WARN_ON(!dl_prio(prio)); 730 731 WARN_ON(!dl_rq->dl_nr_running); 731 732 dl_rq->dl_nr_running--; 733 + dec_nr_running(rq_of_dl_rq(dl_rq)); 732 734 733 735 dec_dl_deadline(dl_rq, dl_se->deadline); 734 736 dec_dl_migration(dl_se, dl_rq); ··· 836 836 837 837 if (!task_current(rq, p) && p->nr_cpus_allowed > 1) 838 838 enqueue_pushable_dl_task(rq, p); 839 - 840 - inc_nr_running(rq); 841 839 } 842 840 843 841 static void __dequeue_task_dl(struct rq *rq, struct task_struct *p, int flags) ··· 848 850 { 849 851 update_curr_dl(rq); 850 852 __dequeue_task_dl(rq, p, flags); 851 - 852 - dec_nr_running(rq); 853 853 } 854 854 855 855 /*
+2
kernel/sched/fair.c
··· 1757 1757 start = end; 1758 1758 if (pages <= 0) 1759 1759 goto out; 1760 + 1761 + cond_resched(); 1760 1762 } while (end != vma->vm_end); 1761 1763 } 1762 1764
-1
kernel/sched/sched.h
··· 462 462 } earliest_dl; 463 463 464 464 unsigned long dl_nr_migratory; 465 - unsigned long dl_nr_total; 466 465 int overloaded; 467 466 468 467 /*