Re: [PATCH v3 04/10] sched/fair: rework load_balance

From: Peter Zijlstra
Date: Tue Oct 08 2019 - 13:39:37 EST


On Tue, Oct 08, 2019 at 05:30:02PM +0200, Vincent Guittot wrote:

> This is how I plan to get ride of the problem:
> + if (busiest->group_weight == 1 || sds->prefer_sibling) {
> + unsigned int nr_diff = busiest->sum_h_nr_running;
> + /*
> + * When prefer sibling, evenly spread running tasks on
> + * groups.
> + */
> + env->migration_type = migrate_task;
> + lsub_positive(&nr_diff, local->sum_h_nr_running);
> + env->imbalance = nr_diff >> 1;
> + return;
> + }

I'm thinking the max_t(long, 0, ...); variant reads a lot simpler and
really _should_ work given that -fno-strict-overflow / -fwrapv mandates
2s complement.