diff options
Diffstat (limited to 'sys')
93 files changed, 397 insertions, 890 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index ed9dc952acb..81b0ab7c36f 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.43 2001/04/30 15:05:34 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.44 2001/05/05 20:56:30 art Exp $ */ /* $NetBSD: machdep.c,v 1.206 2000/05/23 05:12:54 thorpej Exp $ */ /*- @@ -856,7 +856,7 @@ allocsys(v) * minimum of 16 buffers. */ if (bufpages == 0) - bufpages = (physmem / ((100/BUFCACHEPERCENT) / CLSIZE)); + bufpages = (physmem / (100/BUFCACHEPERCENT)); if (nbuf == 0) { nbuf = bufpages; if (nbuf < 16) @@ -987,9 +987,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); diff --git a/sys/arch/alpha/include/param.h b/sys/arch/alpha/include/param.h index 5e6e01ebaa4..611d1dbcff7 100644 --- a/sys/arch/alpha/include/param.h +++ b/sys/arch/alpha/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.19 2001/03/16 16:56:25 art Exp $ */ +/* $OpenBSD: param.h,v 1.20 2001/05/05 20:56:31 art Exp $ */ /* $NetBSD: param.h,v 1.30 2000/06/09 16:03:04 thorpej Exp $ */ /* @@ -88,9 +88,6 @@ #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ #endif -#define CLSIZE 1 -#define CLSIZELOG2 0 - #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index f88984c6040..d028c7820e3 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.41 2000/05/28 02:23:30 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.42 2001/05/05 20:56:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.95 1997/08/27 18:31:17 is Exp $ */ /* @@ -77,7 +77,7 @@ #include <sys/sem.h> #endif #include <net/netisr.h> -#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */ +#define MAXMEM 64*1024 /* XXX - from cmap.h */ #include <vm/vm_param.h> #include <vm/pmap.h> #include <vm/vm_map.h> @@ -394,10 +394,9 @@ again: */ if (bufpages == 0) { if (physmem < btoc(2 * 1024 * 1024)) - bufpages = physmem / (10 * CLSIZE); + bufpages = physmem / (10); else - bufpages = (btoc(2 * 1024 * 1024) + physmem) / - (20 * CLSIZE); + bufpages = (btoc(2 * 1024 * 1024) + physmem) / 20; } if (nbuf == 0) { @@ -475,7 +474,7 @@ again: * "base" pages for the rest. */ curbuf = (vm_offset_t) buffers + (i * MAXBSIZE); - curbufsize = CLBYTES * ((i < residual) ? (base+1) : base); + curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base); while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); @@ -504,7 +503,7 @@ again: * but has no physical memory allocated for it. */ curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); #endif @@ -537,9 +536,9 @@ again: * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS + CLBYTES / MCLBYTES, M_MBUF, + mclrefcnt = (char *)malloc(NMBCLUSTERS + PAGE_SIZE / MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); #if defined(UVM) mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); @@ -563,7 +562,7 @@ again: ptoa(cnt.v_free_count)/NBPG); #endif printf("using %d buffers containing %d bytes of memory\n", nbuf, - bufpages * CLBYTES); + bufpages * PAGE_SIZE); /* * display memory configuration passed from loadbsd @@ -902,11 +901,11 @@ dumpconf() } --dumplo; /* XXX assume header fits in one block */ /* - * Don't dump on the first CLBYTES (why CLBYTES?) + * Don't dump on the first PAGE_SIZE * in case the dump device includes a disk label. */ - if (dumplo < btodb(CLBYTES)) - dumplo = btodb(CLBYTES); + if (dumplo < btodb(PAGE_SIZE)) + dumplo = btodb(PAGE_SIZE); } /* diff --git a/sys/arch/amiga/amiga/mem.c b/sys/arch/amiga/amiga/mem.c index cacf33b9795..a5feb2ca3ca 100644 --- a/sys/arch/amiga/amiga/mem.c +++ b/sys/arch/amiga/amiga/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.11 2001/01/31 22:39:39 jason Exp $ */ +/* $OpenBSD: mem.c,v 1.12 2001/05/05 20:56:32 art Exp $ */ /* $NetBSD: mem.c,v 1.18 1997/02/02 07:17:14 thorpej Exp $ */ /* @@ -178,9 +178,9 @@ mmrw(dev, uio, flags) if (uio->uio_rw == UIO_READ) { if (devzeropage == NULL) { devzeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(devzeropage, CLBYTES); + bzero(devzeropage, PAGE_SIZE); } c = min(c, NBPG - (int)v); v = (vm_offset_t)devzeropage; @@ -208,10 +208,10 @@ mmrw(dev, uio, flags) } if (devzeropage == NULL) { devzeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(devzeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(devzeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); continue; diff --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c index dad86e56805..9124c183def 100644 --- a/sys/arch/amiga/amiga/trap.c +++ b/sys/arch/amiga/amiga/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.19 2000/11/10 18:15:35 art Exp $ */ +/* $OpenBSD: trap.c,v 1.20 2001/05/05 20:56:32 art Exp $ */ /* $NetBSD: trap.c,v 1.56 1997/07/16 00:01:47 is Exp $ */ /* @@ -391,7 +391,7 @@ trapmmufault(type, code, v, fp, p, sticks) */ nss = 0; if (map != kernel_map && (caddr_t)va >= vm->vm_maxsaddr) { - nss = clrnd(btoc(USRSTACK - (unsigned)va)); + nss = btoc(USRSTACK - (unsigned)va); if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) { rv = KERN_FAILURE; goto nogo; @@ -485,7 +485,7 @@ trapmmufault(type, code, v, fp, p, sticks) */ if (map != kernel_map && (caddr_t)va >= vm->vm_maxsaddr) { if (rv == KERN_SUCCESS) { - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/amiga/amiga/vm_machdep.c b/sys/arch/amiga/amiga/vm_machdep.c index 320250d374e..6af0b043dc4 100644 --- a/sys/arch/amiga/amiga/vm_machdep.c +++ b/sys/arch/amiga/amiga/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.16 2000/11/08 11:44:00 art Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.17 2001/05/05 20:56:32 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/05/19 10:14:50 veego Exp $ */ /* @@ -182,7 +182,7 @@ pagemove(from, to, size) register vm_offset_t pa; #ifdef DEBUG - if (size & CLOFSET) + if ((size & PAGE_MASK) != 0) panic("pagemove"); #endif while (size > 0) { diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c index 1361015130e..a6f03f2c2c2 100644 --- a/sys/arch/amiga/dev/fd.c +++ b/sys/arch/amiga/dev/fd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fd.c,v 1.13 2001/02/16 13:48:43 espie Exp $ */ +/* $OpenBSD: fd.c,v 1.14 2001/05/05 20:56:33 art Exp $ */ /* $NetBSD: fd.c,v 1.36 1996/12/23 09:09:59 veego Exp $ */ /* @@ -911,10 +911,10 @@ fdsetdisklabel(sc, lp) * make sure selected partition is within bounds * XXX on the second check, its to handle a bug in * XXX the cluster routines as they require mutliples - * XXX of CLBYTES currently + * XXX of PAGE_SIZE currently */ if ((pp->p_offset + pp->p_size >= lp->d_secperunit) || - (pp->p_frag * pp->p_fsize % CLBYTES)) + (pp->p_frag * pp->p_fsize % PAGE_SIZE)) return(EINVAL); done: bcopy(lp, clp, sizeof(struct disklabel)); diff --git a/sys/arch/amiga/include/param.h b/sys/arch/amiga/include/param.h index 12da70cf30b..3673a2a8c92 100644 --- a/sys/arch/amiga/include/param.h +++ b/sys/arch/amiga/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.11 2000/02/22 19:27:43 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.12 2001/05/05 20:56:33 art Exp $ */ /* $NetBSD: param.h,v 1.35 1997/07/10 08:22:36 veego Exp $ */ /* @@ -69,10 +69,10 @@ #define NPTEPG (NBPG/(sizeof (pt_entry_t))) /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (3072 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (3072 * 1024 / PAGE_SIZE) #endif #define MSGBUFSIZE 8192 diff --git a/sys/arch/amiga/include/vmparam.h b/sys/arch/amiga/include/vmparam.h index 3ad186e1aa1..d29ee5be68b 100644 --- a/sys/arch/amiga/include/vmparam.h +++ b/sys/arch/amiga/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.9 2000/12/15 15:18:36 art Exp $ */ +/* $OpenBSD: vmparam.h,v 1.10 2001/05/05 20:56:33 art Exp $ */ /* $NetBSD: vmparam.h,v 1.16 1997/07/12 16:18:36 perry Exp $ */ /* @@ -162,8 +162,8 @@ * virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) #define MACHINE_NEW_NONCONTIG diff --git a/sys/arch/hp300/hp300/machdep.c b/sys/arch/hp300/hp300/machdep.c index 074eefbacd0..9e7c9511e17 100644 --- a/sys/arch/hp300/hp300/machdep.c +++ b/sys/arch/hp300/hp300/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.41 2001/05/04 22:48:59 aaron Exp $ */ +/* $OpenBSD: machdep.c,v 1.42 2001/05/05 20:56:34 art Exp $ */ /* $NetBSD: machdep.c,v 1.121 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -101,7 +101,7 @@ #include <dev/cons.h> -#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */ +#define MAXMEM 64*1024 /* XXX - from cmap.h */ #include <vm/vm_kern.h> #include <vm/vm_param.h> @@ -346,7 +346,7 @@ cpu_startup() * "base" pages for the rest. */ curbuf = (vaddr_t) buffers + (i * MAXBSIZE); - curbufsize = CLBYTES * ((i < residual) ? (base+1) : base); + curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base); while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); @@ -375,7 +375,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vaddr_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); #endif /* UVM */ @@ -408,9 +408,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); #if defined(UVM) mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); @@ -433,7 +433,7 @@ cpu_startup() printf("avail mem = %ld\n", ptoa(cnt.v_free_count)); #endif printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); /* * Tell the VM system that page 0 isn't mapped. @@ -539,7 +539,7 @@ allocsys(v) * 1/2 as many swap buffer headers as file i/o buffers. */ if (bufpages == 0) - bufpages = physmem / 10 / CLSIZE; + bufpages = physmem / 10; if (nbuf == 0) { nbuf = bufpages; if (nbuf < 16) @@ -938,7 +938,7 @@ cpu_kcore_hdr_t cpu_kcore_hdr; /* * This is called by configure to set dumplo and dumpsize. - * Dumps always skip the first CLBYTES of disk space + * Dumps always skip the first PAGE_SIZE of disk space * in case there might be a disk label stored there. * If there is extra space, put dump at the end to * reduce the chance that swapping trashes it. @@ -974,7 +974,7 @@ dumpconf() cpu_kcore_hdr.sysseg_pa = pmap_kernel()->pm_stpa; #endif /* HP300_NEWKVM */ - /* Always skip the first CLBYTES, in case there is a label there. */ + /* Always skip the first block, in case there is a label there. */ if (dumplo < ctod(1)) dumplo = ctod(1); diff --git a/sys/arch/hp300/hp300/mem.c b/sys/arch/hp300/hp300/mem.c index 55fadfcfd16..83d96809bbe 100644 --- a/sys/arch/hp300/hp300/mem.c +++ b/sys/arch/hp300/hp300/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.12 2001/05/04 22:48:59 aaron Exp $ */ +/* $OpenBSD: mem.c,v 1.13 2001/05/05 20:56:34 art Exp $ */ /* $NetBSD: mem.c,v 1.25 1999/03/27 00:30:06 mycroft Exp $ */ /* @@ -202,10 +202,10 @@ mmrw(dev, uio, flags) */ if (devzeropage == NULL) { devzeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(devzeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(devzeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); continue; diff --git a/sys/arch/hp300/hp300/trap.c b/sys/arch/hp300/hp300/trap.c index df1278a074d..0f27f56d589 100644 --- a/sys/arch/hp300/hp300/trap.c +++ b/sys/arch/hp300/hp300/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.18 2001/05/04 22:48:59 aaron Exp $ */ +/* $OpenBSD: trap.c,v 1.19 2001/05/05 20:56:34 art Exp $ */ /* $NetBSD: trap.c,v 1.57 1998/02/16 20:58:31 thorpej Exp $ */ /* @@ -719,7 +719,7 @@ trap(type, code, v, frame) if (rv == KERN_SUCCESS) { unsigned nss; - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/hp300/hp300/vm_machdep.c b/sys/arch/hp300/hp300/vm_machdep.c index d155f28f120..ae00864da5f 100644 --- a/sys/arch/hp300/hp300/vm_machdep.c +++ b/sys/arch/hp300/hp300/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.17 2001/05/04 22:48:59 aaron Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.18 2001/05/05 20:56:35 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.47 1999/03/26 23:41:29 mycroft Exp $ */ /* @@ -233,7 +233,7 @@ pagemove(from, to, size) paddr_t pa; #ifdef DEBUG - if (size & CLOFSET) + if ((size & PAGE_MASK) != 0) panic("pagemove"); #endif while (size > 0) { diff --git a/sys/arch/hp300/include/param.h b/sys/arch/hp300/include/param.h index 69eaaed41a8..93876420f56 100644 --- a/sys/arch/hp300/include/param.h +++ b/sys/arch/hp300/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.10 2000/02/22 19:27:46 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.11 2001/05/05 20:56:35 art Exp $ */ /* $NetBSD: param.h,v 1.35 1997/07/10 08:22:38 veego Exp $ */ /* @@ -71,10 +71,10 @@ #define NPTEPG (NBPG/(sizeof (pt_entry_t))) /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -# define NKMEMCLUSTERS (2048 * 1024 / CLBYTES) +# define NKMEMCLUSTERS (2048 * 1024 / PAGE_SIZE) #endif #define MSGBUFSIZE 4096 diff --git a/sys/arch/hp300/include/vmparam.h b/sys/arch/hp300/include/vmparam.h index 835b3014db3..4f8154fa8f6 100644 --- a/sys/arch/hp300/include/vmparam.h +++ b/sys/arch/hp300/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.4 2001/05/04 22:49:00 aaron Exp $ */ +/* $OpenBSD: vmparam.h,v 1.5 2001/05/05 20:56:35 art Exp $ */ /* $NetBSD: vmparam.h,v 1.16 1998/08/20 08:33:48 kleink Exp $ */ /* @@ -132,18 +132,6 @@ #endif /* - * Boundary at which to place first MAPMEM segment if not explicitly - * specified. Should be a power of two. This allows some slop for - * the data segment to grow underneath the first mapped segment. - */ -#define MMSEG 0x200000 - -/* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; @@ -159,82 +147,9 @@ * by the page replacement algorithm. Basically this says that if you are * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES+CLSIZE pages which are not - * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this - * number just means a swapped in process is given around 25k bytes. - * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), - * so we loan each swapped in process memory worth 100$, or just admit - * that we don't consider it worthwhile and swap it out to disk which costs - * $30/mb or about $0.75. - * Update: memory prices have changed recently (9/96). At the current - * value of $6 per megabyte, we lend each swapped in process memory worth - * $0.15, or just admit that we don't consider it worthwhile and swap it out - * to disk which costs $0.20/MB, or just under half a cent. */ #define SAFERSS 4 /* nominal ``small'' resident set size protected against replacement */ - -/* - * DISKRPM is used to estimate the number of paging i/o operations - * which one can expect from a single disk controller. - */ -#define DISKRPM 60 - -/* - * Klustering constants. Klustering is the gathering - * of pages together for pagein/pageout, while clustering - * is the treatment of hardware page size as though it were - * larger than it really is. - * - * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) - * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. - * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) - * unless you like "big push" panics. - */ - -#define KLMAX (4/CLSIZE) -#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ -#define KLIN (4/CLSIZE) /* default data/stack in klust */ -#define KLTXT (4/CLSIZE) /* default text in klust */ -#define KLOUT (4/CLSIZE) - -/* - * KLSDIST is the advance or retard of the fifo reclaim for sequential - * processes data space. - */ -#define KLSDIST 3 /* klusters advance/retard for seq. fifo */ - -/* - * Paging thresholds (see vm_sched.c). - * Strategy of 1/19/85: - * lotsfree is 512k bytes, but at most 1/4 of memory - * desfree is 200k bytes, but at most 1/8 of memory - */ -#define LOTSFREE (512 * 1024) -#define LOTSFREEFRACT 4 -#define DESFREE (200 * 1024) -#define DESFREEFRACT 8 - -/* - * There are two clock hands, initially separated by HANDSPREAD bytes - * (but at most all of user memory). The amount of time to reclaim - * a page once the pageout process examines it increases with this - * distance and decreases as the scan rate rises. - */ -#define HANDSPREAD (2 * 1024 * 1024) - -/* - * The number of times per second to recompute the desired paging rate - * and poke the pagedaemon. - */ -#define RATETOSCHEDPAGING 4 - -/* - * Believed threshold (in megabytes) for which interleaved - * swapping area is desirable. - */ -#define LOTSOFMEM 2 - /* * Mach derived constants */ @@ -248,8 +163,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) /* # of kernel PT pages (initial only, can grow dynamically) */ #define VM_KERNEL_PT_PAGES ((vsize_t)2) /* XXX: SYSPTSIZE */ diff --git a/sys/arch/hppa/dev/mem.c b/sys/arch/hppa/dev/mem.c index d8741adc6b0..64dbc4edefe 100644 --- a/sys/arch/hppa/dev/mem.c +++ b/sys/arch/hppa/dev/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.4 1999/11/26 18:01:01 mickey Exp $ */ +/* $OpenBSD: mem.c,v 1.5 2001/05/05 20:56:36 art Exp $ */ /* * Copyright (c) 1998,1999 Michael Shalayeff @@ -261,7 +261,7 @@ mmrw(dev, uio, flags) c = iov->iov_len; break; } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; default: diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index 96f6928e170..a6777000f3e 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.31 2001/03/29 00:47:53 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.32 2001/05/05 20:56:36 art Exp $ */ /* * Copyright (c) 1999-2000 Michael Shalayeff @@ -463,8 +463,8 @@ hptsize=256; /* XXX one page for now */ MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; @@ -640,7 +640,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vaddr_t) buffers + (i * MAXBSIZE); - curbufsize = CLBYTES * ((i < residual) ? (base+1) : base); + curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base); while (curbufsize) { if ((pg = uvm_pagealloc(NULL, 0, NULL, 0)) == NULL) @@ -671,9 +671,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); @@ -687,7 +687,7 @@ cpu_startup() #endif printf("avail mem = %ld\n", ptoa(uvmexp.free)); printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); /* * Set up buffers, so they can be used to read disk labels. diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index e09e1e1b3a9..897ca32f76d 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.27 2001/04/01 06:13:40 mickey Exp $ */ +/* $OpenBSD: trap.c,v 1.28 2001/05/05 20:56:37 art Exp $ */ /* * Copyright (c) 1998-2000 Michael Shalayeff @@ -348,7 +348,7 @@ trap(type, frame) */ if (va >= (vaddr_t)vm->vm_maxsaddr + vm->vm_ssize) { if (ret == KERN_SUCCESS) { - vsize_t nss = clrnd(btoc(va - USRSTACK + NBPG)); + vsize_t nss = btoc(va - USRSTACK + NBPG); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (ret == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/hppa/include/param.h b/sys/arch/hppa/include/param.h index c096f1df584..473fdfb4639 100644 --- a/sys/arch/hppa/include/param.h +++ b/sys/arch/hppa/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.10 2001/02/16 19:17:24 mickey Exp $ */ +/* $OpenBSD: param.h,v 1.11 2001/05/05 20:56:37 art Exp $ */ /* * Copyright (c) 1988-1994, The University of Utah and @@ -67,10 +67,6 @@ #define MACHINE_STACK_GROWS_UP 1 /* stack grows to higher addresses */ -#define CLSIZE 1 -#define CLSIZELOG2 0 - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE (1) /* initial stack size/NBPG */ #define SINCR (1) /* increment of stack/NBPG */ @@ -85,7 +81,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -99,10 +95,10 @@ #endif /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (16 * 1024 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (16 * 1024 * 1024 / PAGE_SIZE) #endif /* pages ("clicks") (4096 bytes) to disk blocks */ diff --git a/sys/arch/hppa/include/vmparam.h b/sys/arch/hppa/include/vmparam.h index 176fe4ca4c9..066ccd60608 100644 --- a/sys/arch/hppa/include/vmparam.h +++ b/sys/arch/hppa/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.11 2001/03/22 23:50:53 mickey Exp $ */ +/* $OpenBSD: vmparam.h,v 1.12 2001/05/05 20:56:37 art Exp $ */ /* * Copyright (c) 1988-1994, The University of Utah and @@ -74,7 +74,7 @@ #define DMMAX 4096 /* largest potential swap allocation */ #ifndef USRIOSIZE -#define USRIOSIZE ((2*HPPA_PGALIAS)/CLBYTES) /* 2mb */ +#define USRIOSIZE ((2*HPPA_PGALIAS)/PAGE_SIZE) /* 2mb */ #endif /* @@ -86,11 +86,6 @@ #endif /* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; @@ -126,8 +121,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) #define VM_PHYSSEG_MAX 8 /* this many physmem segments */ #define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 4789b130ba3..2fd66ad6f09 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.156 2001/04/30 13:23:11 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.157 2001/05/05 20:56:38 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -200,11 +200,11 @@ extern struct proc *npxproc; #define ISADMA_LIMIT (16 * 1024 * 1024) /* XXX wrong place */ #ifdef UVM #define ALLOC_PGS(sz, limit, pgs) \ - uvm_pglistalloc((sz), 0, (limit), CLBYTES, 0, &(pgs), 1, 0) + uvm_pglistalloc((sz), 0, (limit), PAGE_SIZE, 0, &(pgs), 1, 0) #define FREE_PGS(pgs) uvm_pglistfree(&(pgs)) #else #define ALLOC_PGS(sz, limit, pgs) \ - vm_page_alloc_memory((sz), 0, (limit), CLBYTES, 0, &(pgs), 1, 0) + vm_page_alloc_memory((sz), 0, (limit), PAGE_SIZE, 0, &(pgs), 1, 0) #define FREE_PGS(pgs) vm_page_free_memory(&(pgs)) #endif @@ -427,9 +427,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, M_MBUF, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); #if defined(UVM) mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); @@ -451,7 +451,7 @@ cpu_startup() ptoa(cnt.v_free_count)/1024); #endif printf("using %d buffers containing %u bytes (%uK) of memory\n", - nbuf, bufpages * CLBYTES, bufpages * CLBYTES / 1024); + nbuf, bufpages * PAGE_SIZE, bufpages * PAGE_SIZE / 1024); /* * Set up buffers, so they can be used to read disk labels. @@ -549,10 +549,10 @@ allocsys(v) */ if (bufpages == 0) { if (physmem < btoc(2 * 1024 * 1024)) - bufpages = physmem / (10 * CLSIZE); + bufpages = physmem / 10; else bufpages = (btoc(2 * 1024 * 1024) + physmem) * - BUFCACHEPERCENT / (100 * CLSIZE); + BUFCACHEPERCENT / 100; } if (nbuf == 0) { nbuf = bufpages; @@ -567,8 +567,8 @@ allocsys(v) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ @@ -611,9 +611,9 @@ setup_buffers(maxaddr) base = bufpages / nbuf; residual = bufpages % nbuf; - if (base >= MAXBSIZE / CLBYTES) { + if (base >= MAXBSIZE / PAGE_SIZE) { /* don't want to alloc more physical mem than needed */ - base = MAXBSIZE / CLBYTES; + base = MAXBSIZE / PAGE_SIZE; residual = 0; } @@ -652,8 +652,8 @@ setup_buffers(maxaddr) * bounce all buffer I/O. */ for (left = bufpages; left > 0; left -= chunk) { - chunk = min(left, CHUNKSZ / CLBYTES); - if (ALLOC_PGS(chunk * CLBYTES, ISADMA_LIMIT, pgs)) + chunk = min(left, CHUNKSZ / PAGE_SIZE); + if (ALLOC_PGS(chunk * PAGE_SIZE, ISADMA_LIMIT, pgs)) break; } } @@ -661,7 +661,7 @@ setup_buffers(maxaddr) /* * If we need more pages for the buffer cache, get them from anywhere. */ - if (left > 0 && ALLOC_PGS(left * CLBYTES, avail_end, pgs)) + if (left > 0 && ALLOC_PGS(left * PAGE_SIZE, avail_end, pgs)) panic("cannot get physical memory for buffer cache"); /* @@ -681,7 +681,7 @@ setup_buffers(maxaddr) * but has no physical memory allocated for it. */ addr = (vm_offset_t)buffers + i * MAXBSIZE; - for (size = CLBYTES * (i < residual ? base + 1 : base); + for (size = PAGE_SIZE * (i < residual ? base + 1 : base); size > 0; size -= NBPG, addr += NBPG) { pmap_enter(pmap_kernel(), addr, pg->phys_addr, VM_PROT_READ|VM_PROT_WRITE, TRUE, @@ -1737,7 +1737,7 @@ haltsys: /* * This is called by configure to set dumplo and dumpsize. - * Dumps always skip the first CLBYTES of disk space + * Dumps always skip the first block of disk space * in case there might be a disk label stored there. * If there is extra space, put dump at the end to * reduce the chance that swapping trashes it. @@ -1759,7 +1759,7 @@ dumpconf() if (nblks <= ctod(1)) return; - /* Always skip the first CLBYTES, in case there is a label there. */ + /* Always skip the first block, in case there is a label there. */ if (dumplo < ctod(1)) dumplo = ctod(1); diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 597f966112c..c744360dba3 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,5 +1,5 @@ /* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */ -/* $OpenBSD: mem.c,v 1.15 2000/12/17 21:10:31 matthieu Exp $ */ +/* $OpenBSD: mem.c,v 1.16 2001/05/05 20:56:38 art Exp $ */ /* * Copyright (c) 1988 University of Utah. * Copyright (c) 1982, 1986, 1990, 1993 @@ -215,10 +215,10 @@ mmrw(dev, uio, flags) } if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 7075ed44924..91a50eb16c4 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,8 +1,6 @@ -/* $OpenBSD: trap.c,v 1.37 2001/04/02 21:43:10 niklas Exp $ */ +/* $OpenBSD: trap.c,v 1.38 2001/05/05 20:56:38 art Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ -#undef DEBUG -#define DEBUG /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. * Copyright (c) 1990 The Regents of the University of California. @@ -477,7 +475,7 @@ trap(frame) if ((caddr_t)va >= vm->vm_maxsaddr && (caddr_t)va < (caddr_t)VM_MAXUSER_ADDRESS && map != kernel_map) { - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) { /* * We used to fail here. However, it may @@ -617,7 +615,7 @@ trapwrite(addr) p = curproc; vm = p->p_vmspace; if ((caddr_t)va >= vm->vm_maxsaddr) { - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) nss = 0; } diff --git a/sys/arch/i386/include/param.h b/sys/arch/i386/include/param.h index e118bd08d1a..98f5a4017ed 100644 --- a/sys/arch/i386/include/param.h +++ b/sys/arch/i386/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.14 2001/04/07 17:17:28 niklas Exp $ */ +/* $OpenBSD: param.h,v 1.15 2001/05/05 20:56:39 art Exp $ */ /* $NetBSD: param.h,v 1.29 1996/03/04 05:04:26 cgd Exp $ */ /*- @@ -86,10 +86,6 @@ #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ #endif -#define CLSIZELOG2 0 -#define CLSIZE (1 << CLSIZELOG2) - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ #define UPAGES 2 /* pages of u-area */ @@ -109,7 +105,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -124,10 +120,10 @@ #endif /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (16 * 1024 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (16 * 1024 * 1024 / PAGE_SIZE) #endif /* pages ("clicks") to disk blocks */ diff --git a/sys/arch/i386/include/vmparam.h b/sys/arch/i386/include/vmparam.h index a8dd350ef77..762aa954d50 100644 --- a/sys/arch/i386/include/vmparam.h +++ b/sys/arch/i386/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.16 2001/03/22 23:36:52 niklas Exp $ */ +/* $OpenBSD: vmparam.h,v 1.17 2001/05/05 20:56:39 art Exp $ */ /* $NetBSD: vmparam.h,v 1.15 1994/10/27 04:16:34 cgd Exp $ */ /*- @@ -56,7 +56,7 @@ * Immediately after the user structure is the page table map, and then * kernal address space. */ -#define USRTEXT CLBYTES +#define USRTEXT PAGE_SIZE #define USRSTACK VM_MAXUSER_ADDRESS /* @@ -145,8 +145,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) #define MACHINE_NEW_NONCONTIG /* VM <=> pmap interface modifier */ diff --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h index 6480efc46a2..30fb50252ac 100644 --- a/sys/arch/m68k/include/param.h +++ b/sys/arch/m68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.2 1997/09/17 17:45:20 downsj Exp $ */ +/* $OpenBSD: param.h,v 1.3 2001/05/05 20:56:40 art Exp $ */ /* $NetBSD: param.h,v 1.2 1997/06/10 18:21:23 veego Exp $ */ /* @@ -78,10 +78,6 @@ #define BLKDEV_IOSIZE 2048 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#define CLSIZELOG2 0 -#define CLSIZE (1 << CLSIZELOG2) - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ diff --git a/sys/arch/mac68k/include/param.h b/sys/arch/mac68k/include/param.h index c73f5ac21b3..9fc0fa2bbe9 100644 --- a/sys/arch/mac68k/include/param.h +++ b/sys/arch/mac68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.10 2000/02/22 19:27:51 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.11 2001/05/05 20:56:40 art Exp $ */ /* $NetBSD: param.h,v 1.28 1997/03/01 06:57:45 scottr Exp $ */ /* @@ -104,10 +104,10 @@ #define NPTEPG (NBPG/(sizeof (pt_entry_t))) /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (2048 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (2048 * 1024 / PAGE_SIZE) #endif #define MSGBUFSIZE 4096 diff --git a/sys/arch/mac68k/include/vmparam.h b/sys/arch/mac68k/include/vmparam.h index 5f0d3e75d64..732a11f93d8 100644 --- a/sys/arch/mac68k/include/vmparam.h +++ b/sys/arch/mac68k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.4 1997/11/30 06:10:37 gene Exp $ */ +/* $OpenBSD: vmparam.h,v 1.5 2001/05/05 20:56:41 art Exp $ */ /* $NetBSD: vmparam.h,v 1.8 1996/11/15 14:21:00 briggs Exp $ */ /* @@ -153,18 +153,6 @@ #endif /* - * Boundary at which to place first MAPMEM segment if not explicitly - * specified. Should be a power of two. This allows some slop for - * the data segment to grow underneath the first mapped segment. - */ -#define MMSEG 0x200000 - -/* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; @@ -180,79 +168,9 @@ * by the page replacement algorithm. Basically this says that if you are * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES+CLSIZE pages which are not - * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this - * number just means a swapped in process is given around 25k bytes. - * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), - * so we loan each swapped in process memory worth 100$, or just admit - * that we don't consider it worthwhile and swap it out to disk which costs - * $30/mb or about $0.75. */ #define SAFERSS 4 /* nominal ``small'' resident set size protected against replacement */ - -/* - * DISKRPM is used to estimate the number of paging i/o operations - * which one can expect from a single disk controller. - */ -#define DISKRPM 3600 - -/* - * Klustering constants. Klustering is the gathering - * of pages together for pagein/pageout, while clustering - * is the treatment of hardware page size as though it were - * larger than it really is. - * - * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) - * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. - * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) - * unless you like "big push" panics. - */ - -#define KLMAX (4/CLSIZE) -#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ -#define KLIN (4/CLSIZE) /* default data/stack in klust */ -#define KLTXT (4/CLSIZE) /* default text in klust */ -#define KLOUT (4/CLSIZE) - -/* - * KLSDIST is the advance or retard of the fifo reclaim for sequential - * processes data space. - */ -#define KLSDIST 3 /* klusters advance/retard for seq. fifo */ - -/* - * Paging thresholds (see vm_sched.c). - * Strategy of 1/19/85: - * lotsfree is 512k bytes, but at most 1/4 of memory - * desfree is 200k bytes, but at most 1/8 of memory - * Are these still valid in 1995? - */ -#define LOTSFREE (512 * 1024) -#define LOTSFREEFRACT 4 -#define DESFREE (200 * 1024) -#define DESFREEFRACT 8 - -/* - * There are two clock hands, initially separated by HANDSPREAD bytes - * (but at most all of user memory). The amount of time to reclaim - * a page once the pageout process examines it increases with this - * distance and decreases as the scan rate rises. - */ -#define HANDSPREAD (2 * 1024 * 1024) - -/* - * The number of times per second to recompute the desired paging rate - * and poke the pagedaemon. - */ -#define RATETOSCHEDPAGING 4 - -/* - * Believed threshold (in megabytes) for which interleaved - * swapping area is desirable. - */ -#define LOTSOFMEM 2 - /* * Mach derived constants */ @@ -266,8 +184,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) #define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */ diff --git a/sys/arch/mac68k/mac68k/machdep.c b/sys/arch/mac68k/mac68k/machdep.c index d002aee2cef..505f56d1cef 100644 --- a/sys/arch/mac68k/mac68k/machdep.c +++ b/sys/arch/mac68k/mac68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.67 2000/04/11 02:44:28 pjanzen Exp $ */ +/* $OpenBSD: machdep.c,v 1.68 2001/05/05 20:56:41 art Exp $ */ /* $NetBSD: machdep.c,v 1.134 1997/02/14 06:15:30 scottr Exp $ */ /* @@ -130,7 +130,7 @@ void netintr __P((void)); -#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */ +#define MAXMEM 64*1024 /* XXX - from cmap.h */ #include <vm/vm_param.h> #include <vm/pmap.h> #include <vm/vm_map.h> @@ -387,9 +387,9 @@ again: */ if (bufpages == 0) { if (physmem < btoc(2 * 1024 * 1024)) - bufpages = physmem / 10 / CLSIZE; + bufpages = physmem / 10; else - bufpages = (btoc(2 * 1024 * 1024) + physmem) / 20 / CLSIZE; + bufpages = (btoc(2 * 1024 * 1024) + physmem) / 20; } bufpages = min(NKMEMCLUSTERS * 2 / 5, bufpages); @@ -451,7 +451,7 @@ again: * but has no physical memory allocated for it. */ curbuf = (vm_offset_t) buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base + 1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base + 1 : base); vm_map_pageable(buffer_map, curbuf, curbuf + curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); } @@ -472,9 +472,9 @@ again: * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *) malloc(NMBCLUSTERS + CLBYTES / MCLBYTES, + mclrefcnt = (char *) malloc(NMBCLUSTERS + PAGE_SIZE / MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS + CLBYTES / MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS + PAGE_SIZE / MCLBYTES); mb_map = kmem_suballoc(kernel_map, (vm_offset_t *) & mbutl, &maxaddr, VM_MBUF_SIZE, FALSE); @@ -485,7 +485,7 @@ again: printf("avail mem = %ld\n", ptoa(cnt.v_free_count)); printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); /* * Set up buffers, so they can be used to read disk labels. @@ -731,7 +731,7 @@ long dumplo = 0; /* blocks */ /* * This is called by main to set dumplo and dumpsize. - * Dumps always skip the first CLBYTES of disk space in + * Dumps always skip the first block of disk space in * case there might be a disk label stored there. If there * is extra space, put dump at the end to reduce the chance * that swapping trashes it. @@ -764,7 +764,7 @@ dumpconf() /* * Check to see if we will fit. Note we always skip the - * first CLBYTES in case there is a disk label there. + * first block in case there is a disk label there. */ if (nblks < (ctod(dumpsize) + chdrsize + ctod(1))) { dumpsize = 0; diff --git a/sys/arch/mac68k/mac68k/mem.c b/sys/arch/mac68k/mac68k/mem.c index 6e69548de49..189648ab39a 100644 --- a/sys/arch/mac68k/mac68k/mem.c +++ b/sys/arch/mac68k/mac68k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.9 1999/11/22 19:21:59 matthieu Exp $ */ +/* $OpenBSD: mem.c,v 1.10 2001/05/05 20:56:42 art Exp $ */ /* $NetBSD: mem.c,v 1.11 1996/05/05 06:18:41 briggs Exp $ */ /* @@ -165,10 +165,10 @@ mmrw(dev, uio, flags) } if (devzeropage == NULL) { devzeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(devzeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(devzeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); continue; diff --git a/sys/arch/mac68k/mac68k/trap.c b/sys/arch/mac68k/mac68k/trap.c index 6ce1934a8df..31ac320e38b 100644 --- a/sys/arch/mac68k/mac68k/trap.c +++ b/sys/arch/mac68k/mac68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.18 2000/11/10 18:15:39 art Exp $ */ +/* $OpenBSD: trap.c,v 1.19 2001/05/05 20:56:42 art Exp $ */ /* $NetBSD: trap.c,v 1.46 1997/04/07 22:54:44 scottr Exp $ */ /* @@ -603,7 +603,7 @@ copyfault: if (rv == KERN_SUCCESS) { unsigned nss; - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/mips/include/param.h b/sys/arch/mips/include/param.h index 5368dca22ff..09d7aa991c8 100644 --- a/sys/arch/mips/include/param.h +++ b/sys/arch/mips/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.2 1999/01/27 04:46:05 imp Exp $ */ +/* $OpenBSD: param.h,v 1.3 2001/05/05 20:56:42 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -84,10 +84,6 @@ /* XXX Maxphys temporary changed to 32K while SCSI driver is fixed. */ #define MAXPHYS (32 * 1024) /* max raw I/O transfer size */ -#define CLSIZE 1 -#define CLSIZELOG2 0 - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ @@ -103,7 +99,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -121,10 +117,10 @@ #endif /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (4096*1024/CLBYTES) +#define NKMEMCLUSTERS (4096*1024/PAGE_SIZE) #endif /* pages ("clicks") (4096 bytes) to disk blocks */ diff --git a/sys/arch/mips/include/vmparam.h b/sys/arch/mips/include/vmparam.h index 1e4b31119be..f56fff906ed 100644 --- a/sys/arch/mips/include/vmparam.h +++ b/sys/arch/mips/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.4 1999/01/27 04:46:06 imp Exp $ */ +/* $OpenBSD: vmparam.h,v 1.5 2001/05/05 20:56:43 art Exp $ */ /* $NetBSD: vmparam.h,v 1.5 1994/10/26 21:10:10 cgd Exp $ */ /* @@ -108,18 +108,6 @@ #endif /* - * Boundary at which to place first MAPMEM segment if not explicitly - * specified. Should be a power of two. This allows some slop for - * the data segment to grow underneath the first mapped segment. - */ -#define MMSEG 0x200000 - -/* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; @@ -135,86 +123,9 @@ * by the page replacement algorithm. Basically this says that if you are * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES+CLSIZE pages which are not - * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this - * number just means a swapped in process is given around 25k bytes. - * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), - * so we loan each swapped in process memory worth 100$, or just admit - * that we don't consider it worthwhile and swap it out to disk which costs - * $30/mb or about $0.75. */ #define SAFERSS 4 /* nominal ``small'' resident set size protected against replacement */ - -/* - * DISKRPM is used to estimate the number of paging i/o operations - * which one can expect from a single disk controller. - */ -#define DISKRPM 60 - -/* - * Klustering constants. Klustering is the gathering - * of pages together for pagein/pageout, while clustering - * is the treatment of hardware page size as though it were - * larger than it really is. - * - * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) - * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. - * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) - * unless you like "big push" panics. - */ - -#ifdef notdef /* XXX */ -#define KLMAX (4/CLSIZE) -#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ -#define KLIN (4/CLSIZE) /* default data/stack in klust */ -#define KLTXT (4/CLSIZE) /* default text in klust */ -#define KLOUT (4/CLSIZE) -#else -#define KLMAX (1/CLSIZE) -#define KLSEQL (1/CLSIZE) -#define KLIN (1/CLSIZE) -#define KLTXT (1/CLSIZE) -#define KLOUT (1/CLSIZE) -#endif - -/* - * KLSDIST is the advance or retard of the fifo reclaim for sequential - * processes data space. - */ -#define KLSDIST 3 /* klusters advance/retard for seq. fifo */ - -/* - * Paging thresholds (see vm_sched.c). - * Strategy of 1/19/85: - * lotsfree is 512k bytes, but at most 1/4 of memory - * desfree is 200k bytes, but at most 1/8 of memory - */ -#define LOTSFREE (512 * 1024) -#define LOTSFREEFRACT 4 -#define DESFREE (200 * 1024) -#define DESFREEFRACT 8 - -/* - * There are two clock hands, initially separated by HANDSPREAD bytes - * (but at most all of user memory). The amount of time to reclaim - * a page once the pageout process examines it increases with this - * distance and decreases as the scan rate rises. - */ -#define HANDSPREAD (2 * 1024 * 1024) - -/* - * The number of times per second to recompute the desired paging rate - * and poke the pagedaemon. - */ -#define RATETOSCHEDPAGING 4 - -/* - * Believed threshold (in megabytes) for which interleaved - * swapping area is desirable. - */ -#define LOTSOFMEM 2 - /* * Mach derived constants */ @@ -230,8 +141,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) struct vm_map; diff --git a/sys/arch/mips/mips/mem.c b/sys/arch/mips/mips/mem.c index 4f58f8d6920..819fad7ceea 100644 --- a/sys/arch/mips/mips/mem.c +++ b/sys/arch/mips/mips/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.5 2001/01/31 22:39:42 jason Exp $ */ +/* $OpenBSD: mem.c,v 1.6 2001/05/05 20:56:43 art Exp $ */ /* $NetBSD: mem.c,v 1.6 1995/04/10 11:55:03 mycroft Exp $ */ /* @@ -159,10 +159,10 @@ mmrw(dev, uio, flags) } if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/arch/mips/mips/vm_machdep.c b/sys/arch/mips/mips/vm_machdep.c index 4324c12b546..e45e9869214 100644 --- a/sys/arch/mips/mips/vm_machdep.c +++ b/sys/arch/mips/mips/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.11 2000/06/08 22:25:20 niklas Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.12 2001/05/05 20:56:43 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -252,8 +252,10 @@ pagemove(from, to, size) { pt_entry_t *fpte, *tpte; - if (size % CLBYTES) +#ifdef DIAGNOSTIC + if ((size & PAGE_MASK) != 0) panic("pagemove"); +#endif fpte = kvtopte(from); tpte = kvtopte(to); if(((int)from & CpuCacheAliasMask) != ((int)to & CpuCacheAliasMask)) { diff --git a/sys/arch/mvme68k/include/param.h b/sys/arch/mvme68k/include/param.h index 6146d846670..c8c98e90a3e 100644 --- a/sys/arch/mvme68k/include/param.h +++ b/sys/arch/mvme68k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.8 2000/02/22 19:27:53 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.9 2001/05/05 20:56:44 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -77,10 +77,6 @@ #define BLKDEV_IOSIZE 2048 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#define CLSIZELOG2 0 -#define CLSIZE (1 << CLSIZELOG2) - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ #define UPAGES 2 /* pages of u-area */ @@ -88,7 +84,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -109,10 +105,10 @@ #define MSGBUFSIZE 4096 /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (2048 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (2048 * 1024 / PAGE_SIZE) #endif /* pages ("clicks") to disk blocks */ diff --git a/sys/arch/mvme68k/include/vmparam.h b/sys/arch/mvme68k/include/vmparam.h index c921a36633d..27c16cd6b69 100644 --- a/sys/arch/mvme68k/include/vmparam.h +++ b/sys/arch/mvme68k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.4 1998/03/01 00:37:39 niklas Exp $ */ +/* $OpenBSD: vmparam.h,v 1.5 2001/05/05 20:56:44 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -127,18 +127,6 @@ #endif /* - * Boundary at which to place first MAPMEM segment if not explicitly - * specified. Should be a power of two. This allows some slop for - * the data segment to grow underneath the first mapped segment. - */ -#define MMSEG 0x200000 - -/* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; @@ -154,78 +142,9 @@ * by the page replacement algorithm. Basically this says that if you are * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES+CLSIZE pages which are not - * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this - * number just means a swapped in process is given around 25k bytes. - * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), - * so we loan each swapped in process memory worth 100$, or just admit - * that we don't consider it worthwhile and swap it out to disk which costs - * $30/mb or about $0.75. */ #define SAFERSS 4 /* nominal ``small'' resident set size protected against replacement */ - -/* - * DISKRPM is used to estimate the number of paging i/o operations - * which one can expect from a single disk controller. - */ -#define DISKRPM 60 - -/* - * Klustering constants. Klustering is the gathering - * of pages together for pagein/pageout, while clustering - * is the treatment of hardware page size as though it were - * larger than it really is. - * - * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) - * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. - * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) - * unless you like "big push" panics. - */ - -#define KLMAX (4/CLSIZE) -#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ -#define KLIN (4/CLSIZE) /* default data/stack in klust */ -#define KLTXT (4/CLSIZE) /* default text in klust */ -#define KLOUT (4/CLSIZE) - -/* - * KLSDIST is the advance or retard of the fifo reclaim for sequential - * processes data space. - */ -#define KLSDIST 3 /* klusters advance/retard for seq. fifo */ - -/* - * Paging thresholds (see vm_sched.c). - * Strategy of 1/19/85: - * lotsfree is 512k bytes, but at most 1/4 of memory - * desfree is 200k bytes, but at most 1/8 of memory - */ -#define LOTSFREE (512 * 1024) -#define LOTSFREEFRACT 4 -#define DESFREE (200 * 1024) -#define DESFREEFRACT 8 - -/* - * There are two clock hands, initially separated by HANDSPREAD bytes - * (but at most all of user memory). The amount of time to reclaim - * a page once the pageout process examines it increases with this - * distance and decreases as the scan rate rises. - */ -#define HANDSPREAD (2 * 1024 * 1024) - -/* - * The number of times per second to recompute the desired paging rate - * and poke the pagedaemon. - */ -#define RATETOSCHEDPAGING 4 - -/* - * Believed threshold (in megabytes) for which interleaved - * swapping area is desirable. - */ -#define LOTSOFMEM 2 - /* * Mach derived constants */ @@ -239,8 +158,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) /* # of kernel PT pages (initial only, can grow dynamically) */ #define VM_KERNEL_PT_PAGES ((vm_size_t)2) /* XXX: SYSPTSIZE */ diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index bb8d00ea6e0..0ee732ea93c 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.36 2001/04/17 04:30:46 aaron Exp $ */ +/* $OpenBSD: machdep.c,v 1.37 2001/05/05 20:56:45 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -114,7 +114,7 @@ #include <dev/cons.h> #include <net/netisr.h> -#define MAXMEM 64*1024*CLSIZE /* XXX - from cmap.h */ +#define MAXMEM 64*1024 /* XXX - from cmap.h */ #include <vm/vm_kern.h> /* the following is used externally (sysctl_hw) */ @@ -320,7 +320,7 @@ cpu_startup() * We allocate 1/2 as many swap buffer headers as file i/o buffers. */ if (bufpages == 0) - bufpages = physmem / 20 / CLSIZE; + bufpages = physmem / 20; if (nbuf == 0) { nbuf = bufpages; if (nbuf < 16) @@ -342,7 +342,7 @@ cpu_startup() if (firstaddr == 0) panic("startup: no room for tables"); #ifdef BUFFERS_UNMANAGED - buffermem = (caddr_t) kmem_alloc(kernel_map, bufpages*CLBYTES); + buffermem = (caddr_t) kmem_alloc(kernel_map, bufpages*PAGE_SIZE); if (buffermem == 0) panic("startup: no room for buffers"); #endif @@ -378,7 +378,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); } @@ -398,9 +398,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, - M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, + M_MBUF, M_NOWAIT); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, FALSE); /* @@ -413,7 +413,7 @@ cpu_startup() #endif printf("avail mem = %d\n", ptoa(cnt.v_free_count)); printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); #ifdef MFS /* * Check to see if a mini-root was loaded into memory. It resides @@ -753,7 +753,7 @@ long dumplo = 0; /* blocks */ /* * This is called by configure to set dumplo and dumpsize. - * Dumps always skip the first CLBYTES of disk space + * Dumps always skip the first block of disk space * in case there might be a disk label stored there. * If there is extra space, put dump at the end to * reduce the chance that swapping trashes it. @@ -780,7 +780,7 @@ dumpconf() */ dumpsize = physmem + 1; - /* Always skip the first CLBYTES, in case there is a label there. */ + /* Always skip the first block, in case there is a label there. */ if (dumplo < ctod(1)) dumplo = ctod(1); diff --git a/sys/arch/mvme68k/mvme68k/mem.c b/sys/arch/mvme68k/mvme68k/mem.c index 0821f2a0645..f902cddfe83 100644 --- a/sys/arch/mvme68k/mvme68k/mem.c +++ b/sys/arch/mvme68k/mvme68k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.11 2001/04/05 20:39:39 deraadt Exp $ */ +/* $OpenBSD: mem.c,v 1.12 2001/05/05 20:56:45 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -206,16 +206,10 @@ mmrw(dev, uio, flags) * is a global zeroed page, the null segment table. */ if (devzeropage == NULL) { -#if CLBYTES == NBPG extern caddr_t Segtabzero; devzeropage = Segtabzero; -#else - devzeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(devzeropage, CLBYTES); -#endif } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); continue; diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 41baa261208..7897c940a36 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.27 2001/04/05 20:39:40 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.28 2001/05/05 20:56:45 art Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -619,7 +619,7 @@ copyfault: if (rv == KERN_SUCCESS) { unsigned nss; - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/mvme68k/mvme68k/vm_machdep.c b/sys/arch/mvme68k/mvme68k/vm_machdep.c index 61a8878fc31..e230e23bdeb 100644 --- a/sys/arch/mvme68k/mvme68k/vm_machdep.c +++ b/sys/arch/mvme68k/mvme68k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.20 2001/04/05 20:39:41 deraadt Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.21 2001/05/05 20:56:45 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -169,7 +169,7 @@ pagemove(from, to, size) register vm_offset_t pa; #ifdef DEBUG - if (size & CLOFSET) + if ((size & PAGE_MASK) != 0) panic("pagemove"); #endif while (size > 0) { diff --git a/sys/arch/mvme88k/include/param.h b/sys/arch/mvme88k/include/param.h index 6f229547d5c..1611c25078d 100644 --- a/sys/arch/mvme88k/include/param.h +++ b/sys/arch/mvme88k/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.15 2001/03/09 05:44:40 smurph Exp $ */ +/* $OpenBSD: param.h,v 1.16 2001/05/05 20:56:46 art Exp $ */ /* * Copyright (c) 1999 Steve Murphree, Jr. * Copyright (c) 1988 University of Utah. @@ -40,7 +40,7 @@ * from: Utah $Hdr: machparam.h 1.11 89/08/14$ * * @(#)param.h 7.8 (Berkeley) 6/28/91 - * $Id: param.h,v 1.15 2001/03/09 05:44:40 smurph Exp $ + * $Id: param.h,v 1.16 2001/05/05 20:56:46 art Exp $ */ #ifndef _MACHINE_PARAM_H_ #define _MACHINE_PARAM_H_ @@ -95,10 +95,6 @@ #define BLKDEV_IOSIZE 2048 /* Should this be changed? XXX */ #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#define CLSIZE 1 -#define CLSIZELOG2 0 - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ #define USPACE ctob(UPAGES) @@ -116,7 +112,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -135,10 +131,10 @@ #endif /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (4096*1024/CLBYTES) +#define NKMEMCLUSTERS (4096*1024/PAGE_SIZE) #endif #define MSGBUFSIZE 4096 diff --git a/sys/arch/mvme88k/include/vmparam.h b/sys/arch/mvme88k/include/vmparam.h index e6fbbe5e2b0..d4d294c63fe 100644 --- a/sys/arch/mvme88k/include/vmparam.h +++ b/sys/arch/mvme88k/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.9 2001/03/07 23:37:17 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.10 2001/05/05 20:56:46 art Exp $ */ /* * Mach Operating System * Copyright (c) 1992 Carnegie Mellon University @@ -175,8 +175,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) /* * Conversion between MACHINE pages and VM pages diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c index 04ef80e3cd8..ebb42aab866 100644 --- a/sys/arch/mvme88k/mvme88k/machdep.c +++ b/sys/arch/mvme88k/mvme88k/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.32 2001/04/29 19:00:03 miod Exp $ */ +/* $OpenBSD: machdep.c,v 1.33 2001/05/05 20:56:47 art Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -675,7 +675,7 @@ cpu_startup() * "base" pages for the rest. */ curbuf = (vm_offset_t) buffers + (i * MAXBSIZE); - curbufsize = CLBYTES * ((i < residual) ? (base+1) : base); + curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base); while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); @@ -700,7 +700,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); /* this faults in the required physical pages */ vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); @@ -759,9 +759,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); #if defined(UVM) mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); @@ -782,7 +782,7 @@ cpu_startup() ptoa(cnt.v_free_count)/NBPG); #endif printf("using %d buffers containing %d bytes of memory\n", nbuf, - bufpages * CLBYTES); + bufpages * PAGE_SIZE); #if 0 /* #ifdef MFS */ /* @@ -876,10 +876,10 @@ allocsys(v) */ if (bufpages == 0) { if (physmem < btoc(2 * 1024 * 1024)) - bufpages = physmem / (10 * CLSIZE); + bufpages = physmem / 10; else bufpages = (btoc(2 * 1024 * 1024) + physmem) * - BUFCACHEPERCENT / (100 * CLSIZE); + BUFCACHEPERCENT / 100; } if (nbuf == 0) { nbuf = bufpages; @@ -894,8 +894,8 @@ allocsys(v) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ @@ -1318,11 +1318,11 @@ dumpconf() dumplo = nblks - btodb(ctob(physmem)); } /* - * Don't dump on the first CLBYTES (why CLBYTES?) + * Don't dump on the first block * in case the dump device includes a disk label. */ - if (dumplo < btodb(CLBYTES)) - dumplo = btodb(CLBYTES); + if (dumplo < btodb(PAGE_SIZE)) + dumplo = btodb(PAGE_SIZE); } /* diff --git a/sys/arch/mvme88k/mvme88k/mem.c b/sys/arch/mvme88k/mvme88k/mem.c index ce3a74820f0..2e5ed3764ca 100644 --- a/sys/arch/mvme88k/mvme88k/mem.c +++ b/sys/arch/mvme88k/mvme88k/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.7 2001/01/31 22:39:42 jason Exp $ */ +/* $OpenBSD: mem.c,v 1.8 2001/05/05 20:56:47 art Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -164,9 +164,9 @@ mmrw(dev, uio, flags) if (uio->uio_rw == UIO_READ) { if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + bzero(zeropage, PAGE_SIZE); } c = min(c, NBPG - (int)v); v = (vm_offset_t)zeropage; @@ -193,10 +193,10 @@ mmrw(dev, uio, flags) } if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/arch/mvme88k/mvme88k/trap.c b/sys/arch/mvme88k/mvme88k/trap.c index 9ab88061096..cc53b35e162 100644 --- a/sys/arch/mvme88k/mvme88k/trap.c +++ b/sys/arch/mvme88k/mvme88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.15 2001/03/12 23:00:40 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.16 2001/05/05 20:56:47 art Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -517,7 +517,7 @@ outtahere: if ((caddr_t)va >= vm->vm_maxsaddr) { if (result == KERN_SUCCESS) { - nss = clrnd(btoc(USRSTACK - va));/* XXX check this */ + nss = btoc(USRSTACK - va);/* XXX check this */ if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (result == KERN_PROTECTION_FAILURE) @@ -1082,7 +1082,7 @@ trap2(unsigned type, struct m88100_saved_state *frame) if ((caddr_t)va >= vm->vm_maxsaddr) { if (result == KERN_SUCCESS) { - nss = clrnd(btoc(USRSTACK - va));/* XXX check this */ + nss = btoc(USRSTACK - va);/* XXX check this */ if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (result == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/mvme88k/mvme88k/vm_machdep.c b/sys/arch/mvme88k/mvme88k/vm_machdep.c index 85d3d9e6128..e89a67773d9 100644 --- a/sys/arch/mvme88k/mvme88k/vm_machdep.c +++ b/sys/arch/mvme88k/mvme88k/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.21 2001/04/29 19:00:03 miod Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.22 2001/05/05 20:56:47 art Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. @@ -508,7 +508,7 @@ pagemove(caddr_t from, caddr_t to, size_t size) register vm_offset_t pa; #ifdef DEBUG - if (size & CLOFSET) + if ((size & PAGE_MASK) != 0) panic("pagemove"); #endif while (size > 0) { diff --git a/sys/arch/pmax/include/mips_param.h b/sys/arch/pmax/include/mips_param.h index 7c89ca5acc2..90cf8159203 100644 --- a/sys/arch/pmax/include/mips_param.h +++ b/sys/arch/pmax/include/mips_param.h @@ -22,10 +22,10 @@ #define SEGSHIFT 22 /* LOG2(NBSEG) */ /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (6*1024*1024/CLBYTES) +#define NKMEMCLUSTERS (6*1024*1024/PAGE_SIZE) #endif /* pages ("clicks") (4096 bytes) to disk blocks */ diff --git a/sys/arch/pmax/include/param.h b/sys/arch/pmax/include/param.h index 810769255c2..b98847c8b33 100644 --- a/sys/arch/pmax/include/param.h +++ b/sys/arch/pmax/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.10 2000/12/28 22:21:46 miod Exp $ */ +/* $OpenBSD: param.h,v 1.11 2001/05/05 20:56:48 art Exp $ */ /* $NetBSD: param.h,v 1.18 1997/02/26 01:45:41 jonathan Exp $ */ /* @@ -68,10 +68,6 @@ #define BLKDEV_IOSIZE 2048 #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#define CLSIZE 1 -#define CLSIZELOG2 0 - -/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ diff --git a/sys/arch/pmax/include/vmparam.h b/sys/arch/pmax/include/vmparam.h index 1e7cc3c2dd3..dfe1cbcfc09 100644 --- a/sys/arch/pmax/include/vmparam.h +++ b/sys/arch/pmax/include/vmparam.h @@ -111,18 +111,6 @@ #endif /* - * Boundary at which to place first MAPMEM segment if not explicitly - * specified. Should be a power of two. This allows some slop for - * the data segment to grow underneath the first mapped segment. - */ -#define MMSEG 0x200000 - -/* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* * The time for a process to be blocked before being very swappable. * This is a number of seconds which the system takes as being a non-trivial * amount of real time. You probably shouldn't change this; @@ -138,86 +126,10 @@ * by the page replacement algorithm. Basically this says that if you are * swapped in you deserve some resources. We protect the last SAFERSS * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES+CLSIZE pages which are not - * paged anyways (this is currently 8+2=10 pages or 5k bytes), so this - * number just means a swapped in process is given around 25k bytes. - * Just for fun: current memory prices are 4600$ a megabyte on VAX (4/22/81), - * so we loan each swapped in process memory worth 100$, or just admit - * that we don't consider it worthwhile and swap it out to disk which costs - * $30/mb or about $0.75. */ #define SAFERSS 4 /* nominal ``small'' resident set size protected against replacement */ -/* - * DISKRPM is used to estimate the number of paging i/o operations - * which one can expect from a single disk controller. - */ -#define DISKRPM 60 - -/* - * Klustering constants. Klustering is the gathering - * of pages together for pagein/pageout, while clustering - * is the treatment of hardware page size as though it were - * larger than it really is. - * - * KLMAX gives maximum cluster size in CLSIZE page (cluster-page) - * units. Note that ctod(KLMAX*CLSIZE) must be <= DMMIN in dmap.h. - * ctob(KLMAX) should also be less than MAXPHYS (in vm_swp.c) - * unless you like "big push" panics. - */ - -#ifdef notdef /* XXX */ -#define KLMAX (4/CLSIZE) -#define KLSEQL (2/CLSIZE) /* in klust if vadvise(VA_SEQL) */ -#define KLIN (4/CLSIZE) /* default data/stack in klust */ -#define KLTXT (4/CLSIZE) /* default text in klust */ -#define KLOUT (4/CLSIZE) -#else -#define KLMAX (1/CLSIZE) -#define KLSEQL (1/CLSIZE) -#define KLIN (1/CLSIZE) -#define KLTXT (1/CLSIZE) -#define KLOUT (1/CLSIZE) -#endif - -/* - * KLSDIST is the advance or retard of the fifo reclaim for sequential - * processes data space. - */ -#define KLSDIST 3 /* klusters advance/retard for seq. fifo */ - -/* - * Paging thresholds (see vm_sched.c). - * Strategy of 1/19/85: - * lotsfree is 512k bytes, but at most 1/4 of memory - * desfree is 200k bytes, but at most 1/8 of memory - */ -#define LOTSFREE (512 * 1024) -#define LOTSFREEFRACT 4 -#define DESFREE (200 * 1024) -#define DESFREEFRACT 8 - -/* - * There are two clock hands, initially separated by HANDSPREAD bytes - * (but at most all of user memory). The amount of time to reclaim - * a page once the pageout process examines it increases with this - * distance and decreases as the scan rate rises. - */ -#define HANDSPREAD (2 * 1024 * 1024) - -/* - * The number of times per second to recompute the desired paging rate - * and poke the pagedaemon. - */ -#define RATETOSCHEDPAGING 4 - -/* - * Believed threshold (in megabytes) for which interleaved - * swapping area is desirable. - */ -#define LOTSOFMEM 2 - #define mapin(pte, v, pfnum, prot) \ (*(int *)(pte) = ((pfnum) << PG_SHIFT) | (prot), MachTLBFlushAddr(v)) @@ -234,8 +146,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) /* pcb base */ #define pcbb(p) ((u_int)(p)->p_addr) diff --git a/sys/arch/pmax/pmax/machdep.c b/sys/arch/pmax/pmax/machdep.c index 0177cba9783..aba014f8295 100644 --- a/sys/arch/pmax/pmax/machdep.c +++ b/sys/arch/pmax/pmax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.26 2000/11/08 14:38:23 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.27 2001/05/05 20:56:49 art Exp $ */ /* $NetBSD: machdep.c,v 1.67 1996/10/23 20:04:40 mhitch Exp $ */ /* @@ -734,10 +734,10 @@ mach_init(argc, argv, code, cv) */ if (bufpages == 0) { if (physmem < btoc(2 * 1024 * 1024)) - bufpages = physmem / (10 * CLSIZE); + bufpages = physmem / 10; else bufpages = (btoc(2 * 1024 * 1024) + physmem) * - BUFCACHEPERCENT / (100 * CLSIZE); + BUFCACHEPERCENT / 100; } if (nbuf == 0) { nbuf = bufpages; @@ -752,8 +752,8 @@ mach_init(argc, argv, code, cv) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ @@ -821,9 +821,9 @@ cpu_startup() panic("startup: cannot allocate buffers"); base = bufpages / nbuf; residual = bufpages % nbuf; - if (base >= MAXBSIZE / CLBYTES) { + if (base >= MAXBSIZE / PAGE_SIZE) { /* don't want to alloc more physical mem than needed */ - base = MAXBSIZE / CLBYTES; + base = MAXBSIZE / PAGE_SIZE; residual = 0; } @@ -839,7 +839,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); } @@ -859,9 +859,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, FALSE); /* @@ -874,7 +874,7 @@ cpu_startup() #endif printf("avail mem = %d\n", ptoa(cnt.v_free_count)); printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); /* * Set up buffers, so they can be used to read disk labels. @@ -1188,11 +1188,11 @@ dumpconf() dumplo = nblks - btodb(ctob(physmem)); } /* - * Don't dump on the first CLBYTES (why CLBYTES?) + * Don't dump on the first block * in case the dump device includes a disk label. */ - if (dumplo < btodb(CLBYTES)) - dumplo = btodb(CLBYTES); + if (dumplo < btodb(PAGE_SIZE)) + dumplo = btodb(PAGE_SIZE); } /* diff --git a/sys/arch/pmax/pmax/mem.c b/sys/arch/pmax/pmax/mem.c index 9bcf627a429..f7dca1a5295 100644 --- a/sys/arch/pmax/pmax/mem.c +++ b/sys/arch/pmax/pmax/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.10 2001/01/31 22:39:43 jason Exp $ */ +/* $OpenBSD: mem.c,v 1.11 2001/05/05 20:56:49 art Exp $ */ /* $NetBSD: mem.c,v 1.7 1995/09/29 21:53:29 jonathan Exp $ */ /* @@ -154,10 +154,10 @@ mmrw(dev, uio, flags) } if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/arch/pmax/pmax/trap.c b/sys/arch/pmax/pmax/trap.c index 1a5cba2b292..8e64b1b87a2 100644 --- a/sys/arch/pmax/pmax/trap.c +++ b/sys/arch/pmax/pmax/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.23 2001/04/03 20:25:35 art Exp $ */ +/* $OpenBSD: trap.c,v 1.24 2001/05/05 20:56:49 art Exp $ */ /* $NetBSD: trap.c,v 1.50 1996/10/13 21:37:49 jonathan Exp $ */ /* @@ -574,7 +574,7 @@ trap(statusReg, causeReg, vadr, pc, args) if (rv == KERN_SUCCESS) { unsigned nss; - nss = clrnd(btoc(USRSTACK-(unsigned)va)); + nss = btoc(USRSTACK-(unsigned)va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/pmax/pmax/vm_machdep.c b/sys/arch/pmax/pmax/vm_machdep.c index fc80ee5f7bc..dfc7b97508e 100644 --- a/sys/arch/pmax/pmax/vm_machdep.c +++ b/sys/arch/pmax/pmax/vm_machdep.c @@ -254,8 +254,10 @@ pagemove(from, to, size) { register pt_entry_t *fpte, *tpte; - if (size % CLBYTES) +#ifdef DIAGNOSTIC + if ((size & PAGE_MASK) != 0) panic("pagemove"); +#endif fpte = kvtopte(from); tpte = kvtopte(to); while (size > 0) { diff --git a/sys/arch/powerpc/include/param.h b/sys/arch/powerpc/include/param.h index 64e7b766bc1..6632d9fd25d 100644 --- a/sys/arch/powerpc/include/param.h +++ b/sys/arch/powerpc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.13 2001/02/07 06:03:53 drahn Exp $ */ +/* $OpenBSD: param.h,v 1.14 2001/05/05 20:56:50 art Exp $ */ /* $NetBSD: param.h,v 1.1 1996/09/30 16:34:28 ws Exp $ */ /*- @@ -63,9 +63,6 @@ #define BLKDEV_IOSIZE NBPG #define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#define CLSIZELOG2 0 -#define CLSIZE (1 << CLSIZELOG2) - #define UPAGES 4 #define USPACE (UPAGES * NBPG) @@ -73,7 +70,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -94,10 +91,10 @@ #define MSGBUFSIZE (NBPG*2) /* - * Size of kernel malloc arena in CLBYTES-sized logical pages. + * Size of kernel malloc arena in logical pages. */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (16 * 1024 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (16 * 1024 * 1024 / PAGE_SIZE) #endif /* diff --git a/sys/arch/powerpc/include/vmparam.h b/sys/arch/powerpc/include/vmparam.h index e5799f5021d..94bf42327b0 100644 --- a/sys/arch/powerpc/include/vmparam.h +++ b/sys/arch/powerpc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.8 2001/03/29 18:52:19 drahn Exp $ */ +/* $OpenBSD: vmparam.h,v 1.9 2001/05/05 20:56:50 art Exp $ */ /* $NetBSD: vmparam.h,v 1.1 1996/09/30 16:34:38 ws Exp $ */ /*- @@ -35,7 +35,7 @@ #ifndef MACHINE_VMPARAM_H #define MACHINE_VMPARAM_H -#define USRTEXT CLBYTES +#define USRTEXT PAGE_SIZE #define USRSTACK VM_MAXUSER_ADDRESS #ifndef MAXTSIZ @@ -106,9 +106,9 @@ extern vm_offset_t ppc_kvm_size; #define MACHINE_NEW_NONCONTIG /* VM <=> pmap interface modifier */ -#define VM_KMEM_SIZE (NKMEMCLUSTERS * CLBYTES) -#define VM_MBUF_SIZE (NMBCLUSTERS * CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE * CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS * PAGE_SIZE) +#define VM_MBUF_SIZE (NMBCLUSTERS * PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE * PAGE_SIZE) struct pmap_physseg { struct pv_entry *pvent; diff --git a/sys/arch/powerpc/powerpc/machdep.c b/sys/arch/powerpc/powerpc/machdep.c index 7117f62406e..d7441484a2f 100644 --- a/sys/arch/powerpc/powerpc/machdep.c +++ b/sys/arch/powerpc/powerpc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.57 2001/05/02 06:02:45 drahn Exp $ */ +/* $OpenBSD: machdep.c,v 1.58 2001/05/05 20:56:51 art Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -506,7 +506,7 @@ cpu_startup() struct vm_page *pg; curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base + 1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base + 1 : base); #ifdef UVM while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); @@ -552,9 +552,9 @@ cpu_startup() /* * Allocate mbuf pool. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS + CLBYTES/MCLBYTES, M_MBUF, + mclrefcnt = (char *)malloc(NMBCLUSTERS + PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS + CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS + PAGE_SIZE/MCLBYTES); #ifdef UVM mb_map = uvm_km_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, FALSE, FALSE, NULL); @@ -574,7 +574,7 @@ cpu_startup() printf("avail mem = %d\n", ptoa(cnt.v_free_count)); #endif printf("using %d buffers containing %d bytes of memory\n", nbuf, - bufpages * CLBYTES); + bufpages * PAGE_SIZE); /* @@ -623,7 +623,7 @@ allocsys(v) * Decide on buffer space to use. */ if (bufpages == 0) - bufpages = physmem * BUFCACHEPERCENT / (100 * CLSIZE); + bufpages = physmem * BUFCACHEPERCENT / 100; if (nbuf == 0) { nbuf = bufpages; if (nbuf < 16) @@ -636,8 +636,8 @@ allocsys(v) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) & ~1; diff --git a/sys/arch/powerpc/powerpc/mem.c b/sys/arch/powerpc/powerpc/mem.c index a443c06f9a5..bff71b64091 100644 --- a/sys/arch/powerpc/powerpc/mem.c +++ b/sys/arch/powerpc/powerpc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.6 2001/01/31 22:39:43 jason Exp $ */ +/* $OpenBSD: mem.c,v 1.7 2001/05/05 20:56:51 art Exp $ */ /* $NetBSD: mem.c,v 1.1 1996/09/30 16:34:50 ws Exp $ */ /* @@ -135,10 +135,10 @@ mmrw(dev, uio, flags) break; } if (zeropage == NULL) { - zeropage = (caddr_t)malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + zeropage = (caddr_t)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h index f0f3ff99afa..f7ef8e11e70 100644 --- a/sys/arch/sparc/include/param.h +++ b/sys/arch/sparc/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.16 2001/01/15 23:23:58 jason Exp $ */ +/* $OpenBSD: param.h,v 1.17 2001/05/05 20:56:52 art Exp $ */ /* $NetBSD: param.h,v 1.29 1997/03/10 22:50:37 pk Exp $ */ /* @@ -101,16 +101,12 @@ extern int nbpg, pgofset, pgshift; #define BLKDEV_IOSIZE 2048 #define MAXPHYS (64 * 1024) -#define CLSIZE 1 -#define CLSIZELOG2 0 - -/* NOTE: SSIZE must be multiple of CLSIZE */ #define SSIZE 1 /* initial stack size in pages */ #define USPACE 8192 /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -131,10 +127,10 @@ extern int nbpg, pgofset, pgshift; #define MSGBUFSIZE 4096 /* cannot be changed without great pain */ /* - * Size of kernel malloc arena in CLBYTES-sized logical pages. + * Size of kernel malloc arena in logical pages. */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (6 * 1024 * 1024 / CLBYTES) +#define NKMEMCLUSTERS (6 * 1024 * 1024 / PAGE_SIZE) #endif /* pages ("clicks") to disk blocks */ diff --git a/sys/arch/sparc/include/vmparam.h b/sys/arch/sparc/include/vmparam.h index 02eb31cb076..1f80f122a19 100644 --- a/sys/arch/sparc/include/vmparam.h +++ b/sys/arch/sparc/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.15 2001/01/15 23:23:58 jason Exp $ */ +/* $OpenBSD: vmparam.h,v 1.16 2001/05/05 20:56:52 art Exp $ */ /* $NetBSD: vmparam.h,v 1.13 1997/07/12 16:20:03 perry Exp $ */ /* @@ -144,7 +144,7 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) #define MACHINE_NEW_NONCONTIG diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index 66dfc239bbe..6b68142e839 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.53 2001/04/30 16:42:26 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.54 2001/05/05 20:56:52 art Exp $ */ /* $NetBSD: machdep.c,v 1.85 1997/09/12 08:55:02 pk Exp $ */ /* @@ -247,7 +247,7 @@ cpu_startup() * "base" pages for the rest. */ curbuf = (vaddr_t) buffers + (i * MAXBSIZE); - curbufsize = CLBYTES * ((i < residual) ? (base+1) : base); + curbufsize = PAGE_SIZE * ((i < residual) ? (base+1) : base); while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); @@ -291,7 +291,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vaddr_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); } @@ -343,9 +343,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); #if defined(UVM) mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); @@ -367,7 +367,7 @@ cpu_startup() printf("avail mem = %ld\n", ptoa(cnt.v_free_count)); #endif printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); /* * Set up buffers, so they can be used to read disk labels. @@ -422,7 +422,7 @@ allocsys(v) * Allocate 1/2 as many swap buffer headers as file i/o buffers. */ if (bufpages == 0) - bufpages = physmem * BUFCACHEPERCENT / (100 * CLSIZE); + bufpages = physmem * BUFCACHEPERCENT / 100; if (nbuf == 0) { nbuf = bufpages; if (nbuf < 16) @@ -437,8 +437,8 @@ allocsys(v) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ diff --git a/sys/arch/sparc/sparc/mem.c b/sys/arch/sparc/sparc/mem.c index fedee0ef622..3dba040dc06 100644 --- a/sys/arch/sparc/sparc/mem.c +++ b/sys/arch/sparc/sparc/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.13 2001/01/31 16:11:34 art Exp $ */ +/* $OpenBSD: mem.c,v 1.14 2001/05/05 20:56:53 art Exp $ */ /* $NetBSD: mem.c,v 1.13 1996/03/30 21:12:16 christos Exp $ */ /* @@ -209,10 +209,10 @@ mmrw(dev, uio, flags) } if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c index 4e0dadc677f..8ddbafa01e9 100644 --- a/sys/arch/sparc/sparc/trap.c +++ b/sys/arch/sparc/sparc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.27 2001/04/06 04:42:06 csapuntz Exp $ */ +/* $OpenBSD: trap.c,v 1.28 2001/05/05 20:56:53 art Exp $ */ /* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */ /* @@ -756,7 +756,7 @@ mem_access_fault(type, ser, v, pc, psr, tf) */ if ((caddr_t)va >= vm->vm_maxsaddr) { if (rv == KERN_SUCCESS) { - unsigned nss = clrnd(btoc(USRSTACK - va)); + unsigned nss = btoc(USRSTACK - va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) @@ -997,7 +997,7 @@ mem_access_fault4m(type, sfsr, sfva, tf) */ if ((caddr_t)va >= vm->vm_maxsaddr) { if (rv == KERN_SUCCESS) { - unsigned nss = clrnd(btoc(USRSTACK - va)); + unsigned nss = btoc(USRSTACK - va); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index e8946bb25c8..19c508e4e47 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.22 2001/01/15 23:23:58 jason Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.23 2001/05/05 20:56:53 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.30 1997/03/10 23:55:40 pk Exp $ */ /* @@ -81,8 +81,12 @@ pagemove(from, to, size) { register paddr_t pa; - if (size & CLOFSET || (int)from & CLOFSET || (int)to & CLOFSET) +#ifdef DEBUG + if ((size & PAGE_MASK) != 0 || + ((vaddr_t)from & PAGE_MASK) != 0 || + ((vaddr_t)to & PAGE_MASK) != 0) panic("pagemove 1"); +#endif while (size > 0) { pa = pmap_extract(pmap_kernel(), (vaddr_t)from); if (pa == 0) diff --git a/sys/arch/sun3/include/param.h b/sys/arch/sun3/include/param.h index ee0ccee1dbc..58d4a5b9749 100644 --- a/sys/arch/sun3/include/param.h +++ b/sys/arch/sun3/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.21 2000/07/14 14:24:54 miod Exp $ */ +/* $OpenBSD: param.h,v 1.22 2001/05/05 20:56:53 art Exp $ */ /* $NetBSD: param.h,v 1.34 1996/03/04 05:04:40 cgd Exp $ */ /* @@ -73,7 +73,7 @@ /* * Constants related to network buffer management. - * MCLBYTES must be no larger than CLBYTES (the software page size), and, + * MCLBYTES must be no larger than the software page size, and, * on machines that exchange pages of input or output buffers with mbuf * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple * of the hardware page size. @@ -93,10 +93,10 @@ #define MSGBUFSIZE (NBPG >> 1) /* - * Size of kernel malloc arena in CLBYTES-sized logical pages + * Size of kernel malloc arena in logical pages */ #ifndef NKMEMCLUSTERS -#define NKMEMCLUSTERS (2048*1024/CLBYTES) +#define NKMEMCLUSTERS (2048*1024/PAGE_SIZE) #endif /* diff --git a/sys/arch/sun3/include/vmparam.h b/sys/arch/sun3/include/vmparam.h index 7d64990874b..6227eeb6ef3 100644 --- a/sys/arch/sun3/include/vmparam.h +++ b/sys/arch/sun3/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.4 2000/04/30 15:28:50 miod Exp $ */ +/* $OpenBSD: vmparam.h,v 1.5 2001/05/05 20:56:54 art Exp $ */ /* $NetBSD: vmparam.h,v 1.14 1995/09/26 04:02:10 gwr Exp $ */ /* @@ -161,8 +161,8 @@ /* virtual sizes (bytes) for various kernel submaps */ #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) #define MACHINE_NEW_NONCONTIG diff --git a/sys/arch/sun3/sun3/machdep.c b/sys/arch/sun3/sun3/machdep.c index 800e598df4e..df8b8cf0433 100644 --- a/sys/arch/sun3/sun3/machdep.c +++ b/sys/arch/sun3/sun3/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.28 2000/10/27 00:16:20 mickey Exp $ */ +/* $OpenBSD: machdep.c,v 1.29 2001/05/05 20:56:54 art Exp $ */ /* $NetBSD: machdep.c,v 1.77 1996/10/13 03:47:51 christos Exp $ */ /* @@ -219,7 +219,7 @@ allocsys(v) if (bufpages == 0) { /* We always have more than 2MB of memory. */ bufpages = (btoc(2 * 1024 * 1024) + physmem) * - BUFCACHEPERCENT / (100 * CLSIZE); + BUFCACHEPERCENT / 100; } if (nbuf == 0) { nbuf = bufpages; @@ -233,8 +233,8 @@ allocsys(v) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; if (nswbuf == 0) { nswbuf = (nbuf / 2) &~ 1; /* force even */ if (nswbuf > 256) @@ -316,7 +316,7 @@ cpu_startup() * but has no physical memory allocated for it. */ curbuf = (vm_offset_t)buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base+1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base+1 : base); vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE); vm_map_simplify(buffer_map, curbuf); } @@ -339,9 +339,9 @@ cpu_startup() * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. */ - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, FALSE); @@ -352,7 +352,7 @@ cpu_startup() printf("avail mem = %ld\n", ptoa(cnt.v_free_count)); printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + nbuf, bufpages * PAGE_SIZE); /* * Allocate a virtual page (for use by /dev/mem) @@ -646,7 +646,7 @@ vm_offset_t dumppage_pa; /* * This is called by cpu_startup to set dumplo, dumpsize. - * Dumps always skip the first CLBYTES of disk space + * Dumps always skip the first block of disk space * in case there might be a disk label stored there. * If there is extra space, put dump at the end to * reduce the chance that swapping trashes it. diff --git a/sys/arch/sun3/sun3/mem.c b/sys/arch/sun3/sun3/mem.c index 8f4b28f4f09..0d7cf24bd9f 100644 --- a/sys/arch/sun3/sun3/mem.c +++ b/sys/arch/sun3/sun3/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.9 2000/03/02 23:02:14 todd Exp $ */ +/* $OpenBSD: mem.c,v 1.10 2001/05/05 20:56:54 art Exp $ */ /* $NetBSD: mem.c,v 1.19 1995/08/08 21:09:01 gwr Exp $ */ /* @@ -228,10 +228,10 @@ mmrw(dev, uio, flags) */ if (devzeropage == NULL) { devzeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(devzeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(devzeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(devzeropage, c, uio); continue; diff --git a/sys/arch/sun3/sun3/trap.c b/sys/arch/sun3/sun3/trap.c index 27aec29f066..c9657f5790a 100644 --- a/sys/arch/sun3/sun3/trap.c +++ b/sys/arch/sun3/sun3/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.22 2000/11/10 18:15:43 art Exp $ */ +/* $OpenBSD: trap.c,v 1.23 2001/05/05 20:56:55 art Exp $ */ /* $NetBSD: trap.c,v 1.63-1.65ish 1997/01/16 15:41:40 gwr Exp $ */ /* @@ -555,7 +555,7 @@ trap(type, code, v, frame) if (rv == KERN_SUCCESS) { unsigned nss; - nss = clrnd(btoc((u_int)(USRSTACK-va))); + nss = btoc((u_int)(USRSTACK-va)); if (nss > vm->vm_ssize) vm->vm_ssize = nss; } else if (rv == KERN_PROTECTION_FAILURE) diff --git a/sys/arch/sun3/sun3/vm_machdep.c b/sys/arch/sun3/sun3/vm_machdep.c index 2bb2a4ff86d..10a525395d2 100644 --- a/sys/arch/sun3/sun3/vm_machdep.c +++ b/sys/arch/sun3/sun3/vm_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_machdep.c,v 1.13 2000/06/08 22:25:23 niklas Exp $ */ +/* $OpenBSD: vm_machdep.c,v 1.14 2001/05/05 20:56:55 art Exp $ */ /* $NetBSD: vm_machdep.c,v 1.35 1996/04/26 18:38:06 gwr Exp $ */ /* @@ -292,7 +292,9 @@ pagemove(from, to, size) register vm_offset_t pa; #ifdef DIAGNOSTIC - if (size & CLOFSET || (int)from & CLOFSET || (int)to & CLOFSET) + if ((size & PAGE_MASK) != 0 || + ((vaddr_t)from & PAGE_MASK) != 0 || + ((vaddr_t)to & PAGE_MASK) != 0) panic("pagemove 1"); #endif while (size > 0) { diff --git a/sys/arch/vax/if/if_uba.c b/sys/arch/vax/if/if_uba.c index 34175ed4c18..fe3d5bbaa7f 100644 --- a/sys/arch/vax/if/if_uba.c +++ b/sys/arch/vax/if/if_uba.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_uba.c,v 1.6 2000/04/27 03:14:43 bjc Exp $ */ +/* $OpenBSD: if_uba.c,v 1.7 2001/05/05 20:56:55 art Exp $ */ /* $NetBSD: if_uba.c,v 1.15 1999/01/01 21:43:18 ragge Exp $ */ /* @@ -228,7 +228,7 @@ if_ubaget(ifu, ifr, totlen, ifp) } len = min(len, MCLBYTES); m->m_len = len; - if (!claligned(cp)){ + if (((vaddr_t)cp & PAGE_MASK) != 0) { goto copy; } /* @@ -347,7 +347,8 @@ if_ubaput(ifu, ifw, m) cp = ifw->ifw_addr; while (m) { dp = mtod(m, char *); - if (claligned(cp) && claligned(dp) && + if (((vaddr_t)cp & PAGE_MASK) == 0 && + ((vaddr_t)dp & PAGE_MASK) == 0 && (m->m_len == MCLBYTES || m->m_next == (struct mbuf *)0)) { struct pte *pte; int *ip; diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h index 22e892c434c..3762edc6f21 100644 --- a/sys/arch/vax/include/param.h +++ b/sys/arch/vax/include/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.13 2000/10/09 22:55:35 bjc Exp $ */ +/* $OpenBSD: param.h,v 1.14 2001/05/05 20:56:56 art Exp $ */ /* $NetBSD: param.h,v 1.39 1999/10/22 21:14:34 ragge Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -85,9 +85,6 @@ #define MAXPHYS (63 * 1024) /* max raw I/O transfer size */ #define MAXBSIZE 0x4000 /* max FS block size - XXX */ -#define CLSIZELOG2 0 -#define CLSIZE 1 - #define UPAGES 2 /* pages of u-area */ #define USPACE (NBPG*UPAGES) #define REDZONEADDR (VAX_NBPG*3) /* Must be > sizeof(struct user) */ diff --git a/sys/arch/vax/include/vmparam.h b/sys/arch/vax/include/vmparam.h index a2080cb6f9b..52d54a8ea83 100644 --- a/sys/arch/vax/include/vmparam.h +++ b/sys/arch/vax/include/vmparam.h @@ -1,4 +1,4 @@ -/* $OpenBSD: vmparam.h,v 1.10 2000/10/09 23:04:15 bjc Exp $ */ +/* $OpenBSD: vmparam.h,v 1.11 2001/05/05 20:56:56 art Exp $ */ /* $NetBSD: vmparam.h,v 1.32 2000/03/07 00:05:59 matt Exp $ */ /*- @@ -155,7 +155,7 @@ struct pmap_physseg { #define VM_PHYS_SIZE (USRIOSIZE*VAX_NBPG) /* virtual sizes (bytes) for various kernel submaps */ -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) +#define VM_KMEM_SIZE (NKMEMCLUSTERS*PAGE_SIZE) #define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) diff --git a/sys/arch/vax/vax/machdep.c b/sys/arch/vax/vax/machdep.c index 3013e64359f..f6befecaed8 100644 --- a/sys/arch/vax/vax/machdep.c +++ b/sys/arch/vax/vax/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.29 2001/02/11 12:59:40 bjc Exp $ */ +/* $OpenBSD: machdep.c,v 1.30 2001/05/05 20:56:56 art Exp $ */ /* $NetBSD: machdep.c,v 1.108 2000/09/13 15:00:23 thorpej Exp $ */ /* @@ -239,7 +239,7 @@ cpu_startup() * physical memory allocated for it. */ curbuf = (vm_offset_t) buffers + i * MAXBSIZE; - curbufsize = CLBYTES * (i < residual ? base + 1 : base); + curbufsize = PAGE_SIZE * (i < residual ? base + 1 : base); while (curbufsize) { pg = uvm_pagealloc(NULL, 0, NULL, 0); if (pg == NULL) @@ -267,16 +267,16 @@ cpu_startup() phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr, VM_PHYS_SIZE, 0, FALSE, NULL); - mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES, + mclrefcnt = (char *)malloc(NMBCLUSTERS+PAGE_SIZE/MCLBYTES, M_MBUF, M_NOWAIT); - bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES); + bzero(mclrefcnt, NMBCLUSTERS+PAGE_SIZE/MCLBYTES); mb_map = uvm_km_suballoc(kernel_map, (vaddr_t *)&mbutl, &maxaddr, VM_MBUF_SIZE, VM_MAP_INTRSAFE, FALSE, NULL); timeout_init(); printf("avail memory = %ld\n", ptoa(uvmexp.free)); - printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * CLBYTES); + printf("using %d buffers containing %d bytes of memory\n", nbuf, bufpages * PAGE_SIZE); /* * Set up buffers, so they can be used to read disk labels. @@ -306,11 +306,11 @@ cpu_dumpconf() dumplo = nblks - btodb(ctob(dumpsize)); } /* - * Don't dump on the first CLBYTES (why CLBYTES?) in case the dump + * Don't dump on the first block in case the dump * device includes a disk label. */ - if (dumplo < btodb(CLBYTES)) - dumplo = btodb(CLBYTES); + if (dumplo < btodb(PAGE_SIZE)) + dumplo = btodb(PAGE_SIZE); } int @@ -791,10 +791,10 @@ allocsys(v) */ if (bufpages == 0) { if (physmem < btoc(2 * 1024 * 1024)) - bufpages = physmem / (10 * CLSIZE); + bufpages = physmem / 10; else bufpages = (btoc(2 * 1024 * 1024) + physmem) * - BUFCACHEPERCENT / (100 * CLSIZE); + BUFCACHEPERCENT / 100; } if (nbuf == 0) nbuf = bufpages < 16 ? 16 : bufpages; @@ -806,8 +806,8 @@ allocsys(v) MAXBSIZE * 7 / 10; /* More buffer pages than fits into the buffers is senseless. */ - if (bufpages > nbuf * MAXBSIZE / CLBYTES) - bufpages = nbuf * MAXBSIZE / CLBYTES; + if (bufpages > nbuf * MAXBSIZE / PAGE_SIZE) + bufpages = nbuf * MAXBSIZE / PAGE_SIZE; /* Allocate 1/2 as many swap buffer headers as file i/o buffers. */ if (nswbuf == 0) { diff --git a/sys/arch/vax/vax/mem.c b/sys/arch/vax/vax/mem.c index 028ee19e024..f381ab3dbe8 100644 --- a/sys/arch/vax/vax/mem.c +++ b/sys/arch/vax/vax/mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mem.c,v 1.7 2000/04/27 01:10:13 bjc Exp $ */ +/* $OpenBSD: mem.c,v 1.8 2001/05/05 20:56:57 art Exp $ */ /* $NetBSD: mem.c,v 1.15 1999/03/24 05:51:17 mrg Exp $ */ /* @@ -152,10 +152,10 @@ mmrw(dev, uio, flags) } if (zeropage == NULL) { zeropage = (caddr_t) - malloc(CLBYTES, M_TEMP, M_WAITOK); - bzero(zeropage, CLBYTES); + malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + bzero(zeropage, PAGE_SIZE); } - c = min(iov->iov_len, CLBYTES); + c = min(iov->iov_len, PAGE_SIZE); error = uiomove(zeropage, c, uio); continue; diff --git a/sys/conf/param.c b/sys/conf/param.c index 0e5a9638600..2cb893efcb2 100644 --- a/sys/conf/param.c +++ b/sys/conf/param.c @@ -1,4 +1,4 @@ -/* $OpenBSD: param.c,v 1.10 2000/03/27 13:56:10 mickey Exp $ */ +/* $OpenBSD: param.c,v 1.11 2001/05/05 20:56:57 art Exp $ */ /* $NetBSD: param.c,v 1.16 1996/03/12 03:08:40 mrg Exp $ */ /* @@ -113,7 +113,7 @@ int fscale = FSCALE; /* kernel uses `FSCALE', user uses `fscale' */ #define SHMMIN 1 #define SHMMNI 32 /* <= SHMMMNI in shm.h */ #define SHMSEG 8 -#define SHMALL (SHMMAXPGS/CLSIZE) +#define SHMALL (SHMMAXPGS) struct shminfo shminfo = { SHMMAX, diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c index f978f516e59..78069096bd8 100644 --- a/sys/dev/ccd.c +++ b/sys/dev/ccd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ccd.c,v 1.41 1999/11/26 16:46:17 art Exp $ */ +/* $OpenBSD: ccd.c,v 1.42 2001/05/05 20:56:58 art Exp $ */ /* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */ /*- @@ -222,7 +222,7 @@ getccdbuf() cbp = malloc(sizeof (struct ccdbuf), M_DEVBUF, M_WAITOK); bzero(cbp, sizeof (struct ccdbuf)); - cbp->cb_sg = malloc(sizeof (struct ccdseg) * MAXBSIZE / CLBYTES, + cbp->cb_sg = malloc(sizeof (struct ccdseg) * MAXBSIZE >> PAGE_SHIFT, M_DEVBUF, M_WAITOK); return (cbp); } @@ -777,14 +777,14 @@ ccdstart(cs, bp) M_WAITOK); bzero(cbpp, 2 * cs->sc_nccdisks * sizeof(struct ccdbuf *)); addr = bp->b_data; - old_io = old_io || ((vaddr_t)addr & CLOFSET); /* XXX !claligned */ + old_io = old_io || ((vaddr_t)addr & PAGE_MASK); for (bcount = bp->b_bcount; bcount > 0; bcount -= rcount) { rcount = ccdbuffer(cs, bp, bn, addr, bcount, cbpp, old_io); /* * This is the old, slower, but less restrictive, mode of * operation. It allows interleaves which are not multiples - * of CLBYTES and mirroring. + * of PAGE_SIZE and mirroring. */ if (old_io) { if ((cbpp[0]->cb_buf.b_flags & B_READ) == 0) @@ -989,9 +989,8 @@ ccdbuffer(cs, bp, bn, addr, bcount, cbpp, old_io) printf("ccdbuffer: sg %d (%p/%x) off %x\n", cbp->cb_sgcnt, addr, bcount, old_bcount); #endif - pagemove(addr, nbp->b_data + old_bcount, - clrnd(round_page(bcount))); - nbp->b_bufsize += clrnd(round_page(bcount)); + pagemove(addr, nbp->b_data + old_bcount, round_page(bcount)); + nbp->b_bufsize += round_page(bcount); cbp->cb_sg[cbp->cb_sgcnt].cs_sgaddr = addr; cbp->cb_sg[cbp->cb_sgcnt].cs_sglen = bcount; cbp->cb_sgcnt++; @@ -1087,7 +1086,7 @@ ccdiodone(vbp) cbp->cb_sg[i].cs_sglen, off); #endif pagemove(vbp->b_data + off, cbp->cb_sg[i].cs_sgaddr, - clrnd(round_page(cbp->cb_sg[i].cs_sglen))); + round_page(cbp->cb_sg[i].cs_sglen)); off += cbp->cb_sg[i].cs_sglen; } @@ -1226,7 +1225,7 @@ ccdioctl(dev, cmd, data, flag, p) * must use the old I/O code (by design), as must mirror * setups (until implemented in the new code). */ - if (ccio->ccio_ileave % (CLBYTES / DEV_BSIZE) != 0 || + if (ccio->ccio_ileave % (PAGE_SIZE / DEV_BSIZE) != 0 || (ccd.ccd_flags & CCDF_MIRROR)) ccd.ccd_flags |= CCDF_OLD; diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index ac8a9d3a131..25a84dd719b 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.44 2001/02/03 06:10:17 mickey Exp $ */ +/* $OpenBSD: if_de.c,v 1.45 2001/05/05 20:56:58 art Exp $ */ /* $NetBSD: if_de.c,v 1.45 1997/06/09 00:34:18 thorpej Exp $ */ /*- @@ -4153,7 +4153,7 @@ tulip_txput( do { int len = m0->m_len; caddr_t addr = mtod(m0, caddr_t); - unsigned clsize = CLBYTES - (((u_long) addr) & (CLBYTES-1)); + unsigned clsize = PAGE_SIZE - (((u_long) addr) & PAGE_MASK); while (len > 0) { unsigned slen = min(len, clsize); @@ -4226,7 +4226,7 @@ tulip_txput( if (partial) continue; #endif - clsize = CLBYTES; + clsize = PAGE_SIZE; } } while ((m0 = m0->m_next) != NULL); diff --git a/sys/dev/pci/if_devar.h b/sys/dev/pci/if_devar.h index 1bc0bd48bfc..09c870ef491 100644 --- a/sys/dev/pci/if_devar.h +++ b/sys/dev/pci/if_devar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_devar.h,v 1.11 2001/02/20 19:39:42 mickey Exp $ */ +/* $OpenBSD: if_devar.h,v 1.12 2001/05/05 20:56:59 art Exp $ */ /* $NetBSD: if_devar.h,v 1.13 1997/06/08 18:46:36 thorpej Exp $ */ /*- @@ -890,7 +890,6 @@ static tulip_softc_t *tulips[TULIP_MAX_DEVICES]; #define tulip_intrfunc_t void #define TULIP_VOID_INTRFUNC #define IFF_NOTRAILERS 0 -#define CLBYTES PAGE_SIZE #if 0 #define TULIP_KVATOPHYS(sc, va) kvtop(va) #endif diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index cc3989f1b76..98dc7e04620 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc.c,v 1.6 2000/04/27 00:32:09 chris Exp $ */ +/* $OpenBSD: if_lmc.c,v 1.7 2001/05/05 20:56:59 art Exp $ */ /* $NetBSD: if_lmc.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -1045,7 +1045,7 @@ lmc_txput(lmc_softc_t * const sc, struct mbuf *m) do { int len = m0->m_len; caddr_t addr = mtod(m0, caddr_t); - unsigned clsize = CLBYTES - (((u_long) addr) & (CLBYTES-1)); + unsigned clsize = PAGE_SIZE - (((u_long) addr) & PAGE_MASK); while (len > 0) { unsigned slen = min(len, clsize); @@ -1110,7 +1110,7 @@ lmc_txput(lmc_softc_t * const sc, struct mbuf *m) if (partial) continue; #endif - clsize = CLBYTES; + clsize = PAGE_SIZE; } } while ((m0 = m0->m_next) != NULL); diff --git a/sys/dev/pci/if_lmcvar.h b/sys/dev/pci/if_lmcvar.h index 3e5fd0b1cb7..ef046d7f3b8 100644 --- a/sys/dev/pci/if_lmcvar.h +++ b/sys/dev/pci/if_lmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmcvar.h,v 1.4 2000/02/06 20:56:02 chris Exp $ */ +/* $OpenBSD: if_lmcvar.h,v 1.5 2001/05/05 20:56:59 art Exp $ */ /* $NetBSD: if_lmcvar.h,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -463,7 +463,6 @@ static lmc_softc_t *tulips[LMC_MAX_DEVICES]; #endif #define LMC_VOID_INTRFUNC #define IFF_NOTRAILERS 0 -#define CLBYTES PAGE_SIZE #define LMC_EADDR_FMT "%6D" #define LMC_EADDR_ARGS(addr) addr, ":" #else diff --git a/sys/kern/kern_lkm.c b/sys/kern/kern_lkm.c index b6cff77961b..dfe83208002 100644 --- a/sys/kern/kern_lkm.c +++ b/sys/kern/kern_lkm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_lkm.c,v 1.28 2001/02/10 10:42:35 niklas Exp $ */ +/* $OpenBSD: kern_lkm.c,v 1.29 2001/05/05 20:57:00 art Exp $ */ /* $NetBSD: kern_lkm.c,v 1.31 1996/03/31 21:40:27 christos Exp $ */ /* @@ -557,7 +557,7 @@ lkmioctl(dev, cmd, data, flag, p) statp->offset = curp->private.lkm_any->lkm_offset; statp->type = curp->private.lkm_any->lkm_type; statp->area = curp->area; - statp->size = curp->size / CLBYTES; + statp->size = curp->size / PAGE_SIZE; statp->private = (unsigned long)curp->private.lkm_any; statp->ver = curp->private.lkm_any->lkm_ver; copyoutstr(curp->private.lkm_any->lkm_name, diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c index baa922fea98..5428e9d7c90 100644 --- a/sys/kern/kern_malloc.c +++ b/sys/kern/kern_malloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_malloc.c,v 1.25 2001/04/06 14:37:50 angelos Exp $ */ +/* $OpenBSD: kern_malloc.c,v 1.26 2001/05/05 20:57:00 art Exp $ */ /* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */ /* @@ -160,10 +160,10 @@ malloc(size, type, flags) if (kbp->kb_next == NULL) { kbp->kb_last = NULL; if (size > MAXALLOCSAVE) - allocsize = clrnd(round_page(size)); + allocsize = round_page(size); else allocsize = 1 << indx; - npg = clrnd(btoc(allocsize)); + npg = btoc(allocsize); #if defined(UVM) va = (caddr_t) uvm_km_kmemalloc(kmem_map, uvmexp.kmem_object, (vsize_t)ctob(npg), @@ -348,8 +348,8 @@ free(addr, type) * Check for returns of data that do not point to the * beginning of the allocation. */ - if (size > PAGE_SIZE * CLSIZE) - alloc = addrmask[BUCKETINDX(PAGE_SIZE * CLSIZE)]; + if (size > PAGE_SIZE) + alloc = addrmask[BUCKETINDX(PAGE_SIZE)]; else alloc = addrmask[kup->ku_indx]; if (((u_long)addr & alloc) != 0) @@ -444,7 +444,7 @@ kmeminit() #if (MAXALLOCSAVE > MINALLOCSIZE * 32768) ERROR!_kmeminit:_MAXALLOCSAVE_too_big #endif -#if (MAXALLOCSAVE < CLBYTES) +#if (MAXALLOCSAVE < PAGE_SIZE) ERROR!_kmeminit:_MAXALLOCSAVE_too_small #endif @@ -468,10 +468,10 @@ kmeminit() #endif #ifdef KMEMSTATS for (indx = 0; indx < MINBUCKET + 16; indx++) { - if (1 << indx >= CLBYTES) + if (1 << indx >= PAGE_SIZE) bucket[indx].kb_elmpercl = 1; else - bucket[indx].kb_elmpercl = CLBYTES / (1 << indx); + bucket[indx].kb_elmpercl = PAGE_SIZE / (1 << indx); bucket[indx].kb_highwat = 5 * bucket[indx].kb_elmpercl; } for (indx = 0; indx < M_LAST; indx++) diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c index 4b558da6266..8ed48c24843 100644 --- a/sys/kern/sysv_shm.c +++ b/sys/kern/sysv_shm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysv_shm.c,v 1.14 1999/11/25 13:41:30 art Exp $ */ +/* $OpenBSD: sysv_shm.c,v 1.15 2001/05/05 20:57:00 art Exp $ */ /* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */ /* @@ -136,7 +136,7 @@ shm_deallocate_segment(shmseg) size_t size; shm_handle = shmseg->shm_internal; - size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; + size = round_page(shmseg->shm_segsz); #ifdef UVM uao_detach(shm_handle->shm_object); #else @@ -160,7 +160,7 @@ shm_delete_mapping(vm, shmmap_s) segnum = IPCID_TO_IX(shmmap_s->shmid); shmseg = &shmsegs[segnum]; - size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; + size = round_page(shmseg->shm_segsz); #ifdef UVM result = uvm_deallocate(&vm->vm_map, shmmap_s->va, size); #else @@ -247,7 +247,7 @@ sys_shmat(p, v, retval) } if (i >= shminfo.shmseg) return EMFILE; - size = (shmseg->shm_segsz + CLOFSET) & ~CLOFSET; + size = round_page(shmseg->shm_segsz); prot = VM_PROT_READ; if ((SCARG(uap, shmflg) & SHM_RDONLY) == 0) prot |= VM_PROT_WRITE; @@ -423,7 +423,7 @@ shmget_allocate_segment(p, uap, mode, retval) return EINVAL; if (shm_nused >= shminfo.shmmni) /* any shmids left? */ return ENOSPC; - size = (SCARG(uap, size) + CLOFSET) & ~CLOFSET; + size = round_page(SCARG(uap, size)); if (shm_committed + btoc(size) > shminfo.shmall) return ENOMEM; if (shm_last_free < 0) { diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 7836872ae3f..7b4801f9d53 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_mbuf.c,v 1.26 2001/04/05 10:52:45 art Exp $ */ +/* $OpenBSD: uipc_mbuf.c,v 1.27 2001/05/05 20:57:00 art Exp $ */ /* $NetBSD: uipc_mbuf.c,v 1.15.4.1 1996/06/13 17:11:44 cgd Exp $ */ /* @@ -79,7 +79,7 @@ mbinit() int s; s = splimp(); - if (m_clalloc(max(4096 / CLBYTES, 1), M_DONTWAIT) == 0) + if (m_clalloc(max(4096 / PAGE_SIZE, 1), M_DONTWAIT) == 0) goto bad; splx(s); return; @@ -105,7 +105,7 @@ m_clalloc(ncl, nowait) register int i; int npg, s; - npg = ncl * CLSIZE; + npg = ncl; #if defined(UVM) p = (caddr_t)uvm_km_kmemalloc(mb_map, uvmexp.mb_object, ctob(npg), nowait ? 0 : UVM_KMF_NOWAIT); @@ -124,7 +124,7 @@ m_clalloc(ncl, nowait) m_reclaim(); return (mclfree != NULL); } - ncl = ncl * CLBYTES / MCLBYTES; + ncl = ncl * PAGE_SIZE / MCLBYTES; for (i = 0; i < ncl; i++) { ((union mcluster *)p)->mcl_next = mclfree; mclfree = (union mcluster *)p; diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index 7749cef7a09..630456a512b 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_bio.c,v 1.37 2001/04/06 19:10:49 gluk Exp $ */ +/* $OpenBSD: vfs_bio.c,v 1.38 2001/05/05 20:57:01 art Exp $ */ /* $NetBSD: vfs_bio.c,v 1.44 1996/06/11 11:15:36 pk Exp $ */ /*- @@ -194,9 +194,9 @@ bufinit() bp->b_data = buffers + i * MAXBSIZE; LIST_INIT(&bp->b_dep); if (i < residual) - bp->b_bufsize = (base + 1) * CLBYTES; + bp->b_bufsize = (base + 1) * PAGE_SIZE; else - bp->b_bufsize = base * CLBYTES; + bp->b_bufsize = base * PAGE_SIZE; bp->b_flags = B_INVAL; if (bp->b_bufsize) { dp = &bufqueues[BQ_AGE]; @@ -767,7 +767,7 @@ allocbuf(bp, size) vsize_t desired_size; int s; - desired_size = clrnd(round_page(size)); + desired_size = round_page(size); if (desired_size > MAXBSIZE) panic("allocbuf: buffer larger than MAXBSIZE requested"); @@ -1041,24 +1041,24 @@ vfs_bufstats() int s, i, j, count; register struct buf *bp; register struct bqueues *dp; - int counts[MAXBSIZE/CLBYTES+1]; + int counts[MAXBSIZE/PAGE_SIZE+1]; int totals[BQUEUES]; static char *bname[BQUEUES] = { "LOCKED", "LRU", "AGE", "EMPTY" }; s = splbio(); for (dp = bufqueues, i = 0; dp < &bufqueues[BQUEUES]; dp++, i++) { count = 0; - for (j = 0; j <= MAXBSIZE/CLBYTES; j++) + for (j = 0; j <= MAXBSIZE/PAGE_SIZE; j++) counts[j] = 0; for (bp = dp->tqh_first; bp; bp = bp->b_freelist.tqe_next) { - counts[bp->b_bufsize/CLBYTES]++; + counts[bp->b_bufsize/PAGE_SIZE]++; count++; } totals[i] = count; printf("%s: total-%d", bname[i], count); - for (j = 0; j <= MAXBSIZE/CLBYTES; j++) + for (j = 0; j <= MAXBSIZE/PAGE_SIZE; j++) if (counts[j] != 0) - printf(", %d-%d", j * CLBYTES, counts[j]); + printf(", %d-%d", j * PAGE_SIZE, counts[j]); printf("\n"); } if (totals[BQ_EMPTY] != numemptybufs) diff --git a/sys/netiso/iso_chksum.c b/sys/netiso/iso_chksum.c index 5e376999166..c98ff2a3ecf 100644 --- a/sys/netiso/iso_chksum.c +++ b/sys/netiso/iso_chksum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iso_chksum.c,v 1.4 1996/05/01 14:06:28 deraadt Exp $ */ +/* $OpenBSD: iso_chksum.c,v 1.5 2001/05/05 20:57:01 art Exp $ */ /* $NetBSD: iso_chksum.c,v 1.8 1996/04/22 01:43:45 christos Exp $ */ /*- @@ -206,7 +206,7 @@ iso_gen_csum(m, n, l) #endif while (i < l) { - len = min(m->m_len, CLBYTES); + len = min(m->m_len, PAGE_SIZE); /* RAH: don't cksum more than l bytes */ len = min(len, l - i); diff --git a/sys/sys/malloc.h b/sys/sys/malloc.h index 4cb92738004..ffcbcae8871 100644 --- a/sys/sys/malloc.h +++ b/sys/sys/malloc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: malloc.h,v 1.38 2001/05/02 00:47:53 angelos Exp $ */ +/* $OpenBSD: malloc.h,v 1.39 2001/05/05 20:57:02 art Exp $ */ /* $NetBSD: malloc.h,v 1.39 1998/07/12 19:52:01 augustss Exp $ */ /* @@ -387,7 +387,7 @@ struct kmembuckets { */ #define kmemxtob(alloc) (kmembase + (alloc) * NBPG) #define btokmemx(addr) (((caddr_t)(addr) - kmembase) / NBPG) -#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> CLSHIFT]) +#define btokup(addr) (&kmemusage[((caddr_t)(addr) - kmembase) >> PAGE_SHIFT]) /* * Macro versions for the usual cases of malloc/free diff --git a/sys/sys/param.h b/sys/sys/param.h index 5aa9adc493f..43066bb6d05 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: param.h,v 1.36 2001/04/15 02:35:09 deraadt Exp $ */ +/* $OpenBSD: param.h,v 1.37 2001/05/05 20:57:02 art Exp $ */ /* $NetBSD: param.h,v 1.23 1996/03/17 01:02:29 thorpej Exp $ */ /*- @@ -124,27 +124,6 @@ #define NODEV (dev_t)(-1) /* non-existent device */ #define NETDEV (dev_t)(-2) /* network device (for nfs swap) */ -/* - * Clustering of hardware pages on machines with ridiculously small - * page sizes is done here. The paging subsystem deals with units of - * CLSIZE pte's describing NBPG (from machine/param.h) pages each. - */ -#define CLBYTES (CLSIZE*NBPG) -#define CLOFSET (CLSIZE*NBPG-1) /* for clusters, like PGOFSET */ -#define claligned(x) ((((int)(x))&CLOFSET)==0) -#define CLOFF CLOFSET -#define CLSHIFT (PGSHIFT+CLSIZELOG2) - -#if CLSIZE==1 -#define clbase(i) (i) -#define clrnd(i) (i) -#else -/* Give the base virtual address (first of CLSIZE). */ -#define clbase(i) ((i) &~ (CLSIZE-1)) -/* Round a number of clicks up to a whole cluster. */ -#define clrnd(i) (((i) + (CLSIZE-1)) &~ (CLSIZE-1)) -#endif - #define CBLOCK 64 /* Clist block size, must be a power of 2. */ #define CBQSIZE (CBLOCK/NBBY) /* Quote bytes/cblock - can do better. */ /* Data chars/clist. */ @@ -211,11 +190,11 @@ * always allocate and free physical memory; requests for these * size allocations should be done infrequently as they will be slow. * - * Constraints: CLBYTES <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and + * Constraints: PAGE_SIZE <= MAXALLOCSAVE <= 2 ** (MINBUCKET + 14), and * MAXALLOCSIZE must be a power of two. */ #define MINBUCKET 4 /* 4 => min allocation of 16 bytes */ -#define MAXALLOCSAVE (2 * CLBYTES) +#define MAXALLOCSAVE (2 * PAGE_SIZE) /* * Scale factor for scaled integers used to count %cpu time and load avgs. diff --git a/sys/sys/shm.h b/sys/sys/shm.h index 8aa1f795ee7..67684d88f81 100644 --- a/sys/sys/shm.h +++ b/sys/sys/shm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: shm.h,v 1.8 1999/06/23 09:44:28 art Exp $ */ +/* $OpenBSD: shm.h,v 1.9 2001/05/05 20:57:02 art Exp $ */ /* $NetBSD: shm.h,v 1.20 1996/04/09 20:55:35 cgd Exp $ */ /* @@ -43,7 +43,7 @@ #define SHM_RDONLY 010000 /* Attach read-only (else read-write) */ #define SHM_RND 020000 /* Round attach address to SHMLBA */ -#define SHMLBA CLBYTES /* Segment low boundry address multiple */ +#define SHMLBA PAGE_SIZE /* Segment low boundry address multiple */ /* "official" access mode definitions; somewhat braindead since you have to specify (SHM_* >> 3) for group and (SHM_* >> 6) for world permissions */ diff --git a/sys/uvm/uvm_unix.c b/sys/uvm/uvm_unix.c index b4ae538b872..44ac0c01018 100644 --- a/sys/uvm/uvm_unix.c +++ b/sys/uvm/uvm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_unix.c,v 1.8 2001/01/29 02:07:50 niklas Exp $ */ +/* $OpenBSD: uvm_unix.c,v 1.9 2001/05/05 20:57:03 art Exp $ */ /* $NetBSD: uvm_unix.c,v 1.8 1999/03/25 18:48:56 mrg Exp $ */ /* @@ -155,9 +155,9 @@ uvm_grow(p, sp) * Really need to check vs limit and increment stack size if ok. */ #ifdef MACHINE_STACK_GROWS_UP - si = clrnd(btoc(sp - USRSTACK) - vm->vm_ssize); + si = btoc(sp - USRSTACK) - vm->vm_ssize; #else - si = clrnd(btoc(USRSTACK-sp) - vm->vm_ssize); + si = btoc(USRSTACK-sp) - vm->vm_ssize; #endif if (vm->vm_ssize + si > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) return (0); diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c index 68e2e0f5fd2..56b9b0525d7 100644 --- a/sys/vm/vm_swap.c +++ b/sys/vm/vm_swap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_swap.c,v 1.15 2001/03/09 03:13:48 deraadt Exp $ */ +/* $OpenBSD: vm_swap.c,v 1.16 2001/05/05 20:57:04 art Exp $ */ /* $NetBSD: vm_swap.c,v 1.64 1998/11/08 19:45:17 mycroft Exp $ */ /* @@ -597,8 +597,8 @@ swap_on(p, sdp) * boot blocks. */ if (vp->v_type == VBLK) { - size = (int)(nblks - ctod(CLSIZE)); - addr = (long)ctod(CLSIZE); + size = (int)(nblks - ctod(1)); + addr = (long)ctod(1); } else { size = (int)nblks; addr = (long)0; @@ -885,7 +885,7 @@ swstrategy(bp) case VBLK: s = splbio(); buf_replacevnode(bp, sdp->swd_vp); - bp->b_blkno = bn + ctod(CLSIZE); + bp->b_blkno = bn + ctod(1); splx(s); VOP_STRATEGY(bp); return; diff --git a/sys/vm/vm_unix.c b/sys/vm/vm_unix.c index 6a1a7a21148..4a35e4e3482 100644 --- a/sys/vm/vm_unix.c +++ b/sys/vm/vm_unix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vm_unix.c,v 1.9 1998/07/28 00:13:21 millert Exp $ */ +/* $OpenBSD: vm_unix.c,v 1.10 2001/05/05 20:57:04 art Exp $ */ /* $NetBSD: vm_unix.c,v 1.19 1996/02/10 00:08:14 christos Exp $ */ /* @@ -132,7 +132,7 @@ grow(p, sp) /* * Really need to check vs limit and increment stack size if ok. */ - si = clrnd(btoc(USRSTACK-sp) - vm->vm_ssize); + si = btoc(USRSTACK-sp) - vm->vm_ssize; if (vm->vm_ssize + si > btoc(p->p_rlimit[RLIMIT_STACK].rlim_cur)) return (0); vm->vm_ssize += si; |