linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Suleiman Souhlal <suleiman@google.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	 linux-trace-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	 Ankur Arora <ankur.a.arora@oracle.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	 linux-mm@kvack.org, x86@kernel.org, akpm@linux-foundation.org,
	 luto@kernel.org, bp@alien8.de, dave.hansen@linux.intel.com,
	hpa@zytor.com,  juri.lelli@redhat.com,
	vincent.guittot@linaro.org, willy@infradead.org,
	 mgorman@suse.de, jon.grimm@amd.com, bharata@amd.com,
	raghavendra.kt@amd.com,  boris.ostrovsky@oracle.com,
	konrad.wilk@oracle.com, jgross@suse.com,
	 andrew.cooper3@citrix.com,
	Joel Fernandes <joel@joelfernandes.org>,
	 Vineeth Pillai <vineethrp@google.com>,
	Ingo Molnar <mingo@kernel.org>,
	 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Clark Williams <clark.williams@gmail.com>,
	 bigeasy@linutronix.de, daniel.wagner@suse.com,
	joseph.salisbury@oracle.com,  broonie@gmail.com
Subject: Re: [RFC][PATCH 1/2] sched: Extended scheduler time slice
Date: Tue, 4 Feb 2025 12:28:41 +0900	[thread overview]
Message-ID: <CABCjUKA2w9Xip2QDjMRDCWnvmZc52SWbn74-57q52gmpXcT+EA@mail.gmail.com> (raw)
In-Reply-To: <20250203114537.6a30c7c0@gandalf.local.home>

On Tue, Feb 4, 2025 at 1:45 AM Steven Rostedt <rostedt@goodmis.org> wrote:
>
> On Mon, 3 Feb 2025 09:43:06 +0100
> Peter Zijlstra <peterz@infradead.org> wrote:
>
> > Lazy is not the default, nor even the recommended preemption method at
> > this time.
>
> That's OK. If it is considered to be the default in the future, this can
> wait.
>
> >
> > Lazy will not ever be the only preemption method, full isn't going
> > anywhere.
>
> That's fine too, as full preemption has the same issue of preempting
> kernel mutexes. Full preemption is for something that likely doesn't want
> this feature anyway.
>
> >
> > Lazy only applies to fair (and whatever bpf things end up using
> > resched_curr_lazy()).
>
> Is that a problem? User spin locks for RT tasks are very dangerous. If an
> RT task preempts the owner that is of lower priority, it can cause a
> deadlock (if the two tasks are pinned to the same CPU). Which BTW,
> Sebastion mentioned in the Stable RT meeting that glibc supplies a
> pthread_spin_lock() and doesn't have in the man page anything about this
> possible scenario.
>
> >
> > Lazy works on tick granularity, which is variable per the HZ config, and
> > way too long for any of this nonsense.
>
> Patch 2 changes that to do what you wrote the last time. It has a max wait
> time of 50us.
>
> >
> > So by tying this to lazy, you get something that doesn't actually work
> > most of the time, and when it works, it has variable and bad behaviour.
>
> Um no. If we wait for lazy to become the default behavior, it will work
> most of the time. And when it does work, it has strict behavior of 50us.
>
> >
> > So yeah, crap.
>
> As your rationale was not correct, I will disagree with this being crap.
>
>
> >
> > This really isn't difficult to understand, and I've told you this
> > before.
>
> And I listened to what you told me before. Patch 2 implements the 50us max
> that you suggested. I separated it out because it made the code simpler to
> understand and debug. The change log even mentioned:
>
>      For the moment, it lets it run for one more tick (which will be
>      changed later).
>
> That "changed later" is the second patch in this series.
>
> With the "this can wait until lazy is default", is because we have an
> "upstream first" policy. As long as there is some buy-in to the changes, we
> can go ahead and implement it on our devices. We do not have to wait for it
> to be accepted. But if there's a strong NAK to the idea, it is much harder
> to get it implemented internally.

Can you explain why this approach requires PREEMPT_LAZY?

Could  exit_to_user_mode_loop() be changed to something like the
following (with maybe some provision to only do it once)?

if ((ti_work & _TIF_NEED_RESCHED) && !rseq_delay_resched())
    schedule();

I suppose there would also need to be some additional changes to make
sure full preemption also doesn't preempt, maybe in
preempt_schedule*().

