Messages in this thread Patch in this message | | | Date | Wed, 12 Feb 2020 15:45:32 +0000 | From | Mel Gorman <> | Subject | [PATCH 09/11] sched/fair: Split out helper to adjust imbalances between domains |
| |
The patch "sched/fair: Allow a small load imbalance between low utilisation SD_NUMA domains" allows an imbalance when the busiest group has very few tasks. Move the check to a helper function as it is needed by a later patch.
No functional change.
Signed-off-by: Mel Gorman <mgorman@techsingularity.net> --- kernel/sched/fair.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 24fc90b8036a..b2476ef0b056 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8758,6 +8758,21 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd } } +static inline long adjust_numa_imbalance(int imbalance, int src_nr_running) +{ + unsigned int imbalance_min; + + /* + * Allow a small imbalance based on a simple pair of communicating + * tasks that remain local when the source domain is almost idle. + */ + imbalance_min = 2; + if (src_nr_running <= imbalance_min) + return 0; + + return imbalance; +} + /** * calculate_imbalance - Calculate the amount of imbalance present within the * groups of a given sched_domain during load balance. @@ -8854,18 +8869,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s } /* Consider allowing a small imbalance between NUMA groups */ - if (env->sd->flags & SD_NUMA) { - unsigned int imbalance_min; - - /* - * Allow a small imbalance based on a simple pair of - * communicating tasks that remain local when the - * source domain is almost idle. - */ - imbalance_min = 2; - if (busiest->sum_nr_running <= imbalance_min) - env->imbalance = 0; - } + if (env->sd->flags & SD_NUMA) + env->imbalance = adjust_numa_imbalance(env->imbalance, + busiest->sum_nr_running); return; } -- 2.16.4
| |