Commit d329605
sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks
When a task's weight is being changed, set_load_weight() is called with
@update_load set. As weight changes aren't trivial for the fair class,
set_load_weight() calls fair.c::reweight_task() for fair class tasks.
However, set_load_weight() first tests task_has_idle_policy() on entry and
skips calling reweight_task() for SCHED_IDLE tasks. This is buggy as
SCHED_IDLE tasks are just fair tasks with a very low weight and they would
incorrectly skip load, vlag and position updates.
Fix it by updating reweight_task() to take struct load_weight as idle weight
can't be expressed with prio and making set_load_weight() call
reweight_task() for SCHED_IDLE tasks too when @update_load is set.
Fixes: 9059393 ("sched/fair: Use reweight_entity() for set_user_nice()")
Suggested-by: Peter Zijlstra (Intel) <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: [email protected] # v4.15+
Link: http://lkml.kernel.org/r/[email protected]1 parent 0ec208c commit d329605
3 files changed
+14
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1328 | 1328 | | |
1329 | 1329 | | |
1330 | 1330 | | |
1331 | | - | |
| 1331 | + | |
1332 | 1332 | | |
1333 | | - | |
1334 | | - | |
1335 | | - | |
1336 | 1333 | | |
1337 | | - | |
1338 | | - | |
1339 | | - | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
1340 | 1339 | | |
1341 | 1340 | | |
1342 | 1341 | | |
1343 | 1342 | | |
1344 | 1343 | | |
1345 | 1344 | | |
1346 | | - | |
1347 | | - | |
1348 | | - | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
1352 | 1349 | | |
1353 | 1350 | | |
1354 | 1351 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3835 | 3835 | | |
3836 | 3836 | | |
3837 | 3837 | | |
3838 | | - | |
| 3838 | + | |
3839 | 3839 | | |
3840 | 3840 | | |
3841 | 3841 | | |
3842 | 3842 | | |
3843 | | - | |
3844 | 3843 | | |
3845 | | - | |
3846 | | - | |
| 3844 | + | |
| 3845 | + | |
3847 | 3846 | | |
3848 | 3847 | | |
3849 | 3848 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2509 | 2509 | | |
2510 | 2510 | | |
2511 | 2511 | | |
2512 | | - | |
| 2512 | + | |
2513 | 2513 | | |
2514 | 2514 | | |
2515 | 2515 | | |
| |||
0 commit comments