I'm a student who studies linux kernel with 'Linux Kernel Development' written by Rovert Love.I'm newbie.
In parentless child part of this book, there is a find_new_reap function to find new parent process (init or other processes).
Below code :
...if (unlikely(pid_ns->child_reaper == father)) { write_unlock_irq(&tasklist_lock); if (unlikely(pid_ns == &init_pid_ns)) panic("Attempted to kill init!"); zap_pid_ns_processes(pid_ns); write_lock_irq(&tasklist_lock); pid_ns->child_reaper = init_pid_ns.child_reaper;}...
Actually, I couldn't understand these codes but i know these codes are written for 'init' process.
Why was 'write_unlock_irq' used before 'write_lock_irq'?When I searched about that, 'write_unlock_irq' was used before 'write_lock_irq' in most codes.
And why were panic, zap_pid_ns_processes used to set 'init' process?