Sun Jan 23 21:29:52 2011 UTC ()
DEBUG does not imply DIAGNOSTIC; make sure we have a non-null
KASSERTMSG implementation (DIAGNOSTIC) so that the variable inside
the DEBUG section gets used.


(he)
diff -r1.55 -r1.56 src/sys/uvm/uvm_pglist.c

cvs diff -r1.55 -r1.56 src/sys/uvm/uvm_pglist.c (expand / switch to unified diff)

--- src/sys/uvm/uvm_pglist.c 2011/01/22 01:36:27 1.55
+++ src/sys/uvm/uvm_pglist.c 2011/01/23 21:29:52 1.56
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: uvm_pglist.c,v 1.55 2011/01/22 01:36:27 matt Exp $ */ 1/* $NetBSD: uvm_pglist.c,v 1.56 2011/01/23 21:29:52 he 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.55 2011/01/22 01:36:27 matt Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.56 2011/01/23 21:29:52 he 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) \
@@ -380,27 +380,27 @@ uvm_pglistalloc_s_ps(struct vm_physseg * @@ -380,27 +380,27 @@ uvm_pglistalloc_s_ps(struct vm_physseg *
380 pg = &ps->pgs[try - ps->start]; 380 pg = &ps->pgs[try - ps->start];
381 second_pass = false; 381 second_pass = false;
382 382
383 for (;; try++, pg++) { 383 for (;; try++, pg++) {
384 if (try >= limit) { 384 if (try >= limit) {
385 if (ps->start_hint == 0 || second_pass) 385 if (ps->start_hint == 0 || second_pass)
386 break; 386 break;
387 second_pass = true; 387 second_pass = true;
388 try = max(low, ps->avail_start); 388 try = max(low, ps->avail_start);
389 limit = min(high, ps->avail_start + ps->start_hint); 389 limit = min(high, ps->avail_start + ps->start_hint);
390 pg = &ps->pgs[try - ps->start]; 390 pg = &ps->pgs[try - ps->start];
391 continue; 391 continue;
392 } 392 }
393#ifdef DEBUG 393#if defined(DEBUG) && defined(DIAGNOSTIC)
394 { 394 {
395 int cidx = 0; 395 int cidx = 0;
396 const int bank = vm_physseg_find(try, &cidx); 396 const int bank = vm_physseg_find(try, &cidx);
397 KASSERTMSG(bank == ps - vm_physmem, 397 KASSERTMSG(bank == ps - vm_physmem,
398 ("vm_physseg_find(%#x) (%d) != ps %zd", 398 ("vm_physseg_find(%#x) (%d) != ps %zd",
399 try, bank, ps - vm_physmem)); 399 try, bank, ps - vm_physmem));
400 KASSERTMSG(cidx == try - ps->start, 400 KASSERTMSG(cidx == try - ps->start,
401 ("vm_physseg_find(%#x): %#x != off %"PRIxPADDR, 401 ("vm_physseg_find(%#x): %#x != off %"PRIxPADDR,
402 try, cidx, try - ps->start)); 402 try, cidx, try - ps->start));
403 } 403 }
404#endif 404#endif
405 if (VM_PAGE_IS_FREE(pg) == 0) 405 if (VM_PAGE_IS_FREE(pg) == 0)
406 continue; 406 continue;