Re: [RFC][PATCH 1/2] sched: Extended scheduler time slice
From: Steven Rostedt
Date: Wed Feb 12 2025 - 10:00:29 EST
On Wed, 12 Feb 2025 13:11:13 +0100
Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
> > IIUC, today, LAZY causes all SCHED_OTHER tasks to act more like
> > PREEMPT_NONE. Is that correct?
>
> Well. First sched-tick will set the LAZY bit, the second sched-tick
> forces a resched.
> On PREEMPT_NONE the sched-tick would be set NEED_RESCHED while nothing
> will force a resched until the task decides to do schedule() on its own.
> So it is slightly different for kernel threads.
Except that it should schedule on a cond_resched() and the point of adding
LAZY was to get rid of all the cond_resched() which in turn gets rid of the
need for PREEMPT_NONE. Which was what I was getting at. That PREEMPT_LAZY
is really just NONE without the need to sprinkle cond_resched() all over
the kernel. Instead of having cond_resched(), we just wait for the next
tick.
>
> Unless we talk about userland, here we would have a resched on the
> return to userland after the sched-tick LAZY or NONE does not matter.
>
> > Now that the PREEMPT_RT is not one of the preemption selections, when you
> > select PREEMPT_RT, you can pick between CONFIG_PREEMPT and
> > CONFIG_PREEMPT_LAZY. Where CONFIG_PREEMPT will preempt the kernel at the
> > scheduler tick if preemption is enabled and CONFIG_PREEMPT_LAZY will
> > not preempt the kernel on a scheduler tick and wait for exit to user space.
>
> This is not specific to RT but FULL vs LAZY. But yes. However the second
Not true. PREEMPT_RT use to enable PREEMPT_FULL as well (it would preempt
everywhere). The issue we found was that spin_locks which would not have
been preempted by just FULL alone were being preempted when RT was enabled.
That caused a lot more contention with spin locks in the kernel.
That is PREEMPT_RT with PREEMPT_FULL will have a noticeable performance
degradation compared to just PREEMPT_FULL alone.
> sched-tick will force preemption point even without the
> exit-to-userland.
>
My question still stands. Have you compared PREEMPT_FULL with and without
PREEMPT_RT?
-- Steve