]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
unwind: Add comment to unwind_deferred_task_exit()
authorPeter Zijlstra <peterz@infradead.org>
Mon, 22 Sep 2025 13:46:27 +0000 (15:46 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 29 Oct 2025 09:29:55 +0000 (10:29 +0100)
Explain why unwind_deferred_task_exit() exist and its constraints.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://patch.msgid.link/20250924080118.893367437@infradead.org
kernel/exit.c

index 9f74e8f1c431b6aa6e391ff71aadf9895a3857ae..5f6e78e28e8a7635dbedc459ebaff9715d7d44fe 100644 (file)
@@ -939,7 +939,6 @@ void __noreturn do_exit(long code)
 
        tsk->exit_code = code;
        taskstats_exit(tsk, group_dead);
-       unwind_deferred_task_exit(tsk);
        trace_sched_process_exit(tsk, group_dead);
 
        /*
@@ -950,6 +949,12 @@ void __noreturn do_exit(long code)
         * gets woken up by child-exit notifications.
         */
        perf_event_exit_task(tsk);
+       /*
+        * PF_EXITING (above) ensures unwind_deferred_request() will no
+        * longer add new unwinds. While exit_mm() (below) will destroy the
+        * abaility to do unwinds. So flush any pending unwinds here.
+        */
+       unwind_deferred_task_exit(tsk);
 
        exit_mm();