diff options
Diffstat (limited to 'kernel/sched.c')
| -rw-r--r-- | kernel/sched.c | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 8be2c13b50d0..8ee437a5ec1d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -1323,8 +1323,8 @@ static inline void update_load_sub(struct load_weight *lw, unsigned long dec) | |||
| 1323 | * slice expiry etc. | 1323 | * slice expiry etc. |
| 1324 | */ | 1324 | */ |
| 1325 | 1325 | ||
| 1326 | #define WEIGHT_IDLEPRIO 2 | 1326 | #define WEIGHT_IDLEPRIO 3 |
| 1327 | #define WMULT_IDLEPRIO (1 << 31) | 1327 | #define WMULT_IDLEPRIO 1431655765 |
| 1328 | 1328 | ||
| 1329 | /* | 1329 | /* |
| 1330 | * Nice levels are multiplicative, with a gentle 10% change for every | 1330 | * Nice levels are multiplicative, with a gentle 10% change for every |
| @@ -2266,6 +2266,16 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync) | |||
| 2266 | if (!sched_feat(SYNC_WAKEUPS)) | 2266 | if (!sched_feat(SYNC_WAKEUPS)) |
| 2267 | sync = 0; | 2267 | sync = 0; |
| 2268 | 2268 | ||
| 2269 | if (!sync) { | ||
| 2270 | if (current->se.avg_overlap < sysctl_sched_migration_cost && | ||
| 2271 | p->se.avg_overlap < sysctl_sched_migration_cost) | ||
| 2272 | sync = 1; | ||
| 2273 | } else { | ||
| 2274 | if (current->se.avg_overlap >= sysctl_sched_migration_cost || | ||
| 2275 | p->se.avg_overlap >= sysctl_sched_migration_cost) | ||
| 2276 | sync = 0; | ||
| 2277 | } | ||
| 2278 | |||
| 2269 | #ifdef CONFIG_SMP | 2279 | #ifdef CONFIG_SMP |
| 2270 | if (sched_feat(LB_WAKEUP_UPDATE)) { | 2280 | if (sched_feat(LB_WAKEUP_UPDATE)) { |
| 2271 | struct sched_domain *sd; | 2281 | struct sched_domain *sd; |
| @@ -4440,7 +4450,7 @@ void __kprobes sub_preempt_count(int val) | |||
| 4440 | /* | 4450 | /* |
| 4441 | * Underflow? | 4451 | * Underflow? |
| 4442 | */ | 4452 | */ |
| 4443 | if (DEBUG_LOCKS_WARN_ON(val > preempt_count() - (!!kernel_locked()))) | 4453 | if (DEBUG_LOCKS_WARN_ON(val > preempt_count())) |
| 4444 | return; | 4454 | return; |
| 4445 | /* | 4455 | /* |
| 4446 | * Is the spinlock portion underflowing? | 4456 | * Is the spinlock portion underflowing? |
| @@ -4687,8 +4697,8 @@ EXPORT_SYMBOL(default_wake_function); | |||
| 4687 | * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns | 4697 | * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns |
| 4688 | * zero in this (rare) case, and we handle it by continuing to scan the queue. | 4698 | * zero in this (rare) case, and we handle it by continuing to scan the queue. |
| 4689 | */ | 4699 | */ |
| 4690 | static void __wake_up_common(wait_queue_head_t *q, unsigned int mode, | 4700 | void __wake_up_common(wait_queue_head_t *q, unsigned int mode, |
| 4691 | int nr_exclusive, int sync, void *key) | 4701 | int nr_exclusive, int sync, void *key) |
| 4692 | { | 4702 | { |
| 4693 | wait_queue_t *curr, *next; | 4703 | wait_queue_t *curr, *next; |
| 4694 | 4704 | ||
| @@ -5126,7 +5136,7 @@ int can_nice(const struct task_struct *p, const int nice) | |||
| 5126 | * sys_setpriority is a more generic, but much slower function that | 5136 | * sys_setpriority is a more generic, but much slower function that |
| 5127 | * does similar things. | 5137 | * does similar things. |
| 5128 | */ | 5138 | */ |
| 5129 | asmlinkage long sys_nice(int increment) | 5139 | SYSCALL_DEFINE1(nice, int, increment) |
| 5130 | { | 5140 | { |
| 5131 | long nice, retval; | 5141 | long nice, retval; |
| 5132 | 5142 | ||
| @@ -5433,8 +5443,8 @@ do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) | |||
| 5433 | * @policy: new policy. | 5443 | * @policy: new policy. |
| 5434 | * @param: structure containing the new RT priority. | 5444 | * @param: structure containing the new RT priority. |
| 5435 | */ | 5445 | */ |
| 5436 | asmlinkage long | 5446 | SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, |
| 5437 | sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) | 5447 | struct sched_param __user *, param) |
| 5438 | { | 5448 | { |
| 5439 | /* negative values for policy are not valid */ | 5449 | /* negative values for policy are not valid */ |
| 5440 | if (policy < 0) | 5450 | if (policy < 0) |
| @@ -5448,7 +5458,7 @@ sys_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param) | |||
| 5448 | * @pid: the pid in question. | 5458 | * @pid: the pid in question. |
| 5449 | * @param: structure containing the new RT priority. | 5459 | * @param: structure containing the new RT priority. |
| 5450 | */ | 5460 | */ |
| 5451 | asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param) | 5461 | SYSCALL_DEFINE2(sched_setparam, pid_t, pid, struct sched_param __user *, param) |
| 5452 | { | 5462 | { |
| 5453 | return do_sched_setscheduler(pid, -1, param); | 5463 | return do_sched_setscheduler(pid, -1, param); |
| 5454 | } | 5464 | } |
| @@ -5457,7 +5467,7 @@ asmlinkage long sys_sched_setparam(pid_t pid, struct sched_param __user *param) | |||
| 5457 | * sys_sched_getscheduler - get the policy (scheduling class) of a thread | 5467 | * sys_sched_getscheduler - get the policy (scheduling class) of a thread |
| 5458 | * @pid: the pid in question. | 5468 | * @pid: the pid in question. |
| 5459 | */ | 5469 | */ |
| 5460 | asmlinkage long sys_sched_getscheduler(pid_t pid) | 5470 | SYSCALL_DEFINE1(sched_getscheduler, pid_t, pid) |
| 5461 | { | 5471 | { |
| 5462 | struct task_struct *p; | 5472 | struct task_struct *p; |
| 5463 | int retval; | 5473 | int retval; |
| @@ -5482,7 +5492,7 @@ asmlinkage long sys_sched_getscheduler(pid_t pid) | |||
| 5482 | * @pid: the pid in question. | 5492 | * @pid: the pid in question. |
| 5483 | * @param: structure containing the RT priority. | 5493 | * @param: structure containing the RT priority. |
| 5484 | */ | 5494 | */ |
| 5485 | asmlinkage long sys_sched_getparam(pid_t pid, struct sched_param __user *param) | 5495 | SYSCALL_DEFINE2(sched_getparam, pid_t, pid, struct sched_param __user *, param) |
| 5486 | { | 5496 | { |
| 5487 | struct sched_param lp; | 5497 | struct sched_param lp; |
| 5488 | struct task_struct *p; | 5498 | struct task_struct *p; |
| @@ -5600,8 +5610,8 @@ static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len, | |||
| 5600 | * @len: length in bytes of the bitmask pointed to by user_mask_ptr | 5610 | * @len: length in bytes of the bitmask pointed to by user_mask_ptr |
| 5601 | * @user_mask_ptr: user-space pointer to the new cpu mask | 5611 | * @user_mask_ptr: user-space pointer to the new cpu mask |
| 5602 | */ | 5612 | */ |
| 5603 | asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, | 5613 | SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len, |
| 5604 | unsigned long __user *user_mask_ptr) | 5614 | unsigned long __user *, user_mask_ptr) |
| 5605 | { | 5615 | { |
| 5606 | cpumask_var_t new_mask; | 5616 | cpumask_var_t new_mask; |
| 5607 | int retval; | 5617 | int retval; |
| @@ -5648,8 +5658,8 @@ out_unlock: | |||
| 5648 | * @len: length in bytes of the bitmask pointed to by user_mask_ptr | 5658 | * @len: length in bytes of the bitmask pointed to by user_mask_ptr |
| 5649 | * @user_mask_ptr: user-space pointer to hold the current cpu mask | 5659 | * @user_mask_ptr: user-space pointer to hold the current cpu mask |
| 5650 | */ | 5660 | */ |
| 5651 | asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, | 5661 | SYSCALL_DEFINE3(sched_getaffinity, pid_t, pid, unsigned int, len, |
| 5652 | unsigned long __user *user_mask_ptr) | 5662 | unsigned long __user *, user_mask_ptr) |
| 5653 | { | 5663 | { |
| 5654 | int ret; | 5664 | int ret; |
| 5655 | cpumask_var_t mask; | 5665 | cpumask_var_t mask; |
| @@ -5678,7 +5688,7 @@ asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, | |||
| 5678 | * This function yields the current CPU to other tasks. If there are no | 5688 | * This function yields the current CPU to other tasks. If there are no |
| 5679 | * other threads running on this CPU then this function will return. | 5689 | * other threads running on this CPU then this function will return. |
| 5680 | */ | 5690 | */ |
| 5681 | asmlinkage long sys_sched_yield(void) | 5691 | SYSCALL_DEFINE0(sched_yield) |
| 5682 | { | 5692 | { |
| 5683 | struct rq *rq = this_rq_lock(); | 5693 | struct rq *rq = this_rq_lock(); |
| 5684 | 5694 | ||
| @@ -5819,7 +5829,7 @@ long __sched io_schedule_timeout(long timeout) | |||
| 5819 | * this syscall returns the maximum rt_priority that can be used | 5829 | * this syscall returns the maximum rt_priority that can be used |
| 5820 | * by a given scheduling class. | 5830 | * by a given scheduling class. |
| 5821 | */ | 5831 | */ |
| 5822 | asmlinkage long sys_sched_get_priority_max(int policy) | 5832 | SYSCALL_DEFINE1(sched_get_priority_max, int, policy) |
| 5823 | { | 5833 | { |
| 5824 | int ret = -EINVAL; | 5834 | int ret = -EINVAL; |
| 5825 | 5835 | ||
| @@ -5844,7 +5854,7 @@ asmlinkage long sys_sched_get_priority_max(int policy) | |||
| 5844 | * this syscall returns the minimum rt_priority that can be used | 5854 | * this syscall returns the minimum rt_priority that can be used |
| 5845 | * by a given scheduling class. | 5855 | * by a given scheduling class. |
| 5846 | */ | 5856 | */ |
| 5847 | asmlinkage long sys_sched_get_priority_min(int policy) | 5857 | SYSCALL_DEFINE1(sched_get_priority_min, int, policy) |
| 5848 | { | 5858 | { |
| 5849 | int ret = -EINVAL; | 5859 | int ret = -EINVAL; |
| 5850 | 5860 | ||
| @@ -5869,8 +5879,8 @@ asmlinkage long sys_sched_get_priority_min(int policy) | |||
| 5869 | * this syscall writes the default timeslice value of a given process | 5879 | * this syscall writes the default timeslice value of a given process |
| 5870 | * into the user-space timespec buffer. A value of '0' means infinity. | 5880 | * into the user-space timespec buffer. A value of '0' means infinity. |
| 5871 | */ | 5881 | */ |
| 5872 | asmlinkage | 5882 | SYSCALL_DEFINE2(sched_rr_get_interval, pid_t, pid, |
| 5873 | long sys_sched_rr_get_interval(pid_t pid, struct timespec __user *interval) | 5883 | struct timespec __user *, interval) |
| 5874 | { | 5884 | { |
| 5875 | struct task_struct *p; | 5885 | struct task_struct *p; |
| 5876 | unsigned int time_slice; | 5886 | unsigned int time_slice; |
| @@ -9050,6 +9060,13 @@ static int tg_schedulable(struct task_group *tg, void *data) | |||
| 9050 | runtime = d->rt_runtime; | 9060 | runtime = d->rt_runtime; |
| 9051 | } | 9061 | } |
| 9052 | 9062 | ||
| 9063 | #ifdef CONFIG_USER_SCHED | ||
| 9064 | if (tg == &root_task_group) { | ||
| 9065 | period = global_rt_period(); | ||
| 9066 | runtime = global_rt_runtime(); | ||
| 9067 | } | ||
| 9068 | #endif | ||
| 9069 | |||
| 9053 | /* | 9070 | /* |
| 9054 | * Cannot have more runtime than the period. | 9071 | * Cannot have more runtime than the period. |
| 9055 | */ | 9072 | */ |
