diff options
Diffstat (limited to 'kernel/sched.c')
| -rw-r--r-- | kernel/sched.c | 54 |
1 files changed, 51 insertions, 3 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index d601fb0406ca..9a1ddb84e26d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -808,9 +808,9 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32; | |||
| 808 | 808 | ||
| 809 | /* | 809 | /* |
| 810 | * ratelimit for updating the group shares. | 810 | * ratelimit for updating the group shares. |
| 811 | * default: 0.5ms | 811 | * default: 0.25ms |
| 812 | */ | 812 | */ |
| 813 | const_debug unsigned int sysctl_sched_shares_ratelimit = 500000; | 813 | unsigned int sysctl_sched_shares_ratelimit = 250000; |
| 814 | 814 | ||
| 815 | /* | 815 | /* |
| 816 | * period over which we measure -rt task cpu usage in us. | 816 | * period over which we measure -rt task cpu usage in us. |
| @@ -4669,6 +4669,52 @@ int __sched wait_for_completion_killable(struct completion *x) | |||
| 4669 | } | 4669 | } |
| 4670 | EXPORT_SYMBOL(wait_for_completion_killable); | 4670 | EXPORT_SYMBOL(wait_for_completion_killable); |
| 4671 | 4671 | ||
| 4672 | /** | ||
| 4673 | * try_wait_for_completion - try to decrement a completion without blocking | ||
| 4674 | * @x: completion structure | ||
| 4675 | * | ||
| 4676 | * Returns: 0 if a decrement cannot be done without blocking | ||
| 4677 | * 1 if a decrement succeeded. | ||
| 4678 | * | ||
| 4679 | * If a completion is being used as a counting completion, | ||
| 4680 | * attempt to decrement the counter without blocking. This | ||
| 4681 | * enables us to avoid waiting if the resource the completion | ||
| 4682 | * is protecting is not available. | ||
| 4683 | */ | ||
| 4684 | bool try_wait_for_completion(struct completion *x) | ||
| 4685 | { | ||
| 4686 | int ret = 1; | ||
| 4687 | |||
| 4688 | spin_lock_irq(&x->wait.lock); | ||
| 4689 | if (!x->done) | ||
| 4690 | ret = 0; | ||
| 4691 | else | ||
| 4692 | x->done--; | ||
| 4693 | spin_unlock_irq(&x->wait.lock); | ||
| 4694 | return ret; | ||
| 4695 | } | ||
| 4696 | EXPORT_SYMBOL(try_wait_for_completion); | ||
| 4697 | |||
| 4698 | /** | ||
| 4699 | * completion_done - Test to see if a completion has any waiters | ||
| 4700 | * @x: completion structure | ||
| 4701 | * | ||
| 4702 | * Returns: 0 if there are waiters (wait_for_completion() in progress) | ||
| 4703 | * 1 if there are no waiters. | ||
| 4704 | * | ||
| 4705 | */ | ||
| 4706 | bool completion_done(struct completion *x) | ||
| 4707 | { | ||
| 4708 | int ret = 1; | ||
| 4709 | |||
| 4710 | spin_lock_irq(&x->wait.lock); | ||
| 4711 | if (!x->done) | ||
| 4712 | ret = 0; | ||
| 4713 | spin_unlock_irq(&x->wait.lock); | ||
| 4714 | return ret; | ||
| 4715 | } | ||
| 4716 | EXPORT_SYMBOL(completion_done); | ||
| 4717 | |||
| 4672 | static long __sched | 4718 | static long __sched |
| 4673 | sleep_on_common(wait_queue_head_t *q, int state, long timeout) | 4719 | sleep_on_common(wait_queue_head_t *q, int state, long timeout) |
| 4674 | { | 4720 | { |
| @@ -5740,6 +5786,8 @@ static inline void sched_init_granularity(void) | |||
| 5740 | sysctl_sched_latency = limit; | 5786 | sysctl_sched_latency = limit; |
| 5741 | 5787 | ||
| 5742 | sysctl_sched_wakeup_granularity *= factor; | 5788 | sysctl_sched_wakeup_granularity *= factor; |
| 5789 | |||
| 5790 | sysctl_sched_shares_ratelimit *= factor; | ||
| 5743 | } | 5791 | } |
| 5744 | 5792 | ||
| 5745 | #ifdef CONFIG_SMP | 5793 | #ifdef CONFIG_SMP |
| @@ -8462,8 +8510,8 @@ struct task_group *sched_create_group(struct task_group *parent) | |||
| 8462 | WARN_ON(!parent); /* root should already exist */ | 8510 | WARN_ON(!parent); /* root should already exist */ |
| 8463 | 8511 | ||
| 8464 | tg->parent = parent; | 8512 | tg->parent = parent; |
| 8465 | list_add_rcu(&tg->siblings, &parent->children); | ||
| 8466 | INIT_LIST_HEAD(&tg->children); | 8513 | INIT_LIST_HEAD(&tg->children); |
| 8514 | list_add_rcu(&tg->siblings, &parent->children); | ||
| 8467 | spin_unlock_irqrestore(&task_group_lock, flags); | 8515 | spin_unlock_irqrestore(&task_group_lock, flags); |
| 8468 | 8516 | ||
| 8469 | return tg; | 8517 | return tg; |
