linux-yocto/kernel/sched
Tejun Heo b37f1c530d sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks
commit d329605287 upstream.

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: 9059393e4e ("sched/fair: Use reweight_entity() for set_user_nice()")
Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: stable@vger.kernel.org # v4.15+
Link: http://lkml.kernel.org/r/20240624102331.GI31592@noisy.programming.kicks-ass.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-19 05:45:11 +02:00
..
autogroup.c
autogroup.h
clock.c
completion.c
core_sched.c
core.c sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks 2024-08-19 05:45:11 +02:00
cpuacct.c sched/cpuacct: Optimize away RCU read lock 2023-10-06 13:18:19 +02:00
cpudeadline.c
cpudeadline.h
cpufreq_schedutil.c
cpufreq.c
cpupri.c sched/rt: Fix live lock between select_fallback_rq() and RT push 2023-10-06 13:18:22 +02:00
cpupri.h
cputime.c
deadline.c sched: Fix stop_one_cpu_nowait() vs hotplug 2023-11-20 11:08:13 +01:00
debug.c
fair.c sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks 2024-08-19 05:45:11 +02:00
features.h
idle.c Revert "kernel/sched: Modify initial boot task idle setup" 2023-10-19 23:05:38 +02:00
isolation.c
loadavg.c
Makefile
membarrier.c sched/membarrier: reduce the ability to hammer on sys_membarrier 2024-02-23 08:55:14 +01:00
pelt.c
pelt.h
psi.c
rt.c sched/rt: Disallow writing invalid values to sched_rt_period_us 2024-03-01 13:21:43 +01:00
sched-pelt.h
sched.h sched/fair: set_load_weight() must also call reweight_task() for SCHED_IDLE tasks 2024-08-19 05:45:11 +02:00
smp.h
stats.c
stats.h
stop_task.c
swait.c
topology.c sched/fair: Allow disabling sched_balance_newidle with sched_relax_domain_level 2024-06-16 13:39:34 +02:00
wait_bit.c
wait.c