lkml.org 
[lkml]   [2012]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC 2/5] sched: adjust exec_clock to use it as cpu usage metric
    Date
    exec_clock already provides per-group cpu usage metrics, and can be
    reused by cpuacct in case cpu and cpuacct are comounted.

    However, it is only provided by tasks in fair class. Doing the same for
    rt is easy, and can be done in an already existing hierarchy loop. This
    is an improvement over the independent hierarchy walk executed by
    cpuacct.

    Signed-off-by: Glauber Costa <glommer@parallels.com>
    CC: Dave Jones <davej@redhat.com>
    CC: Ben Hutchings <ben@decadent.org.uk>
    CC: Peter Zijlstra <a.p.zijlstra@chello.nl>
    CC: Paul Turner <pjt@google.com>
    CC: Lennart Poettering <lennart@poettering.net>
    CC: Kay Sievers <kay.sievers@vrfy.org>
    CC: Tejun Heo <tj@kernel.org>
    ---
    kernel/sched/rt.c | 1 +
    kernel/sched/sched.h | 3 +++
    2 files changed, 4 insertions(+)

    diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
    index 573e1ca..40ef6af 100644
    --- a/kernel/sched/rt.c
    +++ b/kernel/sched/rt.c
    @@ -930,6 +930,7 @@ static void update_curr_rt(struct rq *rq)

    for_each_sched_rt_entity(rt_se) {
    rt_rq = rt_rq_of_se(rt_se);
    + schedstat_add(rt_rq, exec_clock, delta_exec);

    if (sched_rt_runtime(rt_rq) != RUNTIME_INF) {
    raw_spin_lock(&rt_rq->rt_runtime_lock);
    diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
    index 55844f2..8da579d 100644
    --- a/kernel/sched/sched.h
    +++ b/kernel/sched/sched.h
    @@ -204,6 +204,7 @@ struct cfs_rq {
    unsigned int nr_running, h_nr_running;

    u64 exec_clock;
    + u64 prev_exec_clock;
    u64 min_vruntime;
    #ifndef CONFIG_64BIT
    u64 min_vruntime_copy;
    @@ -295,6 +296,8 @@ struct rt_rq {
    struct plist_head pushable_tasks;
    #endif
    int rt_throttled;
    + u64 exec_clock;
    + u64 prev_exec_clock;
    u64 rt_time;
    u64 rt_runtime;
    /* Nests inside the rq lock: */
    --
    1.7.11.4


    \
     
     \ /
      Last update: 2012-09-04 17:23    [W:3.941 / U:0.192 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site