Source to kern/zalloc.h
/*
* Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
*
* @[email protected]
*
* "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* Source License Version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License."
*
* @[email protected]
*/
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or [email protected]
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
/*
* Copyright (c) 1995, 1997 Apple Computer, Inc.
*
* HISTORY
*
* 23 June 1995 ? at NeXT
* Pulled over from CMU (MK83), added local
* mods: freespace suballocator and sorted
* zone free lists to reduce fragmentation.
*/
/*
* File: zalloc.h
* Author: Avadis Tevanian, Jr.
* Date: 1985
*
*/
#ifndef _KERN_ZALLOC_H_
#define _KERN_ZALLOC_H_
#include <mach/machine/vm_types.h>
#include <kern/lock.h>
#include <kern/queue.h>
#include <machdep/machine/machspl.h>
/*
* A zone is a collection of fixed size blocks for which there
* is fast allocation/deallocation access. Kernel routines can
* use zones to manage data structures dynamically, creating a zone
* for each type of data structure to be managed.
*
*/
typedef struct zone {
decl_simple_lock_data(,lock) /* generic lock */
spl_t lock_ipl;
int count; /* Number of elements used now */
vm_offset_t last_insert;
vm_offset_t free_elements;
vm_size_t cur_size; /* current memory utilization */
vm_size_t max_size; /* how large can this zone grow */
vm_size_t elem_size; /* size of an element */
vm_size_t alloc_size; /* size used for more memory */
boolean_t doing_alloc; /* is zone expanding now? */
char *zone_name; /* a name for the zone */
unsigned int
/* boolean_t */ pageable :1, /* zone pageable? */
/* boolean_t */ sleepable :1, /* sleep if empty? */
/* boolean_t */ exhaustible :1, /* merely return if empty? */
/* boolean_t */ expandable :1; /* expand zone (with message)? */
lock_data_t complex_lock; /* Lock for pageable zones */
struct zone_free_space *
free_space; /* where to get new elements from */
struct zone * next_zone; /* Link for all-zones list */
} *zone_t;