Date: Thu, 10 Apr 2003 20:41:02 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Julian Elischer <julian@elischer.org> Cc: FreeBSD current users <current@freebsd.org> Subject: Re: variable mp_ncpu Message-ID: <20030410201727.C3091@gamplex.bde.org> In-Reply-To: <Pine.BSF.4.21.0304100028020.55025-100000@InterJet.elischer.org> References: <Pine.BSF.4.21.0304100028020.55025-100000@InterJet.elischer.org>
index | next in thread | previous in thread | raw e-mail
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 Brucehelp
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030410201727.C3091>
