Skip to content

Commit b8fd842

Browse files
deggemanIngo Molnar
authored andcommitted
sched/fair: Explain why MIN_SHARES isn't scaled in calc_cfs_shares()
Signed-off-by: Dietmar Eggemann <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Paul Turner <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Samuel Thibault <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 89ee048 commit b8fd842

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernel/sched/fair.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2657,6 +2657,18 @@ static long calc_cfs_shares(struct cfs_rq *cfs_rq, struct task_group *tg)
26572657
if (tg_weight)
26582658
shares /= tg_weight;
26592659

2660+
/*
2661+
* MIN_SHARES has to be unscaled here to support per-CPU partitioning
2662+
* of a group with small tg->shares value. It is a floor value which is
2663+
* assigned as a minimum load.weight to the sched_entity representing
2664+
* the group on a CPU.
2665+
*
2666+
* E.g. on 64-bit for a group with tg->shares of scale_load(15)=15*1024
2667+
* on an 8-core system with 8 tasks each runnable on one CPU shares has
2668+
* to be 15*1024*1/8=1920 instead of scale_load(MIN_SHARES)=2*1024. In
2669+
* case no task is runnable on a CPU MIN_SHARES=2 should be returned
2670+
* instead of 0.
2671+
*/
26602672
if (shares < MIN_SHARES)
26612673
shares = MIN_SHARES;
26622674
if (shares > tg->shares)

0 commit comments

Comments
 (0)