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 fixes: group scheduling corner case fix, two deadline scheduler
fixes, effective_load() overflow fix, nested sleep fix, 6144 CPUs
system fix"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
sched/fair: Fix RCU stall upon -ENOMEM in sched_create_group()
sched/deadline: Avoid double-accounting in case of missed deadlines
sched/deadline: Fix migration of SCHED_DEADLINE tasks
sched: Fix odd values in effective_load() calculations
sched, fanotify: Deal with nested sleeps
sched: Fix KMALLOC_MAX_SIZE overflow during cpumask allocation

Changed files
+20 -36
fs
notify
fanotify
kernel
+5 -5
fs/notify/fanotify/fanotify_user.c
··· 259 259 struct fsnotify_event *kevent; 260 260 char __user *start; 261 261 int ret; 262 - DEFINE_WAIT(wait); 262 + DEFINE_WAIT_FUNC(wait, woken_wake_function); 263 263 264 264 start = buf; 265 265 group = file->private_data; 266 266 267 267 pr_debug("%s: group=%p\n", __func__, group); 268 268 269 + add_wait_queue(&group->notification_waitq, &wait); 269 270 while (1) { 270 - prepare_to_wait(&group->notification_waitq, &wait, TASK_INTERRUPTIBLE); 271 - 272 271 mutex_lock(&group->notification_mutex); 273 272 kevent = get_one_event(group, count); 274 273 mutex_unlock(&group->notification_mutex); ··· 288 289 289 290 if (start != buf) 290 291 break; 291 - schedule(); 292 + 293 + wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); 292 294 continue; 293 295 } 294 296 ··· 318 318 buf += ret; 319 319 count -= ret; 320 320 } 321 + remove_wait_queue(&group->notification_waitq, &wait); 321 322 322 - finish_wait(&group->notification_waitq, &wait); 323 323 if (start != buf && ret != -EFAULT) 324 324 ret = buf - start; 325 325 return ret;
+6 -9
kernel/sched/core.c
··· 7113 7113 #ifdef CONFIG_RT_GROUP_SCHED 7114 7114 alloc_size += 2 * nr_cpu_ids * sizeof(void **); 7115 7115 #endif 7116 - #ifdef CONFIG_CPUMASK_OFFSTACK 7117 - alloc_size += num_possible_cpus() * cpumask_size(); 7118 - #endif 7119 7116 if (alloc_size) { 7120 7117 ptr = (unsigned long)kzalloc(alloc_size, GFP_NOWAIT); 7121 7118 ··· 7132 7135 ptr += nr_cpu_ids * sizeof(void **); 7133 7136 7134 7137 #endif /* CONFIG_RT_GROUP_SCHED */ 7135 - #ifdef CONFIG_CPUMASK_OFFSTACK 7136 - for_each_possible_cpu(i) { 7137 - per_cpu(load_balance_mask, i) = (void *)ptr; 7138 - ptr += cpumask_size(); 7139 - } 7140 - #endif /* CONFIG_CPUMASK_OFFSTACK */ 7141 7138 } 7139 + #ifdef CONFIG_CPUMASK_OFFSTACK 7140 + for_each_possible_cpu(i) { 7141 + per_cpu(load_balance_mask, i) = (cpumask_var_t)kzalloc_node( 7142 + cpumask_size(), GFP_KERNEL, cpu_to_node(i)); 7143 + } 7144 + #endif /* CONFIG_CPUMASK_OFFSTACK */ 7142 7145 7143 7146 init_rt_bandwidth(&def_rt_bandwidth, 7144 7147 global_rt_period(), global_rt_runtime());
+4 -21
kernel/sched/deadline.c
··· 570 570 static 571 571 int dl_runtime_exceeded(struct rq *rq, struct sched_dl_entity *dl_se) 572 572 { 573 - int dmiss = dl_time_before(dl_se->deadline, rq_clock(rq)); 574 - int rorun = dl_se->runtime <= 0; 575 - 576 - if (!rorun && !dmiss) 577 - return 0; 578 - 579 - /* 580 - * If we are beyond our current deadline and we are still 581 - * executing, then we have already used some of the runtime of 582 - * the next instance. Thus, if we do not account that, we are 583 - * stealing bandwidth from the system at each deadline miss! 584 - */ 585 - if (dmiss) { 586 - dl_se->runtime = rorun ? dl_se->runtime : 0; 587 - dl_se->runtime -= rq_clock(rq) - dl_se->deadline; 588 - } 589 - 590 - return 1; 573 + return (dl_se->runtime <= 0); 591 574 } 592 575 593 576 extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); ··· 809 826 * parameters of the task might need updating. Otherwise, 810 827 * we want a replenishment of its runtime. 811 828 */ 812 - if (!dl_se->dl_new && flags & ENQUEUE_REPLENISH) 813 - replenish_dl_entity(dl_se, pi_se); 814 - else 829 + if (dl_se->dl_new || flags & ENQUEUE_WAKEUP) 815 830 update_dl_entity(dl_se, pi_se); 831 + else if (flags & ENQUEUE_REPLENISH) 832 + replenish_dl_entity(dl_se, pi_se); 816 833 817 834 __enqueue_dl_entity(dl_se); 818 835 }
+5 -1
kernel/sched/fair.c
··· 4005 4005 4006 4006 static void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b) 4007 4007 { 4008 + /* init_cfs_bandwidth() was not called */ 4009 + if (!cfs_b->throttled_cfs_rq.next) 4010 + return; 4011 + 4008 4012 hrtimer_cancel(&cfs_b->period_timer); 4009 4013 hrtimer_cancel(&cfs_b->slack_timer); 4010 4014 } ··· 4428 4424 * wl = S * s'_i; see (2) 4429 4425 */ 4430 4426 if (W > 0 && w < W) 4431 - wl = (w * tg->shares) / W; 4427 + wl = (w * (long)tg->shares) / W; 4432 4428 else 4433 4429 wl = tg->shares; 4434 4430