Zombie processes are not subject to freezing, but they are still part of the global task list. During freeze traversal, tasks are examined for priority and eligibility, which may involve unnecessary locking even for non-freezable tasks like zombies. This patch assigns a default freeze priority to zombie tasks during exit, so that the freezer can skip priority setup and locking for them in subsequent iterations. This helps reduce overhead during freeze traversal, especially when many zombie processes exist in the system. Signed-off-by: Zihuan Zhang --- kernel/sched/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index be00629f0ba4..5a26d7511047 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -6980,6 +6981,7 @@ void __noreturn do_task_dead(void) current->flags |= PF_NOFREEZE; __schedule(SM_NONE); + freeze_set_default_priority(current, FREEZE_PRIORITY_NEVER); BUG(); /* Avoid "noreturn function does return" - but don't continue if BUG() is a NOP: */ -- 2.25.1