Print this page
OS-7753 THREAD_KPRI_RELEASE does nothing of the sort
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
@@ -18,10 +18,11 @@
*
* CDDL HEADER END
*/
/*
* Copyright (c) 1991, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
*/
/*
* VM - page locking primitives
@@ -362,11 +363,10 @@
* writer that wants exclusive access, return failure
*/
retval = 0;
} else if ((pp->p_selock & ~SE_EWANTED) == 0) {
/* no reader/writer lock held */
- THREAD_KPRI_REQUEST();
/* this clears our setting of the SE_EWANTED bit */
pp->p_selock = SE_WRITER;
retval = 1;
} else {
/* page is locked */
@@ -549,11 +549,10 @@
* SE_EXCL_WANTED.
*/
if (!(old & SE_EWANTED) || (es & SE_EXCL_WANTED)) {
if ((old & ~SE_EWANTED) == 0) {
/* no reader/writer lock held */
- THREAD_KPRI_REQUEST();
/* this clears out our setting of the SE_EWANTED bit */
pp->p_selock = SE_WRITER;
mutex_exit(pse);
return (1);
}
@@ -588,11 +587,10 @@
return (0);
}
if (se == SE_EXCL) {
if (pp->p_selock == 0) {
- THREAD_KPRI_REQUEST();
pp->p_selock = SE_WRITER;
mutex_exit(pse);
return (1);
}
} else {
@@ -626,11 +624,10 @@
if (CV_HAS_WAITERS(&pp->p_cv))
cv_broadcast(&pp->p_cv);
} else if ((old & ~SE_EWANTED) == SE_DELETED) {
panic("page_unlock_nocapture: page %p is deleted", (void *)pp);
} else if (old < 0) {
- THREAD_KPRI_RELEASE();
pp->p_selock &= SE_EWANTED;
if (CV_HAS_WAITERS(&pp->p_cv))
cv_broadcast(&pp->p_cv);
} else if ((old & ~SE_EWANTED) > SE_READER) {
pp->p_selock = old - SE_READER;
@@ -660,11 +657,10 @@
if (CV_HAS_WAITERS(&pp->p_cv))
cv_broadcast(&pp->p_cv);
} else if ((old & ~SE_EWANTED) == SE_DELETED) {
panic("page_unlock: page %p is deleted", (void *)pp);
} else if (old < 0) {
- THREAD_KPRI_RELEASE();
pp->p_selock &= SE_EWANTED;
if (CV_HAS_WAITERS(&pp->p_cv))
cv_broadcast(&pp->p_cv);
} else if ((old & ~SE_EWANTED) > SE_READER) {
pp->p_selock = old - SE_READER;
@@ -680,11 +676,10 @@
* relatively long time in the kernel making no progress.
*/
if ((pp->p_toxic & PR_CAPTURE) &&
!(curthread->t_flag & T_CAPTURING) &&
!PP_RETIRED(pp)) {
- THREAD_KPRI_REQUEST();
pp->p_selock = SE_WRITER;
mutex_exit(pse);
page_unlock_capture(pp);
} else {
mutex_exit(pse);
@@ -710,11 +705,10 @@
mutex_enter(pse);
if (!(pp->p_selock & SE_EWANTED)) {
/* no threads want exclusive access, try upgrade */
if (pp->p_selock == SE_READER) {
- THREAD_KPRI_REQUEST();
/* convert to exclusive lock */
pp->p_selock = SE_WRITER;
mutex_exit(pse);
return (1);
}
@@ -736,11 +730,10 @@
ASSERT((pp->p_selock & ~SE_EWANTED) != SE_DELETED);
ASSERT(PAGE_EXCL(pp));
mutex_enter(pse);
excl_waiting = pp->p_selock & SE_EWANTED;
- THREAD_KPRI_RELEASE();
pp->p_selock = SE_READER | excl_waiting;
if (CV_HAS_WAITERS(&pp->p_cv))
cv_broadcast(&pp->p_cv);
mutex_exit(pse);
}
@@ -754,11 +747,10 @@
ASSERT(pp->p_vnode == NULL);
ASSERT(pp->p_offset == (u_offset_t)-1);
ASSERT(!PP_ISFREE(pp));
mutex_enter(pse);
- THREAD_KPRI_RELEASE();
pp->p_selock = SE_DELETED;
if (CV_HAS_WAITERS(&pp->p_cv))
cv_broadcast(&pp->p_cv);
mutex_exit(pse);
}