lkml.org 
[lkml]   [2020]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC] exit: do exit_task_work() before shooting off mm
Date
Handle task works and lock it earlier before it starts killing off
task's resources like mm. io_uring makes use of it a lot and it'd
nicer to have all added task_work finding tasks in a consistent state.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---

Would it be correct? I clearly don't know all the exit invariants, but
can't find any users relying on task_works in-between.

kernel/exit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 1f236ed375f8..c2a0cffd824d 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -763,6 +763,7 @@ void __noreturn do_exit(long code)
}

exit_signals(tsk); /* sets PF_EXITING */
+ exit_task_work(tsk);

/* sync mm's RSS info before statistics gathering */
if (tsk->mm)
@@ -806,7 +807,6 @@ void __noreturn do_exit(long code)
if (group_dead)
disassociate_ctty(1);
exit_task_namespaces(tsk);
- exit_task_work(tsk);
exit_thread(tsk);

/*
--
2.24.0
\
 
 \ /
  Last update: 2020-12-03 03:35    [W:0.093 / U:1.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site