Reduce the number of "magic constants" used for page coloring

by one: PQ_PRIME2 and PQ_PRIME3 are used to accomplish the same
thing at different places in the kernel.  Drop PQ_PRIME3.
This commit is contained in:
Alan Cox 1999-07-22 06:04:17 +00:00
parent e11a2e3d81
commit 3b21348301
6 changed files with 11 additions and 17 deletions

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.16 1999/06/10 20:40:59 dt Exp $
* $Id: vm_machdep.c,v 1.17 1999/07/01 13:21:32 peter Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -442,7 +442,7 @@ vm_page_zero_idle()
if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count))
zero_state = 1;
}
free_rover = (free_rover + PQ_PRIME3) & PQ_L2_MASK;
free_rover = (free_rover + PQ_PRIME2) & PQ_L2_MASK;
splx(s);
#ifdef SMP
rel_mplock();

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.122 1999/06/01 18:19:50 jlemon Exp $
* $Id: vm_machdep.c,v 1.123 1999/07/01 13:21:35 peter Exp $
*/
#include "npx.h"
@ -575,7 +575,7 @@ vm_page_zero_idle()
if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count))
zero_state = 1;
}
free_rover = (free_rover + PQ_PRIME3) & PQ_L2_MASK;
free_rover = (free_rover + PQ_PRIME2) & PQ_L2_MASK;
splx(s);
__asm __volatile("cli" : : : "memory");
#ifdef SMP

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.122 1999/06/01 18:19:50 jlemon Exp $
* $Id: vm_machdep.c,v 1.123 1999/07/01 13:21:35 peter Exp $
*/
#include "npx.h"
@ -575,7 +575,7 @@ vm_page_zero_idle()
if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count))
zero_state = 1;
}
free_rover = (free_rover + PQ_PRIME3) & PQ_L2_MASK;
free_rover = (free_rover + PQ_PRIME2) & PQ_L2_MASK;
splx(s);
__asm __volatile("cli" : : : "memory");
#ifdef SMP

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.16 1999/06/10 20:40:59 dt Exp $
* $Id: vm_machdep.c,v 1.17 1999/07/01 13:21:32 peter Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -442,7 +442,7 @@ vm_page_zero_idle()
if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count))
zero_state = 1;
}
free_rover = (free_rover + PQ_PRIME3) & PQ_L2_MASK;
free_rover = (free_rover + PQ_PRIME2) & PQ_L2_MASK;
splx(s);
#ifdef SMP
rel_mplock();

View File

@ -38,7 +38,7 @@
*
* from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91
* Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$
* $Id: vm_machdep.c,v 1.16 1999/06/10 20:40:59 dt Exp $
* $Id: vm_machdep.c,v 1.17 1999/07/01 13:21:32 peter Exp $
*/
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@ -442,7 +442,7 @@ vm_page_zero_idle()
if (vm_page_zero_count >= ZIDLE_HI(cnt.v_free_count))
zero_state = 1;
}
free_rover = (free_rover + PQ_PRIME3) & PQ_L2_MASK;
free_rover = (free_rover + PQ_PRIME2) & PQ_L2_MASK;
splx(s);
#ifdef SMP
rel_mplock();

View File

@ -61,7 +61,7 @@
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*
* $Id: vm_page.h,v 1.61 1999/06/19 18:42:53 alc Exp $
* $Id: vm_page.h,v 1.62 1999/06/22 07:18:20 alc Exp $
*/
/*
@ -153,7 +153,6 @@ struct vm_page {
#if defined(PQ_HUGECACHE)
#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_PRIME3 17 /* Prime number somewhat less than PQ_HASH_SIZE */
#define PQ_L2_SIZE 256 /* A number of colors opt for 1M cache */
#endif
@ -161,7 +160,6 @@ struct vm_page {
#if defined(PQ_LARGECACHE)
#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_PRIME3 17 /* Prime number somewhat less than PQ_HASH_SIZE */
#define PQ_L2_SIZE 128 /* A number of colors opt for 512K cache */
#endif
@ -172,21 +170,18 @@ struct vm_page {
#if defined(PQ_NOOPT)
#define PQ_PRIME1 1
#define PQ_PRIME2 1
#define PQ_PRIME3 1
#define PQ_L2_SIZE 1
#endif
#if defined(PQ_NORMALCACHE)
#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_PRIME3 11 /* 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) || !defined(PQ_L2_SIZE)
#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_PRIME3 5 /* Prime number somewhat less than PQ_HASH_SIZE */
#define PQ_L2_SIZE 64 /* A number of colors opt for 256K cache */
#endif
@ -194,7 +189,6 @@ struct vm_page {
#define PQ_NONE 0
#define PQ_FREE 1
/* #define PQ_ZERO (1 + PQ_L2_SIZE) */
#define PQ_INACTIVE (1 + 1*PQ_L2_SIZE)
#define PQ_ACTIVE (2 + 1*PQ_L2_SIZE)
#define PQ_CACHE (3 + 1*PQ_L2_SIZE)