Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax/vax Do more intelligent calculation of KVM size...
details: https://anonhg.NetBSD.org/src/rev/612d2143a7f6
branches: trunk
changeset: 511928:612d2143a7f6
user: ragge <ragge%NetBSD.org@localhost>
date: Sat Jun 30 12:54:33 2001 +0000
description:
Do more intelligent calculation of KVM size. This reduces the amount of
pre-allocated physical memory significantly.
A 11/750, for example, get 2MB more free (of 14MB), about 12%.
diffstat:
sys/arch/vax/vax/machdep.c | 4 +-
sys/arch/vax/vax/pmap.c | 80 +++++++++++++++++++++++++++++++++------------
2 files changed, 62 insertions(+), 22 deletions(-)
diffs (160 lines):
diff -r 5d2de9e58dd5 -r 612d2143a7f6 sys/arch/vax/vax/machdep.c
--- a/sys/arch/vax/vax/machdep.c Sat Jun 30 11:00:31 2001 +0000
+++ b/sys/arch/vax/vax/machdep.c Sat Jun 30 12:54:33 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.117 2001/06/02 18:09:23 chs Exp $ */
+/* $NetBSD: machdep.c,v 1.118 2001/06/30 12:54:33 ragge Exp $ */
/*
* Copyright (c) 1994, 1998 Ludd, University of Lule}, Sweden.
@@ -219,12 +219,14 @@
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
+#if VAX46 || VAX48 || VAX49 || VAX53 || VAXANY
/*
* Allocate a submap for physio. This map effectively limits the
* number of processes doing physio at any one time.
*/
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
VM_PHYS_SIZE, 0, FALSE, NULL);
+#endif
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
printf("avail memory = %s\n", pbuf);
diff -r 5d2de9e58dd5 -r 612d2143a7f6 sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c Sat Jun 30 11:00:31 2001 +0000
+++ b/sys/arch/vax/vax/pmap.c Sat Jun 30 12:54:33 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.103 2001/06/07 05:29:13 chs Exp $ */
+/* $NetBSD: pmap.c,v 1.104 2001/06/30 12:54:34 ragge Exp $ */
/*
* Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -30,6 +30,7 @@
*/
#include "opt_ddb.h"
+#include "opt_cputype.h"
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@@ -42,6 +43,7 @@
#include <sys/user.h>
#include <sys/systm.h>
#include <sys/device.h>
+#include <sys/buf.h>
#include <uvm/uvm_extern.h>
@@ -146,6 +148,56 @@
struct pv_entry *get_pventry(void);
void free_pventry(struct pv_entry *);
void more_pventries(void);
+#define USRPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / VAX_NBPG)
+
+/*
+ * Calculation of the System Page Table is somewhat a pain, because it
+ * must be in contiguous physical memory and all size calculations must
+ * be done before memory management is turned on.
+ */
+static vsize_t
+calc_kvmsize(void)
+{
+ extern int bufcache;
+ vsize_t kvmsize;
+ int n, s, bp, bc;
+
+ /* All physical memory */
+ kvmsize = avail_end;
+ /* User Page table area. This may be large */
+ kvmsize += (USRPTSIZE * sizeof(struct pte) * maxproc);
+ /* Kernel stacks per process */
+ kvmsize += (USPACE * maxproc);
+ /* kernel malloc arena */
+ kvmsize += (NKMEMPAGES_MAX_DEFAULT * NBPG +
+ NKMEMPAGES_MAX_DEFAULT * sizeof(struct kmemusage));
+ /* IO device register space */
+ kvmsize += (IOSPSZ * VAX_NBPG);
+ /* Pager allocations */
+ kvmsize += (PAGER_MAP_SIZE + MAXBSIZE);
+ /* Anon pool structures */
+ kvmsize += (physmem * sizeof(struct vm_anon));
+
+ /* allocated buffer space etc... This is a hack */
+ n = nbuf; s = nswbuf; bp = bufpages; bc = bufcache;
+ kvmsize += (int)allocsys(NULL, NULL);
+ /* Buffer space */
+ kvmsize += (MAXBSIZE * nbuf);
+ nbuf = n; nswbuf = s; bufpages = bp; bufcache = bc;
+
+ /* Exec arg space */
+ kvmsize += NCARGS;
+#if VAX46 || VAX48 || VAX49 || VAX53 || VAXANY
+ /* Physmap */
+ kvmsize += VM_PHYS_SIZE;
+#endif
+#ifdef LKM
+ /* LKMs are allocated out of kernel_map */
+#define MAXLKMSIZ 0x100000 /* XXX */
+ kvmsize += MAXLKMSIZ;
+#endif
+ return kvmsize;
+}
/*
* pmap_bootstrap().
@@ -160,31 +212,16 @@
extern unsigned int etext, proc0paddr;
struct pcb *pcb = (struct pcb *)proc0paddr;
pmap_t pmap = pmap_kernel();
+ vsize_t kvmsize;
/* Set logical page size */
uvmexp.pagesize = NBPG;
uvm_setpagesize();
- /*
- * Calculation of the System Page Table is somewhat a pain,
- * because it must be in contiguous physical memory and all
- * size calculations must be done now.
- * Remember: sysptsize is in PTEs and nothing else!
- */
physmem = btoc(avail_end);
-#define USRPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / VAX_NBPG)
- /* Kernel alloc area */
- sysptsize = (((0x100000 * maxproc) >> VAX_PGSHIFT) / 4);
- /* reverse mapping struct */
- sysptsize += (avail_end >> VAX_PGSHIFT) * 2;
- /* User Page table area. This may grow big */
- sysptsize += ((USRPTSIZE * 4) / VAX_NBPG) * maxproc;
- /* Kernel stacks per process */
- sysptsize += UPAGES * maxproc;
- /* IO device register space */
- sysptsize += IOSPSZ;
-
+ kvmsize = calc_kvmsize();
+ sysptsize = kvmsize >> VAX_PGSHIFT;
/*
* Virtual_* and avail_* is used for mapping of system page table.
* The need for kernel virtual memory is linear dependent of the
@@ -261,8 +298,8 @@
#if 0 /* Breaks cninit() on some machines */
cninit();
- printf("Sysmap %p, istack %lx, scratch %\n",Sysmap,istack,scratch);
- printf("etext %p\n", &etext);
+ printf("Sysmap %p, istack %lx, scratch %lx\n",Sysmap,istack,scratch);
+ printf("etext %p, kvmsize %lx\n", &etext, kvmsize);
printf("SYSPTSIZE %x\n",sysptsize);
printf("pv_table %p, ptemapstart %lx ptemapend %lx\n",
pv_table, ptemapstart, ptemapend);
@@ -313,6 +350,7 @@
mtpr(sysptsize, PR_SLR);
rpb.sbr = mfpr(PR_SBR);
rpb.slr = mfpr(PR_SLR);
+ rpb.wait = 0; /* DDB signal */
mtpr(1, PR_MAPEN);
}
Home |
Main Index |
Thread Index |
Old Index