extent_t bitpacking logic refactoring
This commit is contained in:
parent
f47e39d11a
commit
72bdbc35e3
@ -86,42 +86,42 @@ struct extent_s {
|
|||||||
* serial number to both resulting adjacent extents.
|
* serial number to both resulting adjacent extents.
|
||||||
*/
|
*/
|
||||||
uint64_t e_bits;
|
uint64_t e_bits;
|
||||||
#define EXTENT_BITS_ARENA_SHIFT 0
|
#define MASK(CURRENT_FIELD_WIDTH, CURRENT_FIELD_SHIFT) ((((((uint64_t)0x1U) << (CURRENT_FIELD_WIDTH)) - 1)) << (CURRENT_FIELD_SHIFT))
|
||||||
#define EXTENT_BITS_ARENA_MASK \
|
|
||||||
(((uint64_t)(1U << MALLOCX_ARENA_BITS) - 1) << EXTENT_BITS_ARENA_SHIFT)
|
|
||||||
|
|
||||||
#define EXTENT_BITS_SLAB_SHIFT MALLOCX_ARENA_BITS
|
#define EXTENT_BITS_ARENA_WIDTH MALLOCX_ARENA_BITS
|
||||||
#define EXTENT_BITS_SLAB_MASK \
|
#define EXTENT_BITS_ARENA_SHIFT 0
|
||||||
((uint64_t)0x1U << EXTENT_BITS_SLAB_SHIFT)
|
#define EXTENT_BITS_ARENA_MASK MASK(EXTENT_BITS_ARENA_WIDTH, EXTENT_BITS_ARENA_SHIFT)
|
||||||
|
|
||||||
#define EXTENT_BITS_COMMITTED_SHIFT (MALLOCX_ARENA_BITS + 1)
|
#define EXTENT_BITS_SLAB_WIDTH 1
|
||||||
#define EXTENT_BITS_COMMITTED_MASK \
|
#define EXTENT_BITS_SLAB_SHIFT (EXTENT_BITS_ARENA_WIDTH + EXTENT_BITS_ARENA_SHIFT)
|
||||||
((uint64_t)0x1U << EXTENT_BITS_COMMITTED_SHIFT)
|
#define EXTENT_BITS_SLAB_MASK MASK(EXTENT_BITS_SLAB_WIDTH, EXTENT_BITS_SLAB_SHIFT)
|
||||||
|
|
||||||
#define EXTENT_BITS_DUMPABLE_SHIFT (MALLOCX_ARENA_BITS + 2)
|
#define EXTENT_BITS_COMMITTED_WIDTH 1
|
||||||
#define EXTENT_BITS_DUMPABLE_MASK \
|
#define EXTENT_BITS_COMMITTED_SHIFT (EXTENT_BITS_SLAB_WIDTH + EXTENT_BITS_SLAB_SHIFT)
|
||||||
((uint64_t)0x1U << EXTENT_BITS_DUMPABLE_SHIFT)
|
#define EXTENT_BITS_COMMITTED_MASK MASK(EXTENT_BITS_COMMITTED_WIDTH, EXTENT_BITS_COMMITTED_SHIFT)
|
||||||
|
|
||||||
#define EXTENT_BITS_ZEROED_SHIFT (MALLOCX_ARENA_BITS + 3)
|
#define EXTENT_BITS_DUMPABLE_WIDTH 1
|
||||||
#define EXTENT_BITS_ZEROED_MASK \
|
#define EXTENT_BITS_DUMPABLE_SHIFT (EXTENT_BITS_COMMITTED_WIDTH + EXTENT_BITS_COMMITTED_SHIFT)
|
||||||
((uint64_t)0x1U << EXTENT_BITS_ZEROED_SHIFT)
|
#define EXTENT_BITS_DUMPABLE_MASK MASK(EXTENT_BITS_DUMPABLE_WIDTH, EXTENT_BITS_DUMPABLE_SHIFT)
|
||||||
|
|
||||||
#define EXTENT_BITS_STATE_SHIFT (MALLOCX_ARENA_BITS + 4)
|
#define EXTENT_BITS_ZEROED_WIDTH 1
|
||||||
#define EXTENT_BITS_STATE_MASK \
|
#define EXTENT_BITS_ZEROED_SHIFT (EXTENT_BITS_DUMPABLE_WIDTH + EXTENT_BITS_DUMPABLE_SHIFT)
|
||||||
((uint64_t)0x3U << EXTENT_BITS_STATE_SHIFT)
|
#define EXTENT_BITS_ZEROED_MASK MASK(EXTENT_BITS_ZEROED_WIDTH, EXTENT_BITS_ZEROED_SHIFT)
|
||||||
|
|
||||||
#define EXTENT_BITS_SZIND_SHIFT (MALLOCX_ARENA_BITS + 6)
|
#define EXTENT_BITS_STATE_WIDTH 2
|
||||||
#define EXTENT_BITS_SZIND_MASK \
|
#define EXTENT_BITS_STATE_SHIFT (EXTENT_BITS_ZEROED_WIDTH + EXTENT_BITS_ZEROED_SHIFT)
|
||||||
(((uint64_t)(1U << LG_CEIL_NSIZES) - 1) << EXTENT_BITS_SZIND_SHIFT)
|
#define EXTENT_BITS_STATE_MASK MASK(EXTENT_BITS_STATE_WIDTH, EXTENT_BITS_STATE_SHIFT)
|
||||||
|
|
||||||
#define EXTENT_BITS_NFREE_SHIFT \
|
#define EXTENT_BITS_SZIND_WIDTH LG_CEIL_NSIZES
|
||||||
(MALLOCX_ARENA_BITS + 6 + LG_CEIL_NSIZES)
|
#define EXTENT_BITS_SZIND_SHIFT (EXTENT_BITS_STATE_WIDTH + EXTENT_BITS_STATE_SHIFT)
|
||||||
#define EXTENT_BITS_NFREE_MASK \
|
#define EXTENT_BITS_SZIND_MASK MASK(EXTENT_BITS_SZIND_WIDTH, EXTENT_BITS_SZIND_SHIFT)
|
||||||
((uint64_t)((1U << (LG_SLAB_MAXREGS + 1)) - 1) << EXTENT_BITS_NFREE_SHIFT)
|
|
||||||
|
|
||||||
#define EXTENT_BITS_SN_SHIFT \
|
#define EXTENT_BITS_NFREE_WIDTH (LG_SLAB_MAXREGS + 1)
|
||||||
(MALLOCX_ARENA_BITS + 6 + LG_CEIL_NSIZES + (LG_SLAB_MAXREGS + 1))
|
#define EXTENT_BITS_NFREE_SHIFT (EXTENT_BITS_SZIND_WIDTH + EXTENT_BITS_SZIND_SHIFT)
|
||||||
#define EXTENT_BITS_SN_MASK (UINT64_MAX << EXTENT_BITS_SN_SHIFT)
|
#define EXTENT_BITS_NFREE_MASK MASK(EXTENT_BITS_NFREE_WIDTH, EXTENT_BITS_NFREE_SHIFT)
|
||||||
|
|
||||||
|
#define EXTENT_BITS_SN_SHIFT (EXTENT_BITS_NFREE_WIDTH + EXTENT_BITS_NFREE_SHIFT)
|
||||||
|
#define EXTENT_BITS_SN_MASK (UINT64_MAX << EXTENT_BITS_SN_SHIFT)
|
||||||
|
|
||||||
/* Pointer to the extent that this structure is responsible for. */
|
/* Pointer to the extent that this structure is responsible for. */
|
||||||
void *e_addr;
|
void *e_addr;
|
||||||
|
Loading…
Reference in New Issue
Block a user