Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm __predict_false() out-of-resource conditions and DIA...
details: https://anonhg.NetBSD.org/src/rev/68399efce4a3
branches: trunk
changeset: 485930:68399efce4a3
user: thorpej <thorpej%NetBSD.org@localhost>
date: Mon May 08 23:10:20 2000 +0000
description:
__predict_false() out-of-resource conditions and DIAGNOSTIC error checks.
diffstat:
sys/uvm/uvm_km.c | 54 ++++++++++++++++++++++++++++--------------------------
1 files changed, 28 insertions(+), 26 deletions(-)
diffs (174 lines):
diff -r d675eeb39ab3 -r 68399efce4a3 sys/uvm/uvm_km.c
--- a/sys/uvm/uvm_km.c Mon May 08 22:59:35 2000 +0000
+++ b/sys/uvm/uvm_km.c Mon May 08 23:10:20 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_km.c,v 1.34 2000/01/11 06:57:50 chs Exp $ */
+/* $NetBSD: uvm_km.c,v 1.35 2000/05/08 23:10:20 thorpej Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -336,7 +336,7 @@
simple_lock(&uobj->vmobjlock); /* lock object */
#ifdef DIAGNOSTIC
- if (uobj->pgops != &aobj_pager)
+ if (__predict_false(uobj->pgops != &aobj_pager))
panic("uvm_km_pgremove: object %p not an aobj", uobj);
#endif
@@ -436,7 +436,7 @@
simple_lock(&uobj->vmobjlock); /* lock object */
#ifdef DIAGNOSTIC
- if (UVM_OBJ_IS_INTRSAFE_OBJECT(uobj) == 0)
+ if (__predict_false(UVM_OBJ_IS_INTRSAFE_OBJECT(uobj) == 0))
panic("uvm_km_pgremove_intrsafe: object %p not intrsafe", uobj);
#endif
@@ -457,11 +457,11 @@
UVMHIST_LOG(maphist," page 0x%x, busy=%d", pp,
pp->flags & PG_BUSY, 0, 0);
#ifdef DIAGNOSTIC
- if (pp->flags & PG_BUSY)
+ if (__predict_false(pp->flags & PG_BUSY))
panic("uvm_km_pgremove_intrsafe: busy page");
- if (pp->pqflags & PQ_ACTIVE)
+ if (__predict_false(pp->pqflags & PQ_ACTIVE))
panic("uvm_km_pgremove_intrsafe: active page");
- if (pp->pqflags & PQ_INACTIVE)
+ if (__predict_false(pp->pqflags & PQ_INACTIVE))
panic("uvm_km_pgremove_intrsafe: inactive page");
#endif
@@ -483,11 +483,11 @@
pp->flags & PG_BUSY, 0, 0);
#ifdef DIAGNOSTIC
- if (pp->flags & PG_BUSY)
+ if (__predict_false(pp->flags & PG_BUSY))
panic("uvm_km_pgremove_intrsafe: busy page");
- if (pp->pqflags & PQ_ACTIVE)
+ if (__predict_false(pp->pqflags & PQ_ACTIVE))
panic("uvm_km_pgremove_intrsafe: active page");
- if (pp->pqflags & PQ_INACTIVE)
+ if (__predict_false(pp->pqflags & PQ_INACTIVE))
panic("uvm_km_pgremove_intrsafe: inactive page");
#endif
@@ -528,7 +528,7 @@
map, obj, size, flags);
#ifdef DIAGNOSTIC
/* sanity check */
- if (vm_map_pmap(map) != pmap_kernel())
+ if (__predict_false(vm_map_pmap(map) != pmap_kernel()))
panic("uvm_km_kmemalloc: invalid map");
#endif
@@ -543,10 +543,10 @@
* allocate some virtual space
*/
- if (uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET,
+ if (__predict_false(uvm_map(map, &kva, size, obj, UVM_UNKNOWN_OFFSET,
UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
UVM_ADV_RANDOM, (flags & UVM_KMF_TRYLOCK)))
- != KERN_SUCCESS) {
+ != KERN_SUCCESS)) {
UVMHIST_LOG(maphist, "<- done (no VM)",0,0,0,0);
return(0);
}
@@ -585,7 +585,7 @@
* out of memory?
*/
- if (pg == NULL) {
+ if (__predict_false(pg == NULL)) {
if (flags & UVM_KMF_NOWAIT) {
/* free everything! */
uvm_unmap(map, kva, kva + size);
@@ -688,9 +688,10 @@
* allocate some virtual space
*/
- if (uvm_map(map, &kva, size, uvm.kernel_object, UVM_UNKNOWN_OFFSET,
- UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
- UVM_ADV_RANDOM, 0)) != KERN_SUCCESS) {
+ if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object,
+ UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL,
+ UVM_INH_NONE, UVM_ADV_RANDOM,
+ 0)) != KERN_SUCCESS)) {
UVMHIST_LOG(maphist,"<- done (no VM)",0,0,0,0);
return(0);
}
@@ -731,7 +732,7 @@
UVM_PAGE_OWN(pg, NULL);
}
simple_unlock(&uvm.kernel_object->vmobjlock);
- if (pg == NULL) {
+ if (__predict_false(pg == NULL)) {
uvm_wait("km_alloc1w"); /* wait for memory */
continue;
}
@@ -777,7 +778,7 @@
UVMHIST_LOG(maphist, "(map=0x%x, size=0x%x)", map, size, 0,0);
#ifdef DIAGNOSTIC
- if (vm_map_pmap(map) != pmap_kernel())
+ if (__predict_false(vm_map_pmap(map) != pmap_kernel()))
panic("uvm_km_valloc");
#endif
@@ -788,9 +789,10 @@
* allocate some virtual space. will be demand filled by kernel_object.
*/
- if (uvm_map(map, &kva, size, uvm.kernel_object, UVM_UNKNOWN_OFFSET,
- UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_NONE,
- UVM_ADV_RANDOM, 0)) != KERN_SUCCESS) {
+ if (__predict_false(uvm_map(map, &kva, size, uvm.kernel_object,
+ UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL,
+ UVM_INH_NONE, UVM_ADV_RANDOM,
+ 0)) != KERN_SUCCESS)) {
UVMHIST_LOG(maphist, "<- done (no VM)", 0,0,0,0);
return(0);
}
@@ -818,7 +820,7 @@
UVMHIST_LOG(maphist, "(map=0x%x, size=0x%x)", map, size, 0,0);
#ifdef DIAGNOSTIC
- if (vm_map_pmap(map) != pmap_kernel())
+ if (__predict_false(vm_map_pmap(map) != pmap_kernel()))
panic("uvm_km_valloc_wait");
#endif
@@ -834,10 +836,10 @@
* by kernel_object.
*/
- if (uvm_map(map, &kva, size, uvm.kernel_object,
+ if (__predict_true(uvm_map(map, &kva, size, uvm.kernel_object,
UVM_UNKNOWN_OFFSET, UVM_MAPFLAG(UVM_PROT_ALL,
UVM_PROT_ALL, UVM_INH_NONE, UVM_ADV_RANDOM, 0))
- == KERN_SUCCESS) {
+ == KERN_SUCCESS)) {
UVMHIST_LOG(maphist,"<- done (kva=0x%x)", kva,0,0,0);
return(kva);
}
@@ -877,7 +879,7 @@
again:
pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE);
- if (pg == NULL) {
+ if (__predict_false(pg == NULL)) {
if (waitok) {
uvm_wait("plpg");
goto again;
@@ -885,7 +887,7 @@
return (0);
}
va = PMAP_MAP_POOLPAGE(VM_PAGE_TO_PHYS(pg));
- if (va == 0)
+ if (__predict_false(va == 0))
uvm_pagefree(pg);
return (va);
#else
Home |
Main Index |
Thread Index |
Old Index