38 #if SIZEOF_SIZE_T == 4 || !defined(PG_HAVE_ATOMIC_U64_SUPPORT) || \
39 defined(USE_SMALL_DSA_POINTER)
40 #define SIZEOF_DSA_POINTER 4
42 #define SIZEOF_DSA_POINTER 8
52 #if SIZEOF_DSA_POINTER == 4
55 #define dsa_pointer_atomic_init pg_atomic_init_u32
56 #define dsa_pointer_atomic_read pg_atomic_read_u32
57 #define dsa_pointer_atomic_write pg_atomic_write_u32
58 #define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u32
59 #define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u32
60 #define DSA_POINTER_FORMAT "%08x"
64 #define dsa_pointer_atomic_init pg_atomic_init_u64
65 #define dsa_pointer_atomic_read pg_atomic_read_u64
66 #define dsa_pointer_atomic_write pg_atomic_write_u64
67 #define dsa_pointer_atomic_fetch_add pg_atomic_fetch_add_u64
68 #define dsa_pointer_atomic_compare_exchange pg_atomic_compare_exchange_u64
69 #define DSA_POINTER_FORMAT "%016" INT64_MODIFIER "x"
73 #define DSA_ALLOC_HUGE 0x01
74 #define DSA_ALLOC_NO_OOM 0x02
75 #define DSA_ALLOC_ZERO 0x04
78 #define InvalidDsaPointer ((dsa_pointer) 0)
85 #if SIZEOF_DSA_POINTER == 4
86 #define DSA_OFFSET_WIDTH 27
88 #define DSA_OFFSET_WIDTH 40
97 #define DSA_DEFAULT_INIT_SEGMENT_SIZE ((size_t) (1 * 1024 * 1024))
100 #define DSA_MIN_SEGMENT_SIZE ((size_t) (256 * 1024L))
103 #define DSA_MAX_SEGMENT_SIZE ((size_t) 1 << DSA_OFFSET_WIDTH)
106 #define DsaPointerIsValid(x) ((x) != InvalidDsaPointer)
109 #define dsa_allocate(area, size) \
110 dsa_allocate_extended(area, size, 0)
113 #define dsa_allocate0(area, size) \
114 dsa_allocate_extended(area, size, DSA_ALLOC_ZERO)
117 #define dsa_create(tranch_id) \
118 dsa_create_ext(tranch_id, DSA_DEFAULT_INIT_SEGMENT_SIZE, \
119 DSA_MAX_SEGMENT_SIZE)
122 #define dsa_create_in_place(place, size, tranch_id, segment) \
123 dsa_create_in_place_ext(place, size, tranch_id, segment, \
124 DSA_DEFAULT_INIT_SEGMENT_SIZE, \
125 DSA_MAX_SEGMENT_SIZE)
139 #define DSA_HANDLE_INVALID ((dsa_handle) DSM_HANDLE_INVALID)
142 size_t max_segment_size);
145 size_t init_segment_size,
146 size_t max_segment_size);
dsa_area * dsa_create_in_place_ext(void *place, size_t size, int tranche_id, dsm_segment *segment, size_t init_segment_size, size_t max_segment_size)
void dsa_trim(dsa_area *area)
dsa_pointer dsa_allocate_extended(dsa_area *area, size_t size, int flags)
size_t dsa_get_total_size(dsa_area *area)
dsa_area * dsa_attach(dsa_handle handle)
void dsa_on_shmem_exit_release_in_place(int, Datum)
void * dsa_get_address(dsa_area *area, dsa_pointer dp)
void dsa_release_in_place(void *place)
void dsa_set_size_limit(dsa_area *area, size_t limit)
pg_atomic_uint64 dsa_pointer_atomic
void dsa_unpin(dsa_area *area)
void dsa_pin_mapping(dsa_area *area)
void dsa_dump(dsa_area *area)
void dsa_on_dsm_detach_release_in_place(dsm_segment *, Datum)
dsa_handle dsa_get_handle(dsa_area *area)
void dsa_detach(dsa_area *area)
dsa_area * dsa_attach_in_place(void *place, dsm_segment *segment)
void dsa_free(dsa_area *area, dsa_pointer dp)
dsa_area * dsa_create_ext(int tranche_id, size_t init_segment_size, size_t max_segment_size)
size_t dsa_minimum_size(void)
void dsa_pin(dsa_area *area)
static pg_noinline void Size size