* [PATCH v5] sched/eevdf: Fix vprot across reweighting
@ 2026-10-16 15:37 Kayra Cizmeci
2026-11-02 13:31 ` Kayra Cizmeci
2026-11-17 16:15 ` Kayra Cizmeci
0 siblings, 2 replies; 3+ messages in thread
From: Kayra Cizmeci @ 2026-10-16 15:37 UTC (permalink / raw)
To: peterz, vincent.guittot, Ingo Molnar, Juri Lelli,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak
Cc: christian.loehle, elif.topuz, linux-kernel, mingo, sh, Kayra Cizmeci
Currently in reweighting, while a tasks vruntime changes dead protection
could go alive, or alive protection could decrease, increase and go dead.
Fix it in reweight_eevdf(), and just cancel it in the sched_change_end()
path.
Fixes: 80390ead2080 ("sched/fair: Separate se->vlag from se->vprot")
Fixes: bcd74b2ffdd0 ("sched/fair: Only set slice protection at pick time")
Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Signed-off-by: Kayra Cizmeci <kayracizmeci@gmail.com>
---
Changes v4->v5:
* Use Vincent's comment
* Grab Tags
v4: https://lore.kernel.org/lkml/20261016150402.6952-1-kayracizmeci@gmail.com/
Not tested.
kernel/sched/fair.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 0feec172fd37..fd8902813c9f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4892,12 +4892,15 @@ static void reweight_eevdf(struct cfs_rq *cfs_rq, struct sched_entity *se,
update_load_set(&se->h_load, weight);
if (on_rq) {
- if (rel_vprot)
- se->vprot += avruntime;
se->deadline += avruntime;
se->rel_deadline = 0;
se->vruntime = avruntime - se->vlag;
+ if (rel_vprot)
+ se->vprot += avruntime;
+ else if (curr)
+ se->vprot = se->vruntime;
+
if (!curr)
__enqueue_entity(cfs_rq, se);
cfs_rq->h_nr_queued++;
@@ -8202,6 +8205,14 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
if (!curr) {
reweight_eevdf(cfs_rq, se, weight, false);
place_entity(cfs_rq, se, flags | ENQUEUE_QUEUED);
+ /*
+ * During a sched_change pattern, current is dequeued and
+ * cfs_rq->curr becomes NULL while rq->donor == p. As all
+ * properties can change, cancel slice protection which is
+ * not reliable anymore.
+ */
+ if (task_current_donor(rq, p))
+ cancel_protect_slice(se);
__enqueue_entity(cfs_rq, se);
}
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5] sched/eevdf: Fix vprot across reweighting
2026-10-16 15:37 [PATCH v5] sched/eevdf: Fix vprot across reweighting Kayra Cizmeci
@ 2026-11-02 13:31 ` Kayra Cizmeci
2026-11-17 16:15 ` Kayra Cizmeci
1 sibling, 0 replies; 3+ messages in thread
From: Kayra Cizmeci @ 2026-11-02 13:31 UTC (permalink / raw)
To: peterz, vincent.guittot, Ingo Molnar, Juri Lelli,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak
Cc: christian.loehle, elif.topuz, linux-kernel, mingo, sh
Hi Peter,
Gentle ping on this one. Do you think its ready to be applied?
Thanks,
Kayra
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v5] sched/eevdf: Fix vprot across reweighting
2026-10-16 15:37 [PATCH v5] sched/eevdf: Fix vprot across reweighting Kayra Cizmeci
2026-11-02 13:31 ` Kayra Cizmeci
@ 2026-11-17 16:15 ` Kayra Cizmeci
1 sibling, 0 replies; 3+ messages in thread
From: Kayra Cizmeci @ 2026-11-17 16:15 UTC (permalink / raw)
To: peterz, vincent.guittot, Ingo Molnar, Juri Lelli,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak
Cc: christian.loehle, elif.topuz, linux-kernel, mingo, sh
On Fri, Oct 16, 2026 at 06:37:20PM +0300, Kayra Cizmeci wrote:
> Currently in reweighting, while a tasks vruntime changes dead protection
> could go alive, or alive protection could decrease, increase and go dead.
> Fix it in reweight_eevdf(), and just cancel it in the sched_change_end()
> path.
>
> Fixes: 80390ead2080 ("sched/fair: Separate se->vlag from se->vprot")
> Fixes: bcd74b2ffdd0 ("sched/fair: Only set slice protection at pick time")
> Suggested-by: Vincent Guittot <vincent.guittot@linaro.org>
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> Signed-off-by: Kayra Cizmeci <kayracizmeci@gmail.com>
> ---
> Changes v4->v5:
> * Use Vincent's comment
> * Grab Tags
>
> v4: https://lore.kernel.org/lkml/20261016150402.6952-1-kayracizmeci@gmail.com/
>
> Not tested.
Well I got bored, so I tested this. I don't know what more to do on this
patch. I already pinged. So the only thing left was testing, I guess.
The results were good. I tried to verify 2 things:
* Only sched change thingies enter the newly added path in enqueue_task_fair()
* All tasks protection gets handled correctly
There were ~318000 reweights of curr, ~48000 of them were alive.
No exceptions :-). Or :-( since if there was an exception atleast it
would be fun to check it out.
Cheers,
Kayra
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-17 16:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-16 15:37 [PATCH v5] sched/eevdf: Fix vprot across reweighting Kayra Cizmeci
2026-11-02 13:31 ` Kayra Cizmeci
2026-11-17 16:15 ` Kayra Cizmeci
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®