Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Simplify pmap_remove() a little by avoiding pmap_do_remo...
details: https://anonhg.NetBSD.org/src/rev/ba5a8dce4d95
branches: trunk
changeset: 748382:ba5a8dce4d95
user: rmind <rmind%NetBSD.org@localhost>
date: Thu Oct 22 19:50:55 2009 +0000
description:
Simplify pmap_remove() a little by avoiding pmap_do_remove() layer, since
possibility to skip wired mappings is not needed anymore. Apart from that,
no functional differences are intended.
diffstat:
sys/arch/alpha/alpha/pmap.c | 41 ++----------
sys/arch/arm/arm32/pmap.c | 29 ++------
sys/arch/arm/include/arm32/pmap.h | 4 +-
sys/arch/m68k/m68k/pmap_motorola.c | 105 +++++++++++++--------------------
sys/arch/x86/x86/pmap.c | 41 ++----------
sys/rump/librump/rumpkern/pmap_stub.c | 17 +---
6 files changed, 74 insertions(+), 163 deletions(-)
diffs (truncated from 587 to 300 lines):
diff -r b60ad9ce236a -r ba5a8dce4d95 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c Thu Oct 22 19:10:42 2009 +0000
+++ b/sys/arch/alpha/alpha/pmap.c Thu Oct 22 19:50:55 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.244 2009/10/21 21:11:58 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.245 2009/10/22 19:50:55 rmind Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008 The NetBSD Foundation, Inc.
@@ -140,7 +140,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.244 2009/10/21 21:11:58 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.245 2009/10/22 19:50:55 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -439,7 +439,6 @@
* Internal routines
*/
static void alpha_protection_init(void);
-static void pmap_do_remove(pmap_t, vaddr_t, vaddr_t, bool);
static bool pmap_remove_mapping(pmap_t, vaddr_t, pt_entry_t *, bool, long);
static void pmap_changebit(struct vm_page *, pt_entry_t, pt_entry_t, long);
@@ -1255,25 +1254,6 @@
void
pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva)
{
-
-#ifdef DEBUG
- if (pmapdebug & (PDB_FOLLOW|PDB_REMOVE|PDB_PROTECT))
- printf("pmap_remove(%p, %lx, %lx)\n", pmap, sva, eva);
-#endif
-
- pmap_do_remove(pmap, sva, eva, true);
-}
-
-/*
- * pmap_do_remove:
- *
- * This actually removes the range of addresses from the
- * specified map. It is used by and pmap_remove() (does
- * want to remove wired mappings).
- */
-static void
-pmap_do_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva, bool dowired)
-{
pt_entry_t *l1pte, *l2pte, *l3pte;
pt_entry_t *saved_l1pte, *saved_l2pte, *saved_l3pte;
vaddr_t l1eva, l2eva, vptva;
@@ -1297,8 +1277,6 @@
PMAP_MAP_TO_HEAD_LOCK();
PMAP_LOCK(pmap);
- KASSERT(dowired == true);
-
while (sva < eva) {
l3pte = PMAP_KERNEL_PTE(sva);
if (pmap_pte_v(l3pte)) {
@@ -1380,15 +1358,14 @@
for (; sva < l2eva && sva < eva;
sva += PAGE_SIZE, l3pte++) {
- if (pmap_pte_v(l3pte) &&
- (dowired == true ||
- pmap_pte_w(l3pte) == 0)) {
- needisync |=
- pmap_remove_mapping(
- pmap, sva,
- l3pte, true,
- cpu_id);
+ if (!pmap_pte_v(l3pte)) {
+ continue;
}
+ needisync |=
+ pmap_remove_mapping(
+ pmap, sva,
+ l3pte, true,
+ cpu_id);
}
/*
diff -r b60ad9ce236a -r ba5a8dce4d95 sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Thu Oct 22 19:10:42 2009 +0000
+++ b/sys/arch/arm/arm32/pmap.c Thu Oct 22 19:50:55 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.199 2009/10/21 21:11:59 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.200 2009/10/22 19:50:55 rmind Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -212,7 +212,7 @@
#include <machine/param.h>
#include <arm/arm32/katelib.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.199 2009/10/21 21:11:59 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.200 2009/10/22 19:50:55 rmind Exp $");
#ifdef PMAP_DEBUG
@@ -640,7 +640,7 @@
static void pmap_enter_pv(struct vm_page *, struct pv_entry *,
pmap_t, vaddr_t, u_int);
static struct pv_entry *pmap_find_pv(struct vm_page *, pmap_t, vaddr_t);
-static struct pv_entry *pmap_remove_pv(struct vm_page *, pmap_t, vaddr_t, int);
+static struct pv_entry *pmap_remove_pv(struct vm_page *, pmap_t, vaddr_t);
static u_int pmap_modify_pv(struct vm_page *, pmap_t, vaddr_t,
u_int, u_int);
@@ -960,7 +960,7 @@
* => we return the removed pve
*/
static struct pv_entry *
-pmap_remove_pv(struct vm_page *pg, pmap_t pm, vaddr_t va, int skip_wired)
+pmap_remove_pv(struct vm_page *pg, pmap_t pm, vaddr_t va)
{
struct pv_entry *pve, **prevptr;
@@ -975,8 +975,6 @@
NPDEBUG(PDB_PVDUMP, printf("pmap_remove_pv: pm %p, pg "
"%p, flags 0x%x\n", pm, pg, pve->pv_flags));
if (pve->pv_flags & PVF_WIRED) {
- if (skip_wired)
- return (NULL);
--pm->pm_stats.wired_count;
}
*prevptr = SLIST_NEXT(pve, pv_link); /* remove it! */
@@ -2891,7 +2889,7 @@
* must remove it from the PV list
*/
simple_lock(&opg->mdpage.pvh_slock);
- pve = pmap_remove_pv(opg, pm, va, 0);
+ pve = pmap_remove_pv(opg, pm, va);
pmap_vac_me_harder(opg, pm, 0);
simple_unlock(&opg->mdpage.pvh_slock);
oflags = pve->pv_flags;
@@ -2954,7 +2952,7 @@
* at this address.
*/
simple_lock(&opg->mdpage.pvh_slock);
- pve = pmap_remove_pv(opg, pm, va, 0);
+ pve = pmap_remove_pv(opg, pm, va);
pmap_vac_me_harder(opg, pm, 0);
simple_unlock(&opg->mdpage.pvh_slock);
oflags = pve->pv_flags;
@@ -3078,7 +3076,7 @@
#define PMAP_REMOVE_CLEAN_LIST_SIZE 3
void
-pmap_do_remove(pmap_t pm, vaddr_t sva, vaddr_t eva, int skip_wired)
+pmap_remove(pmap_t pm, vaddr_t sva, vaddr_t eva)
{
struct l2_bucket *l2b;
vaddr_t next_bucket;
@@ -3148,7 +3146,7 @@
if ((pg = PHYS_TO_VM_PAGE(pa)) != NULL) {
struct pv_entry *pve;
simple_lock(&pg->mdpage.pvh_slock);
- pve = pmap_remove_pv(pg, pm, sva, skip_wired);
+ pve = pmap_remove_pv(pg, pm, sva);
pmap_vac_me_harder(pg, pm, 0);
simple_unlock(&pg->mdpage.pvh_slock);
if (pve != NULL) {
@@ -3159,17 +3157,8 @@
PV_BEEN_REFD(pve->pv_flags);
}
pool_put(&pmap_pv_pool, pve);
- } else
- if (skip_wired) {
- /* The mapping is wired. Skip it */
- continue;
}
- } else
- if (skip_wired) {
- /* Unmanaged pages are always wired. */
- continue;
}
-
mappings++;
if (!l2pte_valid(pte)) {
@@ -3285,7 +3274,7 @@
KASSERT(pg->mdpage.pvh_attrs & (PVF_COLORED|PVF_NC));
KASSERT((pg->mdpage.pvh_attrs & PVF_KMPAGE) == 0);
- pv = pmap_remove_pv(pg, pmap_kernel(), va, false);
+ pv = pmap_remove_pv(pg, pmap_kernel(), va);
KASSERT(pv);
KASSERT(pv->pv_flags & PVF_KENTRY);
diff -r b60ad9ce236a -r ba5a8dce4d95 sys/arch/arm/include/arm32/pmap.h
--- a/sys/arch/arm/include/arm32/pmap.h Thu Oct 22 19:10:42 2009 +0000
+++ b/sys/arch/arm/include/arm32/pmap.h Thu Oct 22 19:50:55 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.92 2009/08/19 23:54:33 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.93 2009/10/22 19:50:55 rmind Exp $ */
/*
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -268,8 +268,6 @@
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
-#define pmap_remove(pmap,sva,eva) pmap_do_remove((pmap),(sva),(eva),0)
-
#define pmap_is_modified(pg) \
(((pg)->mdpage.pvh_attrs & PVF_MOD) != 0)
#define pmap_is_referenced(pg) \
diff -r b60ad9ce236a -r ba5a8dce4d95 sys/arch/m68k/m68k/pmap_motorola.c
--- a/sys/arch/m68k/m68k/pmap_motorola.c Thu Oct 22 19:10:42 2009 +0000
+++ b/sys/arch/m68k/m68k/pmap_motorola.c Thu Oct 22 19:50:55 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_motorola.c,v 1.48 2009/10/21 21:12:00 rmind Exp $ */
+/* $NetBSD: pmap_motorola.c,v 1.49 2009/10/22 19:50:55 rmind Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -117,7 +117,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.48 2009/10/21 21:12:00 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.49 2009/10/22 19:50:55 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -280,7 +280,6 @@
struct pv_entry *pmap_alloc_pv(void);
void pmap_free_pv(struct pv_entry *);
-static void pmap_collect_pv(void);
#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
@@ -297,13 +296,11 @@
* Internal routines
*/
void pmap_remove_mapping(pmap_t, vaddr_t, pt_entry_t *, int);
-void pmap_do_remove(pmap_t, vaddr_t, vaddr_t, int);
bool pmap_testbit(paddr_t, int);
bool pmap_changebit(paddr_t, int, int);
int pmap_enter_ptpage(pmap_t, vaddr_t, bool);
void pmap_ptpage_addref(vaddr_t);
int pmap_ptpage_delref(vaddr_t);
-void pmap_collect1(pmap_t, paddr_t, paddr_t);
void pmap_pinit(pmap_t);
void pmap_release(pmap_t);
@@ -593,7 +590,8 @@
*
* Perform compaction on the PV list, called via pmap_collect().
*/
-static void
+#ifdef notyet
+void
pmap_collect_pv(void)
{
struct pv_page_list pv_page_collectlist;
@@ -654,6 +652,7 @@
uvm_km_free(kernel_map, (vaddr_t)pvp, PAGE_SIZE, UVM_KMF_WIRED);
}
}
+#endif
/*
* pmap_map:
@@ -852,13 +851,6 @@
void
pmap_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva)
{
-
- pmap_do_remove(pmap, sva, eva, 1);
-}
-
-void
-pmap_do_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva, int remove_wired)
-{
vaddr_t nssva;
pt_entry_t *pte;
int flags;
@@ -877,7 +869,6 @@
/*
* Invalidate every valid mapping within this segment.
- * If remove_wired is zero, skip the wired pages.
*/
pte = pmap_pte(pmap, sva);
@@ -893,10 +884,7 @@
break;
}
-
-
- if (pmap_pte_v(pte) &&
- (remove_wired || !pmap_pte_w(pte))) {
+ if (pmap_pte_v(pte)) {
#ifdef M68K_MMU_HP
Home |
Main Index |
Thread Index |
Old Index