Messages in this thread |  | | Date | Tue, 7 Jan 2020 12:22:55 +0100 | From | Peter Zijlstra <> | Subject | Re: [PATCH] sched, fair: Allow a small degree of load imbalance between SD_NUMA domains v2 |
| |
On Tue, Jan 07, 2020 at 09:56:55AM +0000, Mel Gorman wrote:
> Much more importantly, doing what you suggest allows an imbalance > of more CPUs than are backed by a single LLC. On high-end AMD EPYC 2 > machines, busiest->group_weight scaled by imbalance_pct spans multiple L3 > caches. That is going to have side-effects. While I also do not account > for the LLC group_weight, it's unlikely the cut-off I used would be > smaller than an LLC cache on a large machine as the cache. > > These two points are why I didn't take the group weight into account. > > Now if you want, I can do what you suggest anyway as long as you are happy > that the child domain weight is also taken into account and to bound the > largest possible allowed imbalance to deal with the case of a node having > multiple small LLC caches. That means that some machines will be using the > size of the node and some machines will use the size of an LLC. It's less > predictable overall as some machines will be "special" relative to others > making it harder to reproduce certain problems locally but it would take > imbalance_pct into account in a way that you're happy with. > > Also bear in mind that whether LLC is accounted for or not, the final > result should be halved similar to the other imbalance calculations to > avoid over or under load balancing.
> + /* Consider allowing a small imbalance between NUMA groups */ > + if (env->sd->flags & SD_NUMA) { > + struct sched_domain *child = env->sd->child;
This assumes sd-child exists, which should be true for NUMA domains I suppose.
> + unsigned int imbalance_adj; > + > + /* > + * Calculate an acceptable degree of imbalance based > + * on imbalance_adj. However, do not allow a greater > + * imbalance than the child domains weight to avoid > + * a case where the allowed imbalance spans multiple > + * LLCs. > + */
That comment is a wee misleading, @child is not an LLC per se. This could be the NUMA distance 2 domain, in which case @child is the NUMA distance 1 group.
That said, even then it probably makes sense to ensure you don't idle a whole smaller distance group.
> + imbalance_adj = busiest->group_weight * (env->sd->imbalance_pct - 100) / 100; > + imbalance_adj = min(imbalance_adj, child->span_weight); > + imbalance_adj >>= 1; > + > + /* > + * Ignore small imbalances when the busiest group has > + * low utilisation. > + */ > + if (busiest->sum_nr_running < imbalance_adj) > + env->imbalance = 0; > + } > + > return; > } >
|  |