]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
sched/fair: Carve out logic to mark a group for asymmetric packing
authorRicardo Neri <ricardo.neri-calderon@linux.intel.com>
Sat, 11 Sep 2021 01:18:18 +0000 (18:18 -0700)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 22 Feb 2022 18:10:39 +0000 (19:10 +0100)
Create a separate function, sched_asym(). A subsequent changeset will
introduce logic to deal with SMT in conjunction with asmymmetric
packing. Such logic will need the statistics of the scheduling
group provided as argument. Update them before calling sched_asym().

Co-developed-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Reviewed-by: Len Brown <len.brown@intel.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20210911011819.12184-6-ricardo.neri-calderon@linux.intel.com
(cherry picked from commit aafc917a3c31dcc76cb0279cd7617dda11b15f2a)
Signed-off-by: Brad Figg <brad.figg@canonical.com>
kernel/sched/fair.c

index cfe6cba7f8ffcb8e07bda23580d36e83431d082e..54c441abc3835ded550059e188b0b550e76f8051 100644 (file)
@@ -8613,6 +8613,13 @@ group_type group_classify(unsigned int imbalance_pct,
        return group_has_spare;
 }
 
+static inline bool
+sched_asym(struct lb_env *env, struct sd_lb_stats *sds,  struct sg_lb_stats *sgs,
+          struct sched_group *group)
+{
+       return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu);
+}
+
 /**
  * update_sg_lb_stats - Update sched_group's statistics for load balancing.
  * @env: The load balancing environment.
@@ -8673,18 +8680,17 @@ static inline void update_sg_lb_stats(struct lb_env *env,
                }
        }
 
+       sgs->group_capacity = group->sgc->capacity;
+
+       sgs->group_weight = group->group_weight;
+
        /* Check if dst CPU is idle and preferred to this group */
        if (!local_group && env->sd->flags & SD_ASYM_PACKING &&
-           env->idle != CPU_NOT_IDLE &&
-           sgs->sum_h_nr_running &&
-           sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
+           env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running &&
+           sched_asym(env, sds, sgs, group)) {
                sgs->group_asym_packing = 1;
        }
 
-       sgs->group_capacity = group->sgc->capacity;
-
-       sgs->group_weight = group->group_weight;
-
        sgs->group_type = group_classify(env->sd->imbalance_pct, group, sgs);
 
        /* Computing avg_load makes sense only when group is overloaded */