Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm26/arm26 Split off the pm_entries array from the...



details:   https://anonhg.NetBSD.org/src/rev/0426f5ec5602
branches:  trunk
changeset: 514057:0426f5ec5602
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Mon Aug 20 23:12:54 2001 +0000

description:
Split off the pm_entries array from the rest of struct pmap.  This makes
memory allocation for it more efficient (since pm_entries is 4096 bytes long),
and will allow pm_entries to be freed for swapped processes.

diffstat:

 sys/arch/arm26/arm26/pmap.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (69 lines):

diff -r eaa3e18ffe81 -r 0426f5ec5602 sys/arch/arm26/arm26/pmap.c
--- a/sys/arch/arm26/arm26/pmap.c       Mon Aug 20 23:10:51 2001 +0000
+++ b/sys/arch/arm26/arm26/pmap.c       Mon Aug 20 23:12:54 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.30 2001/06/09 12:22:11 bjh21 Exp $ */
+/* $NetBSD: pmap.c,v 1.31 2001/08/20 23:12:54 bjh21 Exp $ */
 /*-
  * Copyright (c) 1997, 1998, 2000 Ben Harris
  * All rights reserved.
@@ -105,7 +105,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.30 2001/06/09 12:22:11 bjh21 Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.31 2001/08/20 23:12:54 bjh21 Exp $");
 
 #include <sys/kernel.h> /* for cold */
 #include <sys/malloc.h>
@@ -143,12 +143,14 @@
 #define PV_MODIFIED    0x02
 };
 
+#define PM_NENTRIES 1024
+
 struct pmap {
        int     pm_count;       /* Reference count */
        int     pm_flags;
 #define PM_ACTIVE 0x00000001
        struct  pmap_statistics pm_stats;
-       struct  pv_entry *pm_entries[1024];
+       struct  pv_entry **pm_entries;
 };
 
 /*
@@ -171,6 +173,7 @@
 /* Kernel pmap -- statically allocated to make life slightly less odd. */
 
 struct pmap kernel_pmap_store;
+struct pv_entry *kernel_pmap_entries[PM_NENTRIES];
 
 static boolean_t pmap_initialised = FALSE;
 
@@ -248,6 +251,8 @@
        bzero(pmap, sizeof(*pmap));
        pmap->pm_count = 1;
        pmap->pm_flags = PM_ACTIVE; /* Kernel pmap always is */
+       pmap->pm_entries = kernel_pmap_entries;
+       bzero(pmap->pm_entries, sizeof(struct pv_entry *) * PM_NENTRIES);
        /* pmap_pinit(pmap); */
        /* Clear the MEMC's page table */
        /* XXX Maybe we should leave zero page alone? */
@@ -356,6 +361,9 @@
                pmap_init2();
        pmap = pool_get(&pmap_pool, PR_WAITOK);
        bzero(pmap, sizeof(*pmap));
+       MALLOC(pmap->pm_entries, struct pv_entry **,
+           sizeof(struct pv_entry *) * PM_NENTRIES, M_VMPMAP, M_WAITOK);
+       bzero(pmap->pm_entries, sizeof(struct pv_entry *) * PM_NENTRIES);
        pmap->pm_count = 1;
        return pmap;
 }
@@ -379,6 +387,7 @@
                if (pmap->pm_entries[i] != NULL)
                        panic("pmap_destroy: pmap isn't empty");
 #endif
+       FREE(pmap->pm_entries, M_VMPMAP);
        pool_put(&pmap_pool, pmap);
 }
 



Home | Main Index | Thread Index | Old Index