Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/arm32 Update PMAP_STEAL_MEMORY code to uvm_hotplug
details: https://anonhg.NetBSD.org/src/rev/7cb09ed83b8f
branches: trunk
changeset: 467194:7cb09ed83b8f
user: skrll <skrll%NetBSD.org@localhost>
date: Fri Jan 17 12:39:00 2020 +0000
description:
Update PMAP_STEAL_MEMORY code to uvm_hotplug
diffstat:
sys/arch/arm/arm32/pmap.c | 35 ++++++++++++++++-------------------
1 files changed, 16 insertions(+), 19 deletions(-)
diffs (78 lines):
diff -r aab7972dbbbc -r 7cb09ed83b8f sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Fri Jan 17 12:34:55 2020 +0000
+++ b/sys/arch/arm/arm32/pmap.c Fri Jan 17 12:39:00 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.375 2019/12/31 18:09:21 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.376 2020/01/17 12:39:00 skrll Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -221,7 +221,7 @@
#include <arm/db_machdep.h>
#endif
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375 2019/12/31 18:09:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.376 2020/01/17 12:39:00 skrll Exp $");
//#define PMAP_DEBUG
#ifdef PMAP_DEBUG
@@ -7789,8 +7789,6 @@
pv_addr_t *rpv)
{
pv_addr_t *pv, **pvp;
- struct vm_physseg *ps;
- size_t i;
KASSERT(amount & PGOFSET);
KASSERT((mask & PGOFSET) == 0);
@@ -7848,7 +7846,7 @@
return;
}
- if (vm_nphysseg == 0)
+ if (!uvm_physseg_valid_p(uvm_physseg_get_first()))
panic("pmap_boot_pagealloc: couldn't allocate memory");
for (pvp = &SLIST_FIRST(&pmap_boot_freeq);
@@ -7858,28 +7856,27 @@
break;
}
KASSERT(mask == 0);
- for (i = 0; i < vm_nphysseg; i++) {
- ps = VM_PHYSMEM_PTR(i);
- if (ps->avail_start == atop(pv->pv_pa + pv->pv_size)
- && pv->pv_va + pv->pv_size <= ptoa(ps->avail_end)) {
+
+ for (uvm_physseg_t ups = uvm_physseg_get_first();
+ uvm_physseg_valid_p(ups);
+ ups = uvm_physseg_get_next(ups)) {
+
+ paddr_t spn = uvm_physseg_get_start(ups);
+ paddr_t epn = uvm_physseg_get_end(ups);
+ if (spn == atop(pv->pv_pa + pv->pv_size)
+ && pv->pv_va + pv->pv_size <= ptoa(epn)) {
rpv->pv_va = pv->pv_va;
rpv->pv_pa = pv->pv_pa;
rpv->pv_size = amount;
*pvp = NULL;
pmap_map_chunk(kernel_l1pt.pv_va,
- ptoa(ps->avail_start) + (pv->pv_va - pv->pv_pa),
- ptoa(ps->avail_start),
+ ptoa(spn) + (pv->pv_va - pv->pv_pa),
+ ptoa(spn),
amount - pv->pv_size,
VM_PROT_READ|VM_PROT_WRITE,
PTE_CACHE);
- ps->avail_start += atop(amount - pv->pv_size);
- /*
- * If we consumed the entire physseg, remove it.
- */
- if (ps->avail_start == ps->avail_end) {
- for (--vm_nphysseg; i < vm_nphysseg; i++)
- VM_PHYSMEM_PTR_SWAP(i, i + 1);
- }
+
+ uvm_physseg_unplug(spn, atop(amount - pv->pv_size));
memset((void *)rpv->pv_va, 0, rpv->pv_size);
return;
}
Home |
Main Index |
Thread Index |
Old Index