A memory ordering barrier is needed in crit_exit() ensure that td_pri
authorMatthew Dillon <dillon@dragonflybsd.org>
Tue, 4 May 2004 17:13:04 +0000 (17:13 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Tue, 4 May 2004 17:13:04 +0000 (17:13 +0000)
commit853ae338e419ee3152e276fa3daaac5d49696627
treeca6e57bf98f6dcdfc7d4f18c5377bce35ca1705c
parent4f0a1741357637aefa5456932504e60189f56374
A memory ordering barrier is needed in crit_exit() ensure that td_pri
is adjusted before gd_reqflags is tested.

Reorder the tests in crit_exit() as a branch prediction optimization.
Check gd_reqflags first, since it is likely to be NULL, and td_pri second,
since thd td_pri check may oscillate depending on the critical section's
nesting level.

Load the globaldata pointer before adjusting td_pri in crit_exit_quick()
as an instruction ordering optimization.
sys/sys/thread2.h