summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/kern_kse.c22
-rw-r--r--sys/kern/kern_thread.c22
-rw-r--r--sys/sys/proc.h3
3 files changed, 14 insertions, 33 deletions
diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c
index 2080493..c739809 100644
--- a/sys/kern/kern_kse.c
+++ b/sys/kern/kern_kse.c
@@ -500,14 +500,8 @@ kse_release(struct thread *td, struct kse_release_args *uap)
timespecadd(&ts, &timeout);
TIMESPEC_TO_TIMEVAL(&tv, &timeout);
}
- mtx_lock_spin(&sched_lock);
/* Change OURSELF to become an upcall. */
- td->td_flags = TDF_UPCALLING;
-#if 0 /* XXX This shouldn't be necessary */
- if (p->p_sflag & PS_NEEDSIGCHK)
- td->td_flags |= TDF_ASTPENDING;
-#endif
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags |= TDP_UPCALLING;
PROC_LOCK(p);
while ((td->td_upcall->ku_flags & KUF_DOUPCALL) == 0 &&
(kg->kg_completed == NULL)) {
@@ -1379,7 +1373,7 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku)
/* Let the new thread become owner of the upcall */
ku->ku_owner = td2;
td2->td_upcall = ku;
- td2->td_flags = TDF_UPCALLING;
+ td2->td_pflags = TDP_UPCALLING;
#if 0 /* XXX This shouldn't be necessary */
if (td->td_proc->p_sflag & PS_NEEDSIGCHK)
td2->td_flags |= TDF_ASTPENDING;
@@ -1432,9 +1426,7 @@ error:
void
thread_signal_upcall(struct thread *td)
{
- mtx_lock_spin(&sched_lock);
- td->td_flags |= TDF_UPCALLING;
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags |= TDP_UPCALLING;
return;
}
@@ -1612,9 +1604,7 @@ thread_userret(struct thread *td, struct trapframe *frame)
* strucuture, we can go to userland.
* Turn ourself into an upcall thread.
*/
- mtx_lock_spin(&sched_lock);
- td->td_flags |= TDF_UPCALLING;
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags |= TDP_UPCALLING;
} else if (td->td_mailbox && (ku == NULL)) {
error = thread_export_context(td);
/* possibly upcall with error? */
@@ -1663,7 +1653,7 @@ thread_userret(struct thread *td, struct trapframe *frame)
PROC_UNLOCK(p);
}
- if (td->td_flags & TDF_UPCALLING) {
+ if (td->td_pflags & TDP_UPCALLING) {
uts_crit = 0;
kg->kg_nextupcall = ticks+kg->kg_upquantum;
/*
@@ -1674,8 +1664,8 @@ thread_userret(struct thread *td, struct trapframe *frame)
CTR3(KTR_PROC, "userret: upcall thread %p (pid %d, %s)",
td, td->td_proc->p_pid, td->td_proc->p_comm);
+ td->td_pflags &= ~TDP_UPCALLING;
mtx_lock_spin(&sched_lock);
- td->td_flags &= ~TDF_UPCALLING;
if (ku->ku_flags & KUF_DOUPCALL)
ku->ku_flags &= ~KUF_DOUPCALL;
mtx_unlock_spin(&sched_lock);
diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c
index 2080493..c739809 100644
--- a/sys/kern/kern_thread.c
+++ b/sys/kern/kern_thread.c
@@ -500,14 +500,8 @@ kse_release(struct thread *td, struct kse_release_args *uap)
timespecadd(&ts, &timeout);
TIMESPEC_TO_TIMEVAL(&tv, &timeout);
}
- mtx_lock_spin(&sched_lock);
/* Change OURSELF to become an upcall. */
- td->td_flags = TDF_UPCALLING;
-#if 0 /* XXX This shouldn't be necessary */
- if (p->p_sflag & PS_NEEDSIGCHK)
- td->td_flags |= TDF_ASTPENDING;
-#endif
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags |= TDP_UPCALLING;
PROC_LOCK(p);
while ((td->td_upcall->ku_flags & KUF_DOUPCALL) == 0 &&
(kg->kg_completed == NULL)) {
@@ -1379,7 +1373,7 @@ thread_schedule_upcall(struct thread *td, struct kse_upcall *ku)
/* Let the new thread become owner of the upcall */
ku->ku_owner = td2;
td2->td_upcall = ku;
- td2->td_flags = TDF_UPCALLING;
+ td2->td_pflags = TDP_UPCALLING;
#if 0 /* XXX This shouldn't be necessary */
if (td->td_proc->p_sflag & PS_NEEDSIGCHK)
td2->td_flags |= TDF_ASTPENDING;
@@ -1432,9 +1426,7 @@ error:
void
thread_signal_upcall(struct thread *td)
{
- mtx_lock_spin(&sched_lock);
- td->td_flags |= TDF_UPCALLING;
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags |= TDP_UPCALLING;
return;
}
@@ -1612,9 +1604,7 @@ thread_userret(struct thread *td, struct trapframe *frame)
* strucuture, we can go to userland.
* Turn ourself into an upcall thread.
*/
- mtx_lock_spin(&sched_lock);
- td->td_flags |= TDF_UPCALLING;
- mtx_unlock_spin(&sched_lock);
+ td->td_pflags |= TDP_UPCALLING;
} else if (td->td_mailbox && (ku == NULL)) {
error = thread_export_context(td);
/* possibly upcall with error? */
@@ -1663,7 +1653,7 @@ thread_userret(struct thread *td, struct trapframe *frame)
PROC_UNLOCK(p);
}
- if (td->td_flags & TDF_UPCALLING) {
+ if (td->td_pflags & TDP_UPCALLING) {
uts_crit = 0;
kg->kg_nextupcall = ticks+kg->kg_upquantum;
/*
@@ -1674,8 +1664,8 @@ thread_userret(struct thread *td, struct trapframe *frame)
CTR3(KTR_PROC, "userret: upcall thread %p (pid %d, %s)",
td, td->td_proc->p_pid, td->td_proc->p_comm);
+ td->td_pflags &= ~TDP_UPCALLING;
mtx_lock_spin(&sched_lock);
- td->td_flags &= ~TDF_UPCALLING;
if (ku->ku_flags & KUF_DOUPCALL)
ku->ku_flags &= ~KUF_DOUPCALL;
mtx_unlock_spin(&sched_lock);
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 699bb08..4a3e5b7 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -339,7 +339,6 @@ struct thread {
#define TDF_IDLETD 0x000020 /* This is one of the per-CPU idle threads */
#define TDF_SELECT 0x000040 /* Selecting; wakeup/waiting danger. */
#define TDF_CVWAITQ 0x000080 /* Thread is on a cv_waitq (not slpq). */
-#define TDF_UPCALLING 0x000100 /* This thread is doing an upcall. */
#define TDF_ONSLEEPQ 0x000200 /* On the sleep queue. */
#define TDF_ASTPENDING 0x000800 /* Thread has some asynchronous events. */
#define TDF_TIMOFAIL 0x001000 /* Timeout from sleep after we were awake. */
@@ -348,12 +347,14 @@ struct thread {
#define TDF_OWEUPC 0x008000 /* Owe thread an addupc() call at next AST. */
#define TDF_NEEDRESCHED 0x010000 /* Thread needs to yield. */
#define TDF_NEEDSIGCHK 0x020000 /* Thread may need signal delivery. */
+#define TDF_SA 0x040000 /* A scheduler activation based thread */
#define TDF_DEADLKTREAT 0x800000 /* Lock aquisition - deadlock treatment. */
/* "private" flags kept in td_pflags */
#define TDP_OLDMASK 0x0001 /* Need to restore mask after suspend. */
#define TDP_INKTR 0x0002 /* Thread is currently in KTR code. */
#define TDP_INKTRACE 0x0004 /* Thread is currently in KTRACE code. */
+#define TDP_UPCALLING 0x0008 /* This thread is doing an upcall. */
#define TDI_SUSPENDED 0x0001 /* On suspension queue. */
#define TDI_SLEEPING 0x0002 /* Actually asleep! (tricky). */
OpenPOWER on IntegriCloud