Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Jun 2000 18:17:43 -0700 (PDT)
From:      Kelly Yancey <kbyanc@posi.net>
To:        John Baldwin <jhb@FreeBSD.ORG>
Cc:        Motomichi Matsuzaki <mzaki@e-mail.ne.jp>, freebsd-hackers@FreeBSD.ORG
Subject:   RE: VM coloring description in NOTES
Message-ID:  <Pine.BSF.4.21.0006251814200.1634-100000@gateway.posi.net>
In-Reply-To: <200006251907.MAA03026@john.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 25 Jun 2000, John Baldwin wrote:

> > currently     ->      candidate
> > PQ_HUGECACHE          PQ_CACHE1024
> > PQ_LARGECACHE         PQ_CACHE512
> > PQ_MEDIUMCACHE                PQ_CACHE256
> > PQ_NORMALCACHE                PQ_CACHE64
> > 
> > and newly PQ_CACHE128 should be defined as default.
> > 
> > Any ideas?

> 
> Sounds ok to me.  Do you have any patches for this?  If not,
> I'll make some and see if they pass muster.
> 

  John, I've actually got something similar I worked up a while back on my
local machine. It's not exactly the same (you set PQ_CACHESIZE to the value of
your L2 cache as opposed to having multiple #defines/config options). I just
cleaned it up and added backward-compatibility with the pre-existing PQ_
options so as to not break anyone's config files. :) Patches are attached
below. I can only say that they've been working on my 4.0-STABLE machines for
a few weeks.

  Kelly

--
Kelly Yancey  -  kbyanc@posi.net  -  Belmont, CA
System Administrator, eGroups.com                  http://www.egroups.com/
Maintainer, BSD Driver Database       http://www.posi.net/freebsd/drivers/
Coordinator, Team FreeBSD        http://www.posi.net/freebsd/Team-FreeBSD/

--- sys/vm/vm_page.h.orig	Sun Jun 25 17:52:37 2000
+++ sys/vm/vm_page.h	Sun Jun 25 18:13:45 2000
@@ -150,46 +150,51 @@
  */
 /* Each of PQ_FREE, and PQ_CACHE have PQ_HASH_SIZE entries */
 
-/* Define one of the following */
+/* Backward compatibility for existing PQ_*CACHE config options. */
+#if !defined(PQ_CACHESIZE)
 #if defined(PQ_HUGECACHE)
+#define PQ_CACHESIZE 1024
+#elsif defined(PQ_LARGECACHE)
+#define PQ_CACHESIZE 512
+#elsif defined(PQ_MEDIUMCACHE)
+#define PQ_CACHESIZE 256
+#elsif defined(PQ_NORMALCACHE)
+#define PQ_CACHESIZE 64
+#else
+#define PQ_CACHESIZE 0
+#endif
+#endif
+
+#if PQ_CACHESIZE >= 1024
 #define PQ_PRIME1 31	/* Prime number somewhat less than PQ_HASH_SIZE */
 #define PQ_PRIME2 23	/* Prime number somewhat less than PQ_HASH_SIZE */
 #define PQ_L2_SIZE 256	/* A number of colors opt for 1M cache */
-#endif
 
-/* Define one of the following */
-#if defined(PQ_LARGECACHE)
+#elsif PQ_CACHESIZE >= 512
 #define PQ_PRIME1 31	/* Prime number somewhat less than PQ_HASH_SIZE */
 #define PQ_PRIME2 23	/* Prime number somewhat less than PQ_HASH_SIZE */
 #define PQ_L2_SIZE 128	/* A number of colors opt for 512K cache */
-#endif
 
+#elsif PQ_CACHESIZE >= 256
+#define PQ_PRIME1 13	/* Prime number somewhat less than PQ_HASH_SIZE */
+#define PQ_PRIME2 7	/* Prime number somewhat less than PQ_HASH_SIZE */
+#define PQ_L2_SIZE 64	/* A number of colors opt for 256K cache */
 
-/*
- * Use 'options PQ_NOOPT' to disable page coloring
- */
-#if defined(PQ_NOOPT)
-#define PQ_PRIME1 1
-#define PQ_PRIME2 1
-#define PQ_L2_SIZE 1
-#endif
+#elsif PQ_CACHESIZE >= 128
+#define PQ_PRIME1 9	/* Produces a good PQ_L2_SIZE/3 + PQ_PRIME1 */
+#define PQ_PRIME2 5	/* Prime number somewhat less than PQ_HASH_SIZE */
+#define PQ_L2_SIZE 32	/* A number of colors opt for 128k cache */
 
-#if defined(PQ_NORMALCACHE)
+#elsif PQ_CACHESIZE >= 64
 #define PQ_PRIME1 5	/* Prime number somewhat less than PQ_HASH_SIZE */
 #define PQ_PRIME2 3	/* Prime number somewhat less than PQ_HASH_SIZE */
 #define PQ_L2_SIZE 16	/* A reasonable number of colors (opt for 64K cache) */
-#endif
 
-#if defined(PQ_MEDIUMCACHE)
-#define PQ_PRIME1 13	/* Prime number somewhat less than PQ_HASH_SIZE */
-#define PQ_PRIME2 7	/* Prime number somewhat less than PQ_HASH_SIZE */
-#define PQ_L2_SIZE 64	/* A number of colors opt for 256K cache */
-#endif
+#else
+#define PQ_PRIME1 1	/* Disable page coloring. */
+#define PQ_PRIME2 1
+#define PQ_L2_SIZE 1
 
-#if !defined(PQ_L2_SIZE)
-#define PQ_PRIME1 9	/* Produces a good PQ_L2_SIZE/3 + PQ_PRIME1 */
-#define PQ_PRIME2 5	/* Prime number somewhat less than PQ_HASH_SIZE */
-#define PQ_L2_SIZE 32	/* 512KB or smaller, 4-way set-associative cache */
 #endif
 
 #define PQ_L2_MASK (PQ_L2_SIZE - 1)



--- sys/conf/options.orig	Sun Jun 25 18:08:22 2000
+++ sys/conf/options	Sun Jun 25 18:14:11 2000
@@ -364,6 +364,7 @@
 PQ_MEDIUMCACHE		opt_vmpage.h
 PQ_LARGECACHE		opt_vmpage.h
 PQ_HUGECACHE		opt_vmpage.h
+PQ_CACHESIZE		opt_vmpage.h
 
 # Standard SMP options
 SMP			opt_global.h



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0006251814200.1634-100000>