sched: Add sched_class->reweight_task()
authorTejun Heo <tj@kernel.org>
Tue, 18 Jun 2024 20:09:16 +0000 (10:09 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 18 Jun 2024 20:09:16 +0000 (10:09 -1000)
commite83edbf88f18087b5b349c7ff701b030dd53dff3
tree751d145f677b63fa3306b95caa5ac0b8ad838059
parent304b3f2bc07ba7c74a1ebc7917a8f0549e6b8d54
sched: Add sched_class->reweight_task()

Currently, during a task weight change, sched core directly calls
reweight_task() defined in fair.c if @p is on CFS. Let's make it a proper
sched_class operation instead. CFS's reweight_task() is renamed to
reweight_task_fair() and now called through sched_class.

While it turns a direct call into an indirect one, set_load_weight() isn't
called from a hot path and this change shouldn't cause any noticeable
difference. This will be used to implement reweight_task for a new BPF
extensible sched_class so that it can keep its cached task weight
up-to-date.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: David Vernet <dvernet@meta.com>
Acked-by: Josh Don <joshdon@google.com>
Acked-by: Hao Luo <haoluo@google.com>
Acked-by: Barret Rhoden <brho@google.com>
kernel/sched/core.c
kernel/sched/fair.c
kernel/sched/sched.h