Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/eevdf: Update se->vprot in reweight_entity()

In the EEVDF framework with Run-to-Parity protection, `se->vprot` is an
independent variable defining the virtual protection timestamp.

When `reweight_entity()` is called (e.g., via nice/renice), it performs
the following actions to preserve Lag consistency:
1. Scales `se->vlag` based on the new weight.
2. Calls `place_entity()`, which recalculates `se->vruntime` based on
the new weight and scaled lag.

However, the current implementation fails to update `se->vprot`, leading
to mismatches between the task's actual runtime and its expected duration.

Fixes: 63304558ba5d ("sched/eevdf: Curb wakeup-preemption")
Suggested-by: Zhang Qiao <zhangqiao22@huawei.com>
Signed-off-by: Wang Tao <wangtao554@huawei.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Tested-by: Shubhang Kaushik <shubhang@os.amperecomputing.com>
Link: https://patch.msgid.link/20260120123113.3518950-1-wangtao554@huawei.com

authored by

Wang Tao and committed by
Peter Zijlstra
ff384240 bcd74b2f

+12
+12
kernel/sched/fair.c
··· 3815 3815 unsigned long weight) 3816 3816 { 3817 3817 bool curr = cfs_rq->curr == se; 3818 + bool rel_vprot = false; 3819 + u64 vprot; 3818 3820 3819 3821 if (se->on_rq) { 3820 3822 /* commit outstanding execution time */ ··· 3824 3822 update_entity_lag(cfs_rq, se); 3825 3823 se->deadline -= se->vruntime; 3826 3824 se->rel_deadline = 1; 3825 + if (curr && protect_slice(se)) { 3826 + vprot = se->vprot - se->vruntime; 3827 + rel_vprot = true; 3828 + } 3829 + 3827 3830 cfs_rq->nr_queued--; 3828 3831 if (!curr) 3829 3832 __dequeue_entity(cfs_rq, se); ··· 3844 3837 if (se->rel_deadline) 3845 3838 se->deadline = div_s64(se->deadline * se->load.weight, weight); 3846 3839 3840 + if (rel_vprot) 3841 + vprot = div_s64(vprot * se->load.weight, weight); 3842 + 3847 3843 update_load_set(&se->load, weight); 3848 3844 3849 3845 do { ··· 3858 3848 enqueue_load_avg(cfs_rq, se); 3859 3849 if (se->on_rq) { 3860 3850 place_entity(cfs_rq, se, 0); 3851 + if (rel_vprot) 3852 + se->vprot = se->vruntime + vprot; 3861 3853 update_load_add(&cfs_rq->load, se->load.weight); 3862 3854 if (!curr) 3863 3855 __enqueue_entity(cfs_rq, se);