I learned in a textbook that Linux keeps the process descriptors when the process becomes a zombie until future parent verifies the exit status. I understand that process descriptor comes in two structs: task_struct in slab, and thread_info in kernel stack (forget x86).
I am reading through <kernel/exit.c> do_exit() part of the source code, but I don't quite get where kernel stack is deallocated. I can find that exit_notify() changes the process' status to zombie. and the rest of the code looks like its about cleaning up mostly locks and stuff until schedule().
I can't seem to find the part for deallocating kernel stack? or am I not understanding how kernel stacks work?
Or perhaps thread_info is not considered to be kept at all and was already discarded along with kernel stack before changing into zombie?
What is exactly going on?