-- Suleiman


  reply	other threads:[~2025-02-04  3:28 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-31 22:58 [RFC][PATCH 0/2] sched: Extended Scheduler Time Slice revisited Steven Rostedt
2025-01-31 22:58 ` [RFC][PATCH 1/2] sched: Extended scheduler time slice Steven Rostedt
2025-02-01 11:59   ` Peter Zijlstra
2025-02-01 12:47     ` Steven Rostedt
2025-02-01 18:11       ` Peter Zijlstra
2025-02-01 23:06         ` Steven Rostedt
2025-02-03  8:43           ` Peter Zijlstra
2025-02-03  8:53             ` Peter Zijlstra
2025-02-03 16:45             ` Steven Rostedt
2025-02-04  3:28               ` Suleiman Souhlal [this message]
2025-02-04  3:57                 ` Steven Rostedt
2025-02-04  9:16               ` Peter Zijlstra
2025-02-04 12:51                 ` Steven Rostedt
2025-02-04 13:16                   ` Steven Rostedt
2025-02-04 15:05                     ` Steven Rostedt
2025-02-04 15:30                   ` Peter Zijlstra
2025-02-04 16:11                     ` Steven Rostedt
2025-02-05  9:07                       ` Peter Zijlstra
2025-02-05 13:10                         ` Steven Rostedt
2025-02-05 13:44                           ` Steven Rostedt
2025-02-04 22:44         ` Prakash Sangappa
2025-02-05  0:56           ` Joel Fernandes
2025-02-05  3:04             ` Steven Rostedt
2025-02-05  5:09               ` Joel Fernandes
2025-02-05 13:16                 ` Steven Rostedt
2025-02-05 13:38                   ` Steven Rostedt
2025-02-05 21:08                   ` Prakash Sangappa
2025-02-05 21:19                     ` Steven Rostedt
2025-02-05 21:33                       ` Steven Rostedt
2025-02-05 21:36                         ` Prakash Sangappa
2025-02-06  3:07                   ` Joel Fernandes
2025-02-06 13:30                     ` Steven Rostedt
2025-02-06 13:44                       ` Sebastian Andrzej Siewior
2025-02-06 13:48                         ` Peter Zijlstra
2025-02-06 13:53                           ` Sebastian Andrzej Siewior
2025-02-06 13:57                             ` Peter Zijlstra
2025-02-06 14:20                               ` Steven Rostedt
2025-02-06 14:22                               ` Sebastian Andrzej Siewior
2025-02-06 14:27                                 ` Peter Zijlstra
2025-02-06 14:57                                   ` Steven Rostedt
2025-02-06 15:01                                   ` Sebastian Andrzej Siewior
2025-02-10 19:43                         ` Steven Rostedt
2025-02-10 22:04                           ` David Laight
2025-02-10 22:15                             ` Steven Rostedt
2025-02-11  8:21                           ` Sebastian Andrzej Siewior
2025-02-11 10:57                             ` Peter Zijlstra
2025-02-11 15:28                             ` Steven Rostedt
2025-02-12 12:11                               ` Sebastian Andrzej Siewior
2025-02-12 15:00                                 ` Steven Rostedt
2025-02-12 15:18                                   ` Sebastian Andrzej Siewior
2025-02-10 14:07                       ` Joel Fernandes
2025-02-10 19:48                         ` Steven Rostedt
2025-02-10 17:20                       ` David Laight
2025-02-10 17:27                         ` Steven Rostedt
2025-02-10 19:44                           ` Steven Rostedt
2025-02-10 21:51                             ` David Laight
2025-02-10 21:58                               ` Steven Rostedt
2025-02-01 14:35   ` Mathieu Desnoyers
2025-02-01 23:08     ` Steven Rostedt
2025-02-01 23:18       ` Linus Torvalds
2025-02-01 23:35         ` Linus Torvalds
2025-02-02  3:26           ` Steven Rostedt
2025-02-02  3:22         ` Steven Rostedt
2025-02-02  7:22           ` Matthew Wilcox
2025-02-02 22:29             ` Steven Rostedt
2025-01-31 22:58 ` [RFC][PATCH 2/2] sched: Shorten time that tasks can extend their time slice for Steven Rostedt

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=CABCjUKA2w9Xip2QDjMRDCWnvmZc52SWbn74-57q52gmpXcT+EA@mail.gmail.com \
    --to=suleiman@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=bharata@amd.com \
    --cc=bigeasy@linutronix.de \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=broonie@gmail.com \
    --cc=clark.williams@gmail.com \
    --cc=daniel.wagner@suse.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=joel@joelfernandes.org \
    --cc=jon.grimm@amd.com \
    --cc=joseph.salisbury@oracle.com \
    --cc=juri.lelli@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=raghavendra.kt@amd.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vineethrp@google.com \
    --cc=willy@infradead.org \
    --cc=x86@kernel.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