diff mbox series

[v4,23/24] dept: Let it work with real sleeps in __schedule()

Message ID 1646377603-19730-24-git-send-email-byungchul.park@lge.com (mailing list archive)
State New, archived
Headers show
Series DEPT(Dependency Tracker) | expand

Commit Message

Byungchul Park March 4, 2022, 7:06 a.m. UTC
Dept commits the staged wait in __schedule() even if the corresponding
wake_up() has already woken up the task. Which means Dept considers the
case as a sleep. This would help Dept work for stronger detection but
also leads false positives.

It'd be better to let Dept work only with real sleeps conservatively for
now. So did it.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 kernel/sched/core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 6a422aa..2ec7cf8 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6192,7 +6192,12 @@  static void __sched notrace __schedule(unsigned int sched_mode)
 	local_irq_disable();
 	rcu_note_context_switch(!!sched_mode);
 
-	if (sched_mode == SM_NONE)
+	/*
+	 * Skip the commit if the current task does not actually go to
+	 * sleep.
+	 */
+	if (READ_ONCE(prev->__state) & TASK_NORMAL &&
+	    sched_mode == SM_NONE)
 		dept_ask_event_wait_commit(_RET_IP_);
 
 	/*