diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-07-18 09:50:22 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-07-18 09:50:40 -0400 |
commit | 5304d5fc74a269cc6c3e70f9713684ca729abdf0 (patch) | |
tree | 6a5db62915abd260241a2b9aee34086c93293ca6 /kernel/sched.c | |
parent | 54d35f29f49224d86b994acb6e5969b9ba09022d (diff) | |
parent | 78af08d90b8f745044b1274430bc4bc6b2b27aca (diff) |
Merge branch 'linus' into sched/core
Merge reason: branch had an old upstream base (-rc1-ish), but also
merge to avoid a conflict.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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 ebc5151f88c8..03f7e3fd80b5 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 |
@@ -2572,15 +2573,37 @@ static void __sched_fork(struct task_struct *p) | |||
2572 | p->se.avg_wakeup = sysctl_sched_wakeup_granularity; | 2573 | p->se.avg_wakeup = sysctl_sched_wakeup_granularity; |
2573 | 2574 | ||
2574 | #ifdef CONFIG_SCHEDSTATS | 2575 | #ifdef CONFIG_SCHEDSTATS |
2575 | p->se.wait_start = 0; | 2576 | p->se.wait_start = 0; |
2576 | p->se.sum_sleep_runtime = 0; | 2577 | p->se.wait_max = 0; |
2577 | p->se.sleep_start = 0; | 2578 | p->se.wait_count = 0; |
2578 | p->se.block_start = 0; | 2579 | p->se.wait_sum = 0; |
2579 | p->se.sleep_max = 0; | 2580 | |
2580 | p->se.block_max = 0; | 2581 | p->se.sleep_start = 0; |
2581 | p->se.exec_max = 0; | 2582 | p->se.sleep_max = 0; |
2582 | p->se.slice_max = 0; | 2583 | p->se.sum_sleep_runtime = 0; |
2583 | p->se.wait_max = 0; | 2584 | |
2585 | p->se.block_start = 0; | ||
2586 | p->se.block_max = 0; | ||
2587 | p->se.exec_max = 0; | ||
2588 | p->se.slice_max = 0; | ||
2589 | |||
2590 | p->se.nr_migrations_cold = 0; | ||
2591 | p->se.nr_failed_migrations_affine = 0; | ||
2592 | p->se.nr_failed_migrations_running = 0; | ||
2593 | p->se.nr_failed_migrations_hot = 0; | ||
2594 | p->se.nr_forced_migrations = 0; | ||
2595 | p->se.nr_forced2_migrations = 0; | ||
2596 | |||
2597 | p->se.nr_wakeups = 0; | ||
2598 | p->se.nr_wakeups_sync = 0; | ||
2599 | p->se.nr_wakeups_migrate = 0; | ||
2600 | p->se.nr_wakeups_local = 0; | ||
2601 | p->se.nr_wakeups_remote = 0; | ||
2602 | p->se.nr_wakeups_affine = 0; | ||
2603 | p->se.nr_wakeups_affine_attempts = 0; | ||
2604 | p->se.nr_wakeups_passive = 0; | ||
2605 | p->se.nr_wakeups_idle = 0; | ||
2606 | |||
2584 | #endif | 2607 | #endif |
2585 | 2608 | ||
2586 | INIT_LIST_HEAD(&p->rt.run_list); | 2609 | INIT_LIST_HEAD(&p->rt.run_list); |
@@ -6580,6 +6603,11 @@ SYSCALL_DEFINE0(sched_yield) | |||
6580 | return 0; | 6603 | return 0; |
6581 | } | 6604 | } |
6582 | 6605 | ||
6606 | static inline int should_resched(void) | ||
6607 | { | ||
6608 | return need_resched() && !(preempt_count() & PREEMPT_ACTIVE); | ||
6609 | } | ||
6610 | |||
6583 | static void __cond_resched(void) | 6611 | static void __cond_resched(void) |
6584 | { | 6612 | { |
6585 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 6613 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
@@ -6599,8 +6627,7 @@ static void __cond_resched(void) | |||
6599 | 6627 | ||
6600 | int __sched _cond_resched(void) | 6628 | int __sched _cond_resched(void) |
6601 | { | 6629 | { |
6602 | if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) && | 6630 | if (should_resched()) { |
6603 | system_state == SYSTEM_RUNNING) { | ||
6604 | __cond_resched(); | 6631 | __cond_resched(); |
6605 | return 1; | 6632 | return 1; |
6606 | } | 6633 | } |
@@ -6618,12 +6645,12 @@ EXPORT_SYMBOL(_cond_resched); | |||
6618 | */ | 6645 | */ |
6619 | int cond_resched_lock(spinlock_t *lock) | 6646 | int cond_resched_lock(spinlock_t *lock) |
6620 | { | 6647 | { |
6621 | int resched = need_resched() && system_state == SYSTEM_RUNNING; | 6648 | int resched = should_resched(); |
6622 | int ret = 0; | 6649 | int ret = 0; |
6623 | 6650 | ||
6624 | if (spin_needbreak(lock) || resched) { | 6651 | if (spin_needbreak(lock) || resched) { |
6625 | spin_unlock(lock); | 6652 | spin_unlock(lock); |
6626 | if (resched && need_resched()) | 6653 | if (resched) |
6627 | __cond_resched(); | 6654 | __cond_resched(); |
6628 | else | 6655 | else |
6629 | cpu_relax(); | 6656 | cpu_relax(); |
@@ -6638,7 +6665,7 @@ int __sched cond_resched_softirq(void) | |||
6638 | { | 6665 | { |
6639 | BUG_ON(!in_softirq()); | 6666 | BUG_ON(!in_softirq()); |
6640 | 6667 | ||
6641 | if (need_resched() && system_state == SYSTEM_RUNNING) { | 6668 | if (should_resched()) { |
6642 | local_bh_enable(); | 6669 | local_bh_enable(); |
6643 | __cond_resched(); | 6670 | __cond_resched(); |
6644 | local_bh_disable(); | 6671 | local_bh_disable(); |
@@ -9109,7 +9136,7 @@ static void init_rt_rq(struct rt_rq *rt_rq, struct rq *rq) | |||
9109 | #ifdef CONFIG_SMP | 9136 | #ifdef CONFIG_SMP |
9110 | rt_rq->rt_nr_migratory = 0; | 9137 | rt_rq->rt_nr_migratory = 0; |
9111 | rt_rq->overloaded = 0; | 9138 | rt_rq->overloaded = 0; |
9112 | plist_head_init(&rq->rt.pushable_tasks, &rq->lock); | 9139 | plist_head_init(&rt_rq->pushable_tasks, &rq->lock); |
9113 | #endif | 9140 | #endif |
9114 | 9141 | ||
9115 | rt_rq->rt_time = 0; | 9142 | rt_rq->rt_time = 0; |