From owner-freebsd-current@FreeBSD.ORG Mon Jun 7 11:03:07 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8307F16A4D1 for ; Mon, 7 Jun 2004 11:03:07 +0000 (GMT) Received: from mailout08.sul.t-online.com (mailout08.sul.t-online.com [194.25.134.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA13543D2D for ; Mon, 7 Jun 2004 11:03:06 +0000 (GMT) (envelope-from Alexander@Leidinger.net) Received: from fwd02.aul.t-online.de by mailout08.sul.t-online.com with smtp id 1BXHuD-0005Ac-00; Mon, 07 Jun 2004 13:03:05 +0200 Received: from Andro-Beta.Leidinger.net (EXrKycZ6Qe3QHOzAjqDPDO3uXXXtqG8xUsIFNcxyjeljt3mHywMTgy@[80.131.123.52]) by fmrl02.sul.t-online.com with esmtp id 1BXHtz-0yg26K0; Mon, 7 Jun 2004 13:02:51 +0200 Received: from Magellan.Leidinger.net (Magellan.Leidinger.net [192.168.1.1]) i57B36mr098821; Mon, 7 Jun 2004 13:03:06 +0200 (CEST) (envelope-from Alexander@Leidinger.net) Date: Mon, 7 Jun 2004 13:04:30 +0200 From: Alexander Leidinger To: Alan Cox Message-Id: <20040607130430.0ebbbb8e@Magellan.Leidinger.net> In-Reply-To: <20040606201249.GH24461@cs.rice.edu> References: <20040606142446.2900a97e@Magellan.Leidinger.net> <20040606201249.GH24461@cs.rice.edu> X-Mailer: Sylpheed version 0.9.11claws (GTK+ 1.2.10; i386-portbld-freebsd5.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Seen: false X-ID: EXrKycZ6Qe3QHOzAjqDPDO3uXXXtqG8xUsIFNcxyjeljt3mHywMTgy@t-dialin.net cc: current@freebsd.org Subject: Re: comments in the page coloring options in /sys/conf/NOTES X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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, 07 Jun 2004 11:03:07 -0000 On Sun, 6 Jun 2004 15:12:49 -0500 Alan Cox wrote: > My recent commit fixed a "syntax" error in the comments, specifically, > a reference to a missing macro. The comments are, however, still > "semantically" broken: > > 1. Cache size alone does not correctly determine the number of colors, > except for direct map caches. The correct formula is > > (cache size in bytes / page size in bytes) / degree of cache associativity > > Thus, the comments would lead one to configure his/her system with too > many colors. (Relative to configuring a system with too few colors, > this is not so bad.) vm_page.h contains: ---snip--- #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 */ ---snip--- The three defines seem to be the tunables for the page coloring, but neither of them seem to be near cache_size/page_size. So even for the direct mapped case this doesn't seem to fit your explanation. Is it as easy as using appropriate values for those defines at boot time or is there more work involved for auto-tuning version? Is there a way to determine the size of the L2 cache and the associativity at run time in the kernel or are these properties which we have to obtain from a table (which we have to write and maintain for automatic tuning)? > 2. The references to L1 should be removed. They are historical > leftovers. cut&paste: ---snip--- Index: sys/conf/NOTES =================================================================== RCS file: /big/FreeBSD-CVS/src/sys/conf/NOTES,v retrieving revision 1.1227 diff -u -r1.1227 NOTES --- sys/conf/NOTES 1 Jun 2004 06:22:56 -0000 1.1227 +++ sys/conf/NOTES 7 Jun 2004 10:07:16 -0000 @@ -103,13 +103,13 @@ # Options for the VM subsystem # L2 cache size (in KB) can be specified in PQ_CACHESIZE -options PQ_CACHESIZE=512 # color for 512k/16k cache +options PQ_CACHESIZE=512 # color for 512k cache # Deprecated options supported for backwards compatibility #options PQ_NOOPT # No coloring -#options PQ_LARGECACHE # color for 512k/16k cache -#options PQ_HUGECACHE # color for 1024k/16k cache -#options PQ_MEDIUMCACHE # color for 256k/16k cache -#options PQ_NORMALCACHE # color for 64k/16k cache +#options PQ_LARGECACHE # color for 512k cache +#options PQ_HUGECACHE # color for 1024k cache +#options PQ_MEDIUMCACHE # color for 256k cache +#options PQ_NORMALCACHE # color for 64k cache # This allows you to actually store this configuration file into # the kernel binary itself, where it may be later read by saying: Index: sys/vm/vm_pageq.c =================================================================== RCS file: /big/FreeBSD-CVS/src/sys/vm/vm_pageq.c,v retrieving revision 1.13 diff -u -r1.13 vm_pageq.c --- sys/vm/vm_pageq.c 30 May 2004 00:42:38 -0000 1.13 +++ sys/vm/vm_pageq.c 7 Jun 2004 10:38:31 -0000 @@ -176,8 +176,8 @@ * * The page coloring optimization attempts to locate a page * that does not overload other nearby pages in the object in - * the cpu's L1 or L2 caches. We need this optimization because - * cpu caches tend to be physical caches, while object spaces tend + * the cpu's L2 cache. We need this optimization because cpu + * caches tend to be physical caches, while object spaces tend * to be virtual. * * This routine must be called at splvm(). ---snip--- I think the comment with the reference to L1 in sys/vm/vm_zeroidle.c is ok. If this is ok, do I have your approval to commit it? Bye, Alexander. -- I'm available to get hired (preferred in .lu). http://www.Leidinger.net Alexander @ Leidinger.net GPG fingerprint = C518 BC70 E67F 143F BE91 3365 79E2 9C60 B006 3FE7