PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "port/atomics.h"
#include "port/pg_bitutils.h"
#include "storage/dsm.h"
#include "storage/lwlock.h"
#include "utils/dsa.h"
#include "utils/freepage.h"
#include "utils/memutils.h"
#include "utils/resowner.h"
Go to the source code of this file.
Data Structures | |
struct | dsa_segment_header |
struct | dsa_area_span |
struct | dsa_area_pool |
struct | dsa_area_control |
struct | dsa_segment_map |
struct | dsa_area |
Typedefs | |
typedef size_t | dsa_segment_index |
Functions | |
static size_t | contiguous_pages_to_segment_bin (size_t n) |
static void | init_span (dsa_area *area, dsa_pointer span_pointer, dsa_area_pool *pool, dsa_pointer start, size_t npages, uint16 size_class) |
static bool | transfer_first_span (dsa_area *area, dsa_area_pool *pool, int fromclass, int toclass) |
static dsa_pointer | alloc_object (dsa_area *area, int size_class) |
static bool | ensure_active_superblock (dsa_area *area, dsa_area_pool *pool, int size_class) |
static dsa_segment_map * | get_segment_by_index (dsa_area *area, dsa_segment_index index) |
static void | destroy_superblock (dsa_area *area, dsa_pointer span_pointer) |
static void | unlink_span (dsa_area *area, dsa_area_span *span) |
static void | add_span_to_fullness_class (dsa_area *area, dsa_area_span *span, dsa_pointer span_pointer, int fclass) |
static void | unlink_segment (dsa_area *area, dsa_segment_map *segment_map) |
static dsa_segment_map * | get_best_segment (dsa_area *area, size_t npages) |
static dsa_segment_map * | make_new_segment (dsa_area *area, size_t requested_pages) |
static dsa_area * | create_internal (void *place, size_t size, int tranche_id, dsm_handle control_handle, dsm_segment *control_segment, size_t init_segment_size, size_t max_segment_size) |
static dsa_area * | attach_internal (void *place, dsm_segment *segment, dsa_handle handle) |
static void | check_for_freed_segments (dsa_area *area) |
static void | check_for_freed_segments_locked (dsa_area *area) |
static void | rebin_segment (dsa_area *area, dsa_segment_map *segment_map) |
dsa_area * | dsa_create_ext (int tranche_id, size_t init_segment_size, 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) |
dsa_handle | dsa_get_handle (dsa_area *area) |
dsa_area * | dsa_attach (dsa_handle handle) |
dsa_area * | dsa_attach_in_place (void *place, dsm_segment *segment) |
void | dsa_on_dsm_detach_release_in_place (dsm_segment *segment, Datum place) |
void | dsa_on_shmem_exit_release_in_place (int code, Datum place) |
void | dsa_release_in_place (void *place) |
void | dsa_pin_mapping (dsa_area *area) |
dsa_pointer | dsa_allocate_extended (dsa_area *area, size_t size, int flags) |
void | dsa_free (dsa_area *area, dsa_pointer dp) |
void * | dsa_get_address (dsa_area *area, dsa_pointer dp) |
void | dsa_pin (dsa_area *area) |
void | dsa_unpin (dsa_area *area) |
void | dsa_set_size_limit (dsa_area *area, size_t limit) |
size_t | dsa_get_total_size (dsa_area *area) |
void | dsa_trim (dsa_area *area) |
void | dsa_dump (dsa_area *area) |
size_t | dsa_minimum_size (void) |
void | dsa_detach (dsa_area *area) |
Variables | |
static const uint16 | dsa_size_classes [] |
static const uint8 | dsa_size_class_map [] |
#define DSA_EXTRACT_OFFSET | ( | dp | ) | ((dp) & DSA_OFFSET_BITMASK) |
#define DSA_EXTRACT_SEGMENT_NUMBER | ( | dp | ) | ((dp) >> DSA_OFFSET_WIDTH) |
#define DSA_MAKE_POINTER | ( | segment_number, | |
offset | |||
) | (((dsa_pointer) (segment_number) << DSA_OFFSET_WIDTH) | (offset)) |
#define DSA_MAX_SEGMENTS Min(1024, (1 << ((SIZEOF_DSA_POINTER * 8) - DSA_OFFSET_WIDTH))) |
#define DSA_NUM_SIZE_CLASSES lengthof(dsa_size_classes) |
#define DSA_OFFSET_BITMASK (((dsa_pointer) 1 << DSA_OFFSET_WIDTH) - 1) |
#define DSA_SCLASS_LOCK | ( | area, | |
sclass | |||
) | (&area->control->pools[sclass].lock) |
#define DSA_SEGMENT_INDEX_NONE (~(dsa_segment_index)0) |
#define DSA_SUPERBLOCK_SIZE (DSA_PAGES_PER_SUPERBLOCK * FPM_PAGE_SIZE) |
#define DsaAreaPoolToDsaPointer | ( | area, | |
p | |||
) | DSA_MAKE_POINTER(0, (char *) p - (char *) area->control) |
#define get_segment_index | ( | area, | |
segment_map_ptr | |||
) | (segment_map_ptr - &area->segment_maps[0]) |
typedef size_t dsa_segment_index |
|
static |
Definition at line 1929 of file dsa.c.
References dsa_get_address(), DsaPointerIsValid, dsa_area_span::fclass, InvalidDsaPointer, dsa_area_span::nextspan, dsa_area_span::pool, dsa_area_span::prevspan, and dsa_area_pool::spans.
Referenced by dsa_free().
|
inlinestatic |
Definition at line 1472 of file dsa.c.
References Assert, dsa_area::control, DSA_FULLNESS_CLASSES, dsa_get_address(), DSA_NUM_SIZE_CLASSES, DSA_SCLASS_LOCK, dsa_size_classes, DSA_SPAN_NOTHING_FREE, DsaPointerIsValid, ensure_active_superblock(), dsa_area_span::firstfree, InvalidDsaPointer, LW_EXCLUSIVE, LWLockAcquire(), LWLockHeldByMe(), LWLockRelease(), dsa_area_span::nallocatable, NextFreeObjectIndex, dsa_area_span::ninitialized, dsa_area_control::pools, size, dsa_area_pool::spans, dsa_area_span::start, and transfer_first_span().
Referenced by dsa_allocate_extended(), and ensure_active_superblock().
|
static |
Definition at line 1326 of file dsa.c.
References Assert, dsa_area::control, CurrentResourceOwner, DSA_AREA_LOCK, DSA_MAX_SEGMENTS, DSA_SEGMENT_HEADER_MAGIC, ereport, errcode(), errmsg(), ERROR, dsa_segment_map::fpm, dsa_area_control::freed_segment_counter, dsa_area::freed_segment_counter, dsa_area_control::handle, dsa_segment_map::header, dsa_area::high_segment_index, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_segment_header::magic, dsa_segment_map::mapped_address, MAXALIGN, dsa_segment_map::pagemap, palloc(), dsa_area_control::refcnt, dsa_area::resowner, dsa_segment_map::segment, dsa_area_control::segment_handles, dsa_area_control::segment_header, and dsa_area::segment_maps.
Referenced by dsa_attach(), and dsa_attach_in_place().
|
static |
Definition at line 2252 of file dsa.c.
References check_for_freed_segments_locked(), dsa_area::control, DSA_AREA_LOCK, dsa_area_control::freed_segment_counter, dsa_area::freed_segment_counter, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), pg_read_barrier, and unlikely.
Referenced by dsa_free(), and dsa_get_address().
|
static |
Definition at line 2288 of file dsa.c.
References Assert, dsa_area::control, DSA_AREA_LOCK, dsm_detach(), dsa_segment_header::freed, dsa_area_control::freed_segment_counter, dsa_area::freed_segment_counter, dsa_segment_map::header, dsa_area::high_segment_index, i, LWLockHeldByMe(), dsa_segment_map::mapped_address, dsa_segment_map::segment, dsa_area::segment_maps, and unlikely.
Referenced by check_for_freed_segments(), destroy_superblock(), dsa_dump(), and get_best_segment().
|
inlinestatic |
Definition at line 119 of file dsa.c.
References DSA_NUM_SEGMENT_BINS, Min, and pg_leftmost_one_pos_size_t.
Referenced by create_internal(), get_best_segment(), make_new_segment(), and rebin_segment().
|
static |
Definition at line 1218 of file dsa.c.
References Assert, dsa_segment_header::bin, contiguous_pages_to_segment_bin(), dsa_area::control, CurrentResourceOwner, DSA_MAX_SEGMENT_SIZE, DSA_MAX_SEGMENTS, DSA_MIN_SEGMENT_SIZE, dsa_minimum_size(), DSA_NUM_SEGMENT_BINS, DSA_NUM_SIZE_CLASSES, DSA_SCLASS_LOCK, DSA_SEGMENT_HEADER_MAGIC, DSA_SEGMENT_INDEX_NONE, elog, ERROR, dsa_segment_map::fpm, FPM_PAGE_SIZE, dsa_segment_header::freed, dsa_area::freed_segment_counter, FreePageManagerInitialize(), FreePageManagerPut(), dsa_area_control::handle, dsa_segment_map::header, dsa_area::high_segment_index, i, dsa_area_control::init_segment_size, dsa_area_control::lock, dsa_area_control::lwlock_tranche_id, LWLockInitialize(), dsa_segment_header::magic, dsa_segment_map::mapped_address, dsa_area_control::max_segment_size, dsa_area_control::max_total_segment_size, MAXALIGN, dsa_segment_header::next, dsa_segment_map::pagemap, palloc(), dsa_segment_header::prev, dsa_area_control::refcnt, dsa_area::resowner, dsa_segment_map::segment, dsa_area_control::segment_bins, dsa_area_control::segment_handles, dsa_area_control::segment_header, dsa_area::segment_maps, dsa_segment_header::size, size, dsa_area_control::total_segment_size, and dsa_segment_header::usable_pages.
Referenced by dsa_create_ext(), and dsa_create_in_place_ext().
|
static |
Definition at line 1837 of file dsa.c.
References Assert, check_for_freed_segments_locked(), dsa_area::control, DSA_AREA_LOCK, DSA_EXTRACT_OFFSET, DSA_EXTRACT_SEGMENT_NUMBER, dsa_free(), dsa_get_address(), DSA_SCLASS_BLOCK_OF_SPANS, dsm_detach(), DSM_HANDLE_INVALID, dsm_segment_handle(), dsm_unpin_segment(), dsa_segment_map::fpm, fpm_largest, FPM_PAGE_SIZE, dsa_segment_header::freed, dsa_area_control::freed_segment_counter, FreePageManagerPut(), get_segment_by_index(), get_segment_index, dsa_segment_map::header, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_segment_map::mapped_address, dsa_area_span::npages, rebin_segment(), dsa_segment_map::segment, dsa_area_control::segment_handles, dsa_segment_header::size, dsa_area_span::size_class, dsa_area_span::start, dsa_area_control::total_segment_size, unlink_segment(), unlink_span(), and dsa_segment_header::usable_pages.
Referenced by dsa_free(), and dsa_trim().
dsa_pointer dsa_allocate_extended | ( | dsa_area * | area, |
size_t | size, | ||
int | flags | ||
) |
Definition at line 671 of file dsa.c.
References alloc_object(), AllocHugeSizeIsValid, AllocSizeIsValid, Assert, dsa_area::control, DSA_ALLOC_HUGE, DSA_ALLOC_NO_OOM, DSA_ALLOC_ZERO, DSA_AREA_LOCK, dsa_free(), dsa_get_address(), DSA_MAKE_POINTER, DSA_SCLASS_BLOCK_OF_SPANS, DSA_SCLASS_LOCK, DSA_SCLASS_SPAN_LARGE, dsa_size_class_map, DSA_SIZE_CLASS_MAP_QUANTUM, dsa_size_classes, DsaPointerIsValid, elog, ereport, errcode(), errdetail(), errmsg(), ERROR, FATAL, dsa_segment_map::fpm, FPM_PAGE_SIZE, fpm_size_to_pages, FreePageManagerGet(), get_best_segment(), get_segment_index, init_span(), InvalidDsaPointer, lengthof, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), make_new_segment(), dsa_segment_map::pagemap, dsa_area_control::pools, and size.
Referenced by dshash_create(), and pagetable_allocate().
dsa_area* dsa_attach | ( | dsa_handle | handle | ) |
Definition at line 510 of file dsa.c.
References attach_internal(), dsa_on_dsm_detach_release_in_place(), dsm_attach(), dsm_segment_address(), ereport, errcode(), errmsg(), ERROR, on_dsm_detach(), and PointerGetDatum().
Referenced by init_dsm_registry(), logicalrep_launcher_attach_dshmem(), and TidStoreAttach().
dsa_area* dsa_attach_in_place | ( | void * | place, |
dsm_segment * | segment | ||
) |
Definition at line 545 of file dsa.c.
References attach_internal(), DSA_HANDLE_INVALID, dsa_on_dsm_detach_release_in_place(), on_dsm_detach(), and PointerGetDatum().
Referenced by AttachSession(), ParallelQueryMain(), and pgstat_attach_shmem().
dsa_area* dsa_create_ext | ( | int | tranche_id, |
size_t | init_segment_size, | ||
size_t | max_segment_size | ||
) |
Definition at line 421 of file dsa.c.
References create_internal(), dsa_on_dsm_detach_release_in_place(), dsm_create(), dsm_pin_segment(), dsm_segment_address(), dsm_segment_handle(), on_dsm_detach(), and PointerGetDatum().
Referenced by TidStoreCreateShared().
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 | ||
) |
Definition at line 471 of file dsa.c.
References create_internal(), dsa_on_dsm_detach_release_in_place(), DSM_HANDLE_INVALID, on_dsm_detach(), PointerGetDatum(), and size.
void dsa_detach | ( | dsa_area * | area | ) |
Definition at line 1952 of file dsa.c.
References dsm_detach(), dsa_area::high_segment_index, i, pfree(), dsa_segment_map::segment, and dsa_area::segment_maps.
Referenced by DetachSession(), ExecParallelCleanup(), ParallelQueryMain(), pgstat_detach_shmem(), StatsShmemInit(), test_basic(), test_dsa_basic(), test_dsa_resowners(), test_empty(), test_random(), TidStoreDestroy(), and TidStoreDetach().
void dsa_dump | ( | dsa_area * | area | ) |
Definition at line 1088 of file dsa.c.
References check_for_freed_segments_locked(), dsa_area::control, DSA_AREA_LOCK, DSA_FULLNESS_CLASSES, dsa_get_address(), DSA_NUM_SEGMENT_BINS, DSA_NUM_SIZE_CLASSES, DSA_POINTER_FORMAT, DSA_SCLASS_BLOCK_OF_SPANS, DSA_SCLASS_LOCK, DSA_SCLASS_SPAN_LARGE, DSA_SEGMENT_INDEX_NONE, dsa_size_classes, DsaPointerIsValid, dsa_segment_map::fpm, fpm_largest, fprintf, get_segment_by_index(), dsa_area_control::handle, dsa_segment_map::header, i, j, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_segment_map::mapped_address, dsa_area_control::max_total_segment_size, dsa_area_span::nallocatable, dsa_segment_header::next, dsa_area_span::nextspan, dsa_area_span::nmax, dsa_area_span::npages, dsa_area_control::pinned, dsa_area_control::pools, dsa_area_control::refcnt, dsa_area_control::segment_bins, dsa_area_pool::spans, dsa_area_span::start, dsa_area_control::total_segment_size, and dsa_segment_header::usable_pages.
void dsa_free | ( | dsa_area * | area, |
dsa_pointer | dp | ||
) |
Definition at line 826 of file dsa.c.
References add_span_to_fullness_class(), Assert, check_for_freed_segments(), destroy_superblock(), DSA_AREA_LOCK, DSA_EXTRACT_OFFSET, DSA_EXTRACT_SEGMENT_NUMBER, DSA_FULLNESS_CLASSES, dsa_get_address(), DSA_SCLASS_LOCK, DSA_SCLASS_SPAN_LARGE, dsa_size_classes, DSA_SUPERBLOCK_SIZE, dsa_area_span::fclass, dsa_area_span::firstfree, dsa_segment_map::fpm, FPM_PAGE_SIZE, FreePageManagerPut(), get_segment_by_index(), InvalidDsaPointer, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_area_span::nallocatable, NextFreeObjectIndex, dsa_area_span::nmax, dsa_area_span::npages, dsa_segment_map::pagemap, dsa_area_span::prevspan, rebin_segment(), size, dsa_area_span::size_class, dsa_area_span::start, and unlink_span().
Referenced by delete_item_from_bucket(), delete_key_from_bucket(), destroy_superblock(), dsa_allocate_extended(), dshash_create(), dshash_destroy(), ExecHashTableDetach(), ExecHashTableDetachBatch(), ExecParallelCleanup(), ExecParallelHashIncreaseNumBatches(), ExecParallelHashIncreaseNumBuckets(), ExecParallelHashRepartitionFirst(), ExecParallelReinitialize(), find_or_make_matching_shared_tupledesc(), pagetable_free(), pgstat_free_entry(), resize(), RT_FREE(), RT_FREE_LEAF(), RT_FREE_NODE(), tbm_free_shared_area(), test_dsa_basic(), and test_dsa_resowners().
void* dsa_get_address | ( | dsa_area * | area, |
dsa_pointer | dp | ||
) |
Definition at line 942 of file dsa.c.
References Assert, check_for_freed_segments(), DSA_EXTRACT_OFFSET, DSA_EXTRACT_SEGMENT_NUMBER, DSA_MAX_SEGMENTS, DsaPointerIsValid, get_segment_by_index(), dsa_segment_map::mapped_address, dsa_area::segment_maps, and unlikely.
Referenced by add_span_to_fullness_class(), alloc_object(), delete_item_from_bucket(), delete_key_from_bucket(), destroy_superblock(), dsa_allocate_extended(), dsa_dump(), dsa_free(), dsa_trim(), dshash_attach(), dshash_create(), dshash_destroy(), dshash_dump(), dshash_seq_next(), ensure_active_superblock(), ensure_valid_bucket_pointers(), ExecHashTableDetachBatch(), ExecParallelHashEnsureBatchAccessors(), ExecParallelHashFirstTuple(), ExecParallelHashIncreaseNumBatches(), ExecParallelHashIncreaseNumBuckets(), ExecParallelHashJoinSetUpBatches(), ExecParallelHashNextTuple(), ExecParallelHashPopChunkQueue(), ExecParallelHashRepartitionRest(), ExecParallelHashTableAlloc(), ExecParallelHashTableSetCurrentBatch(), ExecParallelHashTupleAlloc(), find_in_bucket(), find_or_make_matching_shared_tupledesc(), init_span(), insert_into_bucket(), insert_item_into_bucket(), lookup_rowtype_tupdesc_internal(), pagetable_allocate(), ParallelQueryMain(), pgstat_build_snapshot(), pgstat_get_entry_ref(), pgstat_init_entry(), pgstat_reinit_entry(), pgstat_reset_matching_entries(), pgstat_write_statsfile(), resize(), RT_PTR_SET_LOCAL(), SerializeParamExecParams(), share_tupledesc(), shared_record_table_compare(), shared_record_table_hash(), tbm_attach_shared_iterate(), tbm_free_shared_area(), tbm_prepare_shared_iterate(), test_dsa_basic(), test_dsa_resowners(), transfer_first_span(), and unlink_span().
dsa_handle dsa_get_handle | ( | dsa_area * | area | ) |
Definition at line 498 of file dsa.c.
References Assert, dsa_area::control, DSA_HANDLE_INVALID, and dsa_area_control::handle.
Referenced by init_dsm_registry(), logicalrep_launcher_attach_dshmem(), parallel_vacuum_init(), and parallel_vacuum_reset_dead_items().
size_t dsa_get_total_size | ( | dsa_area * | area | ) |
Definition at line 1027 of file dsa.c.
References dsa_area::control, DSA_AREA_LOCK, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), size, and dsa_area_control::total_segment_size.
Referenced by RT_MEMORY_USAGE().
size_t dsa_minimum_size | ( | void | ) |
Definition at line 1196 of file dsa.c.
References FPM_PAGE_SIZE, MAXALIGN, and size.
Referenced by create_internal(), ExecInitParallelPlan(), and pgstat_dsa_init_size().
void dsa_on_dsm_detach_release_in_place | ( | dsm_segment * | segment, |
Datum | place | ||
) |
Definition at line 576 of file dsa.c.
References DatumGetPointer(), and dsa_release_in_place().
Referenced by dsa_attach(), dsa_attach_in_place(), dsa_create_ext(), and dsa_create_in_place_ext().
void dsa_on_shmem_exit_release_in_place | ( | int | code, |
Datum | place | ||
) |
Definition at line 590 of file dsa.c.
References DatumGetPointer(), and dsa_release_in_place().
void dsa_pin | ( | dsa_area * | area | ) |
Definition at line 975 of file dsa.c.
References dsa_area::control, DSA_AREA_LOCK, elog, ERROR, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_area_control::pinned, and dsa_area_control::refcnt.
Referenced by init_dsm_registry(), logicalrep_launcher_attach_dshmem(), and StatsShmemInit().
void dsa_pin_mapping | ( | dsa_area * | area | ) |
Definition at line 635 of file dsa.c.
References dsm_pin_mapping(), dsa_area::high_segment_index, i, dsa_area::resowner, dsa_segment_map::segment, and dsa_area::segment_maps.
Referenced by AttachSession(), GetSessionDsmHandle(), init_dsm_registry(), logicalrep_launcher_attach_dshmem(), pgstat_attach_shmem(), and test_create().
void dsa_release_in_place | ( | void * | place | ) |
Definition at line 605 of file dsa.c.
References Assert, DSA_SEGMENT_HEADER_MAGIC, DSM_HANDLE_INVALID, dsm_unpin_segment(), dsa_area_control::handle, dsa_area_control::high_segment_index, i, dsa_area_control::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_segment_header::magic, dsa_area_control::refcnt, dsa_area_control::segment_handles, and dsa_area_control::segment_header.
Referenced by dsa_on_dsm_detach_release_in_place(), dsa_on_shmem_exit_release_in_place(), and pgstat_detach_shmem().
void dsa_set_size_limit | ( | dsa_area * | area, |
size_t | limit | ||
) |
Definition at line 1018 of file dsa.c.
References dsa_area::control, DSA_AREA_LOCK, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), and dsa_area_control::max_total_segment_size.
Referenced by StatsShmemInit().
void dsa_trim | ( | dsa_area * | area | ) |
Definition at line 1043 of file dsa.c.
References dsa_area::control, destroy_superblock(), dsa_get_address(), DSA_NUM_SIZE_CLASSES, DSA_SCLASS_LOCK, DSA_SCLASS_SPAN_LARGE, DsaPointerIsValid, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_area_span::nallocatable, next, dsa_area_span::nextspan, dsa_area_span::nmax, dsa_area_control::pools, and dsa_area_pool::spans.
void dsa_unpin | ( | dsa_area * | area | ) |
Definition at line 994 of file dsa.c.
References Assert, dsa_area::control, DSA_AREA_LOCK, elog, ERROR, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), dsa_area_control::pinned, and dsa_area_control::refcnt.
|
static |
Definition at line 1560 of file dsa.c.
References alloc_object(), Assert, DSA_AREA_LOCK, DSA_FULLNESS_CLASSES, dsa_get_address(), DSA_MAKE_POINTER, DSA_PAGES_PER_SUPERBLOCK, DSA_SCLASS_BLOCK_OF_SPANS, DSA_SCLASS_LOCK, dsa_size_classes, DSA_SUPERBLOCK_SIZE, DsaPointerIsValid, elog, FATAL, dsa_area_span::fclass, dsa_segment_map::fpm, FPM_PAGE_SIZE, FreePageManagerGet(), get_best_segment(), get_segment_index, i, init_span(), InvalidDsaPointer, LW_EXCLUSIVE, LWLockAcquire(), LWLockHeldByMe(), LWLockRelease(), make_new_segment(), dsa_area_span::nallocatable, dsa_area_span::nextspan, dsa_segment_map::pagemap, dsa_area_span::prevspan, dsa_area_pool::spans, and transfer_first_span().
Referenced by alloc_object().
|
static |
Definition at line 2010 of file dsa.c.
References Assert, check_for_freed_segments_locked(), contiguous_pages_to_segment_bin(), dsa_area::control, DSA_AREA_LOCK, DSA_NUM_SEGMENT_BINS, DSA_SEGMENT_INDEX_NONE, dsa_segment_map::fpm, fpm_largest, get_segment_by_index(), dsa_segment_map::header, LWLockHeldByMe(), dsa_segment_header::next, rebin_segment(), and dsa_area_control::segment_bins.
Referenced by dsa_allocate_extended(), and ensure_active_superblock().
|
static |
Definition at line 1757 of file dsa.c.
References Assert, dsa_area::control, CurrentResourceOwner, DSA_SEGMENT_HEADER_MAGIC, dsm_attach(), DSM_HANDLE_INVALID, dsm_segment_address(), elog, ERROR, dsa_segment_map::fpm, dsa_segment_header::freed, dsa_area_control::handle, dsa_segment_map::header, dsa_area::high_segment_index, dsa_segment_header::magic, dsa_segment_map::mapped_address, MAXALIGN, dsa_segment_map::pagemap, dsa_area::resowner, dsa_segment_map::segment, dsa_area_control::segment_handles, dsa_area::segment_maps, and unlikely.
Referenced by destroy_superblock(), dsa_dump(), dsa_free(), dsa_get_address(), get_best_segment(), make_new_segment(), rebin_segment(), and unlink_segment().
|
static |
Definition at line 1377 of file dsa.c.
References Assert, dsa_get_address(), DSA_SCLASS_BLOCK_OF_SPANS, DSA_SCLASS_LOCK, DSA_SCLASS_SPAN_LARGE, dsa_size_classes, DSA_SPAN_NOTHING_FREE, DSA_SUPERBLOCK_SIZE, DsaAreaPoolToDsaPointer, DsaPointerIsValid, dsa_area_span::fclass, dsa_area_span::firstfree, FPM_PAGE_SIZE, InvalidDsaPointer, LWLockHeldByMe(), dsa_area_span::nallocatable, dsa_area_span::nextspan, dsa_area_span::ninitialized, dsa_area_span::nmax, dsa_area_span::npages, dsa_area_span::pool, dsa_area_span::prevspan, dsa_area_span::size_class, dsa_area_pool::spans, dsa_area_span::start, and start.
Referenced by dsa_allocate_extended(), and ensure_active_superblock().
|
static |
Definition at line 2081 of file dsa.c.
References Assert, dsa_segment_header::bin, contiguous_pages_to_segment_bin(), dsa_area::control, CurrentResourceOwner, DSA_AREA_LOCK, DSA_MAX_SEGMENT_SIZE, DSA_MAX_SEGMENTS, DSA_NUM_SEGMENTS_AT_EACH_SIZE, DSA_SEGMENT_HEADER_MAGIC, DSA_SEGMENT_INDEX_NONE, dsm_create(), DSM_HANDLE_INVALID, dsm_pin_segment(), dsm_segment_address(), dsm_segment_handle(), dsa_segment_map::fpm, FPM_PAGE_SIZE, dsa_segment_header::freed, FreePageManagerInitialize(), FreePageManagerPut(), get_segment_by_index(), dsa_area_control::handle, dsa_segment_map::header, dsa_area_control::high_segment_index, dsa_area::high_segment_index, dsa_area_control::init_segment_size, LWLockHeldByMe(), dsa_segment_header::magic, dsa_segment_map::mapped_address, dsa_area_control::max_segment_size, dsa_area_control::max_total_segment_size, MAXALIGN, Min, next, dsa_segment_header::next, dsa_segment_map::pagemap, dsa_segment_header::prev, dsa_area::resowner, dsa_segment_map::segment, dsa_area_control::segment_bins, dsa_area_control::segment_handles, dsa_area::segment_maps, dsa_segment_header::size, dsa_area_control::total_segment_size, total_size, and dsa_segment_header::usable_pages.
Referenced by dsa_allocate_extended(), and ensure_active_superblock().
|
static |
Definition at line 2316 of file dsa.c.
References Assert, dsa_segment_header::bin, contiguous_pages_to_segment_bin(), dsa_area::control, DSA_SEGMENT_INDEX_NONE, dsa_segment_map::fpm, fpm_largest, get_segment_by_index(), get_segment_index, dsa_segment_map::header, next, dsa_segment_header::next, dsa_segment_header::prev, dsa_area_control::segment_bins, and unlink_segment().
Referenced by destroy_superblock(), dsa_free(), and get_best_segment().
|
static |
Definition at line 1432 of file dsa.c.
References dsa_get_address(), DsaPointerIsValid, dsa_area_span::fclass, InvalidDsaPointer, dsa_area_span::nextspan, dsa_area_span::prevspan, and dsa_area_pool::spans.
Referenced by alloc_object(), and ensure_active_superblock().
|
static |
Definition at line 1978 of file dsa.c.
References Assert, dsa_segment_header::bin, dsa_area::control, DSA_SEGMENT_INDEX_NONE, get_segment_by_index(), get_segment_index, dsa_segment_map::header, next, dsa_segment_header::next, dsa_segment_header::prev, and dsa_area_control::segment_bins.
Referenced by destroy_superblock(), and rebin_segment().
|
static |
Definition at line 1906 of file dsa.c.
References dsa_get_address(), DsaPointerIsValid, dsa_area_span::fclass, next, dsa_area_span::nextspan, dsa_area_span::pool, dsa_area_span::prevspan, and dsa_area_pool::spans.
Referenced by destroy_superblock(), and dsa_free().
|
static |
Definition at line 248 of file dsa.c.
Referenced by dsa_allocate_extended().
|
static |
Definition at line 225 of file dsa.c.
Referenced by alloc_object(), dsa_allocate_extended(), dsa_dump(), dsa_free(), ensure_active_superblock(), and init_span().