• Ingo Molnar's avatar
    sched/balancing: Simplify the sg_status bitmask and use separate ->overloaded... · 4475cd8b
    Ingo Molnar authored
    sched/balancing: Simplify the sg_status bitmask and use separate ->overloaded and ->overutilized flags
    
    SG_OVERLOADED and SG_OVERUTILIZED flags plus the sg_status bitmask are an
    unnecessary complication that only make the code harder to read and slower.
    
    We only ever set them separately:
    
     thule:~/tip> git grep SG_OVER kernel/sched/
     kernel/sched/fair.c:            set_rd_overutilized_status(rq->rd, SG_OVERUTILIZED);
     kernel/sched/fair.c:                    *sg_status |= SG_OVERLOADED;
     kernel/sched/fair.c:                    *sg_status |= SG_OVERUTILIZED;
     kernel/sched/fair.c:                            *sg_status |= SG_OVERLOADED;
     kernel/sched/fair.c:            set_rd_overloaded(env->dst_rq->rd, sg_status & SG_OVERLOADED);
     kernel/sched/fair.c:                                       sg_status & SG_OVERUTILIZED);
     kernel/sched/fair.c:    } else if (sg_status & SG_OVERUTILIZED) {
     kernel/sched/fair.c:            set_rd_overutilized_status(env->dst_rq->rd, SG_OVERUTILIZED);
     kernel/sched/sched.h:#define SG_OVERLOADED              0x1 /* More than one runnable task on a CPU. */
     kernel/sched/sched.h:#define SG_OVERUTILIZED            0x2 /* One or more CPUs are over-utilized. */
     kernel/sched/sched.h:           set_rd_overloaded(rq->rd, SG_OVERLOADED);
    
    And use them separately, which results in suboptimal code:
    
                    /* update overload indicator if we are at root domain */
                    set_rd_overloaded(env->dst_rq->rd, sg_status & SG_OVERLOADED);
    
                    /* Update over-utilization (tipping point, U >= 0) indicator */
                    set_rd_overutilized_status(env->dst_rq->rd,
    
    Introduce separate sg_overloaded and sg_overutilized flags in update_sd_lb_stats()
    and its lower level functions, and change all of them to 'bool'.
    
    Remove the now unused SG_OVERLOADED and SG_OVERUTILIZED flags.
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Acked-by: default avatarShrikanth Hegde <sshegde@linux.ibm.com>
    Tested-by: default avatarShrikanth Hegde <sshegde@linux.ibm.com>
    Cc: Qais Yousef <qyousef@layalina.io>
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Link: https://lore.kernel.org/r/ZgVPhODZ8/nbsqbP@gmail.com
    4475cd8b
fair.c 355 KB