From f5f6f62357b90e1ce1eb24f2929314b0d84078d0 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Fri, 24 Aug 2012 22:34:03 +0200 Subject: Store threads waiting on a message queue in LIFO order * ipc/ipc_thread.h (ipc_thread_enqueue_macro): Insert thread at the head of the list instead of the tail. --- ipc/ipc_thread.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ipc/ipc_thread.h') diff --git a/ipc/ipc_thread.h b/ipc/ipc_thread.h index e8bfe4a8..fbeea46a 100644 --- a/ipc/ipc_thread.h +++ b/ipc/ipc_thread.h @@ -46,6 +46,11 @@ typedef thread_t ipc_thread_t; #define ith_lock(thread) simple_lock(&(thread)->ith_lock_data) #define ith_unlock(thread) simple_unlock(&(thread)->ith_lock_data) +/* + * Note that this isn't a queue, but rather a stack. This causes + * threads that were recently running to be reused earlier, which + * helps improve locality of reference. + */ typedef struct ipc_thread_queue { ipc_thread_t ithq_base; } *ipc_thread_queue_t; @@ -103,6 +108,7 @@ MACRO_BEGIN \ (thread)->ith_prev = _last; \ _first->ith_prev = (thread); \ _last->ith_next = (thread); \ + (queue)->ithq_base = (thread); \ } \ MACRO_END -- cgit v1.2.3