From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Wang Tao <wangtao554@huawei.com>, <mingo@redhat.com>,
<peterz@infradead.org>, <juri.lelli@redhat.com>,
<vincent.guittot@linaro.org>
Cc: <dietmar.eggemann@arm.com>, <rostedt@goodmis.org>,
<bsegall@google.com>, <mgorman@suse.de>, <vschneid@redhat.com>,
<tanghui20@huawei.com>, <zhangqiao22@huawei.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/eevdf: Update se->vprot in reweight_entity()
Date: Wed, 21 Jan 2026 09:51:44 +0530 [thread overview]
Message-ID: <8e7aadf8-b7a0-4500-ad2d-507665007694@amd.com> (raw)
In-Reply-To: <20260120123113.3518950-1-wangtao554@huawei.com>
Hello Wang,
On 1/20/2026 6:01 PM, Wang Tao wrote:
> 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.
I don't think that is correct. "vprot" allows for "min_slice" worth of
runtime from the beginning of the pick however, if we do a
set_protect_slice() after reweight, we'll essentially grant another
"min_slice" worth of time from the current "se->vruntime" (or until
deadline if it is sooner) which is not correct.
>
> This patch fixes the issue by calling `set_protect_slice()` at the end of
> `reweight_entity()`. This ensures that a new, valid protection slice is
> committed based on the updated `vruntime` and the new weight, restoring
> Run-to-Parity consistency immediately after a weight change.
>
> Fixes: 63304558ba5d ("sched/eevdf: Curb wakeup-preemption")
> Suggested-by: Zhang Qiao <zhangqiao22@huawei.com>
> Signed-off-by: Wang Tao <wangtao554@huawei.com>
> ---
> kernel/sched/fair.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index e71302282671..bdd8c4e688ae 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3792,6 +3792,8 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
At the beginning of reweight_entity, we should first check if
protect_slice() for curr is true or not:
bool protect_slice = curr && protect_slice(se);
> if (!curr)
> __enqueue_entity(cfs_rq, se);
> cfs_rq->nr_queued++;
> + if (curr)
> + set_protect_slice(cfs_rq, se);
If protect_slice() was true to begin with, we should do:
if (protect_slice)
se->vprot = min_vruntime(se->vprot, se->deadline);
This ensures that if our deadline has moved back, we only protect until
the new deadline and the scheduler can re-evaluate after that. If there
was an entity with a shorter slice at the beginning of the pick, the
"vprot" should still reflect the old value that was calculated using
"se->vruntime" at the time of the pick.
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2026-01-21 4:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-20 12:31 Wang Tao
2026-01-21 4:21 ` K Prateek Nayak [this message]
2026-01-21 9:33 ` wangtao (EQ)
2026-01-21 17:00 ` Vincent Guittot
2026-01-22 4:38 ` K Prateek Nayak
2026-01-23 16:38 ` Vincent Guittot
2026-01-22 7:52 ` wangtao (EQ)
2026-01-23 17:32 ` Vincent Guittot
2026-01-23 15:38 ` Peter Zijlstra
2026-01-23 16:39 ` K Prateek Nayak
2026-01-23 21:31 ` Peter Zijlstra
2026-01-23 17:37 ` Vincent Guittot
2026-02-23 10:25 ` [tip: sched/urgent] " tip-bot2 for Wang Tao
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=8e7aadf8-b7a0-4500-ad2d-507665007694@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tanghui20@huawei.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=wangtao554@huawei.com \
--cc=zhangqiao22@huawei.com \
/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®