[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <abab9af4e0d26358538a45a2826650e9cefd2924.1606961931.git.asml.silence@gmail.com>
Date: Thu, 3 Dec 2020 02:30:46 +0000
From: Pavel Begunkov <asml.silence@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [RFC] exit: do exit_task_work() before shooting off mm
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@...il.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
Powered by blists - more mailing lists