linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] exit: do exit_task_work() before shooting off mm
@ 2020-12-03  2:30 Pavel Begunkov
  2020-12-08  1:37 ` Al Viro
  2020-12-14 14:51 ` [exit] 80fae08355: stderr.mount:/fs/sda1:/dev/sda1_already_mounted_or_mount_point_busy kernel test robot
  0 siblings, 2 replies; 7+ messages in thread
From: Pavel Begunkov @ 2020-12-03  2:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Jens Axboe

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-12-20 14:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03  2:30 [RFC] exit: do exit_task_work() before shooting off mm Pavel Begunkov
2020-12-08  1:37 ` Al Viro
2020-12-08  3:00   ` Pavel Begunkov
2020-12-20 12:50   ` Pavel Begunkov
2020-12-20 13:58     ` Oleg Nesterov
2020-12-20 14:42       ` Pavel Begunkov
2020-12-14 14:51 ` [exit] 80fae08355: stderr.mount:/fs/sda1:/dev/sda1_already_mounted_or_mount_point_busy kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).