Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 pmap_enter_gnt(): call pmap_free_ptp() if n...
details: https://anonhg.NetBSD.org/src/rev/60883eb1ffc9
branches: trunk
changeset: 943409:60883eb1ffc9
user: bouyer <bouyer%NetBSD.org@localhost>
date: Wed Sep 02 17:07:45 2020 +0000
description:
pmap_enter_gnt(): call pmap_free_ptp() if needed. We can have a 0 wire count
if we had an old mapping and grant map hypercall failed, and this was the
only page in this ptp.
while there remove ptp != NULL checks for gnt operations: we always have
a ptp here.
diffstat:
sys/arch/x86/x86/pmap.c | 28 +++++++++++++---------------
1 files changed, 13 insertions(+), 15 deletions(-)
diffs (67 lines):
diff -r 794de7cc34db -r 60883eb1ffc9 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Wed Sep 02 16:22:45 2020 +0000
+++ b/sys/arch/x86/x86/pmap.c Wed Sep 02 17:07:45 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.404 2020/09/01 11:24:14 bouyer Exp $ */
+/* $NetBSD: pmap.c,v 1.405 2020/09/02 17:07:45 bouyer Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.404 2020/09/01 11:24:14 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.405 2020/09/02 17:07:45 bouyer Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -5255,21 +5255,20 @@
if (__predict_false(op->status != GNTST_okay)) {
printf("%s: GNTTABOP_map_grant_ref status: %d\n",
__func__, op->status);
- if (ptp != NULL) {
- if (have_oldpa) {
- ptp->wire_count--;
- }
+ if (have_oldpa) {
+ ptp->wire_count--;
}
} else {
pgnt->pd_gnt_refs++;
- if (ptp != NULL) {
- if (!have_oldpa) {
- ptp->wire_count++;
- }
- /* Remember minimum VA in PTP. */
- pmap_ptp_range_set(ptp, va);
+ if (!have_oldpa) {
+ ptp->wire_count++;
}
- }
+ KASSERT(ptp->wire_count >= 1);
+ /* Remember minimum VA in PTP. */
+ pmap_ptp_range_set(ptp, va);
+ }
+ if (ptp->wire_count <= 1)
+ pmap_free_ptp(pmap, ptp, va, ptes, pdes);
/*
* Done with the PTEs: they can now be unmapped.
@@ -5280,7 +5279,6 @@
* Update statistics and PTP's reference count.
*/
pmap_stats_update_bypte(pmap, 0, opte);
- KASSERT(ptp == NULL || ptp->wire_count >= 1);
/*
* If old page is pv-tracked, remove pv_entry from its list.
@@ -5376,7 +5374,7 @@
* being used, free it!
*/
- if (ptp && ptp->wire_count <= 1)
+ if (ptp->wire_count <= 1)
pmap_free_ptp(pmap, ptp, va, ptes, pdes);
pmap_unmap_ptes(pmap, pmap2);
}
Home |
Main Index |
Thread Index |
Old Index