lkml.org 
[lkml]   [2008]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC PATCH v2 2/5] sched: calculate statistics for current load balance domain
    Date
    Add data structures and function to collect per sched domain
    statistics required for load balance decision.

    Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
    ---

    kernel/sched.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
    1 files changed, 51 insertions(+), 0 deletions(-)

    diff --git a/kernel/sched.c b/kernel/sched.c
    index ab77937..cfd83d9 100644
    --- a/kernel/sched.c
    +++ b/kernel/sched.c
    @@ -3178,6 +3178,57 @@ int get_group_loads(struct sched_group *group, int this_cpu,
    return need_balance;
    }

    +/* Struct to hold sched domain level loads */
    +
    +struct sd_loads {
    + struct sched_domain *sd;
    + unsigned long load; /* Total decay load */
    + unsigned long cpu_power; /* Total cpu_power */
    + unsigned long max_load; /* load of busiest group */
    + unsigned long load_per_cpu; /* Decay load per cpu in this sd
    + * (load/cpu_power)
    + */
    + struct group_loads local; /* this_cpu's group,
    + * need to pull from busiest
    + */
    + struct group_loads busiest; /* Candidate group to pull */
    + /* sched_mc power_save balance groups */
    + struct group_loads min_load_group; /* Group that is least loaded and
    + * can fit the tasks into the
    + * leader group
    + */
    + struct group_loads power_save_leader_group; /* Group that is almost
    + * full but can still pull
    + * tasks from
    + * min_load_group
    + */
    +};
    +
    +/* Function to aggregate per group loads to sched domain loads */
    +
    +void update_sd_loads(struct sd_loads *sdl, struct group_loads *gl)
    +{
    + int group_capacity = gl->group->__cpu_power / SCHED_LOAD_SCALE;
    + sdl->max_load = 0;
    +
    + if (gl->local_group)
    + sdl->local = *gl;
    + else {
    + sdl->load += gl->load;
    + sdl->cpu_power += gl->group->__cpu_power;
    +
    +
    + /* Find the busiest */
    + if (gl->load > sdl->max_load &&
    + (gl->nr_running > group_capacity ||
    + gl->group_imbalance)) {
    +
    + sdl->max_load = gl->load;
    + sdl->busiest = *gl;
    + }
    + }
    +}
    +
    /*
    * find_busiest_group finds and returns the busiest CPU group within the
    * domain. It calculates and returns the amount of weighted load which


    \
     
     \ /
      Last update: 2008-10-09 14:09    [W:0.025 / U:30.996 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site