Module Name: src
Committed By: jakllsch
Date: Tue Nov 27 20:15:55 UTC 2012
Modified Files:
src/sys/uvm: uvm_swap.c
Log Message:
Until such time as the swap subsystem can be converted to use The One True
Allocator, prevent panics if (MAXPHYS/PAGE_SIZE) > BLIST_MAX_ALLOC.
>From Wolfgang Stukenbrock in PR#41765.
To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/uvm/uvm_swap.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_swap.c
diff -u src/sys/uvm/uvm_swap.c:1.161 src/sys/uvm/uvm_swap.c:1.162
--- src/sys/uvm/uvm_swap.c:1.161 Sun Feb 5 16:08:28 2012
+++ src/sys/uvm/uvm_swap.c Tue Nov 27 20:15:55 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_swap.c,v 1.161 2012/02/05 16:08:28 rmind Exp $ */
+/* $NetBSD: uvm_swap.c,v 1.162 2012/11/27 20:15:55 jakllsch Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.161 2012/02/05 16:08:28 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.162 2012/11/27 20:15:55 jakllsch Exp $");
#include "opt_uvmhist.h"
#include "opt_compat_netbsd.h"
@@ -1535,6 +1535,19 @@ uvm_swap_alloc(int *nslots /* IN/OUT */,
return 0;
/*
+ * XXXJAK: BEGIN HACK
+ *
+ * blist_alloc() in subr_blist.c will panic if we try to allocate
+ * too many slots.
+ */
+ if (*nslots > BLIST_MAX_ALLOC) {
+ if (__predict_false(lessok == false))
+ return 0;
+ *nslots = BLIST_MAX_ALLOC;
+ }
+ /* XXXJAK: END HACK */
+
+ /*
* lock data lock, convert slots into blocks, and enter loop
*/
mutex_enter(&uvm_swap_data_lock);