summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-14 02:20:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-06-14 02:20:24 +0000
commit0a2d2dcfd5d2ea4348c898ce15f1bb1b03ee2c7c (patch)
treee7ab7a535ca85d76096678f316f0022f37185fde /sys/uvm
parent75c544ff7b233c2b109aecedc839e0b857e49385 (diff)
back out the free vs dirty fix, because pmemrange will go soon too
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_pmemrange.c25
-rw-r--r--sys/uvm/uvm_pmemrange.h4
2 files changed, 18 insertions, 11 deletions
diff --git a/sys/uvm/uvm_pmemrange.c b/sys/uvm/uvm_pmemrange.c
index 76f75803576..3ea1d7b41c7 100644
--- a/sys/uvm/uvm_pmemrange.c
+++ b/sys/uvm/uvm_pmemrange.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pmemrange.c,v 1.6 2009/06/14 02:04:15 deraadt Exp $ */
+/* $OpenBSD: uvm_pmemrange.c,v 1.7 2009/06/14 02:20:23 deraadt Exp $ */
/*
* Copyright (c) 2009 Ariane van der Steldt <ariane@stack.nl>
@@ -619,8 +619,17 @@ ReTryDesperate:
*/
if (count <= maxseg && align == 1 && boundary == 0 &&
(flags & UVM_PLA_TRY_CONTIG) == 0) {
- fcount += uvm_pmr_get1page(count - fcount, memtype, result,
- start, end);
+ if (!desperate) {
+ KASSERT(fcount == 0);
+ fcount += uvm_pmr_get1page(count, memtype, result,
+ start, end);
+ } else {
+ for (memtype = 0; memtype < UVM_PMR_MEMTYPE_MAX &&
+ fcount < count; memtype++) {
+ fcount += uvm_pmr_get1page(count - fcount,
+ memtype, result, start, end);
+ }
+ }
if (fcount == count)
goto Out;
@@ -688,7 +697,6 @@ DrainFound:
goto ReScan;
}
-Fail:
/*
* Not enough memory of the requested type available. Fall back to
* less good memory that we'll clean up better later.
@@ -699,13 +707,12 @@ Fail:
*/
if (!desperate) {
desperate = 1;
-#if UVM_PMR_MEMTYPE_MAX != 2
-#error Too many memtypes, need to become smarter!
-#endif
- memtype = UVM_PMR_MEMTYPE_MAX - 1 - memtype;
+ memtype = 0;
+ goto ReTryDesperate;
+ } else if (++memtype < UVM_PMR_MEMTYPE_MAX)
goto ReTryDesperate;
- }
+Fail:
/*
* Allocation failed.
*/
diff --git a/sys/uvm/uvm_pmemrange.h b/sys/uvm/uvm_pmemrange.h
index 38f7cc1c2c3..493961f1f9c 100644
--- a/sys/uvm/uvm_pmemrange.h
+++ b/sys/uvm/uvm_pmemrange.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pmemrange.h,v 1.2 2009/06/10 20:36:40 ariane Exp $ */
+/* $OpenBSD: uvm_pmemrange.h,v 1.3 2009/06/14 02:20:23 deraadt Exp $ */
/*
* Copyright (c) 2009 Ariane van der Steldt <ariane@stack.nl>
@@ -34,7 +34,7 @@ RB_HEAD(uvm_pmr_size, vm_page);
* - DIRTY: this page may contain random data.
* - ZERO: this page has been zeroed.
*/
-#define UVM_PMR_MEMTYPE_DIRTY 0
+#define UVM_PMR_MEMTYPE_DIRTY 1
#define UVM_PMR_MEMTYPE_ZERO 1
#define UVM_PMR_MEMTYPE_MAX 2