Page MenuHomeFreeBSD

D42266.id129066.diff
No OneTemporary

D42266.id129066.diff

diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -568,9 +568,16 @@
if (tid0 != THREAD0_TID)
panic("tid0 %d != %d\n", tid0, THREAD0_TID);
+ /*
+ * Thread structures are specially aligned so that (at least) the
+ * 5 lower bits of a pointer to 'struct thead' must be 0. These are
+ * used by synchronization primitives to store flags in pointers to
+ * thread structures (lockmgr, rwlock, and sx use the whole 5 bits,
+ * rmlock indirectly by relying on sx, mtx (non-spin) relies on 3 bits).
+ */
thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(),
thread_ctor, thread_dtor, thread_init, thread_fini,
- 32 - 1, UMA_ZONE_NOFREE);
+ UMA_ALIGN_CACHE_AND_MASK(32 - 1), UMA_ZONE_NOFREE);
tidhashtbl = hashinit(maxproc / 2, M_TIDHASH, &tidhash);
tidhashlock = (tidhash + 1) / 64;
if (tidhashlock > 0)

File Metadata

Mime Type
text/plain
Expires
Tue, Apr 22, 10:17 AM (4 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17703027
Default Alt Text
D42266.id129066.diff (910 B)

Event Timeline