From owner-p4-projects Sun Jun 9 23:49:56 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7780537B400; Sun, 9 Jun 2002 23:49:45 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 439A637B404 for ; Sun, 9 Jun 2002 23:49:44 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5A6niM20387 for perforce@freebsd.org; Sun, 9 Jun 2002 23:49:44 -0700 (PDT) (envelope-from julian@freebsd.org) Date: Sun, 9 Jun 2002 23:49:44 -0700 (PDT) Message-Id: <200206100649.g5A6niM20387@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to julian@freebsd.org using -f From: Julian Elischer Subject: PERFORCE change 12640 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12640 Change 12640 by julian@julian_jules1 on 2002/06/09 23:48:50 slight cleanup of KSE singlethreading. Affected files ... ... //depot/projects/kse/sys/kern/kern_thread.c#57 edit Differences ... ==== //depot/projects/kse/sys/kern/kern_thread.c#57 (text+ko) ==== @@ -446,7 +446,9 @@ * Wake us up when everyone else has suspended. * (or died) */ + TAILQ_INSERT_TAIL(&p->p_suspended, td, td_runq); td->td_state = TDS_SUSPENDED; + p->p_suspcount++; mtx_lock_spin(&sched_lock); mtx_unlock(&Giant); PROC_UNLOCK(p); @@ -517,8 +519,13 @@ mtx_unlock(&Giant); thread_exit(); } - /* One for us and one for the single waiter. */ - if (p->p_numthreads == (p->p_suspcount + 2)) { + /* + * Just an optimised version of thread_unsuspend(). + */ + if (p->p_numthreads == (p->p_suspcount + 1)) { + TAILQ_REMOVE(&p->p_suspended, + p->p_singlethread, td_runq); + p->p_suspcount--; setrunqueue(p->p_singlethread); p->p_singlethread = NULL; } @@ -563,7 +570,9 @@ setrunqueue(td); } } else if ((P_SHOULDSTOP(p) == P_STOPPED_SNGL) && - (p->p_numthreads == (p->p_suspcount + 1))) { + (p->p_numthreads == p->p_suspcount)) { + TAILQ_REMOVE(&p->p_suspended, p->p_singlethread, td_runq); + p->p_suspcount--; /* * Stopping everything also did the job for the single * threading request. Now we've downgraded to single-threaded, @@ -583,7 +592,7 @@ td = curthread; p = td->td_proc; PROC_LOCK_ASSERT(p, MA_OWNED); - p->p_flag &= P_STOPPED_SNGL; + p->p_flag &= ~P_STOPPED_SNGL; thread_unsuspend(p); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message