Deleted Added
full compact
uma_int.h (251826) uma_int.h (251894)
1/*-
2 * Copyright (c) 2002-2005, 2009, 2013 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-2005, 2009, 2013 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_int.h 251826 2013-06-17 03:43:47Z jeff $
27 * $FreeBSD: head/sys/vm/uma_int.h 251894 2013-06-18 04:50:20Z jeff $
28 *
29 */
30
31/*
32 * This file includes definitions, structures, prototypes, and inlines that
33 * should not be used outside of the actual implementation of UMA.
34 */
35

--- 156 unchanged lines hidden (view full) ---

192 struct mtx uk_lock; /* Lock for the keg */
193 struct uma_hash uk_hash;
194
195 LIST_HEAD(,uma_zone) uk_zones; /* Keg's zones */
196 LIST_HEAD(,uma_slab) uk_part_slab; /* partially allocated slabs */
197 LIST_HEAD(,uma_slab) uk_free_slab; /* empty slab list */
198 LIST_HEAD(,uma_slab) uk_full_slab; /* full slabs */
199
28 *
29 */
30
31/*
32 * This file includes definitions, structures, prototypes, and inlines that
33 * should not be used outside of the actual implementation of UMA.
34 */
35

--- 156 unchanged lines hidden (view full) ---

192 struct mtx uk_lock; /* Lock for the keg */
193 struct uma_hash uk_hash;
194
195 LIST_HEAD(,uma_zone) uk_zones; /* Keg's zones */
196 LIST_HEAD(,uma_slab) uk_part_slab; /* partially allocated slabs */
197 LIST_HEAD(,uma_slab) uk_free_slab; /* empty slab list */
198 LIST_HEAD(,uma_slab) uk_full_slab; /* full slabs */
199
200 uint32_t uk_recurse; /* Allocation recursion count */
201 uint32_t uk_align; /* Alignment mask */
202 uint32_t uk_pages; /* Total page count */
203 uint32_t uk_free; /* Count of items free in slabs */
204 uint32_t uk_size; /* Requested size of each item */
205 uint32_t uk_rsize; /* Real size of each item */
206 uint32_t uk_maxpages; /* Maximum number of pages to alloc */
207
208 uma_init uk_init; /* Keg's init routine */

--- 72 unchanged lines hidden (view full) ---

