uma.h revision 166654
1234285Sdim/*- 2234285Sdim * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> 3234285Sdim * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4234285Sdim * All rights reserved. 5234285Sdim * 6234285Sdim * Redistribution and use in source and binary forms, with or without 7234285Sdim * modification, are permitted provided that the following conditions 8234285Sdim * are met: 9234285Sdim * 1. Redistributions of source code must retain the above copyright 10234285Sdim * notice unmodified, this list of conditions, and the following 11234285Sdim * disclaimer. 12234285Sdim * 2. Redistributions in binary form must reproduce the above copyright 13234285Sdim * notice, this list of conditions and the following disclaimer in the 14234285Sdim * documentation and/or other materials provided with the distribution. 15234285Sdim * 16234285Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17234285Sdim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18234285Sdim * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19234285Sdim * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20234285Sdim * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21234285Sdim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22234285Sdim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23234285Sdim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24234285Sdim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25234285Sdim * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26234285Sdim * 27234285Sdim * $FreeBSD: head/sys/vm/uma.h 166654 2007-02-11 20:13:52Z rwatson $ 28234285Sdim * 29234285Sdim */ 30234285Sdim 31234285Sdim/* 32263508Sdim * uma.h - External definitions for the Universal Memory Allocator 33234285Sdim * 34234285Sdim*/ 35234285Sdim 36234285Sdim#ifndef VM_UMA_H 37234285Sdim#define VM_UMA_H 38234285Sdim 39234285Sdim#include <sys/param.h> /* For NULL */ 40234285Sdim#include <sys/malloc.h> /* For M_* */ 41234285Sdim 42234285Sdim/* User visable parameters */ 43234285Sdim#define UMA_SMALLEST_UNIT (PAGE_SIZE / 256) /* Smallest item allocated */ 44234285Sdim 45234285Sdim/* Types and type defs */ 46234285Sdim 47249423Sdimstruct uma_zone; 48249423Sdim/* Opaque type used as a handle to the zone */ 49249423Sdimtypedef struct uma_zone * uma_zone_t; 50234285Sdim 51234285Sdimvoid zone_drain(uma_zone_t); 52234285Sdim 53249423Sdim/* 54234285Sdim * Item constructor 55234285Sdim * 56234285Sdim * Arguments: 57234285Sdim * item A pointer to the memory which has been allocated. 58234285Sdim * arg The arg field passed to uma_zalloc_arg 59234285Sdim * size The size of the allocated item 60234285Sdim * flags See zalloc flags 61234285Sdim * 62234285Sdim * Returns: 63234285Sdim * 0 on success 64234285Sdim * errno on failure 65234285Sdim * 66234285Sdim * Discussion: 67234285Sdim * The constructor is called just before the memory is returned 68234285Sdim * to the user. It may block if necessary. 69234285Sdim */ 70234285Sdimtypedef int (*uma_ctor)(void *mem, int size, void *arg, int flags); 71234285Sdim 72251662Sdim/* 73251662Sdim * Item destructor 74251662Sdim * 75251662Sdim * Arguments: 76251662Sdim * item A pointer to the memory which has been allocated. 77251662Sdim * size The size of the item being destructed. 78251662Sdim * arg Argument passed through uma_zfree_arg 79251662Sdim * 80234285Sdim * Returns: 81234285Sdim * Nothing 82234285Sdim * 83234285Sdim * Discussion: 84234285Sdim * The destructor may perform operations that differ from those performed 85234285Sdim * by the initializer, but it must leave the object in the same state. 86234285Sdim * This IS type stable storage. This is called after EVERY zfree call. 87234285Sdim */ 88251662Sdimtypedef void (*uma_dtor)(void *mem, int size, void *arg); 89251662Sdim 90251662Sdim/* 91234285Sdim * Item initializer 92234285Sdim * 93234285Sdim * Arguments: 94234285Sdim * item A pointer to the memory which has been allocated. 95234285Sdim * size The size of the item being initialized. 96234285Sdim * flags See zalloc flags 97234285Sdim * 98234285Sdim * Returns: 99234285Sdim * 0 on success 100234285Sdim * errno on failure 101234285Sdim * 102234285Sdim * Discussion: 103234285Sdim * The initializer is called when the memory is cached in the uma zone. 104234285Sdim * this should be the same state that the destructor leaves the object in. 105234285Sdim */ 106234285Sdimtypedef int (*uma_init)(void *mem, int size, int flags); 107234285Sdim 108234285Sdim/* 109251662Sdim * Item discard function 110251662Sdim * 111251662Sdim * Arguments: 112234285Sdim * item A pointer to memory which has been 'freed' but has not left the 113234285Sdim * zone's cache. 114234285Sdim * size The size of the item being discarded. 115234285Sdim * 116234285Sdim * Returns: 117234285Sdim * Nothing 118234285Sdim * 119234285Sdim * Discussion: 120243830Sdim * This routine is called when memory leaves a zone and is returned to the 121234285Sdim * system for other uses. It is the counter part to the init function. 122234285Sdim */ 123234285Sdimtypedef void (*uma_fini)(void *mem, int size); 124234285Sdim 125234285Sdim/* 126234285Sdim * What's the difference between initializing and constructing? 127234285Sdim * 128234285Sdim * The item is initialized when it is cached, and this is the state that the 129243830Sdim * object should be in when returned to the allocator. The purpose of this is 130234285Sdim * to remove some code which would otherwise be called on each allocation by 131234285Sdim * utilizing a known, stable state. This differs from the constructor which 132234285Sdim * will be called on EVERY allocation. 133234285Sdim * 134234285Sdim * For example, in the initializer you may want to initialize embeded locks, 135234285Sdim * NULL list pointers, set up initial states, magic numbers, etc. This way if 136234285Sdim * the object is held in the allocator and re-used it won't be necessary to 137234285Sdim * re-initialize it. 138234285Sdim * 139234285Sdim * The constructor may be used to lock a data structure, link it on to lists, 140234285Sdim * bump reference counts or total counts of outstanding structures, etc. 141234285Sdim * 142234285Sdim */ 143234285Sdim 144234285Sdim 145234285Sdim/* Function proto types */ 146234285Sdim 147234285Sdim/* 148234285Sdim * Create a new uma zone 149234285Sdim * 150234285Sdim * Arguments: 151234285Sdim * name The text name of the zone for debugging and stats, this memory 152234285Sdim * should not be freed until the zone has been deallocated. 153251662Sdim * size The size of the object that is being created. 154251662Sdim * ctor The constructor that is called when the object is allocated 155251662Sdim * dtor The destructor that is called when the object is freed. 156251662Sdim * init An initializer that sets up the initial state of the memory. 157251662Sdim * fini A discard function that undoes initialization done by init. 158251662Sdim * ctor/dtor/init/fini may all be null, see notes above. 159251662Sdim * align A bitmask that corisponds to the requested alignment 160251662Sdim * eg 4 would be 0x3 161251662Sdim * flags A set of parameters that control the behavior of the zone 162251662Sdim * 163251662Sdim * Returns: 164251662Sdim * A pointer to a structure which is intended to be opaque to users of 165251662Sdim * the interface. The value may be null if the wait flag is not set. 166251662Sdim */ 167251662Sdimuma_zone_t uma_zcreate(char *name, size_t size, uma_ctor ctor, uma_dtor dtor, 168243830Sdim uma_init uminit, uma_fini fini, int align, 169243830Sdim u_int32_t flags); 170243830Sdim 171243830Sdim/* 172243830Sdim * Create a secondary uma zone 173243830Sdim * 174243830Sdim * Arguments: 175243830Sdim * name The text name of the zone for debugging and stats, this memory 176243830Sdim * should not be freed until the zone has been deallocated. 177243830Sdim * ctor The constructor that is called when the object is allocated 178243830Sdim * dtor The destructor that is called when the object is freed. 179243830Sdim * zinit An initializer that sets up the initial state of the memory 180243830Sdim * as the object passes from the Keg's slab to the Zone's cache. 181243830Sdim * zfini A discard function that undoes initialization done by init 182243830Sdim * as the object passes from the Zone's cache to the Keg's slab. 183243830Sdim * 184243830Sdim * ctor/dtor/zinit/zfini may all be null, see notes above. 185243830Sdim * Note that the zinit and zfini specified here are NOT 186234285Sdim * exactly the same as the init/fini specified to uma_zcreate() 187234285Sdim * when creating a master zone. These zinit/zfini are called 188234285Sdim * on the TRANSITION from keg to zone (and vice-versa). Once 189234285Sdim * these are set, the primary zone may alter its init/fini 190234285Sdim * (which are called when the object passes from VM to keg) 191234285Sdim * using uma_zone_set_init/fini()) as well as its own 192234285Sdim * zinit/zfini (unset by default for master zone) with 193234285Sdim * uma_zone_set_zinit/zfini() (note subtle 'z' prefix). 194234285Sdim * 195234285Sdim * master A reference to this zone's Master Zone (Primary Zone), 196234285Sdim * which contains the backing Keg for the Secondary Zone 197234285Sdim * being added. 198234285Sdim * 199234285Sdim * Returns: 200234285Sdim * A pointer to a structure which is intended to be opaque to users of 201234285Sdim * the interface. The value may be null if the wait flag is not set. 202234285Sdim */ 203234285Sdimuma_zone_t uma_zsecond_create(char *name, uma_ctor ctor, uma_dtor dtor, 204234285Sdim uma_init zinit, uma_fini zfini, uma_zone_t master); 205234285Sdim 206234285Sdim/* 207234285Sdim * Definitions for uma_zcreate flags 208234285Sdim * 209234285Sdim * These flags share space with UMA_ZFLAGs in uma_int.h. Be careful not to 210234285Sdim * overlap when adding new features. 0xf0000000 is in use by uma_int.h. 211234285Sdim */ 212234285Sdim#define UMA_ZONE_PAGEABLE 0x0001 /* Return items not fully backed by 213234285Sdim physical memory XXX Not yet */ 214234285Sdim#define UMA_ZONE_ZINIT 0x0002 /* Initialize with zeros */ 215234285Sdim#define UMA_ZONE_STATIC 0x0004 /* Staticly sized zone */ 216234285Sdim#define UMA_ZONE_OFFPAGE 0x0008 /* Force the slab structure allocation 217234285Sdim off of the real memory */ 218234285Sdim#define UMA_ZONE_MALLOC 0x0010 /* For use by malloc(9) only! */ 219234285Sdim#define UMA_ZONE_NOFREE 0x0020 /* Do not free slabs of this type! */ 220234285Sdim#define UMA_ZONE_MTXCLASS 0x0040 /* Create a new lock class */ 221234285Sdim#define UMA_ZONE_VM 0x0080 /* 222234285Sdim * Used for internal vm datastructures 223234285Sdim * only. 224243830Sdim */ 225243830Sdim#define UMA_ZONE_HASH 0x0100 /* 226243830Sdim * Use a hash table instead of caching 227243830Sdim * information in the vm_page. 228243830Sdim */ 229243830Sdim#define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ 230243830Sdim#define UMA_ZONE_REFCNT 0x0400 /* Allocate refcnts in slabs */ 231243830Sdim#define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets */ 232243830Sdim 233243830Sdim/* Definitions for align */ 234243830Sdim#define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ 235243830Sdim#define UMA_ALIGN_LONG (sizeof(long) - 1) /* "" long */ 236243830Sdim#define UMA_ALIGN_INT (sizeof(int) - 1) /* "" int */ 237243830Sdim#define UMA_ALIGN_SHORT (sizeof(short) - 1) /* "" short */ 238243830Sdim#define UMA_ALIGN_CHAR (sizeof(char) - 1) /* "" char */ 239234285Sdim#define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ 240234285Sdim 241234285Sdim/* 242234285Sdim * Destroys an empty uma zone. If the zone is not empty uma complains loudly. 243234285Sdim * 244234285Sdim * Arguments: 245234285Sdim * zone The zone we want to destroy. 246234285Sdim * 247234285Sdim */ 248234285Sdimvoid uma_zdestroy(uma_zone_t zone); 249234285Sdim 250234285Sdim/* 251234285Sdim * Allocates an item out of a zone 252234285Sdim * 253234285Sdim * Arguments: 254234285Sdim * zone The zone we are allocating from 255234285Sdim * arg This data is passed to the ctor function 256234285Sdim * flags See sys/malloc.h for available flags. 257234285Sdim * 258234285Sdim * Returns: 259234285Sdim * A non null pointer to an initialized element from the zone is 260234285Sdim * garanteed if the wait flag is M_WAITOK, otherwise a null pointer may be 261234285Sdim * returned if the zone is empty or the ctor failed. 262234285Sdim */ 263234285Sdim 264234285Sdimvoid *uma_zalloc_arg(uma_zone_t zone, void *arg, int flags); 265234285Sdim 266234285Sdim/* 267234285Sdim * Allocates an item out of a zone without supplying an argument 268234285Sdim * 269234285Sdim * This is just a wrapper for uma_zalloc_arg for convenience. 270234285Sdim * 271234285Sdim */ 272234285Sdimstatic __inline void *uma_zalloc(uma_zone_t zone, int flags); 273234285Sdim 274234285Sdimstatic __inline void * 275234285Sdimuma_zalloc(uma_zone_t zone, int flags) 276234285Sdim{ 277234285Sdim return uma_zalloc_arg(zone, NULL, flags); 278234285Sdim} 279234285Sdim 280234285Sdim/* 281234285Sdim * Frees an item back into the specified zone. 282234285Sdim * 283234285Sdim * Arguments: 284234285Sdim * zone The zone the item was originally allocated out of. 285234285Sdim * item The memory to be freed. 286234285Sdim * arg Argument passed to the destructor 287234285Sdim * 288234285Sdim * Returns: 289234285Sdim * Nothing. 290234285Sdim */ 291234285Sdim 292234285Sdimvoid uma_zfree_arg(uma_zone_t zone, void *item, void *arg); 293234285Sdim 294234285Sdim/* 295234285Sdim * Frees an item back to a zone without supplying an argument 296234285Sdim * 297234285Sdim * This is just a wrapper for uma_zfree_arg for convenience. 298234285Sdim * 299234285Sdim */ 300234285Sdimstatic __inline void uma_zfree(uma_zone_t zone, void *item); 301234285Sdim 302234285Sdimstatic __inline void 303234285Sdimuma_zfree(uma_zone_t zone, void *item) 304234285Sdim{ 305234285Sdim uma_zfree_arg(zone, item, NULL); 306234285Sdim} 307234285Sdim 308234285Sdim/* 309234285Sdim * XXX The rest of the prototypes in this header are h0h0 magic for the VM. 310234285Sdim * If you think you need to use it for a normal zone you're probably incorrect. 311234285Sdim */ 312234285Sdim 313234285Sdim/* 314234285Sdim * Backend page supplier routines 315234285Sdim * 316234285Sdim * Arguments: 317234285Sdim * zone The zone that is requesting pages 318234285Sdim * size The number of bytes being requested 319234285Sdim * pflag Flags for these memory pages, see below. 320234285Sdim * wait Indicates our willingness to block. 321234285Sdim * 322234285Sdim * Returns: 323234285Sdim * A pointer to the alloced memory or NULL on failure. 324234285Sdim */ 325234285Sdim 326234285Sdimtypedef void *(*uma_alloc)(uma_zone_t zone, int size, u_int8_t *pflag, int wait); 327234285Sdim 328234285Sdim/* 329234285Sdim * Backend page free routines 330234285Sdim * 331234285Sdim * Arguments: 332234285Sdim * item A pointer to the previously allocated pages 333234285Sdim * size The original size of the allocation 334234285Sdim * pflag The flags for the slab. See UMA_SLAB_* below 335234285Sdim * 336234285Sdim * Returns: 337234285Sdim * None 338234285Sdim */ 339234285Sdimtypedef void (*uma_free)(void *item, int size, u_int8_t pflag); 340234285Sdim 341234285Sdim 342234285Sdim 343234285Sdim/* 344234285Sdim * Sets up the uma allocator. (Called by vm_mem_init) 345234285Sdim * 346234285Sdim * Arguments: 347 * bootmem A pointer to memory used to bootstrap the system. 348 * 349 * Returns: 350 * Nothing 351 * 352 * Discussion: 353 * This memory is used for zones which allocate things before the 354 * backend page supplier can give us pages. It should be 355 * UMA_SLAB_SIZE * boot_pages bytes. (see uma_int.h) 356 * 357 */ 358 359void uma_startup(void *bootmem, int boot_pages); 360 361/* 362 * Finishes starting up the allocator. This should 363 * be called when kva is ready for normal allocs. 364 * 365 * Arguments: 366 * None 367 * 368 * Returns: 369 * Nothing 370 * 371 * Discussion: 372 * uma_startup2 is called by kmeminit() to enable us of uma for malloc. 373 */ 374 375void uma_startup2(void); 376 377/* 378 * Reclaims unused memory for all zones 379 * 380 * Arguments: 381 * None 382 * Returns: 383 * None 384 * 385 * This should only be called by the page out daemon. 386 */ 387 388void uma_reclaim(void); 389 390/* 391 * Sets the alignment mask to be used for all zones requesting cache 392 * alignment. Should be called by MD boot code prior to starting VM/UMA. 393 * 394 * Arguments: 395 * align The alignment mask 396 * 397 * Returns: 398 * Nothing 399 */ 400void uma_set_align(int align); 401 402/* 403 * Switches the backing object of a zone 404 * 405 * Arguments: 406 * zone The zone to update 407 * obj The obj to use for future allocations 408 * size The size of the object to allocate 409 * 410 * Returns: 411 * 0 if kva space can not be allocated 412 * 1 if successful 413 * 414 * Discussion: 415 * A NULL object can be used and uma will allocate one for you. Setting 416 * the size will limit the amount of memory allocated to this zone. 417 * 418 */ 419struct vm_object; 420int uma_zone_set_obj(uma_zone_t zone, struct vm_object *obj, int size); 421 422/* 423 * Sets a high limit on the number of items allowed in a zone 424 * 425 * Arguments: 426 * zone The zone to limit 427 * 428 * Returns: 429 * Nothing 430 */ 431void uma_zone_set_max(uma_zone_t zone, int nitems); 432 433/* 434 * The following two routines (uma_zone_set_init/fini) 435 * are used to set the backend init/fini pair which acts on an 436 * object as it becomes allocated and is placed in a slab within 437 * the specified zone's backing keg. These should probably not 438 * be changed once allocations have already begun and only 439 * immediately upon zone creation. 440 */ 441void uma_zone_set_init(uma_zone_t zone, uma_init uminit); 442void uma_zone_set_fini(uma_zone_t zone, uma_fini fini); 443 444/* 445 * The following two routines (uma_zone_set_zinit/zfini) are 446 * used to set the zinit/zfini pair which acts on an object as 447 * it passes from the backing Keg's slab cache to the 448 * specified Zone's bucket cache. These should probably not 449 * be changed once allocations have already begun and 450 * only immediately upon zone creation. 451 */ 452void uma_zone_set_zinit(uma_zone_t zone, uma_init zinit); 453void uma_zone_set_zfini(uma_zone_t zone, uma_fini zfini); 454 455/* 456 * Replaces the standard page_alloc or obj_alloc functions for this zone 457 * 458 * Arguments: 459 * zone The zone whos back end allocator is being changed. 460 * allocf A pointer to the allocation function 461 * 462 * Returns: 463 * Nothing 464 * 465 * Discussion: 466 * This could be used to implement pageable allocation, or perhaps 467 * even DMA allocators if used in conjunction with the OFFPAGE 468 * zone flag. 469 */ 470 471void uma_zone_set_allocf(uma_zone_t zone, uma_alloc allocf); 472 473/* 474 * Used for freeing memory provided by the allocf above 475 * 476 * Arguments: 477 * zone The zone that intends to use this free routine. 478 * freef The page freeing routine. 479 * 480 * Returns: 481 * Nothing 482 */ 483 484void uma_zone_set_freef(uma_zone_t zone, uma_free freef); 485 486/* 487 * These flags are setable in the allocf and visable in the freef. 488 */ 489#define UMA_SLAB_BOOT 0x01 /* Slab alloced from boot pages */ 490#define UMA_SLAB_KMEM 0x02 /* Slab alloced from kmem_map */ 491#define UMA_SLAB_PRIV 0x08 /* Slab alloced from priv allocator */ 492#define UMA_SLAB_OFFP 0x10 /* Slab is managed separately */ 493#define UMA_SLAB_MALLOC 0x20 /* Slab is a large malloc slab */ 494/* 0x40 and 0x80 are available */ 495 496/* 497 * Used to pre-fill a zone with some number of items 498 * 499 * Arguments: 500 * zone The zone to fill 501 * itemcnt The number of items to reserve 502 * 503 * Returns: 504 * Nothing 505 * 506 * NOTE: This is blocking and should only be done at startup 507 */ 508void uma_prealloc(uma_zone_t zone, int itemcnt); 509 510/* 511 * Used to lookup the reference counter allocated for an item 512 * from a UMA_ZONE_REFCNT zone. For UMA_ZONE_REFCNT zones, 513 * reference counters are allocated for items and stored in 514 * the underlying slab header. 515 * 516 * Arguments: 517 * zone The UMA_ZONE_REFCNT zone to which the item belongs. 518 * item The address of the item for which we want a refcnt. 519 * 520 * Returns: 521 * A pointer to a u_int32_t reference counter. 522 */ 523u_int32_t *uma_find_refcnt(uma_zone_t zone, void *item); 524 525/* 526 * Used to determine if a fixed-size zone is exhausted. 527 * 528 * Arguments: 529 * zone The zone to check 530 * 531 * Returns: 532 * Non-zero if zone is exhausted. 533 */ 534int uma_zone_exhausted(uma_zone_t zone); 535int uma_zone_exhausted_nolock(uma_zone_t zone); 536 537/* 538 * Exported statistics structures to be used by user space monitoring tools. 539 * Statistics stream consusts of a uma_stream_header, followed by a series of 540 * alternative uma_type_header and uma_type_stat structures. Statistics 541 * structures 542 */ 543#define UMA_STREAM_VERSION 0x00000001 544struct uma_stream_header { 545 u_int32_t ush_version; /* Stream format version. */ 546 u_int32_t ush_maxcpus; /* Value of MAXCPU for stream. */ 547 u_int32_t ush_count; /* Number of records. */ 548 u_int32_t _ush_pad; /* Pad/reserved field. */ 549}; 550 551#define UTH_MAX_NAME 32 552#define UTH_ZONE_SECONDARY 0x00000001 553struct uma_type_header { 554 /* 555 * Static per-zone data, some extracted from the supporting keg. 556 */ 557 char uth_name[UTH_MAX_NAME]; 558 u_int32_t uth_align; /* Keg: alignment. */ 559 u_int32_t uth_size; /* Keg: requested size of item. */ 560 u_int32_t uth_rsize; /* Keg: real size of item. */ 561 u_int32_t uth_maxpages; /* Keg: maximum number of pages. */ 562 u_int32_t uth_limit; /* Keg: max items to allocate. */ 563 564 /* 565 * Current dynamic zone/keg-derived statistics. 566 */ 567 u_int32_t uth_pages; /* Keg: pages allocated. */ 568 u_int32_t uth_keg_free; /* Keg: items free. */ 569 u_int32_t uth_zone_free; /* Zone: items free. */ 570 u_int32_t uth_bucketsize; /* Zone: desired bucket size. */ 571 u_int32_t uth_zone_flags; /* Zone: flags. */ 572 u_int64_t uth_allocs; /* Zone: number of allocations. */ 573 u_int64_t uth_frees; /* Zone: number of frees. */ 574 u_int64_t uth_fails; /* Zone: number of alloc failures. */ 575 u_int64_t _uth_reserved1[3]; /* Reserved. */ 576}; 577 578struct uma_percpu_stat { 579 u_int64_t ups_allocs; /* Cache: number of alloctions. */ 580 u_int64_t ups_frees; /* Cache: number of frees. */ 581 u_int64_t ups_cache_free; /* Cache: free items in cache. */ 582 u_int64_t _ups_reserved[5]; /* Reserved. */ 583}; 584 585#endif 586