[PATCH v4 3/6] sched/fair: Optimize checking for group_asym_packing

Ricardo Neri ricardo.neri-calderon at linux.intel.com
Wed Aug 11 00:41:42 AEST 2021


sched_asmy_prefer() always returns false when called on the local group. By
checking local_group, we can avoid additional checks and invoking
sched_asmy_prefer() when it is not needed. No functional changes are
introduced.

Cc: Aubrey Li <aubrey.li at intel.com>
Cc: Ben Segall <bsegall at google.com>
Cc: Daniel Bristot de Oliveira <bristot at redhat.com>
Cc: Dietmar Eggemann <dietmar.eggemann at arm.com>
Cc: Mel Gorman <mgorman at suse.de>
Cc: Quentin Perret <qperret at google.com>
Cc: Rafael J. Wysocki <rafael.j.wysocki at intel.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada at linux.intel.com>
Cc: Steven Rostedt <rostedt at goodmis.org>
Cc: Tim Chen <tim.c.chen at linux.intel.com>
Reviewed-by: Joel Fernandes (Google) <joel at joelfernandes.org>
Reviewed-by: Len Brown <len.brown at intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon at linux.intel.com>
---
Changes since v3:
  * Further rewording of the commit message. (Len)

Changes since v2:
  * Reworded the commit message for clarity. (Peter Z)

Changes since v1:
  * None
---
 kernel/sched/fair.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 44e44c235f1f..3b686e18a39b 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8591,7 +8591,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
 	}
 
 	/* Check if dst CPU is idle and preferred to this group */
-	if (env->sd->flags & SD_ASYM_PACKING &&
+	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)) {
-- 
2.17.1



More information about the Linuxppc-dev mailing list