Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm Fix DIAGNOSTIC physseg find check.
details: https://anonhg.NetBSD.org/src/rev/2e6ab040b9e9
branches: trunk
changeset: 758854:2e6ab040b9e9
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Nov 18 08:18:31 2010 +0000
description:
Fix DIAGNOSTIC physseg find check.
diffstat:
sys/uvm/uvm_pglist.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r 40fdae6ae8b0 -r 2e6ab040b9e9 sys/uvm/uvm_pglist.c
--- a/sys/uvm/uvm_pglist.c Thu Nov 18 07:52:45 2010 +0000
+++ b/sys/uvm/uvm_pglist.c Thu Nov 18 08:18:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_pglist.c,v 1.47 2010/11/14 15:06:34 uebayasi Exp $ */
+/* $NetBSD: uvm_pglist.c,v 1.48 2010/11/18 08:18:31 uebayasi Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.47 2010/11/14 15:06:34 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.48 2010/11/18 08:18:31 uebayasi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -59,6 +59,20 @@
#define STAT_DECR(v)
#endif
+#ifdef DIAGNOSTIC
+static int
+vm_physmem_index(struct vm_physseg *ps)
+{
+ int i;
+
+ for (i = 0; i < vm_nphysmem; i++) {
+ if (VM_PHYSMEM_PTR(i) == ps)
+ return i;
+ }
+ return -1;
+}
+#endif
+
/*
* uvm_pglistalloc: allocate a list of pages
*
@@ -164,11 +178,11 @@
* Make sure this is a managed physical page.
*/
- if (vm_physseg_find(try, &cidx) != ps - VM_PHYSMEM_PTR(0))
+ if (vm_physseg_find(try, &cidx) != vm_physmem_index(ps) - vm_physmem_index(VM_PHYSMEM_PTR(0)))
panic("pgalloc contig: botch1");
if (cidx != try - ps->start)
panic("pgalloc contig: botch2");
- if (vm_physseg_find(try + num - 1, &cidx) != ps - VM_PHYSMEM_PTR(0))
+ if (vm_physseg_find(try + num - 1, &cidx) != vm_physmem_index(ps) - vm_physmem_index(VM_PHYSMEM_PTR(0)))
panic("pgalloc contig: botch3");
if (cidx != try - ps->start + num - 1)
panic("pgalloc contig: botch4");
@@ -303,7 +317,7 @@
for (try = max(atop(low), ps->avail_start);
try < limit; try ++) {
#ifdef DEBUG
- if (vm_physseg_find(try, &cidx) != ps - VM_PHYSMEM_PTR(0))
+ if (vm_physseg_find(try, &cidx) != vm_physmem_index(ps) - vm_physmem_index(VM_PHYSMEM_PTR(0)))
panic("pgalloc simple: botch1");
if (cidx != (try - ps->start))
panic("pgalloc simple: botch2");
Home |
Main Index |
Thread Index |
Old Index