aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/kernel/sched/fair.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2024-06-18 10:09:16 -1000
committerTejun Heo <tj@kernel.org>2024-06-18 10:09:16 -1000
commite83edbf88f18087b5b349c7ff701b030dd53dff3 (patch)
tree751d145f677b63fa3306b95caa5ac0b8ad838059 /kernel/sched/fair.c
parentsched: Allow sched_cgroup_fork() to fail and introduce sched_cancel_fork() (diff)
downloadwireguard-linux-e83edbf88f18087b5b349c7ff701b030dd53dff3.tar.xz
wireguard-linux-e83edbf88f18087b5b349c7ff701b030dd53dff3.zip
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>
Diffstat (limited to 'kernel/sched/fair.c')
-rw-r--r--kernel/sched/fair.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 41b58387023d..18ecd4f908e4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3835,7 +3835,7 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
}
}
-void reweight_task(struct task_struct *p, int prio)
+static void reweight_task_fair(struct rq *rq, struct task_struct *p, int prio)
{
struct sched_entity *se = &p->se;
struct cfs_rq *cfs_rq = cfs_rq_of(se);
@@ -13221,6 +13221,7 @@ DEFINE_SCHED_CLASS(fair) = {
.task_tick = task_tick_fair,
.task_fork = task_fork_fair,
+ .reweight_task = reweight_task_fair,
.prio_changed = prio_changed_fair,
.switched_from = switched_from_fair,
.switched_to = switched_to_fair,