Re: [RFC][PATCH 1/2] sched: Extended scheduler time slice
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Date: 2025-02-12 15:19:03
Also in:
linux-mm, lkml
On 2025-02-12 10:00:01 [-0500], Steven Rostedt wrote:
On Wed, 12 Feb 2025 13:11:13 +0100 Sebastian Andrzej Siewior [off-list ref] wrote:quoted
quoted
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.
I would argue that we want to get out of the kernel asap and not schedule() if we stumble upon cond_resched().
quoted
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.quoted
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 secondNot 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.
okay.
quoted
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?
No I have not.
-- Steve
Sebastian