diff options
Diffstat (limited to 'kernel/sched.c')
| -rw-r--r-- | kernel/sched.c | 57 |
1 files changed, 42 insertions, 15 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 7c9098d186e6..98972d366fdc 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -493,6 +493,7 @@ struct rt_rq { | |||
| 493 | #endif | 493 | #endif |
| 494 | #ifdef CONFIG_SMP | 494 | #ifdef CONFIG_SMP |
| 495 | unsigned long rt_nr_migratory; | 495 | unsigned long rt_nr_migratory; |
| 496 | unsigned long rt_nr_total; | ||
| 496 | int overloaded; | 497 | int overloaded; |
| 497 | struct plist_head pushable_tasks; | 498 | struct plist_head pushable_tasks; |
| 498 | #endif | 499 | #endif |
| @@ -2571,15 +2572,37 @@ static void __sched_fork(struct task_struct *p) | |||
| 2571 | p->se.avg_wakeup = sysctl_sched_wakeup_granularity; | 2572 | p->se.avg_wakeup = sysctl_sched_wakeup_granularity; |
| 2572 | 2573 | ||
| 2573 | #ifdef CONFIG_SCHEDSTATS | 2574 | #ifdef CONFIG_SCHEDSTATS |
| 2574 | p->se.wait_start = 0; | 2575 | p->se.wait_start = 0; |
| 2575 | p->se.sum_sleep_runtime = 0; | 2576 | p->se.wait_max = 0; |
| 2576 | p->se.sleep_start = 0; | 2577 | p->se.wait_count = 0; |
| 2577 | p->se.block_start = 0; | 2578 | p->se.wait_sum = 0; |
| 2578 | p->se.sleep_max = 0; | 2579 | |
| 2579 | p->se.block_max = 0; | 2580 | p->se.sleep_start = 0; |
| 2580 | p->se.exec_max = 0; | 2581 | p->se.sleep_max = 0; |
| 2581 | p->se.slice_max = 0; | 2582 | p->se.sum_sleep_runtime = 0; |
| 2582 | p->se.wait_max = 0; | 2583 | |
| 2584 | p->se.block_start = 0; | ||
| 2585 | p->se.block_max = 0; | ||
| 2586 | p->se.exec_max = 0; | ||
| 2587 | p->se.slice_max = 0; | ||
| 2588 | |||
| 2589 | p->se.nr_migrations_cold = 0; | ||
| 2590 | p->se.nr_failed_migrations_affine = 0; | ||
| 2591 | p->se.nr_failed_migrations_running = 0; | ||
| 2592 | p->se.nr_failed_migrations_hot = 0; | ||
| 2593 | p->se.nr_forced_migrations = 0; | ||
| 2594 | p->se.nr_forced2_migrations = 0; | ||
| 2595 | |||
| 2596 | p->se.nr_wakeups = 0; | ||
| 2597 | p->se.nr_wakeups_sync = 0; | ||
| 2598 | p->se.nr_wakeups_migrate = 0; | ||
| 2599 | p->se.nr_wakeups_local = 0; | ||
| 2600 | p->se.nr_wakeups_remote = 0; | ||
| 2601 | p->se.nr_wakeups_affine = 0; | ||
| 2602 | p->se.nr_wakeups_affine_attempts = 0; | ||
| 2603 | p->se.nr_wakeups_passive = 0; | ||
| 2604 | p->se.nr_wakeups_idle = 0; | ||
| 2605 | |||
| 2583 | #endif | 2606 | #endif |
| 2584 | 2607 | ||
| 2585 | INIT_LIST_HEAD(&p->rt.run_list); | 2608 | INIT_LIST_HEAD(&p->rt.run_list); |
| @@ -6541,6 +6564,11 @@ SYSCALL_DEFINE0(sched_yield) | |||
| 6541 | return 0; | 6564 | return 0; |
| 6542 | } | 6565 | } |
| 6543 | 6566 | ||
| 6567 | static inline int should_resched(void) | ||
| 6568 | { | ||
| 6569 | return need_resched() && !(preempt_count() & PREEMPT_ACTIVE); | ||
| 6570 | } | ||
| 6571 | |||
| 6544 | static void __cond_resched(void) | 6572 | static void __cond_resched(void) |
| 6545 | { | 6573 | { |
| 6546 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 6574 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
| @@ -6560,8 +6588,7 @@ static void __cond_resched(void) | |||
| 6560 | 6588 | ||
| 6561 | int __sched _cond_resched(void) | 6589 | int __sched _cond_resched(void) |
| 6562 | { | 6590 | { |
| 6563 | if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) && | 6591 | if (should_resched()) { |
| 6564 | system_state == SYSTEM_RUNNING) { | ||
| 6565 | __cond_resched(); | 6592 | __cond_resched(); |
| 6566 | return 1; | 6593 | return 1; |
| 6567 | } | 6594 | } |
| @@ -6579,12 +6606,12 @@ EXPORT_SYMBOL(_cond_resched); | |||
| 6579 | */ | 6606 | */ |
| 6580 | int cond_resched_lock(spinlock_t *lock) | 6607 | int cond_resched_lock(spinlock_t *lock) |
| 6581 | { | 6608 | { |
| 6582 | int resched = need_resched() && system_state == SYSTEM_RUNNING; | 6609 | int resched = should_resched(); |
| 6583 | int ret = 0; | 6610 | int ret = 0; |
| 6584 | 6611 | ||
| 6585 | if (spin_needbreak(lock) || resched) { | 6612 | if (spin_needbreak(lock) || resched) { |
| 6586 | spin_unlock(lock); | 6613 | spin_unlock(lock); |
| 6587 | if (resched && need_resched()) | 6614 | if (resched) |
| 6588 | __cond_resched(); | 6615 | __cond_resched(); |
| 6589 | else | 6616 | else |
| 6590 | cpu_relax(); | 6617 | cpu_relax(); |
| @@ -6599,7 +6626,7 @@ int __sched cond_resched_softirq(void) | |||
| 6599 | { | 6626 | { |
| 6600 | BUG_ON(!in_softirq()); | 6627 | BUG_ON(!in_softirq()); |
| 6601 | 6628 | ||
| 6602 | if (need_resched() && system_state == SYSTEM_RUNNING) { | 6629 | if (should_resched()) { |
| 6603 | local_bh_enable(); | 6630 | local_bh_enable(); |
| 6604 | __cond_resched(); | 6631 | __cond_resched(); |
| 6605 | local_bh_disable(); | 6632 | local_bh_disable(); |
| @@ -9070,7 +9097,7 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq) | |||
| 9070 | #ifdef CONFIG_SMP | 9097 | #ifdef CONFIG_SMP |
| 9071 | rt_rq->rt_nr_migratory = 0; | 9098 | rt_rq->rt_nr_migratory = 0; |
| 9072 | rt_rq->overloaded = 0; | 9099 | rt_rq->overloaded = 0; |
| 9073 | plist_head_init(&rq->rt.pushable_tasks, &rq->lock); | 9100 | plist_head_init(&rt_rq->pushable_tasks, &rq->lock); |
| 9074 | #endif | 9101 | #endif |
| 9075 | 9102 | ||
| 9076 | rt_rq->rt_time = 0; | 9103 | rt_rq->rt_time = 0; |
