fork: Move task stack accounting to do_exit()
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Thu, 17 Feb 2022 10:24:04 +0000 (11:24 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 22 Feb 2022 21:25:02 +0000 (22:25 +0100)
commit1a03d3f13ffe5dd24142d6db629e72c11b704d99
tree84657d0e0eb3fb7653a15caf35822407dddb0274
parentf1c1a9ee00e4c53c9ccc03ec1aff4792948a25eb
fork: Move task stack accounting to do_exit()

There is no need to perform the stack accounting of the outgoing task in
its final schedule() invocation which happens with preemption disabled.
The task is leaving, the resources will be freed and the accounting can
happen in do_exit() before the actual schedule invocation which
frees the stack memory.

Move the accounting of the stack memory from release_task_stack() to
exit_task_stack_account() which then can be invoked from do_exit().

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/20220217102406.3697941-7-bigeasy@linutronix.de
include/linux/sched/task_stack.h
kernel/exit.c
kernel/fork.c