lkml.org 
[lkml]   [2012]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 12/18] sched: log the cpu utilization at rq
    Date
    The cpu's utilization is to measure how busy is the cpu.
    util = cpu_rq(cpu)->avg.runnable_avg_sum
    / cpu_rq(cpu)->avg.runnable_avg_period;

    Since the util is no more than 1, we use its percentage value in later
    caculations.

    Considering there are interval between balancing, if the cpu util is
    up to 97%, we can think it is full of load in a health kernel.

    In later power aware scheduling, we are sensitive for how busy of the
    cpu, not how weight of its load. As to power comsuming, it is more
    related with busy time, not the load weight.

    Signed-off-by: Alex Shi <alex.shi@intel.com>
    ---
    kernel/sched/fair.c | 4 ++++
    kernel/sched/sched.h | 3 +++
    2 files changed, 7 insertions(+), 0 deletions(-)

    diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
    index 1b1deb8..4cc1764 100644
    --- a/kernel/sched/fair.c
    +++ b/kernel/sched/fair.c
    @@ -1269,8 +1269,12 @@ static void update_cfs_rq_blocked_load(struct cfs_rq *cfs_rq, int force_update)

    static inline void update_rq_runnable_avg(struct rq *rq, int runnable)
    {
    + int period;
    __update_entity_runnable_avg(rq->clock_task, &rq->avg, runnable);
    __update_tg_runnable_avg(&rq->avg, &rq->cfs);
    +
    + period = rq->avg.runnable_avg_period ? rq->avg.runnable_avg_period : 1;
    + rq->util = rq->avg.runnable_avg_sum * 100 / period;
    }

    /* Add the load generated by se into cfs_rq's child load-average */
    diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
    index 7a5eae4..5247560 100644
    --- a/kernel/sched/sched.h
    +++ b/kernel/sched/sched.h
    @@ -350,6 +350,8 @@ extern struct root_domain def_root_domain;

    #endif /* CONFIG_SMP */

    +/* Take as full load, if the cpu util is up to 97% */
    +#define FULL_UTIL 97
    /*
    * This is the main, per-CPU runqueue data structure.
    *
    @@ -481,6 +483,7 @@ struct rq {
    #endif

    struct sched_avg avg;
    + unsigned int util;
    };

    static inline int cpu_of(struct rq *rq)
    --
    1.7.5.1


    \
     
     \ /
      Last update: 2012-12-10 11:41    [W:3.627 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site