From owner-freebsd-current@FreeBSD.ORG Thu Apr 10 03:41:12 2003 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 0353237B401 for ; Thu, 10 Apr 2003 03:41:12 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id B779243F3F for ; Thu, 10 Apr 2003 03:41:10 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id UAA21443; Thu, 10 Apr 2003 20:41:03 +1000 Date: Thu, 10 Apr 2003 20:41:02 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Julian Elischer In-Reply-To: Message-ID: <20030410201727.C3091@gamplex.bde.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: FreeBSD current users Subject: Re: variable mp_ncpu 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: Thu, 10 Apr 2003 10:41:12 -0000 On Thu, 10 Apr 2003, Julian Elischer wrote: > ok It's too late at night.. hw.ncpu does exist in UP > what I really meant to say is: > could there always be the kernel variable mp_ncpus? > > for example the following code is in the kernel: > 605 /* Too bad, why hasn't kernel always a cpu counter !? */ > 606 #ifdef SMP > 607 ncpus = mp_ncpus; > 608 #else > 609 ncpus = 1; > 610 #endif > > ok, so maybe it would need to be renamed, but at teh moment I need to > have 2 kernel modules, one for SMP and one for UP to be able to cope > with this if it needs to know how many cpus there are.. > (or am I missing something still) Yes :-). The kernel has a bitmap of cpus and a macro (only one) for accessing it. The maximum number of valid bits in the bitmap is MAX_CPU which is 1 for the !SMP case and > 1 for the SMP case. (I think there is actually only the acess macro for the !SMP case). Bruce Bruce