281 * TODO: Optimize for cache line size
282 *
283 */
284struct uma_zone {
285 const char *uz_name; /* Text name of the zone */
286 struct mtx *uz_lock; /* Lock for the zone (keg's lock) */
287
288 LIST_ENTRY(uma_zone) uz_link; /* List of all zones in keg */
200 uint32_t uk_align; /* Alignment mask */
201 uint32_t uk_pages; /* Total page count */
202 uint32_t uk_free; /* Count of items free in slabs */
203 uint32_t uk_size; /* Requested size of each item */
204 uint32_t uk_rsize; /* Real size of each item */
205 uint32_t uk_maxpages; /* Maximum number of pages to alloc */
206
207 uma_init uk_init; /* Keg's init routine */

--- 72 unchanged lines hidden (view full) ---

280 * TODO: Optimize for cache line size
281 *
282 */
283struct uma_zone {
284 const char *uz_name; /* Text name of the zone */
285 struct mtx *uz_lock; /* Lock for the zone (keg's lock) */
286
287 LIST_ENTRY(uma_zone) uz_link; /* List of all zones in keg */
289 LIST_HEAD(,uma_bucket) uz_full_bucket; /* full buckets */
290 LIST_HEAD(,uma_bucket) uz_free_bucket; /* Buckets for frees */
288 LIST_HEAD(,uma_bucket) uz_buckets; /* full buckets */
291
292 LIST_HEAD(,uma_klink) uz_kegs; /* List of kegs. */
293 struct uma_klink uz_klink; /* klink for first keg. */
294
295 uma_slaballoc uz_slab; /* Allocate a slab from the backend. */
296 uma_ctor uz_ctor; /* Constructor for each allocation */
297 uma_dtor uz_dtor; /* Destructor */
298 uma_init uz_init; /* Initializer for each item */

--- 4 unchanged lines hidden (view full) ---

303
304 uint32_t uz_flags; /* Flags inherited from kegs */
305 uint32_t uz_size; /* Size inherited from kegs */
306
307 volatile u_long uz_allocs UMA_ALIGN; /* Total number of allocations */
308 volatile u_long uz_fails; /* Total number of alloc failures */
309 volatile u_long uz_frees; /* Total number of frees */
310 uint64_t uz_sleeps; /* Total number of alloc sleeps */
289
290 LIST_HEAD(,uma_klink) uz_kegs; /* List of kegs. */
291 struct uma_klink uz_klink; /* klink for first keg. */
292
293 uma_slaballoc uz_slab; /* Allocate a slab from the backend. */
294 uma_ctor uz_ctor; /* Constructor for each allocation */
295 uma_dtor uz_dtor; /* Destructor */
296 uma_init uz_init; /* Initializer for each item */

--- 4 unchanged lines hidden (view full) ---

301
302 uint32_t uz_flags; /* Flags inherited from kegs */
303 uint32_t uz_size; /* Size inherited from kegs */
304
305 volatile u_long uz_allocs UMA_ALIGN; /* Total number of allocations */
306 volatile u_long uz_fails; /* Total number of alloc failures */
307 volatile u_long uz_frees; /* Total number of frees */
308 uint64_t uz_sleeps; /* Total number of alloc sleeps */
311 uint16_t uz_fills; /* Outstanding bucket fills */
312 uint16_t uz_count; /* Highest amount of items in bucket */
313
314 /* The next three fields are used to print a rate-limited warnings. */
315 const char *uz_warning; /* Warning to print on failure */
316 struct timeval uz_ratecheck; /* Warnings rate-limiting */
317
318 /*
319 * This HAS to be the last item because we adjust the zone size
320 * based on NCPU and then allocate the space for the zones.
321 */
322 struct uma_cache uz_cpu[1]; /* Per cpu caches */
323};
324
325/*
326 * These flags must not overlap with the UMA_ZONE flags specified in uma.h.
327 */
309 uint16_t uz_count; /* Highest amount of items in bucket */
310
311 /* The next three fields are used to print a rate-limited warnings. */
312 const char *uz_warning; /* Warning to print on failure */
313 struct timeval uz_ratecheck; /* Warnings rate-limiting */
314
315 /*
316 * This HAS to be the last item because we adjust the zone size
317 * based on NCPU and then allocate the space for the zones.
318 */
319 struct uma_cache uz_cpu[1]; /* Per cpu caches */
320};
321
322/*
323 * These flags must not overlap with the UMA_ZONE flags specified in uma.h.
324 */
328#define UMA_ZFLAG_BUCKET 0x02000000 /* Bucket zone. */
329#define UMA_ZFLAG_MULTI 0x04000000 /* Multiple kegs in the zone. */
330#define UMA_ZFLAG_DRAINING 0x08000000 /* Running zone_drain. */
331#define UMA_ZFLAG_PRIVALLOC 0x10000000 /* Use uz_allocf. */
332#define UMA_ZFLAG_INTERNAL 0x20000000 /* No offpage no PCPU. */
333#define UMA_ZFLAG_FULL 0x40000000 /* Reached uz_maxpages */
334#define UMA_ZFLAG_CACHEONLY 0x80000000 /* Don't ask VM for buckets. */
335
325#define UMA_ZFLAG_MULTI 0x04000000 /* Multiple kegs in the zone. */
326#define UMA_ZFLAG_DRAINING 0x08000000 /* Running zone_drain. */
327#define UMA_ZFLAG_PRIVALLOC 0x10000000 /* Use uz_allocf. */
328#define UMA_ZFLAG_INTERNAL 0x20000000 /* No offpage no PCPU. */
329#define UMA_ZFLAG_FULL 0x40000000 /* Reached uz_maxpages */
330#define UMA_ZFLAG_CACHEONLY 0x80000000 /* Don't ask VM for buckets. */
331
336#define UMA_ZFLAG_INHERIT (UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY | \
337 UMA_ZFLAG_BUCKET)
332#define UMA_ZFLAG_INHERIT (UMA_ZFLAG_INTERNAL | UMA_ZFLAG_CACHEONLY)
338
339static inline uma_keg_t
340zone_first_keg(uma_zone_t zone)
341{
342
343 return (LIST_FIRST(&zone->uz_kegs)->kl_keg);
344}
345

--- 16 unchanged lines hidden (view full) ---

362 mtx_init(&(k)->uk_lock, (k)->uk_name, \
363 "UMA zone", MTX_DEF | MTX_DUPOK); \
364 } while (0)
365
366#define KEG_LOCK_FINI(k) mtx_destroy(&(k)->uk_lock)
367#define KEG_LOCK(k) mtx_lock(&(k)->uk_lock)
368#define KEG_UNLOCK(k) mtx_unlock(&(k)->uk_lock)
369#define ZONE_LOCK(z) mtx_lock((z)->uz_lock)
333
334static inline uma_keg_t
335zone_first_keg(uma_zone_t zone)
336{
337
338 return (LIST_FIRST(&zone->uz_kegs)->kl_keg);
339}
340

--- 16 unchanged lines hidden (view full) ---

357 mtx_init(&(k)->uk_lock, (k)->uk_name, \
358 "UMA zone", MTX_DEF | MTX_DUPOK); \
359 } while (0)
360
361#define KEG_LOCK_FINI(k) mtx_destroy(&(k)->uk_lock)
362#define KEG_LOCK(k) mtx_lock(&(k)->uk_lock)
363#define KEG_UNLOCK(k) mtx_unlock(&(k)->uk_lock)
364#define ZONE_LOCK(z) mtx_lock((z)->uz_lock)
365#define ZONE_TRYLOCK(z) mtx_trylock((z)->uz_lock)
370#define ZONE_UNLOCK(z) mtx_unlock((z)->uz_lock)
371
372/*
373 * Find a slab within a hash table. This is used for OFFPAGE zones to lookup
374 * the slab structure.
375 *
376 * Arguments:
377 * hash The hash table to search.

--- 65 unchanged lines hidden ---
366#define ZONE_UNLOCK(z) mtx_unlock((z)->uz_lock)
367
368/*
369 * Find a slab within a hash table. This is used for OFFPAGE zones to lookup
370 * the slab structure.
371 *
372 * Arguments:
373 * hash The hash table to search.

--- 65 unchanged lines hidden ---