diff options
author | kib <kib@FreeBSD.org> | 2015-10-20 20:29:21 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2015-10-20 20:29:21 +0000 |
commit | c517f862f223ae255168c4fe163c9ee06e3ef841 (patch) | |
tree | 0c847573a1b15dfe48a327256383f20499d89a51 /sys | |
parent | 791509a17bcfb081804f8a309a69f1ebdb511731 (diff) | |
download | FreeBSD-src-c517f862f223ae255168c4fe163c9ee06e3ef841.zip FreeBSD-src-c517f862f223ae255168c4fe163c9ee06e3ef841.tar.gz |
Mark struct thread zone as type-stable.
When establishing the locking state for several lock types (including
blockable mutexes and sx) failed, locking primitives try to spin while
the owner thread is running. The spinning loop performs the test for
running condition by dereferencing the owner->td_state field of the
owner thread. If the owner thread exited while spinner was put off
the processor, it is harmless to access reused struct thread owner,
since in some near future the current processor would notice the owner
change and make appropriate progress. But it could be that the page
which carried the freed struct thread was unmapped, then we fault
(this cannot happen on amd64).
For now, disallowing free of the struct thread seems to be good
enough, and tests which create a lot of threads once, did not
demonstrated regressions.
Reviewed by: jhb, pho
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D3908
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_thread.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 3c6232c..ac96ca5 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -281,7 +281,7 @@ threadinit(void) thread_zone = uma_zcreate("THREAD", sched_sizeof_thread(), thread_ctor, thread_dtor, thread_init, thread_fini, - 16 - 1, 0); + 16 - 1, UMA_ZONE_NOFREE); tidhashtbl = hashinit(maxproc / 2, M_TIDHASH, &tidhash); rw_init(&tidhash_lock, "tidhash"); } |