2010-01-17 01:53:50 +08:00
|
|
|
#define JEMALLOC_EXTENT_C_
|
2010-01-17 17:49:20 +08:00
|
|
|
#include "internal/jemalloc_internal.h"
|
2010-01-17 01:53:50 +08:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2010-01-24 18:53:40 +08:00
|
|
|
#if (defined(JEMALLOC_SWAP) || defined(JEMALLOC_DSS))
|
2010-01-17 01:53:50 +08:00
|
|
|
static inline int
|
|
|
|
extent_szad_comp(extent_node_t *a, extent_node_t *b)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
size_t a_size = a->size;
|
|
|
|
size_t b_size = b->size;
|
|
|
|
|
|
|
|
ret = (a_size > b_size) - (a_size < b_size);
|
|
|
|
if (ret == 0) {
|
|
|
|
uintptr_t a_addr = (uintptr_t)a->addr;
|
|
|
|
uintptr_t b_addr = (uintptr_t)b->addr;
|
|
|
|
|
|
|
|
ret = (a_addr > b_addr) - (a_addr < b_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wrap red-black tree macros in functions. */
|
|
|
|
rb_wrap(, extent_tree_szad_, extent_tree_t, extent_node_t, link_szad,
|
|
|
|
extent_szad_comp)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
extent_ad_comp(extent_node_t *a, extent_node_t *b)
|
|
|
|
{
|
|
|
|
uintptr_t a_addr = (uintptr_t)a->addr;
|
|
|
|
uintptr_t b_addr = (uintptr_t)b->addr;
|
|
|
|
|
|
|
|
return ((a_addr > b_addr) - (a_addr < b_addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wrap red-black tree macros in functions. */
|
|
|
|
rb_wrap(, extent_tree_ad_, extent_tree_t, extent_node_t, link_ad,
|
|
|
|
extent_ad_comp)
|