From owner-cvs-all Sun Dec 22 18:14:37 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 845AC37B401; Sun, 22 Dec 2002 18:14:35 -0800 (PST) Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2E37B43ED8; Sun, 22 Dec 2002 18:14:35 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.5/8.12.5) with ESMTP id gBN2EYOM034316; Sun, 22 Dec 2002 18:14:34 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.5/8.12.5/Submit) id gBN2EYCd034315; Sun, 22 Dec 2002 18:14:34 -0800 (PST) (envelope-from dillon) Date: Sun, 22 Dec 2002 18:14:34 -0800 (PST) From: Matthew Dillon Message-Id: <200212230214.gBN2EYCd034315@apollo.backplane.com> To: Bruce Evans Cc: cvs-committers@FreeBSD.ORG, Subject: Re: cvs commit: src/sys/vm vm_meter.c References: <20021223123800.U11555-100000@gamplex.bde.org> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Well, my original intention in placing a vmmeter structure in each per-cpu area was to eventually separate out counters like v_syscall from tracking statistics like v_free_count and have the counters ONLY exist in the per-cpu structure, whether UP or SMP. This patch would be a step backwards from that goal rather then a step forwards. On the otherhand, I have no plans to separate the stuff out now (because there isn't really any pressing need to), so if you want to optimize PCPU_LAZY_INC() as shown below to save 5 nanoseconds, be my guest. Either way the sysctl fix still applies. The current expectation on either UP or SMP is that you can use either structure for a statistics counter, but the per-cpu counter is the one that is more generic. I do not really consider this a bug in the kernel. -Matt Matthew Dillon :I have used the following fix for this for 6 months or so and sent it :to some SMP person(s). It is better because it has no space or time :costs instead of tiny ones, and it actually works (in the !SMP case) :for programs that read the variable directly from kmem or panic dumps. :Fixing the SMP case for these programs is not so easy. : :There is at least one PR about this bug. : :%%% :Index: pcpu.h :=================================================================== :RCS file: /home/ncvs/src/sys/sys/pcpu.h,v :retrieving revision 1.10 :diff -u -2 -r1.10 pcpu.h :--- pcpu.h 10 Dec 2002 02:33:45 -0000 1.10 :+++ pcpu.h 10 Dec 2002 06:04:52 -0000 :@@ -99,6 +101,10 @@ : * support single-instruction memory increments. : */ :-#define PCPU_LAZY_INC(var) (++*PCPU_PTR(var)) :- :+#ifdef SMP :+#define PCPU_LAZY_INC(var) (++*PCPU_PTR(var)) :+#else :+#define PCPU_LAZY_INC(var) (++(var)) :+#endif :+ : /* : * Machine dependent callouts. cpu_pcpu_init() is responsible for :%%% : :Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message