Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm Reallocate emergency pager va when ncolors is increa...
details: https://anonhg.NetBSD.org/src/rev/6aca64582545
branches: trunk
changeset: 769984:6aca64582545
user: matt <matt%NetBSD.org@localhost>
date: Wed Sep 28 22:52:15 2011 +0000
description:
Reallocate emergency pager va when ncolors is increased. (modication of
patch from mrg).
diffstat:
sys/uvm/uvm_page.c | 6 +++-
sys/uvm/uvm_pager.c | 54 +++++++++++++++++++++++++++++++++++++++++++---------
sys/uvm/uvm_pager.h | 3 +-
3 files changed, 50 insertions(+), 13 deletions(-)
diffs (128 lines):
diff -r 4482ae7eabf2 -r 6aca64582545 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Wed Sep 28 22:19:52 2011 +0000
+++ b/sys/uvm/uvm_page.c Wed Sep 28 22:52:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.175 2011/06/15 19:46:11 rmind Exp $ */
+/* $NetBSD: uvm_page.c,v 1.176 2011/09/28 22:52:15 matt 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.175 2011/06/15 19:46:11 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.176 2011/09/28 22:52:15 matt Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -1045,6 +1045,8 @@
ucpu->page_free[lcv].pgfl_buckets = pgfl.pgfl_buckets;
}
+ uvm_pager_realloc_emerg();
+
if (have_recolored_pages) {
mutex_spin_exit(&uvm_fpageqlock);
free(oldbucketarray, M_VMPAGE);
diff -r 4482ae7eabf2 -r 6aca64582545 sys/uvm/uvm_pager.c
--- a/sys/uvm/uvm_pager.c Wed Sep 28 22:19:52 2011 +0000
+++ b/sys/uvm/uvm_pager.c Wed Sep 28 22:52:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_pager.c,v 1.104 2011/09/01 06:40:28 matt Exp $ */
+/* $NetBSD: uvm_pager.c,v 1.105 2011/09/28 22:52:15 matt 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.104 2011/09/01 06:40:28 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.105 2011/09/28 22:52:15 matt Exp $");
#include "opt_uvmhist.h"
#include "opt_readahead.h"
@@ -80,8 +80,48 @@
kmutex_t pager_map_wanted_lock;
bool pager_map_wanted; /* locked by pager map */
static vaddr_t emergva;
+static int emerg_ncolors;
static bool emerginuse;
+void
+uvm_pager_realloc_emerg(void)
+{
+ vaddr_t new_emergva, old_emergva;
+ int old_emerg_ncolors;
+
+ if (__predict_true(emergva != 0 && emerg_ncolors >= uvmexp.ncolors))
+ return;
+
+ KASSERT(!emerginuse);
+
+ new_emergva = uvm_km_alloc(kernel_map,
+ round_page(MAXPHYS) + ptoa(uvmexp.ncolors), 0,
+ UVM_KMF_VAONLY);
+
+ KASSERT(new_emergva != 0);
+
+ old_emergva = emergva;
+ old_emerg_ncolors = emerg_ncolors;
+
+ /*
+ * don't support re-color in late boot anyway.
+ */
+ if (0) /* XXX */
+ mutex_enter(&pager_map_wanted_lock);
+
+ emergva = new_emergva;
+ emerg_ncolors = uvmexp.ncolors;
+ wakeup(&old_emergva);
+
+ if (0) /* XXX */
+ mutex_exit(&pager_map_wanted_lock);
+
+ if (old_emergva)
+ uvm_km_free(kernel_map, old_emergva,
+ round_page(MAXPHYS) + ptoa(old_emerg_ncolors),
+ UVM_KMF_VAONLY);
+}
+
/*
* uvm_pager_init: init pagers (at boot time)
*/
@@ -101,14 +141,8 @@
false, NULL);
mutex_init(&pager_map_wanted_lock, MUTEX_DEFAULT, IPL_NONE);
pager_map_wanted = false;
- emergva = uvm_km_alloc(kernel_map,
- round_page(MAXPHYS) + ptoa(uvmexp.ncolors), 0,
- UVM_KMF_VAONLY);
-#if defined(DEBUG)
- if (emergva == 0)
- panic("emergva");
-#endif
- emerginuse = false;
+
+ uvm_pager_realloc_emerg();
/*
* init ASYNC I/O queue
diff -r 4482ae7eabf2 -r 6aca64582545 sys/uvm/uvm_pager.h
--- a/sys/uvm/uvm_pager.h Wed Sep 28 22:19:52 2011 +0000
+++ b/sys/uvm/uvm_pager.h Wed Sep 28 22:52:15 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_pager.h,v 1.41 2011/02/02 20:07:25 chuck Exp $ */
+/* $NetBSD: uvm_pager.h,v 1.42 2011/09/28 22:52:15 matt Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -165,6 +165,7 @@
*/
void uvm_pager_init(void);
+void uvm_pager_realloc_emerg(void);
struct vm_page *uvm_pageratop(vaddr_t);
vaddr_t uvm_pagermapin(struct vm_page **, int, int);
void uvm_pagermapout(vaddr_t, int);
Home |
Main Index |
Thread Index |
Old Index