From owner-freebsd-current@FreeBSD.ORG Mon Sep 27 18:39:14 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F348B106566B for ; Mon, 27 Sep 2010 18:39:14 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id B82E38FC0C for ; Mon, 27 Sep 2010 18:39:14 +0000 (UTC) Received: by iwn34 with SMTP id 34so6213095iwn.13 for ; Mon, 27 Sep 2010 11:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=EfBZ0ZPEhOgulxrqjLBo4yUBy3O0r2YZSghnWI8BLZQ=; b=Wj+Tlu87DBb/yxshPa08QCAFh0mlhSEkGZQf42Aynlktn08QPHnro37Qj1ZqYiXEo9 cfYoOcxGVoBetJK2jy7Eym8ikpY38/26EorqH6nveGnVCXNS74YZznSi4K48yeSyAYK0 ZXSFhDDwwq3Mr6kLPOi8CXbQj+DF5ZrCZbS/U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=YaONYC0Zo5RbYiapMBorYLCTew7DnP3qXUygnvGeF1O454ugELqE4AuX2HBN+boo8r y1fzGvVtJzUAHH/TdjsCpPSA5ucfqJk6ReKiXhdTRfuVp7qLEYi9zaiXRp7OyM46ZW7A 3BE0Ytz+coiHBdeLDvYenuZc+/IJACYYjBX4M= MIME-Version: 1.0 Received: by 10.231.35.202 with SMTP id q10mr9328734ibd.138.1285611424583; Mon, 27 Sep 2010 11:17:04 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.231.187.71 with HTTP; Mon, 27 Sep 2010 11:17:04 -0700 (PDT) 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> Date: Mon, 27 Sep 2010 11:17:04 -0700 X-Google-Sender-Auth: bUJvbiFjyPu_ji2d6UeA9NdFtsA Message-ID: From: mdf@FreeBSD.org To: Sean Bruno Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: current@freebsd.org Subject: Re: MAXCPU preparations X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 27 Sep 2010 18:39:15 -0000 On Mon, Sep 27, 2010 at 9:21 AM, Sean Bruno 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 >> > >> > =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