On Wed 20-05-15 15:10:44, Michal Hocko wrote: [...] > But I am completely lost in the exit code paths. E.g. what happens > when the thread group leader exits and the other threads are still > alive? I would expect another thread would be chosen as a new leader and > siblings would be updated. But I cannot find that code. Maybe the > original leader just waits for all other threads to terminate and stay > in the linked lists. I've tried a simple test where the main thread (group leader) calls pthread_exit after it creates another thread. The other thread continues to run and the leader is marked as Zombie: $ ./t & Main pid:2432 tid:2432 Exiting main thread Secondary pid:2432 tid:2433...... $ ps ax | grep 2432 2432 pts/3 Zl+ 0:00 [t] <defunct> So I assume the leader simply waits for its threads to finish and it stays in the sibling list. __unhash_process seems like it does the final cleanup and unlinks the leader from the lists. Which means that mm_update_next_owner never sees !group_leader. Is that correct Oleg? -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>