aboutsummaryrefslogtreecommitdiff
path: root/sys/posix4
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>2002-06-29 17:26:22 +0000
committerJulian Elischer <julian@FreeBSD.org>2002-06-29 17:26:22 +0000
commite602ba25fd1f9a7ea2215c01f470c08f140de809 (patch)
tree0a0483a267784fa8e2bf86857d8727edb5b122e9 /sys/posix4
parentcc5dcb202cd7616bae9321687ec46a384a061d99 (diff)
downloadsrc-e602ba25fd1f9a7ea2215c01f470c08f140de809.tar.gz
src-e602ba25fd1f9a7ea2215c01f470c08f140de809.zip
Part 1 of KSE-III
The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals..
Notes
Notes: svn path=/head/; revision=99072
Diffstat (limited to 'sys/posix4')
-rw-r--r--sys/posix4/ksched.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/sys/posix4/ksched.c b/sys/posix4/ksched.c
index c9081c314c75..bbe36bea6874 100644
--- a/sys/posix4/ksched.c
+++ b/sys/posix4/ksched.c
@@ -181,7 +181,18 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched,
mtx_lock_spin(&sched_lock);
rtp_to_pri(&rtp, kg);
- td->td_last_kse->ke_flags |= KEF_NEEDRESCHED; /* XXXKSE */
+ FOREACH_THREAD_IN_GROUP(kg, td) { /* XXXKSE */
+ if (td->td_state == TDS_RUNNING) {
+ td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ } else if (td->td_state == TDS_RUNQ) {
+ if (td->td_priority > kg->kg_user_pri) {
+ remrunqueue(td);
+ td->td_priority =
+ kg->kg_user_pri;
+ setrunqueue(td);
+ }
+ }
+ }
mtx_unlock_spin(&sched_lock);
}
else
@@ -203,7 +214,19 @@ int ksched_setscheduler(register_t *ret, struct ksched *ksched,
* on the scheduling code: You must leave the
* scheduling info alone.
*/
- td->td_last_kse->ke_flags |= KEF_NEEDRESCHED; /* XXXKSE */
+ FOREACH_THREAD_IN_GROUP(kg, td) {
+ if (td->td_state == TDS_RUNNING) {
+ td->td_kse->ke_flags |= KEF_NEEDRESCHED;
+ } else if (td->td_state == TDS_RUNQ) {
+ if (td->td_priority > kg->kg_user_pri) {
+ remrunqueue(td);
+ td->td_priority =
+ kg->kg_user_pri;
+ setrunqueue(td);
+ }
+ }
+
+ }
mtx_unlock_spin(&sched_lock);
}
break;