Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/uma_int.h
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | |||||
#define UMA_SLAB_SIZE PAGE_SIZE /* How big are our slabs? */ | #define UMA_SLAB_SIZE PAGE_SIZE /* How big are our slabs? */ | ||||
#define UMA_SLAB_MASK (PAGE_SIZE - 1) /* Mask to get back to the page */ | #define UMA_SLAB_MASK (PAGE_SIZE - 1) /* Mask to get back to the page */ | ||||
#define UMA_SLAB_SHIFT PAGE_SHIFT /* Number of bits PAGE_MASK */ | #define UMA_SLAB_SHIFT PAGE_SHIFT /* Number of bits PAGE_MASK */ | ||||
/* Max waste percentage before going to off page slab management */ | /* Max waste percentage before going to off page slab management */ | ||||
#define UMA_MAX_WASTE 10 | #define UMA_MAX_WASTE 10 | ||||
/* | |||||
* These flags must not overlap with the UMA_ZONE flags specified in uma.h. | |||||
*/ | |||||
#define UMA_ZFLAG_OFFPAGE 0x00200000 /* | |||||
* Force the slab structure | |||||
* allocation off of the real | |||||
* memory. | |||||
*/ | |||||
#define UMA_ZFLAG_HASH 0x00400000 /* | |||||
* Use a hash table instead of | |||||
* caching information in the | |||||
* vm_page. | |||||
*/ | |||||
#define UMA_ZFLAG_VTOSLAB 0x00800000 /* | |||||
* Zone uses vtoslab for | |||||
* lookup. | |||||
*/ | |||||
#define UMA_ZFLAG_CTORDTOR 0x01000000 /* Zone has ctor/dtor set. */ | |||||
#define UMA_ZFLAG_LIMIT 0x02000000 /* Zone has limit set. */ | |||||
#define UMA_ZFLAG_CACHE 0x04000000 /* uma_zcache_create()d it */ | |||||
#define UMA_ZFLAG_RECLAIMING 0x08000000 /* Running zone_reclaim(). */ | |||||
#define UMA_ZFLAG_BUCKET 0x10000000 /* Bucket zone. */ | |||||
#define UMA_ZFLAG_INTERNAL 0x20000000 /* No offpage no PCPU. */ | |||||
#define UMA_ZFLAG_TRASH 0x40000000 /* Add trash ctor/dtor. */ | |||||
#define UMA_ZFLAG_CACHEONLY 0x80000000 /* Don't ask VM for buckets. */ | |||||
#define UMA_ZFLAG_INHERIT \ | |||||
(UMA_ZFLAG_OFFPAGE | UMA_ZFLAG_HASH | UMA_ZFLAG_VTOSLAB | \ | |||||
UMA_ZFLAG_BUCKET | UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY) | |||||
#define PRINT_UMA_ZFLAGS "\20" \ | |||||
"\40CACHEONLY" \ | |||||
"\37TRASH" \ | |||||
"\36INTERNAL" \ | |||||
"\35BUCKET" \ | |||||
"\34RECLAIMING" \ | |||||
"\33CACHE" \ | |||||
"\32LIMIT" \ | |||||
"\31CTORDTOR" \ | |||||
"\30VTOSLAB" \ | |||||
"\27HASH" \ | |||||
"\26OFFPAGE" \ | |||||
"\22ROUNDROBIN" \ | |||||
"\21FIRSTTOUCH" \ | |||||
"\20PCPU" \ | |||||
"\17NODUMP" \ | |||||
"\16CACHESPREAD" \ | |||||
"\15MINBUCKET" \ | |||||
"\14MAXBUCKET" \ | |||||
"\13NOBUCKET" \ | |||||
"\12SECONDARY" \ | |||||
"\11NOTPAGE" \ | |||||
"\10VM" \ | |||||
"\7MTXCLASS" \ | |||||
"\6NOFREE" \ | |||||
"\5MALLOC" \ | |||||
"\4NOTOUCH" \ | |||||
"\2ZINIT" | |||||
/* | /* | ||||
* Hash table for freed address -> slab translation. | * Hash table for freed address -> slab translation. | ||||
* | * | ||||
* Only zones with memory not touchable by the allocator use the | * Only zones with memory not touchable by the allocator use the | ||||
* hash table. Otherwise slabs are found with vtoslab(). | * hash table. Otherwise slabs are found with vtoslab(). | ||||
*/ | */ | ||||
#define UMA_HASH_SIZE_INIT 32 | #define UMA_HASH_SIZE_INIT 32 | ||||
▲ Show 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
typedef struct uma_hash_slab * uma_hash_slab_t; | typedef struct uma_hash_slab * uma_hash_slab_t; | ||||
static inline void * | static inline void * | ||||
slab_data(uma_slab_t slab, uma_keg_t keg) | slab_data(uma_slab_t slab, uma_keg_t keg) | ||||
{ | { | ||||
if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0) | if ((keg->uk_flags & UMA_ZFLAG_OFFPAGE) == 0) | ||||
return ((void *)((uintptr_t)slab - keg->uk_pgoff)); | return ((void *)((uintptr_t)slab - keg->uk_pgoff)); | ||||
else | else | ||||
return (((uma_hash_slab_t)slab)->uhs_data); | return (((uma_hash_slab_t)slab)->uhs_data); | ||||
} | } | ||||
static inline void * | static inline void * | ||||
slab_item(uma_slab_t slab, uma_keg_t keg, int index) | slab_item(uma_slab_t slab, uma_keg_t keg, int index) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | struct uma_zone { | ||||
/* | /* | ||||
* This HAS to be the last item because we adjust the zone size | * This HAS to be the last item because we adjust the zone size | ||||
* based on NCPU and then allocate the space for the zones. | * based on NCPU and then allocate the space for the zones. | ||||
*/ | */ | ||||
struct uma_cache uz_cpu[]; /* Per cpu caches */ | struct uma_cache uz_cpu[]; /* Per cpu caches */ | ||||
/* uz_domain follows here. */ | /* uz_domain follows here. */ | ||||
}; | }; | ||||
/* | |||||
* These flags must not overlap with the UMA_ZONE flags specified in uma.h. | |||||
*/ | |||||
#define UMA_ZFLAG_CTORDTOR 0x01000000 /* Zone has ctor/dtor set. */ | |||||
#define UMA_ZFLAG_LIMIT 0x02000000 /* Zone has limit set. */ | |||||
#define UMA_ZFLAG_CACHE 0x04000000 /* uma_zcache_create()d it */ | |||||
#define UMA_ZFLAG_RECLAIMING 0x08000000 /* Running zone_reclaim(). */ | |||||
#define UMA_ZFLAG_BUCKET 0x10000000 /* Bucket zone. */ | |||||
#define UMA_ZFLAG_INTERNAL 0x20000000 /* No offpage no PCPU. */ | |||||
#define UMA_ZFLAG_TRASH 0x40000000 /* Add trash ctor/dtor. */ | |||||
#define UMA_ZFLAG_CACHEONLY 0x80000000 /* Don't ask VM for buckets. */ | |||||
#define UMA_ZFLAG_INHERIT \ | |||||
(UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY | UMA_ZFLAG_BUCKET) | |||||
#define PRINT_UMA_ZFLAGS "\20" \ | |||||
"\40CACHEONLY" \ | |||||
"\37TRASH" \ | |||||
"\36INTERNAL" \ | |||||
"\35BUCKET" \ | |||||
"\34RECLAIMING" \ | |||||
"\33CACHE" \ | |||||
"\32LIMIT" \ | |||||
"\31CTORDTOR" \ | |||||
"\23ROUNDROBIN" \ | |||||
"\22FIRSTTOUCH" \ | |||||
"\21MINBUCKET" \ | |||||
"\20PCPU" \ | |||||
"\17NODUMP" \ | |||||
"\16VTOSLAB" \ | |||||
"\15CACHESPREAD" \ | |||||
"\14MAXBUCKET" \ | |||||
"\13NOBUCKET" \ | |||||
"\12SECONDARY" \ | |||||
"\11HASH" \ | |||||
"\10VM" \ | |||||
"\7MTXCLASS" \ | |||||
"\6NOFREE" \ | |||||
"\5MALLOC" \ | |||||
"\4OFFPAGE" \ | |||||
"\3STATIC" \ | |||||
"\2ZINIT" \ | |||||
"\1PAGEABLE" | |||||
/* | /* | ||||
* Macros for interpreting the uz_items field. 20 bits of sleeper count | * Macros for interpreting the uz_items field. 20 bits of sleeper count | ||||
* and 44 bit of item count. | * and 44 bit of item count. | ||||
*/ | */ | ||||
#define UZ_ITEMS_SLEEPER_SHIFT 44LL | #define UZ_ITEMS_SLEEPER_SHIFT 44LL | ||||
#define UZ_ITEMS_SLEEPERS_MAX ((1 << (64 - UZ_ITEMS_SLEEPER_SHIFT)) - 1) | #define UZ_ITEMS_SLEEPERS_MAX ((1 << (64 - UZ_ITEMS_SLEEPER_SHIFT)) - 1) | ||||
#define UZ_ITEMS_COUNT_MASK ((1LL << UZ_ITEMS_SLEEPER_SHIFT) - 1) | #define UZ_ITEMS_COUNT_MASK ((1LL << UZ_ITEMS_SLEEPER_SHIFT) - 1) | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |