diff options
author | Steven Rostedt <srostedt@redhat.com> | 2008-01-25 15:08:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-25 15:08:03 -0500 |
commit | 63489e45e265f64c368882be1f01c42dec5d984c (patch) | |
tree | d228ccbe22bc421c36455c7e05480247a4a8d2b1 | |
parent | 82a1fcb90287052aabfa235e7ffc693ea003fe69 (diff) |
sched: count # of queued RT tasks
This patch adds accounting to keep track of the number of RT tasks running
on a runqueue. This information will be used in later patches.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/sched.c | 1 | ||||
-rw-r--r-- | kernel/sched_rt.c | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/kernel/sched.c b/kernel/sched.c index 5b3d46574eeb..9dd8d121eea6 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -342,6 +342,7 @@ struct rt_rq { | |||
342 | struct rt_prio_array active; | 342 | struct rt_prio_array active; |
343 | int rt_load_balance_idx; | 343 | int rt_load_balance_idx; |
344 | struct list_head *rt_load_balance_head, *rt_load_balance_curr; | 344 | struct list_head *rt_load_balance_head, *rt_load_balance_curr; |
345 | unsigned long rt_nr_running; | ||
345 | }; | 346 | }; |
346 | 347 | ||
347 | /* | 348 | /* |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index cefcd5105146..e3d2ca8832af 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -26,6 +26,19 @@ static void update_curr_rt(struct rq *rq) | |||
26 | cpuacct_charge(curr, delta_exec); | 26 | cpuacct_charge(curr, delta_exec); |
27 | } | 27 | } |
28 | 28 | ||
29 | static inline void inc_rt_tasks(struct task_struct *p, struct rq *rq) | ||
30 | { | ||
31 | WARN_ON(!rt_task(p)); | ||
32 | rq->rt.rt_nr_running++; | ||
33 | } | ||
34 | |||
35 | static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq) | ||
36 | { | ||
37 | WARN_ON(!rt_task(p)); | ||
38 | WARN_ON(!rq->rt.rt_nr_running); | ||
39 | rq->rt.rt_nr_running--; | ||
40 | } | ||
41 | |||
29 | static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup) | 42 | static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup) |
30 | { | 43 | { |
31 | struct rt_prio_array *array = &rq->rt.active; | 44 | struct rt_prio_array *array = &rq->rt.active; |
@@ -33,6 +46,8 @@ static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup) | |||
33 | list_add_tail(&p->run_list, array->queue + p->prio); | 46 | list_add_tail(&p->run_list, array->queue + p->prio); |
34 | __set_bit(p->prio, array->bitmap); | 47 | __set_bit(p->prio, array->bitmap); |
35 | inc_cpu_load(rq, p->se.load.weight); | 48 | inc_cpu_load(rq, p->se.load.weight); |
49 | |||
50 | inc_rt_tasks(p, rq); | ||
36 | } | 51 | } |
37 | 52 | ||
38 | /* | 53 | /* |
@@ -48,6 +63,8 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep) | |||
48 | if (list_empty(array->queue + p->prio)) | 63 | if (list_empty(array->queue + p->prio)) |
49 | __clear_bit(p->prio, array->bitmap); | 64 | __clear_bit(p->prio, array->bitmap); |
50 | dec_cpu_load(rq, p->se.load.weight); | 65 | dec_cpu_load(rq, p->se.load.weight); |
66 | |||
67 | dec_rt_tasks(p, rq); | ||
51 | } | 68 | } |
52 | 69 | ||
53 | /* | 70 | /* |