Major update of the vax pmap:

- Reinstall the "dynamic page table length" that was removed some
	  years ago.
	- Limit the user page table submap to max 5% of available memory.
	- Free the page table space when a process is swapped out.
	- If the UPT submap runs out of space, throw away pmap mappings
	  using the same algorithm as for swapping processes.

As a result of this, 4MB machines are useable again and it's even possible
to compile a kernel for 2MB machines (but it will be slow... :-)

Still to do:
	- Multiprocessor fixes.
	- More profiling.
This commit is contained in:
ragge 2002-03-10 22:32:31 +00:00
parent 071d0cb34b
commit fe503fb96f
5 changed files with 692 additions and 287 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.61 2001/06/14 22:56:58 thorpej Exp $ */
/* $NetBSD: cpu.h,v 1.62 2002/03/10 22:32:31 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@ -52,7 +52,6 @@
#define enablertclock()
#define cpu_wait(p)
#define cpu_swapout(p)
/*
* All cpu-dependent info is kept in this struct. Pointer to the

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.51 2002/03/01 23:55:11 ragge Exp $ */
/* $NetBSD: pmap.h,v 1.52 2002/03/10 22:32:31 ragge Exp $ */
/*
* Copyright (c) 1987 Carnegie-Mellon University
@ -55,8 +55,17 @@
*/
#define LTOHPS (PGSHIFT - VAX_PGSHIFT)
#define LTOHPN (1 << LTOHPS)
#define PROCPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / VAX_NBPG)
#define NPTEPGS (PROCPTSIZE / (sizeof(struct pte) * LTOHPN))
#define PROCPTSIZE ((MAXTSIZ + MAXDSIZ + MAXSSIZ + MMAPSPACE) / VAX_NBPG)
#define NPTEPGS (PROCPTSIZE / (NBPG / (sizeof(struct pte) * LTOHPN)))
/*
* Link struct if more than one process share pmap (like vfork).
* This is rarely used.
*/
struct pm_share {
struct pm_share *ps_next;
struct pcb *ps_pcb;
};
/*
* Pmap structure
@ -64,15 +73,20 @@
*/
typedef struct pmap {
vaddr_t pm_stack; /* Base of alloced p1 pte space */
int ref_count; /* reference count */
struct pte *pm_p1ap; /* Base of alloced p1 pte space */
short pm_count; /* reference count */
short pm_flags;
#define PM_ACTIVE 1 /* Process connected to pmap */
struct pte *pm_p0base; /* Pointer to saved ptes */
struct pm_share *pm_share; /* PCBs using this pmap */
struct pte *pm_p0br; /* page 0 base register */
long pm_p0lr; /* page 0 length register */
struct pte *pm_p1br; /* page 1 base register */
long pm_p1lr; /* page 1 length register */
u_char *pm_pref; /* pte reference count array */
struct pte *pm_p1base; /* Number of pages wired */
struct simplelock pm_lock; /* Lock entry in MP environment */
struct pmap_statistics pm_stats; /* Some statistics */
u_char pm_refcnt[NPTEPGS]; /* Refcount per pte page */
} *pmap_t;
/*
@ -82,7 +96,7 @@ typedef struct pmap {
struct pv_entry {
struct pv_entry *pv_next; /* next pv_entry */
struct pte *pv_pte; /* pte for this physical page */
vaddr_t pv_vaddr; /* address for this physical page */
struct pmap *pv_pmap; /* pmap this entry belongs to */
int pv_attr; /* write/modified bits */
};
@ -158,8 +172,7 @@ pmap_extract(pmap_t pmap, vaddr_t va, paddr_t *pap)
#define pmap_remove(pmap, start, slut) pmap_protect(pmap, start, slut, 0)
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
#define pmap_deactivate(p) /* Dont do anything */
#define pmap_reference(pmap) (pmap)->ref_count++
#define pmap_reference(pmap) (pmap)->pm_count++
/* These can be done as efficient inline macros */
#define pmap_copy_page(src, dst) \

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: trap.c,v 1.67 2002/02/14 07:08:18 chs Exp $ */
/* $NetBSD: trap.c,v 1.68 2002/03/10 22:32:31 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -194,11 +194,15 @@ fram:
#ifdef nohwbug
panic("translation fault");
#endif
case T_PTELEN|T_USER: /* Page table length exceeded */
case T_ACCFLT|T_USER:
if (frame->code < 0) { /* Check for kernel space */
sig = SIGSEGV;
break;
}
case T_PTELEN:
case T_ACCFLT:
#ifdef TRAPDEBUG
if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
@ -260,16 +264,6 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
KERNEL_UNLOCK();
break;
case T_PTELEN:
if (p && p->p_addr)
FAULTCHK;
panic("ptelen fault in system space: addr %lx pc %lx",
frame->code, frame->pc);
case T_PTELEN|T_USER: /* Page table length exceeded */
sig = SIGSEGV;
break;
case T_BPTFLT|T_USER:
case T_TRCTRAP|T_USER:
sig = SIGTRAP;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.76 2002/03/04 02:43:25 simonb Exp $ */
/* $NetBSD: vm_machdep.c,v 1.77 2002/03/10 22:32:31 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden.
@ -260,23 +260,6 @@ cpu_coredump(p, vp, cred, chdr)
return error;
}
/*
* Kernel stack red zone need to be set when a process is swapped in.
* Be sure that all pages are valid.
*/
void
cpu_swapin(p)
struct proc *p;
{
struct pte *pte;
int i;
pte = kvtopte((vaddr_t)p->p_addr);
for (i = 0; i < (USPACE/VAX_NBPG); i ++)
pte[i].pg_v = 1;
kvtopte((vaddr_t)p->p_addr + REDZONEADDR)->pg_v = 0;
}
/*
* Map in a bunch of pages read/writeable for the kernel.
*/