aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_thread.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2018-11-13 22:58:38 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2018-11-13 22:58:38 +0000
commitb79aa45e0e0c66a6406e5222947340e736f42aa8 (patch)
treec40d885ff6f35af8170eccfb882f6a4f1b3fbabc /sys/kern/kern_thread.c
parent85939654f3a0b7cea0a13fec4bface62e757df0b (diff)
downloadsrc-b79aa45e0e0c66a6406e5222947340e736f42aa8.tar.gz
src-b79aa45e0e0c66a6406e5222947340e736f42aa8.zip
For compatibility KPI functions like if_addr_rlock() that used to have
mutexes but now are converted to epoch(9) use thread-private epoch_tracker. Embedding tracker into ifnet(9) or ifnet derived structures creates a non reentrable function, that will fail miserably if called simultaneously from two different contexts. A thread private tracker will provide a single tracker that would allow to call these functions safely. It doesn't allow nested call, but this is not expected from compatibility KPIs. Reviewed by: markj
Notes
Notes: svn path=/head/; revision=340413
Diffstat (limited to 'sys/kern/kern_thread.c')
-rw-r--r--sys/kern/kern_thread.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index b60c2d5b40ef..03da844f652c 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -272,6 +272,7 @@ thread_init(void *mem, int size, int flags)
td->td_rlqe = NULL;
EVENTHANDLER_DIRECT_INVOKE(thread_init, td);
umtx_thread_init(td);
+ epoch_thread_init(td);
td->td_kstack = 0;
td->td_sel = NULL;
return (0);
@@ -291,6 +292,7 @@ thread_fini(void *mem, int size)
turnstile_free(td->td_turnstile);
sleepq_free(td->td_sleepqueue);
umtx_thread_fini(td);
+ epoch_thread_fini(td);
seltdfini(td);
}