The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/vm/vm_zone.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1997, 1998 John S. Dyson
    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  *      notice immediately at the beginning of the file, without modification,
   10  *      this list of conditions, and the following disclaimer.
   11  * 2. Absolutely no warranty of function or purpose is made by the author
   12  *      John S. Dyson.
   13  *
   14  * $FreeBSD: src/sys/vm/vm_zone.h,v 1.13.2.2 2002/10/10 19:50:16 dillon Exp $
   15  * $DragonFly: src/sys/vm/vm_zone.h,v 1.10 2008/01/21 20:21:19 nth Exp $
   16  */
   17 
   18 #ifndef _VM_VM_ZONE_H_
   19 #define _VM_VM_ZONE_H_
   20 
   21 #define ZONE_INTERRUPT 0x0001   /* If you need to allocate at int time */
   22 #define ZONE_PANICFAIL 0x0002   /* panic if the zalloc fails */
   23 #define ZONE_SPECIAL   0x0004   /* special vm_map_entry zone, see zget() */
   24 #define ZONE_BOOT      0x0010   /* Internal flag used by zbootinit */
   25 #define ZONE_USE_RESERVE 0x0020 /* use reserve memory if necessary */
   26 #define ZONE_DESTROYABLE 0x0040 /* can be zdestroy()'ed */
   27 
   28 #include <sys/spinlock.h>
   29 #include <sys/thread.h>
   30 
   31 /*
   32  * Zone allocator.
   33  * Zones are deprecated, use <sys/objcache.h> instead for new developments.
   34  * Zones are not thread-safe; the mp lock must be held while calling
   35  * zone functions.
   36  */
   37 typedef struct vm_zone {
   38         struct spinlock zlock;          /* lock for data structure */
   39         void            *zitems_pcpu[SMP_MAXCPU];
   40         int             zfreecnt_pcpu[SMP_MAXCPU];
   41         void            *zitems;        /* linked list of items */
   42         int             zfreecnt;       /* free entries */
   43         int             zfreemin;       /* minimum number of free entries */
   44         int             znalloc;        /* number of allocations */
   45         vm_offset_t     zkva;           /* Base kva of zone */
   46         int             zpagecount;     /* Total # of allocated pages */
   47         int             zpagemax;       /* Max address space */
   48         int             zmax;           /* Max number of entries allocated */
   49         int             ztotal;         /* Total entries allocated now */
   50         int             zsize;          /* size of each entry */
   51         int             zalloc;         /* hint for # of pages to alloc */
   52         int             zflags;         /* flags for zone */
   53         int             zallocflag;     /* flag for allocation */
   54         struct vm_object *zobj;         /* object to hold zone */
   55         char            *zname;         /* name for diags */
   56         LIST_ENTRY(vm_zone) zlink;      /* link in zlist */
   57         /*
   58          * The following fields track kmem_alloc()'ed blocks when
   59          * ZONE_DESTROYABLE set and normal zone (i.e. not ZONE_INTERRUPT nor
   60          * ZONE_SPECIAL).
   61          */
   62         vm_offset_t     *zkmvec;        /* krealloc()'ed array */
   63         int             zkmcur;         /* next free slot in zkmvec */
   64         int             zkmmax;         /* # of slots in zkmvec */
   65 } *vm_zone_t;
   66 
   67 
   68 void            zerror (int) __dead2;
   69 vm_zone_t       zinit (char *name, int size, int nentries, int flags,
   70                            int zalloc);
   71 int             zinitna (vm_zone_t z, struct vm_object *obj, char *name,
   72                              int size, int nentries, int flags, int zalloc);
   73 void *          zalloc (vm_zone_t z);
   74 void            zfree (vm_zone_t z, void *item);
   75 void            zbootinit (vm_zone_t z, char *name, int size, void *item,
   76                                int nitems);
   77 void            zdestroy(vm_zone_t z);
   78 
   79 #endif  /* _VM_VM_ZONE_H_ */

Cache object: 434a61b687504da0c0a6e89790b9fe47


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.