Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha After a comment by joerg@, go back to using a...
details: https://anonhg.NetBSD.org/src/rev/3386bc7c71ab
branches: trunk
changeset: 379438:3386bc7c71ab
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon May 31 17:16:04 2021 +0000
description:
After a comment by joerg@, go back to using a dedicated field for the
PT page reference count, but add an XXX comment stating the desire to
find a safely-unused field in the vm_page structure when pages are in-
use as PT pages, so that we can save the 8 bytes per page needed for
this.
diffstat:
sys/arch/alpha/alpha/pmap.c | 19 +++++--------------
sys/arch/alpha/include/pmap.h | 21 +++++++++++++++++++--
2 files changed, 24 insertions(+), 16 deletions(-)
diffs (91 lines):
diff -r 14b68c45dd1d -r 3386bc7c71ab sys/arch/alpha/alpha/pmap.c
--- a/sys/arch/alpha/alpha/pmap.c Mon May 31 14:38:55 2021 +0000
+++ b/sys/arch/alpha/alpha/pmap.c Mon May 31 17:16:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.292 2021/05/30 19:50:23 thorpej Exp $ */
+/* $NetBSD: pmap.c,v 1.293 2021/05/31 17:16:04 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.292 2021/05/30 19:50:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.293 2021/05/31 17:16:04 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -507,8 +507,8 @@ pmap_pagelist_free(struct pmap_pagelist
while ((pg = LIST_FIRST(list)) != NULL) {
LIST_REMOVE(pg, pageq.list);
- /* Zap any fields we used internally. */
- atomic_store_relaxed(&pg->loan_count, 0);
+ /* Fix up ref count; it's not always 0 when we get here. */
+ PHYSPAGE_REFCNT_SET(pg, 0);
uvm_pagefree(pg);
}
}
@@ -1893,7 +1893,7 @@ pmap_remove_all(pmap_t pmap)
/* Fix up the reference count on the lev1map page. */
pg = PHYS_TO_VM_PAGE(ALPHA_K0SEG_TO_PHYS((vaddr_t)lev1map));
- atomic_store_relaxed(&pg->loan_count, 0);
+ PHYSPAGE_REFCNT_SET(pg, 0);
/* Step 3 */
while ((pv = LIST_FIRST(&pmap->pm_pvents)) != NULL) {
@@ -3470,15 +3470,6 @@ pmap_pv_page_free(struct pool *pp, void
/******************** misc. functions ********************/
/*
- * Pages that are in-use as page table pages should never be part
- * of a UVM loan, so we'll use that field for our PT page reference
- * count.
- */
-#define PHYSPAGE_REFCNT(pg) atomic_load_relaxed(&(pg)->loan_count)
-#define PHYSPAGE_REFCNT_INC(pg) atomic_inc_uint_nv(&(pg)->loan_count)
-#define PHYSPAGE_REFCNT_DEC(pg) atomic_dec_uint_nv(&(pg)->loan_count)
-
-/*
* pmap_physpage_alloc:
*
* Allocate a single page from the VM system and return the
diff -r 14b68c45dd1d -r 3386bc7c71ab sys/arch/alpha/include/pmap.h
--- a/sys/arch/alpha/include/pmap.h Mon May 31 14:38:55 2021 +0000
+++ b/sys/arch/alpha/include/pmap.h Mon May 31 17:16:04 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.96 2021/05/30 19:41:59 thorpej Exp $ */
+/* $NetBSD: pmap.h,v 1.97 2021/05/31 17:16:05 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000, 2001, 2007 The NetBSD Foundation, Inc.
@@ -355,9 +355,26 @@ do { \
*/
#define __HAVE_VM_PAGE_MD
struct vm_page_md {
- uintptr_t pvh_listx; /* pv_entry list + attrs */
+ uintptr_t pvh_listx; /* pv_entry list + attrs */
+ /*
+ * XXX These fields are only needed for pages that are used
+ * as PT pages. It would be nice to find safely-unused fields
+ * in the vm_page structure that could be used instead.
+ */
+ unsigned int pvh_physpgrefs; /* # refs as a PT page */
+ unsigned int pvh_spare0; /* XXX spare field */
};
+/* Reference counting for page table pages. */
+#define PHYSPAGE_REFCNT(pg) \
+ atomic_load_relaxed(&(pg)->mdpage.pvh_physpgrefs)
+#define PHYSPAGE_REFCNT_SET(pg, v) \
+ atomic_store_relaxed(&(pg)->mdpage.pvh_physpgrefs, (v))
+#define PHYSPAGE_REFCNT_INC(pg) \
+ atomic_inc_uint_nv(&(pg)->mdpage.pvh_physpgrefs)
+#define PHYSPAGE_REFCNT_DEC(pg) \
+ atomic_dec_uint_nv(&(pg)->mdpage.pvh_physpgrefs)
+
#define VM_MDPAGE_PVS(pg) \
((struct pv_entry *)((pg)->mdpage.pvh_listx & ~3UL))
Home |
Main Index |
Thread Index |
Old Index