Date: Sun, 22 Dec 2002 18:14:34 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Bruce Evans <bde@zeta.org.au> Cc: cvs-committers@FreeBSD.ORG, <cvs-all@FreeBSD.ORG> Subject: Re: cvs commit: src/sys/vm vm_meter.c Message-ID: <200212230214.gBN2EYCd034315@apollo.backplane.com> References: <20021223123800.U11555-100000@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
<dillon@backplane.com>
: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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212230214.gBN2EYCd034315>
