kern_malloc.c (43301) | kern_malloc.c (46568) |
---|---|
1/* 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. 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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 | 1/* 2 * Copyright (c) 1987, 1991, 1993 3 * The Regents of the University of California. 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 --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94 |
34 * $Id: kern_malloc.c,v 1.53 1999/01/21 21:54:32 msmith Exp $ | 34 * $Id: kern_malloc.c,v 1.54 1999/01/27 21:49:56 dillon Exp $ |
35 */ 36 37#include "opt_vm.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#define MALLOC_INSTANTIATE --- 300 unchanged lines hidden (view full) --- 343 */ 344 copysize = size < MAX_COPY ? size : MAX_COPY; 345 end = (long *)&((caddr_t)addr)[copysize]; 346 for (lp = (long *)addr; lp < end; lp++) 347 *lp = WEIRD_ADDR; 348 freep->type = type; 349#endif /* INVARIANTS */ 350 kup->ku_freecnt++; | 35 */ 36 37#include "opt_vm.h" 38 39#include <sys/param.h> 40#include <sys/systm.h> 41#include <sys/kernel.h> 42#define MALLOC_INSTANTIATE --- 300 unchanged lines hidden (view full) --- 343 */ 344 copysize = size < MAX_COPY ? size : MAX_COPY; 345 end = (long *)&((caddr_t)addr)[copysize]; 346 for (lp = (long *)addr; lp < end; lp++) 347 *lp = WEIRD_ADDR; 348 freep->type = type; 349#endif /* INVARIANTS */ 350 kup->ku_freecnt++; |
351 if (kup->ku_freecnt >= kbp->kb_elmpercl) | 351 if (kup->ku_freecnt >= kbp->kb_elmpercl) { |
352 if (kup->ku_freecnt > kbp->kb_elmpercl) 353 panic("free: multiple frees"); 354 else if (kbp->kb_totalfree > kbp->kb_highwat) 355 kbp->kb_couldfree++; | 352 if (kup->ku_freecnt > kbp->kb_elmpercl) 353 panic("free: multiple frees"); 354 else if (kbp->kb_totalfree > kbp->kb_highwat) 355 kbp->kb_couldfree++; |
356 } |
|
356 kbp->kb_totalfree++; 357 ksp->ks_memuse -= size; 358 if (ksp->ks_memuse + size >= ksp->ks_limit && 359 ksp->ks_memuse < ksp->ks_limit) 360 wakeup((caddr_t)ksp); 361 ksp->ks_inuse--; 362#ifdef OLD_MALLOC_MEMORY_POLICY 363 if (kbp->kb_next == NULL) --- 143 unchanged lines hidden --- | 357 kbp->kb_totalfree++; 358 ksp->ks_memuse -= size; 359 if (ksp->ks_memuse + size >= ksp->ks_limit && 360 ksp->ks_memuse < ksp->ks_limit) 361 wakeup((caddr_t)ksp); 362 ksp->ks_inuse--; 363#ifdef OLD_MALLOC_MEMORY_POLICY 364 if (kbp->kb_next == NULL) --- 143 unchanged lines hidden --- |