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