summaryrefslogtreecommitdiff
path: root/kern/sched_prim.c
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-09-30 09:08:44 +0200
committerJustus Winter <4winter@informatik.uni-hamburg.de>2015-02-20 18:46:55 +0100
commit739421ac52472d8dd2f23c141d449ff112fbf9b6 (patch)
tree43ae3d1931109f43c4532b9ead5554822bc21d6e /kern/sched_prim.c
parentb0fa32c1d7de74a8b83b33833640ff30c84e9fbd (diff)
kern: reduce the size of `struct thread'
Reduce the size of `struct thread' by twelve bytes making it fit into exactly five cache lines (on 32-bit platforms). * kern/thread.h (struct thread): Group the state and all flags in a bitfield. (TH_EV_WAKE_ACTIVE, TH_EV_STATE): Provide macros that generate keys for synchronization primitives like `thread_wakeup'. * kern/thread.c (thread_halt, thread_dowait, thread_suspend): Use the new keys instead of addresses of fields for the synchronisation. * kern/ipc_sched.c (thread_handoff): Likewise. * kern/sched_prim.c (thread_invoke, thread_dispatch): Likewise.
Diffstat (limited to 'kern/sched_prim.c')
-rw-r--r--kern/sched_prim.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 376217a8..d7792ae6 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -615,7 +615,7 @@ boolean_t thread_invoke(
thread_lock(new_thread);
new_thread->state &= ~TH_UNINT;
thread_unlock(new_thread);
- thread_wakeup(&new_thread->state);
+ thread_wakeup(TH_EV_STATE(new_thread));
if (continuation != (void (*)()) 0) {
(void) spl0();
@@ -637,7 +637,7 @@ boolean_t thread_invoke(
new_thread->state &= ~(TH_SWAPPED | TH_UNINT);
thread_unlock(new_thread);
- thread_wakeup(&new_thread->state);
+ thread_wakeup(TH_EV_STATE(new_thread));
#if NCPUS > 1
new_thread->last_processor = current_processor();
@@ -676,7 +676,7 @@ boolean_t thread_invoke(
if (old_thread->wake_active) {
old_thread->wake_active = FALSE;
thread_unlock(old_thread);
- thread_wakeup((event_t)&old_thread->wake_active);
+ thread_wakeup(TH_EV_WAKE_ACTIVE(old_thread));
goto after_old_thread;
}
@@ -767,7 +767,7 @@ boolean_t thread_invoke(
new_thread->state &= ~(TH_SWAPPED | TH_UNINT);
thread_unlock(new_thread);
- thread_wakeup(&new_thread->state);
+ thread_wakeup(TH_EV_STATE(new_thread));
/*
* Thread is now interruptible.
@@ -932,7 +932,7 @@ void thread_dispatch(
if (thread->wake_active) {
thread->wake_active = FALSE;
thread_unlock(thread);
- thread_wakeup((event_t)&thread->wake_active);
+ thread_wakeup(TH_EV_WAKE_ACTIVE(thread));
return;
}
break;