Date: Mon, 27 Sep 2010 11:17:04 -0700 From: mdf@FreeBSD.org To: Sean Bruno <seanbru@yahoo-inc.com> Cc: current@freebsd.org Subject: Re: MAXCPU preparations Message-ID: <AANLkTimGw5P3JQvUErY4F5g5S4n9UabNxEDXtpefj%2BMS@mail.gmail.com> In-Reply-To: <1285604516.7245.16.camel@home-yahoo> References: <1285601161.7245.7.camel@home-yahoo> <4CA0BE08.50408@freebsd.org> <1285604516.7245.16.camel@home-yahoo>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Sep 27, 2010 at 9:21 AM, Sean Bruno <seanbru@yahoo-inc.com> wrote: > On Mon, 2010-09-27 at 08:53 -0700, Julian Elischer wrote: >> On 9/27/10 8:26 AM, Sean Bruno wrote: >> > Does this look like an appropriate modification to libmemstat? >> > >> > Sean >> > >> > >> > =3D=3D=3D=3D //depot/yahoo/ybsd_7/src/lib/libmemstat/memstat.h#4 >> > - /home/seanbru/ybsd_7/src/lib/libmemstat/memstat.h =3D=3D=3D=3D >> > @@ -28,12 +28,13 @@ >> > >> > =A0 #ifndef _MEMSTAT_H_ >> > =A0 #define =A0 =A0 =A0 =A0_MEMSTAT_H_ >> > +#include<sys/param.h> >> > >> > =A0 /* >> > =A0 =A0* Number of CPU slots in library-internal data structures. =A0T= his >> > should be >> > =A0 =A0* at least the value of MAXCPU from param.h. >> > =A0 =A0*/ >> > -#define =A0 =A0 =A0 =A0MEMSTAT_MAXCPU =A064 >> > +#define =A0 =A0 =A0 =A0MEMSTAT_MAXCPU =A0MAXCPU /* defined in >> > sys/${ARCH}/include/param.h */ >> > >> >> >> wouldn't it be better to do a sysctlbyname() and use the real value >> for the system? >> > > That was my initial thought (as prodded by scottl and peter). > > If it is made dynamic, could this be opening a race condition where the > call to sysctlbyname() returns a count of CPUS that is in turn changed > by the offlining of a CPU? =A0Or am I thinking to much about this? The maximum number of CPUs supported by a running instance will not change. Only, potentially, the current number of CPUs. So a sysctl to fetch the kernel's compiled-in MAXCPU is safe. Thanks, matthew
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTimGw5P3JQvUErY4F5g5S4n9UabNxEDXtpefj%2BMS>