]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - kernel/sched.c
sched: Drop group_capacity to 1 only if local group has extra capacity
[karo-tx-linux.git] / kernel / sched.c
index f33788b77119e527ac12f9410ea160a85a3854c3..7619287a44f789b3a2709d3d4f14f31afb14125a 100644 (file)
@@ -3878,9 +3878,14 @@ static inline void update_sd_lb_stats(struct sched_domain *sd, int this_cpu,
                /*
                 * In case the child domain prefers tasks go to siblings
                 * first, lower the group capacity to one so that we'll try
-                * and move all the excess tasks away.
+                * and move all the excess tasks away. We lower the capacity
+                * of a group only if the local group has the capacity to fit
+                * these excess tasks, i.e. nr_running < group_capacity. The
+                * extra check prevents the case where you always pull from the
+                * heaviest group when it is already under-utilized (possible
+                * with a large weight task outweighs the tasks on the system).
                 */
-               if (prefer_sibling)
+               if (prefer_sibling && !local_group && sds->this_has_capacity)
                        sgs.group_capacity = min(sgs.group_capacity, 1UL);
 
                if (local_group) {