1 #ifndef JEMALLOC_INTERNAL_EXTENT_STRUCTS_H
2 #define JEMALLOC_INTERNAL_EXTENT_STRUCTS_H
3 
4 /* Extent (span of pages).  Use accessor functions for e_* fields. */
5 struct extent_s {
6 	/* Arena from which this extent came, if any. */
7 	arena_t			*e_arena;
8 
9 	/* Pointer to the extent that this structure is responsible for. */
10 	void			*e_addr;
11 
12 	/* Extent size. */
13 	size_t			e_size;
14 
15 	/*
16 	 * Usable size, typically smaller than extent size due to large_pad or
17 	 * promotion of sampled small regions.
18 	 */
19 	size_t			e_usize;
20 
21 	/*
22 	 * Serial number (potentially non-unique).
23 	 *
24 	 * In principle serial numbers can wrap around on 32-bit systems if
25 	 * JEMALLOC_MUNMAP is defined, but as long as comparison functions fall
26 	 * back on address comparison for equal serial numbers, stable (if
27 	 * imperfect) ordering is maintained.
28 	 *
29 	 * Serial numbers may not be unique even in the absence of wrap-around,
30 	 * e.g. when splitting an extent and assigning the same serial number to
31 	 * both resulting adjacent extents.
32 	 */
33 	size_t			e_sn;
34 
35 	/* True if extent is active (in use). */
36 	bool			e_active;
37 
38 	/*
39 	 * The zeroed flag is used by extent recycling code to track whether
40 	 * memory is zero-filled.
41 	 */
42 	bool			e_zeroed;
43 
44 	/*
45 	 * True if physical memory is committed to the extent, whether
46 	 * explicitly or implicitly as on a system that overcommits and
47 	 * satisfies physical memory needs on demand via soft page faults.
48 	 */
49 	bool			e_committed;
50 
51 	/*
52 	 * The slab flag indicates whether the extent is used for a slab of
53 	 * small regions.  This helps differentiate small size classes, and it
54 	 * indicates whether interior pointers can be looked up via iealloc().
55 	 */
56 	bool			e_slab;
57 
58 	union {
59 		/* Small region slab metadata. */
60 		arena_slab_data_t	e_slab_data;
61 
62 		/* Profile counters, used for large objects. */
63 		union {
64 			void		*e_prof_tctx_pun;
65 			prof_tctx_t	*e_prof_tctx;
66 		};
67 	};
68 
69 	/*
70 	 * Linkage for arena's extents_dirty and arena_bin_t's slabs_full rings.
71 	 */
72 	qr(extent_t)		qr_link;
73 
74 	union {
75 		/* Linkage for per size class sn/address-ordered heaps. */
76 		phn(extent_t)		ph_link;
77 
78 		/* Linkage for arena's large and extent_cache lists. */
79 		ql_elm(extent_t)	ql_link;
80 	};
81 };
82 typedef ph(extent_t) extent_heap_t;
83 
84 #endif /* JEMALLOC_INTERNAL_EXTENT_STRUCTS_H */
85