The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Rik van Riel <riel@surriel.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Juri Lelli <juri.lelli@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH] sched/fair: clamp rescaled vlag in reweight_entity() to bound entity_key()
Date: Thu, 11 Jun 2026 10:19:06 +0200	[thread overview]
Message-ID: <20260611081906.GI48970@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260610105529.14e014dd@fangorn>

On Wed, Jun 10, 2026 at 10:55:29AM -0400, Rik van Riel wrote:

> reweight_entity() preserves an entity's lag across a weight change by
> scaling vlag in rescale_entity():
> 
> 	se->vlag = vl' = vl * old_weight / new_weight;
> 
> and then, for an on_rq entity, recomputes:
> 
> 	se->vruntime = avruntime - se->vlag;
> 
> On a large weight decrease (w' << w) this inflates vlag without bound;
> nothing re-clamps it to the per-entity lag limit that entity_lag() and
> update_entity_lag() enforce everywhere else.  The deadline is rescaled
> and re-based separately, so only vruntime drifts.

So the vlag limit is:

	limit = calc_delta_fair(max_slice, se)

Right? But that is in fact:

          max_slice * NICE_0_LOAD
  limit = -----------------------
	       se->weight

Now, rescale does:

          vlag * old_weight
  vlag =  -----------------
             new_weight

So then transform the limit using that same:

          max_slice * NICE_0_LOAD   old_weight   max_slice * NICE_0_LOAD
  limit = ----------------------- * ---------- = -----------------------
                old_weight          new_weight          new_weight

IOW, the transform totally preserves the limit. If the vlag was bound
before, it must be bound after.

What am I missing?

  reply	other threads:[~2026-06-11  8:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 14:55 [PATCH] sched/fair: clamp rescaled vlag in reweight_entity() to bound entity_key() Rik van Riel
2026-06-11  8:19 ` Peter Zijlstra [this message]
2026-06-11 21:55   ` Rik van Riel

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=20260611081906.GI48970@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=riel@surriel.com \
    --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