linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: LKML <linux-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, mingo@redhat.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>,
	Youssef Esmat <youssefesmat@chromium.org>,
	Vineeth Pillai <vineethrp@google.com>,
	Suleiman Souhlal <suleiman@google.com>,
	Ingo Molnar <mingo@kernel.org>,
	Daniel Bristot de Oliveira <bristot@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Subject: Re: [POC][RFC][PATCH] sched: Extended Scheduler Time Slice
Date: Mon, 30 Oct 2023 09:52:03 -0400	[thread overview]
Message-ID: <20231030095203.33325aee@gandalf.local.home> (raw)
In-Reply-To: <20231030132949.GA38123@noisy.programming.kicks-ass.net>

On Mon, 30 Oct 2023 14:29:49 +0100
Peter Zijlstra <peterz@infradead.org> wrote:

> On Thu, Oct 26, 2023 at 09:16:58AM -0400, Steven Rostedt wrote:
> 
> > I said:
> > 
> >   If we are worried about abuse, we could even punish tasks that don't call
> >   sched_yield() by the time its extended time slice is taken.  
> 
> This is a user interface, ofcourse I'm worried about abuse. That's the
> first thing you *should* think about.
> 
> Userspace is out to get you -- must assume hostile.

100% agree!

> 
> Notably, we were talking usec latencies in the Chrome thread, you're
> adding 1000 usec latencies here (in the best case, delaying scheduling
> until the next tick, 10000usec for the HZ=100 folks). This is quite
> 'unfortunate'.
> 
> On my very aged IVB-EP I can get 50us scheduling latencies on a good
> day, on my brand spanking new SPR I can get 20us (more faster more
> better etc..).
> 
> Ideally we don't allow userspace to extend much (if any) beyond the
> granularity already imposed by the kernel's preempt/IRQ-disable regions.
> Sadly we don't have a self-measure of that around.
> 
> So I had a poke at all this and ended up with the below. I still utterly
> detest all this, but it appears to actually work -- although I don't
> much see the improvement, the numbers are somewhat unstable. (I say it
> works because I see the 'yield -- made it' trace_printk when I do it
> right and the 'timeout -- force resched' when I do it 'wrong'.
> 
> This thing works across the board and gives userspace 50usec, equal to
> what the kernel already imposes on (on the IVB).
> 
> I simply took a bit from the existing flags field, and userspace can use
> BTR to test if the kernel cleared it -- in which case it needs yield
> (and not any other syscall).
> 
> Additinally doing a syscall with the bit set will SIGSEGV (when
> DEBUG_RSEQ).
> 

Thanks for looking into this even though you detest it ;-)

Unfortunately, now that the merge window has opened (and someone reported a
bug in my code from linux-next :-( ), I need to take a step back from this
and may not be able to work on it again until plumbers. By then, I hope to
have time to dig deeper into what you have done here.

Thanks again Peter!

-- Steve


  reply	other threads:[~2023-10-30 13:52 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  9:42 Steven Rostedt
2023-10-25  9:46 ` Steven Rostedt
2023-10-25 10:29 ` Peter Zijlstra
2023-10-25 12:54   ` Steven Rostedt
2023-10-25 13:55     ` Peter Zijlstra
2023-10-25 14:31       ` Steven Rostedt
2023-10-25 14:53         ` Mathieu Desnoyers
2023-10-25 15:07           ` Steven Rostedt
2023-10-25 15:42         ` Mathieu Desnoyers
2023-10-25 16:24           ` Mateusz Guzik
2023-10-25 17:17             ` Steven Rostedt
2023-10-25 18:49               ` Mathieu Desnoyers
2023-10-25 19:19                 ` Steven Rostedt
2023-10-25 21:56                   ` Mathieu Desnoyers
2023-10-26  8:54               ` Peter Zijlstra
2023-10-26 13:40                 ` Steven Rostedt
2023-10-26 15:49                   ` Steven Rostedt
2023-10-26 16:31                     ` Daniel Bristot de Oliveira
2023-10-26 17:26                       ` Steven Rostedt
2023-10-26  8:44         ` Peter Zijlstra
2023-10-26 13:16           ` Steven Rostedt
2023-10-30 13:29             ` Peter Zijlstra
2023-10-30 13:52               ` Steven Rostedt [this message]
2023-10-26  5:03   ` Ankur Arora
2023-10-25 15:12 ` Steven Rostedt
2023-10-25 15:34 ` Rasmus Villemoes

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=20231030095203.33325aee@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=andrew.cooper3@citrix.com \
    --cc=ankur.a.arora@oracle.com \
    --cc=bharata@amd.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=bristot@kernel.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=joel@joelfernandes.org \
    --cc=jon.grimm@amd.com \
    --cc=juri.lelli@redhat.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=raghavendra.kt@amd.com \
    --cc=suleiman@google.com \
    --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 \
    --cc=youssefesmat@chromium.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