public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: mingo@redhat.com, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
	kprateek.nayak@amd.com, linux-kernel@vger.kernel.org,
	shubhang@os.amperecomputing.com
Subject: Re: [PATCH v2] sched: fair: Prevent negative lag increase during delayed dequeue
Date: Wed, 22 Apr 2026 16:28:28 +0200	[thread overview]
Message-ID: <20260422142828.GJ3102924@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20260422142410.GS3102624@noisy.programming.kicks-ass.net>

On Wed, Apr 22, 2026 at 04:24:11PM +0200, Peter Zijlstra wrote:
> On Wed, Apr 22, 2026 at 04:06:42PM +0200, Vincent Guittot wrote:
> > On Wed, 22 Apr 2026 at 15:39, Peter Zijlstra <peterz@infradead.org> wrote:
> 
> > > That said, on IRQ you mentioned that this wasn't quite good enough and
> > > that your original patch is best.
> > 
> > Yes, it fixes one case but breaks the other one :-(
> > 
> > >
> > > The trouble is, your original patch can update vlag (!se->sched_delayed)
> > > and report it hasn't changed; because then vlag == se->clag, obviously.
> > 
> > In the  (!se->sched_delayed),  we don't care because the entity is not
> > enqueued so we don't need to place it with new vlag
> 
> I am confused more :-) this could be dequeue_entity() doing a normal
> dequeue, in which case it very much is enqueued. We only delay for
> !eligible, !special etc..
> 
> > > This invalidates the comment on the return value of the function. In
> > > fact, it makes the function have a very non-obvious return meaning.
> > >
> > > So I'm a little confused -- what do we actually want this function to
> > > do?
> > 
> > I want update_entity_lag() to return true if we have modified the vlag
> > of an enqueued entity. In this case we need to dequeue, place entity
> > with new vlag and enqueue it.
> > 
> > we don't need to test se->on_rq because update_entity_lag() is called
> > for enqueued task only with delayed dequeue entity so
> > se->sched_delayed implies se->on_rq
> > 
> > In fact we should test :
> > (vlag != se->vlag) && se->on_rq
> > but  && se->on_rq is useless
> > 
> > That being said, this probably deserves a comment
> 
> But but, dequeue_entity()'s second update_entity_lag() call can have:
> 
>   se->sched_delayed == 0 && se->on_rq == 1
> 
> Think dequeue of eligible or special or...

So only requeue_delayed_entity() cares about the return value, and there
it holds what you say, but that is a very narrow case and doesn't
reflect all the callsites.

Let me ponder this a bit...

  reply	other threads:[~2026-04-22 14:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-31 16:23 [PATCH v2] sched: fair: Prevent negative lag increase during delayed dequeue Vincent Guittot
2026-04-02 13:13 ` Peter Zijlstra
2026-04-02 13:17   ` Vincent Guittot
2026-04-17 17:18     ` Vincent Guittot
2026-04-22 13:39       ` Peter Zijlstra
2026-04-22 14:06         ` Vincent Guittot
2026-04-22 14:24           ` Peter Zijlstra
2026-04-22 14:28             ` Peter Zijlstra [this message]
2026-04-22 14:46               ` Vincent Guittot
2026-04-22 22:20               ` Peter Zijlstra
2026-04-23  7:28                 ` Vincent Guittot
2026-04-23  9:41                   ` Peter Zijlstra
2026-04-23 10:27                     ` Vincent Guittot
2026-04-23 12:12                       ` Vincent Guittot
2026-04-02 13:42 ` Peter Zijlstra
2026-04-02 19:27 ` Shubhang Kaushik
2026-04-03  8:37   ` Vincent Guittot
2026-04-04  8:08     ` Shubhang Kaushik
2026-04-03  8:46   ` Vincent Guittot
2026-04-03 12:30 ` [tip: sched/core] sched/fair: " tip-bot2 for Vincent Guittot

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=20260422142828.GJ3102924@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=shubhang@os.amperecomputing.com \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.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