uma.h (295222) | uma.h (296243) |
---|---|
1/*- 2 * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> 3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * | 1/*- 2 * Copyright (c) 2002, 2003, 2004, 2005 Jeffrey Roberson <jeff@FreeBSD.org> 3 * Copyright (c) 2004, 2005 Bosko Milekic <bmilekic@FreeBSD.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/vm/uma.h 295222 2016-02-03 23:30:17Z glebius $ | 27 * $FreeBSD: head/sys/vm/uma.h 296243 2016-03-01 00:33:32Z glebius $ |
28 * 29 */ 30 31/* 32 * uma.h - External definitions for the Universal Memory Allocator 33 * 34*/ 35 --- 221 unchanged lines hidden (view full) --- 257 * Used for internal vm datastructures 258 * only. 259 */ 260#define UMA_ZONE_HASH 0x0100 /* 261 * Use a hash table instead of caching 262 * information in the vm_page. 263 */ 264#define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ | 28 * 29 */ 30 31/* 32 * uma.h - External definitions for the Universal Memory Allocator 33 * 34*/ 35 --- 221 unchanged lines hidden (view full) --- 257 * Used for internal vm datastructures 258 * only. 259 */ 260#define UMA_ZONE_HASH 0x0100 /* 261 * Use a hash table instead of caching 262 * information in the vm_page. 263 */ 264#define UMA_ZONE_SECONDARY 0x0200 /* Zone is a Secondary Zone */ |
265#define UMA_ZONE_REFCNT 0x0400 /* Allocate refcnts in slabs */ | 265/* 0x0400 Unused */ |
266#define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets */ 267#define UMA_ZONE_CACHESPREAD 0x1000 /* 268 * Spread memory start locations across 269 * all possible cache lines. May 270 * require many virtually contiguous 271 * backend pages and can fail early. 272 */ 273#define UMA_ZONE_VTOSLAB 0x2000 /* Zone uses vtoslab for lookup. */ --- 8 unchanged lines hidden (view full) --- 282 283/* 284 * These flags are shared between the keg and zone. In zones wishing to add 285 * new kegs these flags must be compatible. Some are determined based on 286 * physical parameters of the request and may not be provided by the consumer. 287 */ 288#define UMA_ZONE_INHERIT \ 289 (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \ | 266#define UMA_ZONE_MAXBUCKET 0x0800 /* Use largest buckets */ 267#define UMA_ZONE_CACHESPREAD 0x1000 /* 268 * Spread memory start locations across 269 * all possible cache lines. May 270 * require many virtually contiguous 271 * backend pages and can fail early. 272 */ 273#define UMA_ZONE_VTOSLAB 0x2000 /* Zone uses vtoslab for lookup. */ --- 8 unchanged lines hidden (view full) --- 282 283/* 284 * These flags are shared between the keg and zone. In zones wishing to add 285 * new kegs these flags must be compatible. Some are determined based on 286 * physical parameters of the request and may not be provided by the consumer. 287 */ 288#define UMA_ZONE_INHERIT \ 289 (UMA_ZONE_OFFPAGE | UMA_ZONE_MALLOC | UMA_ZONE_NOFREE | \ |
290 UMA_ZONE_HASH | UMA_ZONE_REFCNT | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU) | 290 UMA_ZONE_HASH | UMA_ZONE_VTOSLAB | UMA_ZONE_PCPU) |
291 292/* Definitions for align */ 293#define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ 294#define UMA_ALIGN_LONG (sizeof(long) - 1) /* "" long */ 295#define UMA_ALIGN_INT (sizeof(int) - 1) /* "" int */ 296#define UMA_ALIGN_SHORT (sizeof(short) - 1) /* "" short */ 297#define UMA_ALIGN_CHAR (sizeof(char) - 1) /* "" char */ 298#define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ --- 319 unchanged lines hidden (view full) --- 618 * Returns: 619 * Nothing 620 * 621 * NOTE: This is blocking and should only be done at startup 622 */ 623void uma_prealloc(uma_zone_t zone, int itemcnt); 624 625/* | 291 292/* Definitions for align */ 293#define UMA_ALIGN_PTR (sizeof(void *) - 1) /* Alignment fit for ptr */ 294#define UMA_ALIGN_LONG (sizeof(long) - 1) /* "" long */ 295#define UMA_ALIGN_INT (sizeof(int) - 1) /* "" int */ 296#define UMA_ALIGN_SHORT (sizeof(short) - 1) /* "" short */ 297#define UMA_ALIGN_CHAR (sizeof(char) - 1) /* "" char */ 298#define UMA_ALIGN_CACHE (0 - 1) /* Cache line size align */ --- 319 unchanged lines hidden (view full) --- 618 * Returns: 619 * Nothing 620 * 621 * NOTE: This is blocking and should only be done at startup 622 */ 623void uma_prealloc(uma_zone_t zone, int itemcnt); 624 625/* |
626 * Used to lookup the reference counter allocated for an item 627 * from a UMA_ZONE_REFCNT zone. For UMA_ZONE_REFCNT zones, 628 * reference counters are allocated for items and stored in 629 * the underlying slab header. 630 * 631 * Arguments: 632 * zone The UMA_ZONE_REFCNT zone to which the item belongs. 633 * item The address of the item for which we want a refcnt. 634 * 635 * Returns: 636 * A pointer to a uint32_t reference counter. 637 */ 638uint32_t *uma_find_refcnt(uma_zone_t zone, void *item); 639 640/* | |
641 * Used to determine if a fixed-size zone is exhausted. 642 * 643 * Arguments: 644 * zone The zone to check 645 * 646 * Returns: 647 * Non-zero if zone is exhausted. 648 */ --- 61 unchanged lines hidden --- | 626 * Used to determine if a fixed-size zone is exhausted. 627 * 628 * Arguments: 629 * zone The zone to check 630 * 631 * Returns: 632 * Non-zero if zone is exhausted. 633 */ --- 61 unchanged lines hidden --- |