CVSROOT:        /cvs
Module name:    src
Changes by:     clau...@cvs.openbsd.org 2025/02/17 03:07:10

Modified files:
        sys/kern       : kern_exec.c kern_exit.c kern_sig.c 
        sys/sys        : proc.h 

Log message:
Make wakeup of parent process in dowait6 reliable even without kernel lock.

Currently dowait6 uses tsleep to wait for an event to report back to wait4(2).
This only works correctly if all wakeups also use the kernel lock.

Instead of this use an atomic flag to indicate if a process has pending
wait events and use sleep_setup()/sleep_finish() to reliably enter sleep
without losing a wakeup.

dowait6 clears the PS_WAITEVENT flag at the start of its loop over all child
processes and if at the end of the loop the flag is still unset the thread
goes to sleep.

Before all wakeups the PS_WAITEVENT flag is now set so that dowait6 knows
that more work is pending and restarts the scan loop.

This is needed since more and more code is unlocked and we end up missing
wakeups which results in hanging processes.

Reply via email to