Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm Correct pagermap emergva allocation. From yamt@.
details: https://anonhg.NetBSD.org/src/rev/6254b740381a
branches: trunk
changeset: 770159:6254b740381a
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Oct 06 12:26:03 2011 +0000
description:
Correct pagermap emergva allocation. From yamt@.
Tested by building i386 kernel with DTRACE defined which died 100%.
diffstat:
sys/uvm/uvm_page.c | 7 +++++--
sys/uvm/uvm_pager.c | 7 ++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diffs (70 lines):
diff -r bc6e5bf2f466 -r 6254b740381a sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Thu Oct 06 12:25:42 2011 +0000
+++ b/sys/uvm/uvm_page.c Thu Oct 06 12:26:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.177 2011/09/30 05:29:12 mrg Exp $ */
+/* $NetBSD: uvm_page.c,v 1.178 2011/10/06 12:26:03 uebayasi Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.177 2011/09/30 05:29:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.178 2011/10/06 12:26:03 uebayasi Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -393,6 +393,7 @@
if (uvmexp.ncolors == 0)
uvmexp.ncolors = 1;
uvmexp.colormask = uvmexp.ncolors - 1;
+ KASSERT((uvmexp.colormask & uvmexp.ncolors) == 0);
/*
* we now know we have (PAGE_SIZE * freepages) bytes of memory we can
@@ -986,6 +987,8 @@
int lcv, color, i, ocolors;
struct uvm_cpu *ucpu;
+ KASSERT(((newncolors - 1) & newncolors) == 0);
+
if (newncolors <= uvmexp.ncolors)
return;
diff -r bc6e5bf2f466 -r 6254b740381a sys/uvm/uvm_pager.c
--- a/sys/uvm/uvm_pager.c Thu Oct 06 12:25:42 2011 +0000
+++ b/sys/uvm/uvm_pager.c Thu Oct 06 12:26:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_pager.c,v 1.105 2011/09/28 22:52:15 matt Exp $ */
+/* $NetBSD: uvm_pager.c,v 1.106 2011/10/06 12:26:03 uebayasi Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.105 2011/09/28 22:52:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.106 2011/10/06 12:26:03 uebayasi Exp $");
#include "opt_uvmhist.h"
#include "opt_readahead.h"
@@ -95,7 +95,7 @@
KASSERT(!emerginuse);
new_emergva = uvm_km_alloc(kernel_map,
- round_page(MAXPHYS) + ptoa(uvmexp.ncolors), 0,
+ round_page(MAXPHYS) + ptoa(uvmexp.ncolors), ptoa(uvmexp.ncolors),
UVM_KMF_VAONLY);
KASSERT(new_emergva != 0);
@@ -264,6 +264,7 @@
if ((kva & ~ptoa(uvmexp.colormask)) == emergva) {
mutex_enter(&pager_map_wanted_lock);
+ KASSERT(emerginuse);
emerginuse = false;
wakeup(&emergva);
mutex_exit(&pager_map_wanted_lock);
Home |
Main Index |
Thread Index |
Old Index