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 6a43c8942b05..29e2ec0bd831 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. |
@@ -4663,6 +4663,52 @@ int __sched wait_for_completion_killable(struct completion *x) | |||
4663 | } | 4663 | } |
4664 | EXPORT_SYMBOL(wait_for_completion_killable); | 4664 | EXPORT_SYMBOL(wait_for_completion_killable); |
4665 | 4665 | ||
4666 | /** | ||
4667 | * try_wait_for_completion - try to decrement a completion without blocking | ||
4668 | * @x: completion structure | ||
4669 | * | ||
4670 | * Returns: 0 if a decrement cannot be done without blocking | ||
4671 | * 1 if a decrement succeeded. | ||
4672 | * | ||
4673 | * If a completion is being used as a counting completion, | ||
4674 | * attempt to decrement the counter without blocking. This | ||
4675 | * enables us to avoid waiting if the resource the completion | ||
4676 | * is protecting is not available. | ||
4677 | */ | ||
4678 | bool try_wait_for_completion(struct completion *x) | ||
4679 | { | ||
4680 | int ret = 1; | ||
4681 | |||
4682 | spin_lock_irq(&x->wait.lock); | ||
4683 | if (!x->done) | ||
4684 | ret = 0; | ||
4685 | else | ||
4686 | x->done--; | ||
4687 | spin_unlock_irq(&x->wait.lock); | ||
4688 | return ret; | ||
4689 | } | ||
4690 | EXPORT_SYMBOL(try_wait_for_completion); | ||
4691 | |||
4692 | /** | ||
4693 | * completion_done - Test to see if a completion has any waiters | ||
4694 | * @x: completion structure | ||
4695 | * | ||
4696 | * Returns: 0 if there are waiters (wait_for_completion() in progress) | ||
4697 | * 1 if there are no waiters. | ||
4698 | * | ||
4699 | */ | ||
4700 | bool completion_done(struct completion *x) | ||
4701 | { | ||
4702 | int ret = 1; | ||
4703 | |||
4704 | spin_lock_irq(&x->wait.lock); | ||
4705 | if (!x->done) | ||
4706 | ret = 0; | ||
4707 | spin_unlock_irq(&x->wait.lock); | ||
4708 | return ret; | ||
4709 | } | ||
4710 | EXPORT_SYMBOL(completion_done); | ||
4711 | |||
4666 | static long __sched | 4712 | static long __sched |
4667 | sleep_on_common(wait_queue_head_t *q, int state, long timeout) | 4713 | sleep_on_common(wait_queue_head_t *q, int state, long timeout) |
4668 | { | 4714 | { |
@@ -5734,6 +5780,8 @@ static inline void sched_init_granularity(void) | |||
5734 | sysctl_sched_latency = limit; | 5780 | sysctl_sched_latency = limit; |
5735 | 5781 | ||
5736 | sysctl_sched_wakeup_granularity *= factor; | 5782 | sysctl_sched_wakeup_granularity *= factor; |
5783 | |||
5784 | sysctl_sched_shares_ratelimit *= factor; | ||
5737 | } | 5785 | } |
5738 | 5786 | ||
5739 | #ifdef CONFIG_SMP | 5787 | #ifdef CONFIG_SMP |
@@ -8456,8 +8504,8 @@ struct task_group *sched_create_group(struct task_group *parent) | |||
8456 | WARN_ON(!parent); /* root should already exist */ | 8504 | WARN_ON(!parent); /* root should already exist */ |
8457 | 8505 | ||
8458 | tg->parent = parent; | 8506 | tg->parent = parent; |
8459 | list_add_rcu(&tg->siblings, &parent->children); | ||
8460 | INIT_LIST_HEAD(&tg->children); | 8507 | INIT_LIST_HEAD(&tg->children); |
8508 | list_add_rcu(&tg->siblings, &parent->children); | ||
8461 | spin_unlock_irqrestore(&task_group_lock, flags); | 8509 | spin_unlock_irqrestore(&task_group_lock, flags); |
8462 | 8510 | ||
8463 | return tg; | 8511 | return tg; |