From 6e817437ecf7820f86564f461d8a12bf432a42fb Mon Sep 17 00:00:00 2001 From: simonmar Date: Fri, 27 Feb 2004 12:39:16 +0000 Subject: [PATCH] [project @ 2004-02-27 12:39:16 by simonmar] scheduleWaitThread(): don't call THREAD_RUNNABLE because the new thread is bound, and therefore only runnable by the current OS thread. Calling THREAD_RUNNABLE just wakes up workers and slows things down. --- ghc/rts/Schedule.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/ghc/rts/Schedule.c b/ghc/rts/Schedule.c index 5ca5666..4017c3b 100644 --- a/ghc/rts/Schedule.c +++ b/ghc/rts/Schedule.c @@ -1,5 +1,5 @@ /* --------------------------------------------------------------------------- - * $Id: Schedule.c,v 1.188 2004/02/26 16:19:32 simonmar Exp $ + * $Id: Schedule.c,v 1.189 2004/02/27 12:39:16 simonmar Exp $ * * (c) The GHC Team, 1998-2003 * @@ -1952,21 +1952,12 @@ void scheduleThread_(StgTSO *tso) { // Precondition: sched_mutex must be held. - - /* Put the new thread on the head of the runnable queue. The caller - * better push an appropriate closure on this thread's stack - * beforehand. In the SMP case, the thread may start running as - * soon as we release the scheduler lock below. - */ PUSH_ON_RUN_QUEUE(tso); THREAD_RUNNABLE(); - -#if 0 - IF_DEBUG(scheduler,printTSO(tso)); -#endif } -void scheduleThread(StgTSO* tso) +void +scheduleThread(StgTSO* tso) { ACQUIRE_LOCK(&sched_mutex); scheduleThread_(tso); @@ -2014,7 +2005,10 @@ scheduleWaitThread(StgTSO* tso, /*[out]*/HaskellObj* ret, m->link = main_threads; main_threads = m; - scheduleThread_(tso); + PUSH_ON_RUN_QUEUE(tso); + // NB. Don't call THREAD_RUNNABLE() here, because the thread is + // bound and only runnable by *this* OS thread, so waking up other + // workers will just slow things down. return waitThread_(m, initialCapability); } -- 1.7.10.4