lkml.org 
[lkml]   [2007]   [Dec]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 01/23] Subject: SCHED - Add rt_nr_running accounting
    Date
    From: Steven Rostedt <srostedt@redhat.com>

    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: Gregory Haskins <ghaskins@novell.com>
    ---

    kernel/sched.c | 1 +
    kernel/sched_rt.c | 17 +++++++++++++++++
    2 files changed, 18 insertions(+), 0 deletions(-)

    diff --git a/kernel/sched.c b/kernel/sched.c
    index b062856..4751c2f 100644
    --- a/kernel/sched.c
    +++ b/kernel/sched.c
    @@ -266,6 +266,7 @@ struct rt_rq {
    struct rt_prio_array active;
    int rt_load_balance_idx;
    struct list_head *rt_load_balance_head, *rt_load_balance_curr;
    + unsigned long rt_nr_running;
    };

    /*
    diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
    index ee9c8b6..a6271f4 100644
    --- a/kernel/sched_rt.c
    +++ b/kernel/sched_rt.c
    @@ -26,12 +26,27 @@ 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;

    list_add_tail(&p->run_list, array->queue + p->prio);
    __set_bit(p->prio, array->bitmap);
    +
    + inc_rt_tasks(p, rq);
    }

    /*
    @@ -46,6 +61,8 @@ static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
    list_del(&p->run_list);
    if (list_empty(array->queue + p->prio))
    __clear_bit(p->prio, array->bitmap);
    +
    + dec_rt_tasks(p, rq);
    }

    /*


    \
     
     \ /
      Last update: 2007-12-04 22:09    [W:0.024 / U:59.020 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site