Skip to content

Commit aafc917

Browse files
ricardonPeter Zijlstra
authored and
Peter Zijlstra
committed
sched/fair: Carve out logic to mark a group for asymmetric packing
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
1 parent c0d14b5 commit aafc917

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

kernel/sched/fair.c

+13-7
Original file line numberDiff line numberDiff line change
@@ -8571,6 +8571,13 @@ group_type group_classify(unsigned int imbalance_pct,
85718571
return group_has_spare;
85728572
}
85738573

8574+
static inline bool
8575+
sched_asym(struct lb_env *env, struct sd_lb_stats *sds, struct sg_lb_stats *sgs,
8576+
struct sched_group *group)
8577+
{
8578+
return sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu);
8579+
}
8580+
85748581
/**
85758582
* update_sg_lb_stats - Update sched_group's statistics for load balancing.
85768583
* @env: The load balancing environment.
@@ -8631,18 +8638,17 @@ static inline void update_sg_lb_stats(struct lb_env *env,
86318638
}
86328639
}
86338640

8641+
sgs->group_capacity = group->sgc->capacity;
8642+
8643+
sgs->group_weight = group->group_weight;
8644+
86348645
/* Check if dst CPU is idle and preferred to this group */
86358646
if (!local_group && env->sd->flags & SD_ASYM_PACKING &&
8636-
env->idle != CPU_NOT_IDLE &&
8637-
sgs->sum_h_nr_running &&
8638-
sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
8647+
env->idle != CPU_NOT_IDLE && sgs->sum_h_nr_running &&
8648+
sched_asym(env, sds, sgs, group)) {
86398649
sgs->group_asym_packing = 1;
86408650
}
86418651

8642-
sgs->group_capacity = group->sgc->capacity;
8643-
8644-
sgs->group_weight = group->group_weight;
8645-
86468652
sgs->group_type = group_classify(env->sd->imbalance_pct, group, sgs);
86478653

86488654
/* Computing avg_load makes sense only when group is overloaded */

0 commit comments

Comments
 (0)