| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: uvm_pglist.c,v 1.52 2011/01/18 21:43:29 matt Exp $ */ | | 1 | /* $NetBSD: uvm_pglist.c,v 1.53 2011/01/21 16:56:38 cegger Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -25,27 +25,27 @@ | | | @@ -25,27 +25,27 @@ |
25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | /* | | 33 | /* |
34 | * uvm_pglist.c: pglist functions | | 34 | * uvm_pglist.c: pglist functions |
35 | */ | | 35 | */ |
36 | | | 36 | |
37 | #include <sys/cdefs.h> | | 37 | #include <sys/cdefs.h> |
38 | __KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.52 2011/01/18 21:43:29 matt Exp $"); | | 38 | __KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.53 2011/01/21 16:56:38 cegger Exp $"); |
39 | | | 39 | |
40 | #include <sys/param.h> | | 40 | #include <sys/param.h> |
41 | #include <sys/systm.h> | | 41 | #include <sys/systm.h> |
42 | #include <sys/malloc.h> | | 42 | #include <sys/malloc.h> |
43 | #include <sys/proc.h> | | 43 | #include <sys/proc.h> |
44 | | | 44 | |
45 | #include <uvm/uvm.h> | | 45 | #include <uvm/uvm.h> |
46 | #include <uvm/uvm_pdpolicy.h> | | 46 | #include <uvm/uvm_pdpolicy.h> |
47 | | | 47 | |
48 | #ifdef VM_PAGE_ALLOC_MEMORY_STATS | | 48 | #ifdef VM_PAGE_ALLOC_MEMORY_STATS |
49 | #define STAT_INCR(v) (v)++ | | 49 | #define STAT_INCR(v) (v)++ |
50 | #define STAT_DECR(v) do { \ | | 50 | #define STAT_DECR(v) do { \ |
51 | if ((v) == 0) \ | | 51 | if ((v) == 0) \ |
| @@ -195,27 +195,27 @@ uvm_pglistalloc_c_ps(struct vm_physseg * | | | @@ -195,27 +195,27 @@ uvm_pglistalloc_c_ps(struct vm_physseg * |
195 | panic("pgalloc contig: botch2"); | | 195 | panic("pgalloc contig: botch2"); |
196 | if (vm_physseg_find(try + num - 1, &cidx) != ps - vm_physmem) | | 196 | if (vm_physseg_find(try + num - 1, &cidx) != ps - vm_physmem) |
197 | panic("pgalloc contig: botch3"); | | 197 | panic("pgalloc contig: botch3"); |
198 | if (cidx != try - ps->start + num - 1) | | 198 | if (cidx != try - ps->start + num - 1) |
199 | panic("pgalloc contig: botch4"); | | 199 | panic("pgalloc contig: botch4"); |
200 | #endif | | 200 | #endif |
201 | tryidx = try - ps->start; | | 201 | tryidx = try - ps->start; |
202 | end = tryidx + num; | | 202 | end = tryidx + num; |
203 | | | 203 | |
204 | /* | | 204 | /* |
205 | * Found a suitable starting page. See if the range is free. | | 205 | * Found a suitable starting page. See if the range is free. |
206 | */ | | 206 | */ |
207 | #ifdef PGALLOC_VERBOSE | | 207 | #ifdef PGALLOC_VERBOSE |
208 | printf("%s: ps=%p try=%#x end=%#x skip=%#x, align=%#x", | | 208 | printf("%s: ps=%p try=%#x end=%#x skip=%#x, align=0x%"PRIxPADDR, |
209 | __func__, ps, tryidx, end, skip, alignment); | | 209 | __func__, ps, tryidx, end, skip, alignment); |
210 | #endif | | 210 | #endif |
211 | /* | | 211 | /* |
212 | * We start at the end and work backwards since if we find a | | 212 | * We start at the end and work backwards since if we find a |
213 | * non-free page, it makes no sense to continue. | | 213 | * non-free page, it makes no sense to continue. |
214 | * | | 214 | * |
215 | * But on the plus size we have "vetted" some number of free | | 215 | * But on the plus size we have "vetted" some number of free |
216 | * pages. If this iteration fails, we may be able to skip | | 216 | * pages. If this iteration fails, we may be able to skip |
217 | * testing most of those pages again in the next pass. | | 217 | * testing most of those pages again in the next pass. |
218 | */ | | 218 | */ |
219 | for (idx = end - 1; idx >= tryidx + skip; idx--) { | | 219 | for (idx = end - 1; idx >= tryidx + skip; idx--) { |
220 | if (VM_PAGE_IS_FREE(&pgs[idx]) == 0) { | | 220 | if (VM_PAGE_IS_FREE(&pgs[idx]) == 0) { |
221 | ok = false; | | 221 | ok = false; |