In kern/kern_exit.c at (original) line 231, there's a call to
membar_producer(), presumably to ensure that p->p_waited is globally
visible before updating p_.p_stat (which might cause someone to look
at p->p_waited).
Now that I'm planning to protect this whole area using proc_lock, I
question whether or not the potentially expensive call to
membar_producer() is still needed?
The membar_producer is certainly longer be needed. It is not clear to
me why it was needed in the first place, nor is the original commit
message (kern_exit.c 1.158.2.6, `Checkpoint work in progress' on the
newlock2 branch) illuminating. I see no matching membar_consumer,
even in the CVS logs.
My guess is that the membar_producer was an aborted attempt to avoid
locks or atomics for a certain part of the signal/wait protocol.