# Re: \[RFC\]\[PATCH 1/2\] sched: Extended scheduler time slice

- From: Peter Zijlstra \<peterz@infradead.org\>
- Date: 2025-02-11 10:57:38 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2025/02/2921316
- Thread: https://ratatoskr.run/linux-trace-kernel/2025/02/2912025/t.md

```text
On Tue, Feb 11, 2025 at 09:21:38AM +0100, Sebastian Andrzej Siewior wrote:

> So with LAZY_PREEMPT (not that one that was merged upstream, its
> predecessor) we had a counter similar to the preemption counter. On each
> rt_spin_lock() the counter was incremented, on each rt_spin_unlock() the
> counter was decremented. Once the counter hit zero and the lazy preempt
> flag was set (which was only set on schedule requests by SCHED_OTHER
> tasks), we scheduled.
> This improved the performance as we didn't schedule() while holding a
> spinlock_t and then bump into the same lock in the next task.
> 
> We don't follow this behaviour exactly today.

I think I send some hackery Mike's way to implement that at some point.

IIRC it wasn't an obvious win. Anyway its not too hard to do.
```
