@@ -9350,74 +9350,26 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu)
9350
9350
}
9351
9351
9352
9352
/**
9353
- * asym_smt_can_pull_tasks - Check whether the load balancing CPU can pull tasks
9354
- * @dst_cpu: Destination CPU of the load balancing
9353
+ * sched_asym - Check if the destination CPU can do asym_packing load balance
9354
+ * @env: The load balancing environment
9355
9355
* @sds: Load-balancing data with statistics of the local group
9356
9356
* @sgs: Load-balancing statistics of the candidate busiest group
9357
- * @sg: The candidate busiest group
9357
+ * @group: The candidate busiest group
9358
9358
*
9359
- * Check the state of the SMT siblings of both @sds::local and @sg and decide
9360
- * if @dst_cpu can pull tasks .
9359
+ * @env::dst_cpu can do asym_packing if it has higher priority than the
9360
+ * preferred CPU of @group .
9361
9361
*
9362
- * This function must be called only if all the SMT siblings of @dst_cpu are
9363
- * idle, if any.
9362
+ * SMT is a special case. If we are balancing load between cores, @env::dst_cpu
9363
+ * can do asym_packing balance only if all its SMT siblings are idle. Also, it
9364
+ * can only do it if @group is an SMT group and has exactly on busy CPU. Larger
9365
+ * imbalances in the number of CPUS are dealt with in find_busiest_group().
9364
9366
*
9365
- * If @dst_cpu does not have SMT siblings, it can pull tasks if two or more of
9366
- * the SMT siblings of @sg are busy. If only one CPU in @sg is busy, pull tasks
9367
- * only if @dst_cpu has higher priority.
9367
+ * If we are balancing load within an SMT core, or at DIE domain level, always
9368
+ * proceed.
9368
9369
*
9369
- * When dealing with SMT cores, only use priorities if the SMT core has exactly
9370
- * one busy sibling. find_busiest_group() will handle bigger imbalances in the
9371
- * number of busy CPUs.
9372
- *
9373
- * Return: true if @dst_cpu can pull tasks, false otherwise.
9370
+ * Return: true if @env::dst_cpu can do with asym_packing load balance. False
9371
+ * otherwise.
9374
9372
*/
9375
- static bool asym_smt_can_pull_tasks (int dst_cpu , struct sd_lb_stats * sds ,
9376
- struct sg_lb_stats * sgs ,
9377
- struct sched_group * sg )
9378
- {
9379
- #ifdef CONFIG_SCHED_SMT
9380
- bool local_is_smt ;
9381
- int sg_busy_cpus ;
9382
-
9383
- local_is_smt = sds -> local -> flags & SD_SHARE_CPUCAPACITY ;
9384
- sg_busy_cpus = sgs -> group_weight - sgs -> idle_cpus ;
9385
-
9386
- if (!local_is_smt ) {
9387
- /*
9388
- * If we are here, @dst_cpu is idle and does not have SMT
9389
- * siblings. Pull tasks if candidate group has two or more
9390
- * busy CPUs.
9391
- */
9392
- if (sg_busy_cpus >= 2 ) /* implies sg_is_smt */
9393
- return true;
9394
-
9395
- /*
9396
- * @dst_cpu does not have SMT siblings. @sg may have SMT
9397
- * siblings and only one is busy. In such case, @dst_cpu
9398
- * can help if it has higher priority and is idle (i.e.,
9399
- * it has no running tasks).
9400
- */
9401
- return sched_asym_prefer (dst_cpu , sg -> asym_prefer_cpu );
9402
- }
9403
-
9404
- /*
9405
- * If we are here @dst_cpu has SMT siblings and are also idle.
9406
- *
9407
- * CPU priorities does not make sense for SMT cores with more than one
9408
- * busy sibling.
9409
- */
9410
- if (group -> flags & SD_SHARE_CPUCAPACITY && sg_busy_cpus != 1 )
9411
- return false;
9412
-
9413
- return sched_asym_prefer (dst_cpu , sg -> asym_prefer_cpu );
9414
-
9415
- #else
9416
- /* Always return false so that callers deal with non-SMT cases. */
9417
- return false;
9418
- #endif
9419
- }
9420
-
9421
9373
static inline bool
9422
9374
sched_asym (struct lb_env * env , struct sd_lb_stats * sds , struct sg_lb_stats * sgs ,
9423
9375
struct sched_group * group )
@@ -9426,10 +9378,14 @@ sched_asym(struct lb_env *env, struct sd_lb_stats *sds, struct sg_lb_stats *sgs
9426
9378
if (!sched_use_asym_prio (env -> sd , env -> dst_cpu ))
9427
9379
return false;
9428
9380
9429
- /* Only do SMT checks if either local or candidate have SMT siblings. */
9430
- if ((sds -> local -> flags & SD_SHARE_CPUCAPACITY ) ||
9431
- (group -> flags & SD_SHARE_CPUCAPACITY ))
9432
- return asym_smt_can_pull_tasks (env -> dst_cpu , sds , sgs , group );
9381
+ /*
9382
+ * CPU priorities does not make sense for SMT cores with more than one
9383
+ * busy sibling.
9384
+ */
9385
+ if (group -> flags & SD_SHARE_CPUCAPACITY ) {
9386
+ if (sgs -> group_weight - sgs -> idle_cpus != 1 )
9387
+ return false;
9388
+ }
9433
9389
9434
9390
return sched_asym_prefer (env -> dst_cpu , group -> asym_prefer_cpu );
9435
9391
}
0 commit comments