public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Prakash Sangappa <prakash.sangappa@oracle.com>,
	Madadi Vineeth Reddy <vineethr@linux.ibm.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch@vger.kernel.org, Randy Dunlap <rdunlap@infradead.org>,
	Ron Geva <rongevarg@gmail.com>, Waiman Long <longman@redhat.com>
Subject: Re: [patch V6 10/11] entry: Hook up rseq time slice extension
Date: Sun, 11 Jan 2026 12:01:31 +0100	[thread overview]
Message-ID: <878qe4ifas.ffs@tglx> (raw)
In-Reply-To: <20251219110711.GE1132199@noisy.programming.kicks-ass.net>

On Fri, Dec 19 2025 at 12:07, Peter Zijlstra wrote:
> On Tue, Dec 16, 2025 at 10:37:24AM -0500, Mathieu Desnoyers wrote:
>> On 2025-12-15 13:24, Thomas Gleixner wrote:
>> > Wire the grant decision function up in exit_to_user_mode_loop()
>> > 
>> [...]
>> > +/* TIF bits, which prevent a time slice extension. */
>> > +#ifdef CONFIG_PREEMPT_RT
>> > +# define TIF_SLICE_EXT_SCHED	(_TIF_NEED_RESCHED_LAZY)
>> > +#else
>> > +# define TIF_SLICE_EXT_SCHED	(_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)
>> 
>> It would be relevant to explain the difference between RT and non-RT
>> in the commit message.
>
> So if you include TIF_NEED_RESCHED the extension period directly affects
> the minimum scheduler delay like:
>
>   min(extension_period, min_sched_delay)
>
> because this is strictly a from-userspace thing. That is, it is
> equivalent to the in-kernel preemption/IRQ disabled regions -- with
> exception of the scheduler critical sections itself.
>
> As I've agrued many times -- I don't see a fundamental reason to not do
> this for RT -- but perhaps further reduce the magic number such that its
> impact cannot be observed on a 'good' machine.
>
> But yes, if/when we do this on RT it needs the promise to agressively
> decrease the magic number any time it can actually be measured to impact
> performance.
>
> cyclictest should probably get a mode where it (ab)uses the feature to
> failure before we do this.
>
> Anyway, I don't mind excluding RT for now, but it *does* deserve a
> comment.

I know you argued about this many times, but I still maintain my point
of view that TIF_PREEMPT and TIF_PREEMPT_LAZY are fundmentally different:

     TIF_PREEMPT_LAZY grants a non-RT task to complete until it reaches
     return to user

     TIF_PREEMPT enforces preemption at the next possible preemption
     point

My main concern is this scenario:

   sched_other_task()
        request_slice_extension()

   ---> interrupt
        RT task is woken up

        return_to_user()
           grant_extension()
           ...

which means the RT task is delayed until the OTHER task relinquishes the
CPU voluntarily or via timeout.

That might be desired _if_ both tasks are using the same lock, but in
case of fully independent tasks it's not necessarily a good idea. If a
RT application uses locks in the RT tasks, then obviously latency is not
so much of a concern, but for optimized RT applications the side effect
of other processes getting a free pass to increase latency is troublesome.

So I prefer to keep the current semantics for RT. This can be revisited
of course when a proper evaluation has been done, but IMO there are too
many moving parts in a RT system to make this actually work correctly
under all circumstances.

I'll add proper comments to that effect.

Thanks,

        tglx







  reply	other threads:[~2026-01-11 11:01 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 16:52 [patch V6 00/11] rseq: Implement time slice extension mechanism Thomas Gleixner
2025-12-15 16:52 ` [patch V6 01/11] rseq: Add fields and constants for time slice extension Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16 14:36   ` Mathieu Desnoyers
2025-12-18 23:21     ` Thomas Gleixner
2026-01-07 21:11       ` Mathieu Desnoyers
2026-01-11 17:11         ` Thomas Gleixner
2026-01-13 23:45           ` Florian Weimer
2026-01-14 21:59             ` Thomas Gleixner
2026-01-17 16:16             ` Mathieu Desnoyers
2026-01-19 10:21               ` Peter Zijlstra
2026-01-19 10:30                 ` Mathieu Desnoyers
2026-01-19 11:03                   ` Peter Zijlstra
2026-01-19 11:10                     ` Mathieu Desnoyers
2026-01-19 11:27                       ` Peter Zijlstra
2026-01-19 10:46                 ` Florian Weimer
2026-01-17  9:36       ` Peter Zijlstra
2026-01-19 10:10   ` Peter Zijlstra
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 02/11] rseq: Provide static branch for time slice extensions Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 03/11] rseq: Add statistics " Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 04/11] rseq: Add prctl() to enable " Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 05/11] rseq: Implement sys_rseq_slice_yield() Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16 14:59   ` Mathieu Desnoyers
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 06/11] rseq: Implement syscall entry work for time slice extensions Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16 15:05   ` Mathieu Desnoyers
2025-12-18 22:28     ` Thomas Gleixner
2025-12-18 22:30       ` Mathieu Desnoyers
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 07/11] rseq: Implement time slice extension enforcement timer Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16  7:18   ` Randy Dunlap
2025-12-16 17:55     ` Prakash Sangappa
2025-12-16  8:26   ` [patch V6.1 " Thomas Gleixner
2025-12-16 15:13   ` [patch V6 " Mathieu Desnoyers
2025-12-18 15:05   ` Peter Zijlstra
2025-12-18 23:26     ` Thomas Gleixner
2025-12-19 10:05       ` Peter Zijlstra
2026-01-16 18:15         ` Peter Zijlstra
2026-01-18 10:46           ` Thomas Gleixner
2026-01-19 10:01             ` Peter Zijlstra
2025-12-18 15:18   ` Peter Zijlstra
2025-12-18 23:25     ` Thomas Gleixner
2026-01-17  9:57   ` Peter Zijlstra
2026-01-23 17:38     ` Prakash Sangappa
2026-01-23 17:41     ` Prakash Sangappa
2026-01-27 18:48       ` Peter Zijlstra
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 08/11] rseq: Reset slice extension when scheduled Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16 15:17   ` Mathieu Desnoyers
2026-01-22 10:16   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 09/11] rseq: Implement rseq_grant_slice_extension() Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16 15:25   ` Mathieu Desnoyers
2025-12-18 23:28     ` Thomas Gleixner
2026-01-11 10:22       ` Thomas Gleixner
2026-01-22 10:15   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 10/11] entry: Hook up rseq time slice extension Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2025-12-16 15:37   ` Mathieu Desnoyers
2025-12-19 11:07     ` Peter Zijlstra
2026-01-11 11:01       ` Thomas Gleixner [this message]
2026-01-17  9:51         ` Peter Zijlstra
2026-01-22 10:15   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 16:52 ` [patch V6 11/11] selftests/rseq: Implement time slice extension test Thomas Gleixner
2025-12-15 18:24   ` Thomas Gleixner
2026-01-22 10:15   ` [tip: sched/core] " tip-bot2 for Thomas Gleixner
2025-12-15 18:24 ` [patch V6 00/11] rseq: Implement time slice extension mechanism Thomas Gleixner

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=878qe4ifas.ffs@tglx \
    --to=tglx@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bigeasy@linutronix.de \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=prakash.sangappa@oracle.com \
    --cc=rdunlap@infradead.org \
    --cc=rongevarg@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=vineethr@linux.ibm.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