# Re: \[rfc patch v4.4-rt2\] sched: fix up preempt lazy forward port

- From: Sebastian Andrzej Siewior \<bigeasy@linutronix.de\>
- Date: 2016-01-18 20:18:32 
- List: linux-rt-users
- Page: https://ratatoskr.run/linux-rt-users/2016/01/4662954
- Thread: https://ratatoskr.run/linux-rt-users/2016/01/4662538/t.md

```text
* Mike Galbraith | 2016-01-18 10:08:23 [+0100]:

>--- a/arch/x86/entry/common.c
>+++ b/arch/x86/entry/common.c
>@@ -220,14 +220,14 @@ long syscall_trace_enter(struct pt_regs
> 
> #define EXIT_TO_USERMODE_LOOP_FLAGS				\
> 	(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |	\
>-	 _TIF_NEED_RESCHED | _TIF_USER_RETURN_NOTIFY)
>+	 _TIF_NEED_RESCHED_MASK | _TIF_USER_RETURN_NOTIFY)
> 

If I read this right, the loop where this define is used
_TIF_ALLWORK_MASK in v4.1 of which _TIF_NEED_RESCHED_MASK was part of.
Adding this will reassmeble the old behaviour.
…

>--- a/kernel/sched/core.c
>+++ b/kernel/sched/core.c
>@@ -3542,6 +3542,15 @@ asmlinkage __visible void __sched notrac
> 	if (likely(!preemptible()))
> 		return;
> 
>+#ifdef CONFIG_PREEMPT_LAZY
>+	/*
>+	 * Check for lazy preemption
>+	 */
>+	if (current_thread_info()->preempt_lazy_count &&
>+	    !test_thread_flag(TIF_NEED_RESCHED))
>+		return;
>+#endif
>+

And this is a new piece. So you forbid that tasks leave the CPU if
lazy_count > 0. Let me look closed why this is happening and if this is
v4.1 … v4.4 or not.

> 	preempt_schedule_common();
> }
> NOKPROBE_SYMBOL(preempt_schedule);

Sebastian
```
