From owner-freebsd-current@FreeBSD.ORG Sun May 9 19:07:31 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B2FE16A4CE for ; Sun, 9 May 2004 19:07:31 -0700 (PDT) Received: from rwcrmhc13.comcast.net (rwcrmhc13.comcast.net [204.127.198.39]) by mx1.FreeBSD.org (Postfix) with ESMTP id 49D8A43D5A for ; Sun, 9 May 2004 19:07:31 -0700 (PDT) (envelope-from julian@elischer.org) Received: from interjet.elischer.org ([24.7.73.28]) by comcast.net (rwcrmhc13) with ESMTP id <20040510020730015007q7b3e>; Mon, 10 May 2004 02:07:30 +0000 Received: from localhost (localhost.elischer.org [127.0.0.1]) by InterJet.elischer.org (8.9.1a/8.9.1) with ESMTP id TAA26031 for ; Sun, 9 May 2004 19:07:29 -0700 (PDT) Date: Sun, 9 May 2004 19:07:28 -0700 (PDT) From: Julian Elischer To: FreeBSD current users Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: RFC for small change to 4bsd scheduler.. X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2004 02:07:31 -0000 in the following code: struct kse * sched_choose(void) { struct kse *ke; struct runq *rq; #ifdef SMP struct kse *kecpu; rq = &runq; ke = runq_choose(&runq); kecpu = runq_choose(&runq_pcpu[PCPU_GET(cpuid)]); if (ke == NULL || (kecpu != NULL && **>>>> kecpu->ke_thread->td_priority < ke->ke_thread->td_priority)) { CTR2(KTR_4BSD, "choosing kse %p from pcpu runq %d", kecpu, PCPU_GET(cpuid)); ke = kecpu; rq = &runq_pcpu[PCPU_GET(cpuid)]; } else { CTR1(KTR_4BSD, "choosing kse %p from main runq", ke); } I think it would be better to have "<=" instead of "<" I think the current code will make processes of equal priority thrash processors if one is on the pcpu list and teh other is on the general queue. as it is the pcpu process will only ever run when there is nothing of teh same priority to run.. maybe there should be code to give such a case a 50/50 chance or something?