aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched.c
diff options
context:
space:
mode:
authorPaul Turner <pjt@google.com>2011-07-21 12:43:27 -0400
committerIngo Molnar <mingo@elte.hu>2011-08-14 06:01:13 -0400
commit953bfcd10e6f3697233e8e5128c611d275da39c1 (patch)
treea3ca8136bb9e992bb40945c5eee2a8dcc0fd0b57 /kernel/sched.c
parent5710f15b52664ae0bfa60a66d75464769d297b2b (diff)
sched: Implement hierarchical task accounting for SCHED_OTHER
Introduce hierarchical task accounting for the group scheduling case in CFS, as well as promoting the responsibility for maintaining rq->nr_running to the scheduling classes. The primary motivation for this is that with scheduling classes supporting bandwidth throttling it is possible for entities participating in throttled sub-trees to not have root visible changes in rq->nr_running across activate and de-activate operations. This in turn leads to incorrect idle and weight-per-task load balance decisions. This also allows us to make a small fixlet to the fastpath in pick_next_task() under group scheduling. Note: this issue also exists with the existing sched_rt throttling mechanism. This patch does not address that. Signed-off-by: Paul Turner <pjt@google.com> Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20110721184756.878333391@google.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/sched.c')
-rw-r--r--kernel/sched.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/sched.c b/kernel/sched.c
index cf427bb2b65e..cd1a531ca8ff 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -311,7 +311,7 @@ struct task_group root_task_group;
311/* CFS-related fields in a runqueue */ 311/* CFS-related fields in a runqueue */
312struct cfs_rq { 312struct cfs_rq {
313 struct load_weight load; 313 struct load_weight load;
314 unsigned long nr_running; 314 unsigned long nr_running, h_nr_running;
315 315
316 u64 exec_clock; 316 u64 exec_clock;
317 u64 min_vruntime; 317 u64 min_vruntime;
@@ -1802,7 +1802,6 @@ static void activate_task(struct rq *rq, struct task_struct *p, int flags)
1802 rq->nr_uninterruptible--; 1802 rq->nr_uninterruptible--;
1803 1803
1804 enqueue_task(rq, p, flags); 1804 enqueue_task(rq, p, flags);
1805 inc_nr_running(rq);
1806} 1805}
1807 1806
1808/* 1807/*
@@ -1814,7 +1813,6 @@ static void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
1814 rq->nr_uninterruptible++; 1813 rq->nr_uninterruptible++;
1815 1814
1816 dequeue_task(rq, p, flags); 1815 dequeue_task(rq, p, flags);
1817 dec_nr_running(rq);
1818} 1816}
1819 1817
1820#ifdef CONFIG_IRQ_TIME_ACCOUNTING 1818#ifdef CONFIG_IRQ_TIME_ACCOUNTING
@@ -4258,7 +4256,7 @@ pick_next_task(struct rq *rq)
4258 * Optimization: we know that if all tasks are in 4256 * Optimization: we know that if all tasks are in
4259 * the fair class we can call that function directly: 4257 * the fair class we can call that function directly:
4260 */ 4258 */
4261 if (likely(rq->nr_running == rq->cfs.nr_running)) { 4259 if (likely(rq->nr_running == rq->cfs.h_nr_running)) {
4262 p = fair_sched_class.pick_next_task(rq); 4260 p = fair_sched_class.pick_next_task(rq);
4263 if (likely(p)) 4261 if (likely(p))
4264 return p; 4262 return p;