From: Kayra Cizmeci <kayracizmeci@gmail.com>
To: christian.loehle@arm.com
Cc: dietmar.eggemann@arm.com, kayracizmeci@gmail.com,
linux-kernel@vger.kernel.org, mingo@redhat.com,
peterz@infradead.org, vincent.guittot@linaro.org
Subject: Re: [PATCH 2/2] sched/eevdf: Keep expired protection expired across reweighting
Date: Wed, 30 Sep 2026 16:37:15 +0300 [thread overview]
Message-ID: <20260930133716.214471-1-kayracizmeci@gmail.com> (raw)
In-Reply-To: <78ce8f8ceb4f5c7fda14216d3dff9d74e17f55ac.1790756779.git.christian.loehle@arm.com>
Hi Christian,
> reweight_eevdf() rescales live slice protection, but leaves an expired
> vprot unchanged when moving vruntime. A reweight can move vruntime behind
> the old vprot. For example, reducing the weight of an entity with positive
> lag can do so:
>
> before reweight: vprot <= vruntime
> after reweight: vruntime < vprot
>
> protect_slice() consequently becomes true again, even though no fresh
> protection was granted.
> This also happens from task_tick_fair() after a queued HRTICK has
> requested a reschedule. A four-task rt-app workload with 100 us, 1 ms,
> 10 ms and 100 ms requests can then repick current despite a runnable,
> eligible entity having an earlier deadline. The stale protection takes
> precedence in pick_eevdf(). Cgroup weight changes also expose this with
> HRTICK disabled.
> Separating vprot from vlag allowed the expired absolute boundary to survive
> the lag update and rescaling. Previously, those writes to vlag overwrote
> the shared storage. Commit ff38424030f9 ("sched/eevdf: Update se->vprot in
> reweight_entity()") subsequently handled live protection, but left the
> expired case unchanged.
> Keep an expired current entity's protection at its new vruntime:
>
> after reweight: vprot = vruntime
>
> This keeps protect_slice() false. Retain the existing rescaling for
> protection that was still live and leave non-current entities alone.
>
> Fixes: 80390ead2080 ("sched/fair: Separate se->vlag from se->vprot")
> Signed-off-by: Christian Loehle <christian.loehle@arm.com>
> ---
> kernel/sched/fair.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 868c3911337a..d10eeea75f13 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4951,6 +4951,9 @@ static void reweight_eevdf(struct cfs_rq *cfs_rq, struct sched_entity *se,
> se->deadline += avruntime;
> se->rel_deadline = 0;
> se->vruntime = avruntime - se->vlag;
> + /* Reweighting must not revive expired slice protection. */
> + if (curr && !rel_vprot)
> + se->vprot = se->vruntime;
>
> if (!curr)
> __enqueue_entity(cfs_rq, se);
Okay, so scene:
we have a rq like this:
+----+
|root|
+----+
/\
/ \
/ \
+------+ +------+
|task_a| |task_b|
+------+ +------+
When, sched_change_end() activates for task_a, (Assuming it's Fair Class and weight is different than h_load.weight)
enqueue_task_fair() calls reweight_eevdf() with on_rq = false so the block never works. Then we call place_entity() and vruntime goes back.
On normal enqueue, this will be tolerated with vprot getting written over. But, sched_change_end() calls set_next_task()
that calls set_next_task_fair() with SNT_NORMAL. On that case set_protect_slice() is not called. reweight_eevdf() is called
again on that path, but because the first call did the job this one just returns early.
I could be missing something tho. If I'm not, should we fold this into 2/2 or should I send a patch about this?
Thanks,
Kayra
next prev parent reply other threads:[~2026-09-30 13:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 8:47 [PATCH 0/2] sched/eevdf: Fix slice protection across state changes Christian Loehle
2026-09-30 8:47 ` [PATCH 1/2] sched/eevdf: Cap protection when current has the shortest slice Christian Loehle
2026-09-30 13:15 ` Christian Loehle
2026-09-30 8:47 ` [PATCH 2/2] sched/eevdf: Keep expired protection expired across reweighting Christian Loehle
2026-09-30 13:37 ` Kayra Cizmeci [this message]
2026-09-30 15:28 ` Christian Loehle
2026-09-30 15:34 ` Kayra Cizmeci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260930133716.214471-1-kayracizmeci@gmail.com \
--to=kayracizmeci@gmail.com \
--cc=christian.loehle@arm.com \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®