uma_dbg.c (99424) | uma_dbg.c (103531) |
---|---|
1/* 2 * Copyright (c) 2002, Jeffrey Roberson <jroberson@chesapeake.net> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 2002, Jeffrey Roberson <jroberson@chesapeake.net> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/vm/uma_dbg.c 99424 2002-07-05 05:16:19Z jeff $ | 26 * $FreeBSD: head/sys/vm/uma_dbg.c 103531 2002-09-18 08:26:30Z jeff $ |
27 * 28 */ 29 30/* 31 * uma_dbg.c Debugging features for UMA users 32 * 33 */ 34 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> 39#include <sys/types.h> 40#include <sys/queue.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/malloc.h> 44 | 27 * 28 */ 29 30/* 31 * uma_dbg.c Debugging features for UMA users 32 * 33 */ 34 35 36#include <sys/param.h> 37#include <sys/systm.h> 38#include <sys/kernel.h> 39#include <sys/types.h> 40#include <sys/queue.h> 41#include <sys/lock.h> 42#include <sys/mutex.h> 43#include <sys/malloc.h> 44 |
45#include <vm/vm.h> 46#include <vm/vm_object.h> 47#include <vm/vm_page.h> |
|
45#include <vm/uma.h> 46#include <vm/uma_int.h> 47#include <vm/uma_dbg.h> 48 49static const u_int32_t uma_junk = 0xdeadc0de; 50 51/* 52 * Checks an item to make sure it hasn't been overwritten since freed. --- 136 unchanged lines hidden (view full) --- 189static uma_slab_t 190uma_dbg_getslab(uma_zone_t zone, void *item) 191{ 192 uma_slab_t slab; 193 u_int8_t *mem; 194 195 mem = (u_int8_t *)((unsigned long)item & (~UMA_SLAB_MASK)); 196 if (zone->uz_flags & UMA_ZFLAG_MALLOC) { | 48#include <vm/uma.h> 49#include <vm/uma_int.h> 50#include <vm/uma_dbg.h> 51 52static const u_int32_t uma_junk = 0xdeadc0de; 53 54/* 55 * Checks an item to make sure it hasn't been overwritten since freed. --- 136 unchanged lines hidden (view full) --- 192static uma_slab_t 193uma_dbg_getslab(uma_zone_t zone, void *item) 194{ 195 uma_slab_t slab; 196 u_int8_t *mem; 197 198 mem = (u_int8_t *)((unsigned long)item & (~UMA_SLAB_MASK)); 199 if (zone->uz_flags & UMA_ZFLAG_MALLOC) { |
197 mtx_lock(&malloc_mtx); 198 slab = hash_sfind(mallochash, mem); 199 mtx_unlock(&malloc_mtx); 200 } else if (zone->uz_flags & UMA_ZFLAG_OFFPAGE) { | 200 slab = vtoslab((vm_offset_t)mem); 201 } else if (zone->uz_flags & UMA_ZFLAG_HASH) { |
201 ZONE_LOCK(zone); 202 slab = hash_sfind(&zone->uz_hash, mem); 203 ZONE_UNLOCK(zone); 204 } else { 205 mem += zone->uz_pgoff; 206 slab = (uma_slab_t)mem; 207 } 208 --- 74 unchanged lines hidden --- | 202 ZONE_LOCK(zone); 203 slab = hash_sfind(&zone->uz_hash, mem); 204 ZONE_UNLOCK(zone); 205 } else { 206 mem += zone->uz_pgoff; 207 slab = (uma_slab_t)mem; 208 } 209 --- 74 unchanged lines hidden --- |