diff options
author | Ariane van der Steldt <ariane@cvs.openbsd.org> | 2009-06-10 20:36:41 +0000 |
---|---|---|
committer | Ariane van der Steldt <ariane@cvs.openbsd.org> | 2009-06-10 20:36:41 +0000 |
commit | 67a527d0c50ebba9d5f2756a2ca616a366fcda18 (patch) | |
tree | ce33756a4f60790cb58c6816da2d92379502b201 /sys/uvm | |
parent | 3db0d6c8b9c40479e8c2102f57684da0aecf0ddb (diff) |
Fix: Clean and dirty pages had the memtype ids and the desparate case failed
to function properly in the fast-allocation path (should not have triggered).
ok: oga, deraadt
Diffstat (limited to 'sys/uvm')
-rw-r--r-- | sys/uvm/uvm_pmemrange.c | 25 | ||||
-rw-r--r-- | sys/uvm/uvm_pmemrange.h | 4 |
2 files changed, 11 insertions, 18 deletions
diff --git a/sys/uvm/uvm_pmemrange.c b/sys/uvm/uvm_pmemrange.c index f380b7f17f2..3d2938bfa4e 100644 --- a/sys/uvm/uvm_pmemrange.c +++ b/sys/uvm/uvm_pmemrange.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmemrange.c,v 1.3 2009/06/07 02:01:54 oga Exp $ */ +/* $OpenBSD: uvm_pmemrange.c,v 1.4 2009/06/10 20:36:40 ariane Exp $ */ /* * Copyright (c) 2009 Ariane van der Steldt <ariane@stack.nl> @@ -619,17 +619,8 @@ ReTryDesperate: */ if (count <= maxseg && align == 1 && boundary == 0 && (flags & UVM_PLA_TRY_CONTIG) == 0) { - 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); - } - } + fcount += uvm_pmr_get1page(count - fcount, memtype, result, + start, end); if (fcount == count) goto Out; @@ -697,6 +688,7 @@ 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. @@ -707,12 +699,13 @@ DrainFound: */ if (!desperate) { desperate = 1; - memtype = 0; - goto ReTryDesperate; - } else if (++memtype < UVM_PMR_MEMTYPE_MAX) +#if UVM_PMR_MEMTYPE_MAX != 2 +#error Too many memtypes, need to become smarter! +#endif + memtype = UVM_PMR_MEMTYPE_MAX - 1 - memtype; goto ReTryDesperate; + } -Fail: /* * Allocation failed. */ diff --git a/sys/uvm/uvm_pmemrange.h b/sys/uvm/uvm_pmemrange.h index 90219dc075b..38f7cc1c2c3 100644 --- a/sys/uvm/uvm_pmemrange.h +++ b/sys/uvm/uvm_pmemrange.h @@ -1,4 +1,4 @@ -/* $OpenBSD: uvm_pmemrange.h,v 1.1 2009/06/01 17:42:33 ariane Exp $ */ +/* $OpenBSD: uvm_pmemrange.h,v 1.2 2009/06/10 20:36:40 ariane 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 1 +#define UVM_PMR_MEMTYPE_DIRTY 0 #define UVM_PMR_MEMTYPE_ZERO 1 #define UVM_PMR_MEMTYPE_MAX 2 |