Module Name: src
Committed By: mrg
Date: Fri Sep 30 05:29:12 UTC 2011
Modified Files:
src/sys/uvm: uvm_page.c
Log Message:
re-arrange the end of uvm_page_recolor() to avoid the multiple exit
points. move the call to uvm_pager_realloc_emerg() to after we
drop the uvm_fpageqlock, since it may be taken again in uvm_km_alloc().
fixes LOCKDEBUG crashes with the previous change.
To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/uvm/uvm_page.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/uvm/uvm_page.c
diff -u src/sys/uvm/uvm_page.c:1.176 src/sys/uvm/uvm_page.c:1.177
--- src/sys/uvm/uvm_page.c:1.176 Wed Sep 28 22:52:15 2011
+++ src/sys/uvm/uvm_page.c Fri Sep 30 05:29:12 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.176 2011/09/28 22:52:15 matt Exp $ */
+/* $NetBSD: uvm_page.c,v 1.177 2011/09/30 05:29:12 mrg 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.176 2011/09/28 22:52:15 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.177 2011/09/30 05:29:12 mrg Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -1045,16 +1045,20 @@ uvm_page_recolor(int newncolors)
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);
- return;
- }
+ if (!have_recolored_pages)
+ oldbucketarray = NULL;
have_recolored_pages = true;
mutex_spin_exit(&uvm_fpageqlock);
+
+ if (oldbucketarray)
+ free(oldbucketarray, M_VMPAGE);
+
+ /*
+ * this calls uvm_km_alloc() which may want to hold
+ * uvm_fpageqlock.
+ */
+ uvm_pager_realloc_emerg();
}
/*