Thread (4 messages) 4 messages, 1 author, 2021-08-22
STALE1761d

[PATCH 1/3] tracehook: Add a return value to tracehook_notify_signal

From: Olivier Langlois <hidden>
Date: 2021-08-22 21:05:56
Also in: linux-fsdevel, lkml
Subsystem: the rest, tracing · Maintainers: Linus Torvalds, Steven Rostedt, Masami Hiramatsu

The return value indicates if task_work_run has been called.
This knowledge can be of value to the caller. In particular, it allows
io_uring to easily replace calls to io_run_task_work with
tracehook_notify_signal when clearing TIF_NOTIFY_SIGNAL is needed.

Signed-off-by: Olivier Langlois <redacted>
---
 include/linux/tracehook.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/linux/tracehook.h b/include/linux/tracehook.h
index 3e80c4bc66f7..1f778ed9c6e2 100644
--- a/include/linux/tracehook.h
+++ b/include/linux/tracehook.h
@@ -204,12 +204,16 @@ static inline void tracehook_notify_resume(struct pt_regs *regs)
  * is currently used by TWA_SIGNAL based task_work, which requires breaking
  * wait loops to ensure that task_work is noticed and run.
  */
-static inline void tracehook_notify_signal(void)
+static inline bool tracehook_notify_signal(void)
 {
+	bool ret;
+
 	clear_thread_flag(TIF_NOTIFY_SIGNAL);
 	smp_mb__after_atomic();
-	if (current->task_works)
+	ret = current->task_works;
+	if (ret)
 		task_work_run();
+	return ret;
 }
 
 /*
-- 
2.32.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help