Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha Keep track of a pmap's PV entries with a list...
details: https://anonhg.NetBSD.org/src/rev/9052cdadfd95
branches: trunk
changeset: 379409:9052cdadfd95
user: thorpej <thorpej%NetBSD.org@localhost>
date: Sun May 30 13:34:21 2021 +0000
description:
Keep track of a pmap's PV entries with a list hanging off the pmap.
diffstat:
sys/arch/alpha/alpha/pmap.c | 14 ++++++++++++--
sys/arch/alpha/include/pmap.h | 7 ++++---
2 files changed, 16 insertions(+), 5 deletions(-)
diffs (86 lines):
diff -r 56c8a55dd072 -r 9052cdadfd95 sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c Sun May 30 13:20:01 2021 +0000
+++ b/sys/arch/alpha/alpha/pmap.c Sun May 30 13:34:21 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.287 2021/05/30 06:41:19 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.288 2021/05/30 13:34:21 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007, 2008, 2020
@@ -135,7 +135,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.287 2021/05/30 06:41:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.288 2021/05/30 13:34:21 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1384,6 +1384,7 @@ pmap_bootstrap(paddr_t ptaddr, u_int max
*/
memset(pmap_kernel(), 0, sizeof(struct pmap));
LIST_INIT(&pmap_kernel()->pm_ptpages);
+ LIST_INIT(&pmap_kernel()->pm_pvents);
atomic_store_relaxed(&pmap_kernel()->pm_count, 1);
/* Kernel pmap does not have per-CPU info. */
TAILQ_INSERT_TAIL(&pmap_all_pmaps, pmap_kernel(), pm_list);
@@ -1568,6 +1569,7 @@ pmap_create(void)
pmap = pool_cache_get(&pmap_pmap_cache, PR_WAITOK);
memset(pmap, 0, sizeof(*pmap));
LIST_INIT(&pmap->pm_ptpages);
+ LIST_INIT(&pmap->pm_pvents);
atomic_store_relaxed(&pmap->pm_count, 1);
@@ -3278,6 +3280,7 @@ pmap_pv_enter(pmap_t pmap, struct vm_pag
uintptr_t const attrs = md->pvh_listx & PGA_ATTRS;
newpv->pv_next = (struct pv_entry *)(md->pvh_listx & ~PGA_ATTRS);
md->pvh_listx = (uintptr_t)newpv | attrs;
+ LIST_INSERT_HEAD(&pmap->pm_pvents, newpv, pv_link);
if (dolock) {
mutex_exit(lock);
@@ -3316,8 +3319,15 @@ pmap_pv_remove(pmap_t pmap, struct vm_pa
KASSERT(pv != NULL);
+ /*
+ * The page attributes are in the lower 2 bits of the first
+ * PV entry pointer. Rather than comparing the pointer address
+ * and branching, we just always preserve what might be there
+ * (either attribute bits or zero bits).
+ */
*pvp = (pv_entry_t)((uintptr_t)pv->pv_next |
(((uintptr_t)*pvp) & PGA_ATTRS));
+ LIST_REMOVE(pv, pv_link);
if (dolock) {
mutex_exit(lock);
diff -r 56c8a55dd072 -r 9052cdadfd95 sys/arch/alpha/include/pmap.h
--- a/sys/arch/alpha/include/pmap.h Sun May 30 13:20:01 2021 +0000
+++ b/sys/arch/alpha/include/pmap.h Sun May 30 13:34:21 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.93 2021/05/30 06:41:19 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.94 2021/05/30 13:34:21 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -151,7 +151,7 @@ struct pmap { /* pmaps are aligned to CO
unsigned int pm_count; /* [24] reference count */
unsigned int __pm_spare0; /* [28] spare field */
struct pmap_pagelist pm_ptpages; /* [32] list of PT pages */
- unsigned long __pm_spare1; /* [40] spare field */
+ LIST_HEAD(, pv_entry) pm_pvents; /* [40] list of PV entries */
TAILQ_ENTRY(pmap) pm_list; /* [48] list of all pmaps */
/* -- COHERENCY_UNIT boundary -- */
struct pmap_percpu pm_percpu[]; /* [64] per-CPU data */
@@ -171,7 +171,8 @@ struct pmap { /* pmaps are aligned to CO
* mappings of that page. An entry is a pv_entry_t, the list is pv_table.
*/
typedef struct pv_entry {
- struct pv_entry *pv_next; /* next pv_entry on list */
+ struct pv_entry *pv_next; /* next pv_entry on page list */
+ LIST_ENTRY(pv_entry) pv_link; /* link on owning pmap's list */
struct pmap *pv_pmap; /* pmap where mapping lies */
vaddr_t pv_va; /* virtual address for mapping */
pt_entry_t *pv_pte; /* PTE that maps the VA */
Home |
Main Index |
Thread Index |
Old Index