summaryrefslogtreecommitdiffstats
path: root/kernel/sched_rt.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2008-01-25 21:08:03 +0100
committerIngo Molnar <mingo@elte.hu>2008-01-25 21:08:03 +0100
commit63489e45e265f64c368882be1f01c42dec5d984c (patch)
treed228ccbe22bc421c36455c7e05480247a4a8d2b1 /kernel/sched_rt.c
parent82a1fcb90287052aabfa235e7ffc693ea003fe69 (diff)
downloadop-kernel-dev-63489e45e265f64c368882be1f01c42dec5d984c.zip
op-kernel-dev-63489e45e265f64c368882be1f01c42dec5d984c.tar.gz
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>
Diffstat (limited to 'kernel/sched_rt.c')
-rw-r--r--kernel/sched_rt.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index cefcd51..e3d2ca8 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -26,6 +26,19 @@ static void update_curr_rt(struct rq *rq)
cpuacct_charge(curr, delta_exec);
}
+static inline void inc_rt_tasks(struct task_struct *p, struct rq *rq)
+{
+ WARN_ON(!rt_task(p));
+ rq->rt.rt_nr_running++;
+}
+
+static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq)
+{
+ WARN_ON(!rt_task(p));
+ WARN_ON(!rq->rt.rt_nr_running);
+ rq->rt.rt_nr_running--;
+}
+
static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
{
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)
list_add_tail(&p->run_list, array->queue + p->prio);
__set_bit(p->prio, array->bitmap);
inc_cpu_load(rq, p->se.load.weight);
+
+ inc_rt_tasks(p, rq);
}
/*
@@ -48,6 +63,8 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
if (list_empty(array->queue + p->prio))
__clear_bit(p->prio, array->bitmap);
dec_cpu_load(rq, p->se.load.weight);
+
+ dec_rt_tasks(p, rq);
}
/*
OpenPOWER on IntegriCloud