[RFC PATCH 32/86] entry: handle TIF_NEED_RESCHED_LAZY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The scheduling policy for TIF_NEED_RESCHED_LAZY is to run to
completion. Scheduling in exit_to_user_mode_loop() satisfies that.

Scheduling while exiting to userspace, also guarantees that the task
being scheduled away is entirely clear of any kernel encumbrances
that cannot span across preemption.

Ordinarily we don't need this extra protection: the preempt_count
check is always available. However, cases where preempt_count might
not be wholly dependable (ARCH_NO_PREEMPT configurations) will make
use of this.

Originally-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Signed-off-by: Ankur Arora <ankur.a.arora@xxxxxxxxxx>
---
 include/linux/entry-common.h | 2 +-
 kernel/entry/common.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index fb2e349a17d2..7a56440442df 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -59,7 +59,7 @@
 #define EXIT_TO_USER_MODE_WORK						\
 	(_TIF_SIGPENDING | _TIF_NOTIFY_RESUME | _TIF_UPROBE |		\
 	 _TIF_NEED_RESCHED | _TIF_PATCH_PENDING | _TIF_NOTIFY_SIGNAL |	\
-	 ARCH_EXIT_TO_USER_MODE_WORK)
+	 _TIF_NEED_RESCHED_LAZY | ARCH_EXIT_TO_USER_MODE_WORK)
 
 /**
  * arch_enter_from_user_mode - Architecture specific sanity check for user mode regs
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index 194c349b8be7..0d055c39690b 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -154,7 +154,7 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
 
 		local_irq_enable_exit_to_user(ti_work);
 
-		if (ti_work & _TIF_NEED_RESCHED)
+		if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY))
 			schedule();
 
 		if (ti_work & _TIF_UPROBE)
-- 
2.31.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux