Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F167854374
D44045.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D44045.id.diff
View Options
diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c
--- a/sys/kern/kern_umtx.c
+++ b/sys/kern/kern_umtx.c
@@ -2520,7 +2520,8 @@
struct umtx_pi *pi;
uint32_t ceiling;
uint32_t owner, id;
- int error, pri, old_inherited_pri, su, rv;
+ int error, pri, old_inherited_pri, new_pri, rv;
+ bool su;
id = td->td_tid;
uq = td->td_umtxq;
@@ -2549,21 +2550,23 @@
error = EINVAL;
goto out;
}
+ new_pri = PRI_MIN_REALTIME + ceiling;
- mtx_lock(&umtx_lock);
- if (td->td_base_user_pri < PRI_MIN_REALTIME + ceiling) {
- mtx_unlock(&umtx_lock);
+ if (td->td_base_user_pri < new_pri) {
error = EINVAL;
goto out;
}
- if (su && PRI_MIN_REALTIME + ceiling < uq->uq_inherited_pri) {
- uq->uq_inherited_pri = PRI_MIN_REALTIME + ceiling;
- thread_lock(td);
- if (uq->uq_inherited_pri < UPRI(td))
- sched_lend_user_prio(td, uq->uq_inherited_pri);
- thread_unlock(td);
+ if (su) {
+ mtx_lock(&umtx_lock);
+ if (new_pri < uq->uq_inherited_pri) {
+ uq->uq_inherited_pri = new_pri;
+ thread_lock(td);
+ if (new_pri < UPRI(td))
+ sched_lend_user_prio(td, new_pri);
+ thread_unlock(td);
+ }
+ mtx_unlock(&umtx_lock);
}
- mtx_unlock(&umtx_lock);
rv = casueword32(&m->m_owner, UMUTEX_CONTESTED, &owner,
id | UMUTEX_CONTESTED);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 26, 12:51 AM (3 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37245146
Default Alt Text
D44045.id.diff (1 KB)
Attached To
Mode
D44045: PP mutexes: lock: Reduce 'umtx_lock' holding before taking the user lock
Attached
Detach File
Event Timeline
Log In to Comment