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

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

* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
sched: sched_slice() fixlet
sched: fix update_min_vruntime
sched: SCHED_OTHER vs SCHED_IDLE isolation
sched: SCHED_IDLE weight change
sched: fix bandwidth validation for UID grouping
Revert "sched: improve preempt debugging"

+37 -13
+10 -3
kernel/sched.c
··· 1323 1323 * slice expiry etc. 1324 1324 */ 1325 1325 1326 - #define WEIGHT_IDLEPRIO 2 1327 - #define WMULT_IDLEPRIO (1 << 31) 1326 + #define WEIGHT_IDLEPRIO 3 1327 + #define WMULT_IDLEPRIO 1431655765 1328 1328 1329 1329 /* 1330 1330 * Nice levels are multiplicative, with a gentle 10% change for every ··· 4440 4440 /* 4441 4441 * Underflow? 4442 4442 */ 4443 - if (DEBUG_LOCKS_WARN_ON(val > preempt_count() - (!!kernel_locked()))) 4443 + if (DEBUG_LOCKS_WARN_ON(val > preempt_count())) 4444 4444 return; 4445 4445 /* 4446 4446 * Is the spinlock portion underflowing? ··· 9049 9049 period = d->rt_period; 9050 9050 runtime = d->rt_runtime; 9051 9051 } 9052 + 9053 + #ifdef CONFIG_USER_SCHED 9054 + if (tg == &root_task_group) { 9055 + period = global_rt_period(); 9056 + runtime = global_rt_runtime(); 9057 + } 9058 + #endif 9052 9059 9053 9060 /* 9054 9061 * Cannot have more runtime than the period.
+27 -10
kernel/sched_fair.c
··· 283 283 struct sched_entity, 284 284 run_node); 285 285 286 - if (vruntime == cfs_rq->min_vruntime) 286 + if (!cfs_rq->curr) 287 287 vruntime = se->vruntime; 288 288 else 289 289 vruntime = min_vruntime(vruntime, se->vruntime); ··· 429 429 u64 slice = __sched_period(cfs_rq->nr_running + !se->on_rq); 430 430 431 431 for_each_sched_entity(se) { 432 - struct load_weight *load = &cfs_rq->load; 432 + struct load_weight *load; 433 + 434 + cfs_rq = cfs_rq_of(se); 435 + load = &cfs_rq->load; 433 436 434 437 if (unlikely(!se->on_rq)) { 435 438 struct load_weight lw = cfs_rq->load; ··· 680 677 unsigned long thresh = sysctl_sched_latency; 681 678 682 679 /* 683 - * convert the sleeper threshold into virtual time 680 + * Convert the sleeper threshold into virtual time. 681 + * SCHED_IDLE is a special sub-class. We care about 682 + * fairness only relative to other SCHED_IDLE tasks, 683 + * all of which have the same weight. 684 684 */ 685 - if (sched_feat(NORMALIZED_SLEEPER)) 685 + if (sched_feat(NORMALIZED_SLEEPER) && 686 + task_of(se)->policy != SCHED_IDLE) 686 687 thresh = calc_delta_fair(thresh, se); 687 688 688 689 vruntime -= thresh; ··· 1347 1340 1348 1341 static void set_last_buddy(struct sched_entity *se) 1349 1342 { 1350 - for_each_sched_entity(se) 1351 - cfs_rq_of(se)->last = se; 1343 + if (likely(task_of(se)->policy != SCHED_IDLE)) { 1344 + for_each_sched_entity(se) 1345 + cfs_rq_of(se)->last = se; 1346 + } 1352 1347 } 1353 1348 1354 1349 static void set_next_buddy(struct sched_entity *se) 1355 1350 { 1356 - for_each_sched_entity(se) 1357 - cfs_rq_of(se)->next = se; 1351 + if (likely(task_of(se)->policy != SCHED_IDLE)) { 1352 + for_each_sched_entity(se) 1353 + cfs_rq_of(se)->next = se; 1354 + } 1358 1355 } 1359 1356 1360 1357 /* ··· 1404 1393 return; 1405 1394 1406 1395 /* 1407 - * Batch tasks do not preempt (their preemption is driven by 1396 + * Batch and idle tasks do not preempt (their preemption is driven by 1408 1397 * the tick): 1409 1398 */ 1410 - if (unlikely(p->policy == SCHED_BATCH)) 1399 + if (unlikely(p->policy != SCHED_NORMAL)) 1411 1400 return; 1401 + 1402 + /* Idle tasks are by definition preempted by everybody. */ 1403 + if (unlikely(curr->policy == SCHED_IDLE)) { 1404 + resched_task(curr); 1405 + return; 1406 + } 1412 1407 1413 1408 if (!sched_feat(WAKEUP_PREEMPT)) 1414 1409 return;