- Reduce scope of #ifdef's in uma_zcreate() call in init_turnstile0().

- Set UMA_ZONE_NOFREE so that the per-turnstile spin locks are type stable
  to avoid a race where one thread might dereference a lock in a free'd
  turnstile that was previously used by another thread.

Theorized by:	tegge (2)
MFC after:	1 week
This commit is contained in:
John Baldwin 2008-09-08 21:40:15 +00:00
parent a4eba4a555
commit 8c68f75a7c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182879

View File

@ -396,12 +396,13 @@ init_turnstile0(void *dummy)
{
turnstile_zone = uma_zcreate("TURNSTILE", sizeof(struct turnstile),
NULL,
#ifdef INVARIANTS
NULL, turnstile_dtor, turnstile_init, turnstile_fini,
UMA_ALIGN_CACHE, 0);
turnstile_dtor,
#else
NULL, NULL, turnstile_init, turnstile_fini, UMA_ALIGN_CACHE, 0);
NULL,
#endif
turnstile_init, turnstile_fini, UMA_ALIGN_CACHE, UMA_ZONE_NOFREE);
thread0.td_turnstile = turnstile_alloc();
}
SYSINIT(turnstile0, SI_SUB_LOCK, SI_ORDER_ANY, init_turnstile0, NULL);