Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/uma_int.h
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | SLIST_REMOVE(&(h)->uh_slab_hash[UMA_HASH((h), \ | ||||
(mem))], (s), uma_slab, us_hlink) | (mem))], (s), uma_slab, us_hlink) | ||||
/* Hash table for freed address -> slab translation */ | /* Hash table for freed address -> slab translation */ | ||||
SLIST_HEAD(slabhead, uma_slab); | SLIST_HEAD(slabhead, uma_slab); | ||||
struct uma_hash { | struct uma_hash { | ||||
struct slabhead *uh_slab_hash; /* Hash table for slabs */ | struct slabhead *uh_slab_hash; /* Hash table for slabs */ | ||||
int uh_hashsize; /* Current size of the hash table */ | u_int uh_hashsize; /* Current size of the hash table */ | ||||
int uh_hashmask; /* Mask used during hashing */ | u_int uh_hashmask; /* Mask used during hashing */ | ||||
}; | }; | ||||
/* | /* | ||||
* align field or structure to cache line | * align field or structure to cache line | ||||
*/ | */ | ||||
#if defined(__amd64__) || defined(__powerpc64__) | #if defined(__amd64__) || defined(__powerpc64__) | ||||
#define UMA_ALIGN __aligned(128) | #define UMA_ALIGN __aligned(128) | ||||
#else | #else | ||||
▲ Show 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Returns: | * Returns: | ||||
* A pointer to a slab if successful, else NULL. | * A pointer to a slab if successful, else NULL. | ||||
*/ | */ | ||||
static __inline uma_slab_t | static __inline uma_slab_t | ||||
hash_sfind(struct uma_hash *hash, uint8_t *data) | hash_sfind(struct uma_hash *hash, uint8_t *data) | ||||
{ | { | ||||
uma_slab_t slab; | uma_slab_t slab; | ||||
int hval; | u_int hval; | ||||
hval = UMA_HASH(hash, data); | hval = UMA_HASH(hash, data); | ||||
SLIST_FOREACH(slab, &hash->uh_slab_hash[hval], us_hlink) { | SLIST_FOREACH(slab, &hash->uh_slab_hash[hval], us_hlink) { | ||||
if ((uint8_t *)slab->us_data == data) | if ((uint8_t *)slab->us_data == data) | ||||
return (slab); | return (slab); | ||||
} | } | ||||
return (NULL); | return (NULL); | ||||
Show All 34 Lines |