All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Prakash Sangappa <prakash.sangappa@oracle.com>,
	linux-kernel@vger.kernel.org, rostedt@goodmis.org,
	mathieu.desnoyers@efficios.com, tglx@linutronix.de,
	kprateek.nayak@amd.com
Subject: Re: [PATCH V3 1/4] Sched: Scheduler time slice extension
Date: Fri, 2 May 2025 17:27:53 +0200	[thread overview]
Message-ID: <20250502152753.aFffUGVv@linutronix.de> (raw)
In-Reply-To: <20250502143544.GW4439@noisy.programming.kicks-ass.net>

On 2025-05-02 16:35:44 [+0200], Peter Zijlstra wrote:
> On Fri, May 02, 2025 at 02:34:33PM +0200, Sebastian Andrzej Siewior wrote:
> > On 2025-05-02 01:59:52 [+0000], Prakash Sangappa wrote:
> > > diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> > > index 20154572ede9..b26adccb32df 100644
> > > --- a/kernel/entry/common.c
> > > +++ b/kernel/entry/common.c
> > > @@ -98,8 +99,12 @@ __always_inline unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
> > >  
> > >  		local_irq_enable_exit_to_user(ti_work);
> > >  
> > > -		if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY))
> > > -			schedule();
> > > +		if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) {
> > 
> > I asked to limit this to LAZY only.
> 
> No -- this should work irrespective of the preemption model chosen.

Focusing on LAZY would easily exclude the tasks with priorities.

> It should also have a default time that is shorter than the scheduling
> delay normally observed.
> 
> It should probably also have a PR_WARN on raising the sysctl value.
> 
> I know you worry about RT, but show me a trace where it is a problem.

The default extends the wakeup by 50us. With a 250us period this extends
the wakeup in worst case by 20% of the period. With 1ms it gets just to
5% of the whole period. You basically expect that everything is well
timed and this delay does not hurt anyone.
This delays interrupt driven wakeups (timer, hardware) and not every
wake up as I assumed initially so it is not as bad but still worse than
in has to be.

On top of that sched(7) says:
|   SCHED_FIFO: First in-first out scheduling
|      SCHED_FIFO  can be used only with static priorities higher than 0, which
|      means that when a SCHED_FIFO thread becomes runnable, it will always
|      immediately preempt any currently running SCHED_OTHER, SCHED_BATCH, or
|      SCHED_IDLE thread.  SCHED_FIFO is a simple scheduling algorithm without
|      time slicing.  For threads scheduled under the SCHED_FIFO  policy,  the
…
|   SCHED_DEADLINE: Sporadic task model deadline scheduling
…
|      if any SCHED_DEADLINE thread is runnable, it will preempt any thread
|      scheduled under
…

With this change, this "immediately preempt any currently running" is no
longer true.

While we could continue to argue how much the delay really is, I don't
understand why we can't exclude real time scheduling policy from this.

Sebastian

  reply	other threads:[~2025-05-02 15:27 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02  1:59 [PATCH V3 0/4] Scheduler time slice extension Prakash Sangappa
2025-05-02  1:59 ` [PATCH V3 1/4] Sched: " Prakash Sangappa
2025-05-02  9:05   ` Peter Zijlstra
2025-05-02 13:06     ` Steven Rostedt
2025-05-05  1:51       ` Prakash Sangappa
2025-05-05 14:48         ` Steven Rostedt
2025-05-05 15:58           ` Prakash Sangappa
2025-05-05 16:34             ` Steven Rostedt
2025-05-05 16:45               ` Steven Rostedt
2025-05-06  1:23               ` Prakash Sangappa
2025-05-06 13:13                 ` Steven Rostedt
2025-05-02 15:39     ` Mathieu Desnoyers
2025-05-05  1:46       ` Prakash Sangappa
2025-05-05  1:42     ` Prakash Sangappa
2025-05-02 12:34   ` Sebastian Andrzej Siewior
2025-05-02 14:35     ` Peter Zijlstra
2025-05-02 15:27       ` Sebastian Andrzej Siewior [this message]
2025-05-02  1:59 ` [PATCH V3 2/4] Sched: Tunable to specify duration of " Prakash Sangappa
2025-05-02  1:59 ` [PATCH V3 3/4] Sched: Add scheduler stat for cpu " Prakash Sangappa
2025-05-02  1:59 ` [PATCH V3 4/4] Sched: Add tracepoint for sched " Prakash Sangappa
2025-05-02  9:14   ` Peter Zijlstra
2025-05-02 11:02     ` Sebastian Andrzej Siewior
2025-05-02 11:10       ` Peter Zijlstra
2025-05-02 12:31         ` Sebastian Andrzej Siewior
2025-05-05  1:43     ` Prakash Sangappa

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=20250502152753.aFffUGVv@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=peterz@infradead.org \
    --cc=prakash.sangappa@oracle.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.