diff mbox series

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

Message ID 5eee1da51b7aaac3f55d6923e96182012b00deaa.1629655338.git.olivier@trillion01.com (mailing list archive)
State New, archived
Headers show
Series coredump: io_uring: Cancel io_uring to avoid core truncation | expand

Commit Message

Olivier Langlois Aug. 22, 2021, 9:05 p.m. UTC
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 <olivier@trillion01.com>
---
 include/linux/tracehook.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

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;
 }
 
 /*