Skip to content

Commit

Permalink
sched/numa: Rename nr_running and break out the magic number
Browse files Browse the repository at this point in the history
This is simply a preparation patch to make the following patches easier
to read. No functional change.

Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lkml.kernel.org/r/20201120090630.3286-2-mgorman@techsingularity.net
  • Loading branch information
Mel Gorman authored and Peter Zijlstra committed Nov 24, 2020
1 parent 74d862b commit abeae76
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,7 +1559,7 @@ struct task_numa_env {
static unsigned long cpu_load(struct rq *rq);
static unsigned long cpu_runnable(struct rq *rq);
static unsigned long cpu_util(int cpu);
static inline long adjust_numa_imbalance(int imbalance, int nr_running);
static inline long adjust_numa_imbalance(int imbalance, int dst_running);

static inline enum
numa_type numa_classify(unsigned int imbalance_pct,
Expand Down Expand Up @@ -8991,16 +8991,18 @@ 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 nr_running)
#define NUMA_IMBALANCE_MIN 2

static inline long adjust_numa_imbalance(int imbalance, int dst_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 (nr_running <= imbalance_min)
imbalance_min = NUMA_IMBALANCE_MIN;
if (dst_running <= imbalance_min)
return 0;

return imbalance;
Expand Down

0 comments on commit abeae76

Please sign in to comment.