|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "common/int.h"#include "fmgr.h"#include "funcapi.h"#include "miscadmin.h"#include "port/pg_numa.h"#include "storage/lwlock.h"#include "storage/pg_shmem.h"#include "storage/shmem.h"#include "storage/spin.h"#include "utils/builtins.h"
Go to the source code of this file.
Data Structures | |
| struct | ShmemAllocatorData |
Macros | |
| #define | PG_GET_SHMEM_SIZES_COLS 4 |
| #define | PG_GET_SHMEM_NUMA_SIZES_COLS 3 |
Typedefs | |
| typedef struct ShmemAllocatorData | ShmemAllocatorData |
Functions | |
| static void * | ShmemAllocRaw (Size size, Size *allocated_size) |
| Datum | pg_numa_available (PG_FUNCTION_ARGS) |
| void | InitShmemAllocator (PGShmemHeader *seghdr) |
| void * | ShmemAlloc (Size size) |
| void * | ShmemAllocNoError (Size size) |
| bool | ShmemAddrIsValid (const void *addr) |
| void | InitShmemIndex (void) |
| HTAB * | ShmemInitHash (const char *name, int64 init_size, int64 max_size, HASHCTL *infoP, int hash_flags) |
| void * | ShmemInitStruct (const char *name, Size size, bool *foundPtr) |
| Size | add_size (Size s1, Size s2) |
| Size | mul_size (Size s1, Size s2) |
| Datum | pg_get_shmem_allocations (PG_FUNCTION_ARGS) |
| Datum | pg_get_shmem_allocations_numa (PG_FUNCTION_ARGS) |
| Size | pg_get_shmem_pagesize (void) |
Variables | |
| static PGShmemHeader * | ShmemSegHdr |
| static void * | ShmemBase |
| static void * | ShmemEnd |
| static ShmemAllocatorData * | ShmemAllocator |
| slock_t * | ShmemLock |
| static HTAB * | ShmemIndex = NULL |
| static bool | firstNumaTouch = true |
| #define PG_GET_SHMEM_NUMA_SIZES_COLS 3 |
| #define PG_GET_SHMEM_SIZES_COLS 4 |
Definition at line 482 of file shmem.c.
References ereport, errcode(), errmsg(), ERROR, fb(), pg_add_size_overflow(), s1, and s2.
Referenced by _brin_parallel_estimate_shared(), _bt_parallel_estimate_shared(), _gin_parallel_estimate_shared(), AioShmemSize(), ApplyLauncherShmemSize(), AsyncShmemInit(), AsyncShmemSize(), AutoVacuumShmemSize(), BackendStatusShmemSize(), BackgroundWorkerShmemSize(), btestimateparallelscan(), BTreeShmemSize(), BufferManagerShmemSize(), CalculateShmemSize(), CheckpointerShmemSize(), CreateAnonymousSegment(), estimate_variable_size(), EstimateClientConnectionInfoSpace(), EstimateComboCIDStateSpace(), EstimateGUCStateSpace(), EstimateLibraryStateSpace(), EstimateParamExecSpace(), EstimateParamListSpace(), EstimateSnapshotSpace(), EstimateTransactionStateSpace(), ExecAggEstimate(), ExecAppendEstimate(), ExecBitmapHeapEstimate(), ExecBitmapHeapInitializeDSM(), ExecHashEstimate(), ExecIncrementalSortEstimate(), ExecMemoizeEstimate(), ExecSortEstimate(), expand_planner_arrays(), FastPathLockShmemSize(), hash_estimate_size(), index_parallelscan_estimate(), index_parallelscan_initialize(), InitializeShmemGUCs(), InjectionPointShmemSize(), LockManagerShmemSize(), LWLockShmemSize(), MultiXactShmemSize(), pgaio_worker_shmem_size(), PgArchShmemSize(), PGProcShmemSize(), pgss_memsize(), PMSignalShmemSize(), PredicateLockShmemInit(), PredicateLockShmemSize(), ProcArrayShmemInit(), ProcArrayShmemSize(), ProcGlobalShmemSize(), ProcSignalShmemSize(), ReplicationOriginShmemSize(), ReplicationSlotsShmemSize(), RequestAddinShmemSpace(), SerializeTransactionState(), SharedInvalShmemSize(), shm_toc_estimate(), StatsShmemSize(), StrategyShmemSize(), table_parallelscan_estimate(), tuplesort_estimate_shared(), TwoPhaseShmemSize(), WaitEventCustomShmemSize(), WaitLSNShmemSize(), WalRcvShmemSize(), WalSndShmemSize(), and XLOGShmemSize().
| void InitShmemAllocator | ( | PGShmemHeader * | seghdr | ) |
Definition at line 122 of file shmem.c.
References Assert, CACHELINEALIGN, ereport, errcode(), errmsg(), ERROR, fb(), ShmemAllocatorData::free_offset, ShmemAllocatorData::index, IsUnderPostmaster, MAXALIGN, ShmemAllocatorData::shmem_lock, ShmemAllocator, ShmemBase, ShmemEnd, ShmemIndex, ShmemLock, ShmemSegHdr, SpinLockInit, and PGShmemHeader::totalsize.
Referenced by CreateSharedMemoryAndSemaphores().
Definition at line 274 of file shmem.c.
References HASHCTL::entrysize, HASH_ELEM, HASH_STRINGS, HASHCTL::keysize, SHMEM_INDEX_KEYSIZE, SHMEM_INDEX_SIZE, ShmemIndex, and ShmemInitHash().
Referenced by CreateOrAttachShmemStructs().
Definition at line 497 of file shmem.c.
References ereport, errcode(), errmsg(), ERROR, fb(), pg_mul_size_overflow(), s1, and s2.
Referenced by _brin_begin_parallel(), _bt_begin_parallel(), _gin_begin_parallel(), AioBackendShmemSize(), AioHandleDataShmemSize(), AioHandleIOVShmemSize(), AioHandleShmemSize(), ApplyLauncherShmemSize(), AsyncShmemInit(), AsyncShmemSize(), AutoVacuumShmemSize(), BackendStatusShmemInit(), BackendStatusShmemSize(), BackgroundWorkerShmemSize(), BTreeShmemSize(), BufferManagerShmemSize(), CheckpointerShmemSize(), EstimateComboCIDStateSpace(), EstimatePendingSyncsSpace(), EstimateReindexStateSpace(), EstimateSnapshotSpace(), EstimateTransactionStateSpace(), ExecAggEstimate(), ExecBitmapHeapEstimate(), ExecBitmapHeapInitializeDSM(), ExecHashEstimate(), ExecIncrementalSortEstimate(), ExecInitParallelPlan(), ExecMemoizeEstimate(), ExecParallelRetrieveInstrumentation(), ExecParallelRetrieveJitInstrumentation(), ExecParallelSetupTupleQueues(), ExecSortEstimate(), FastPathLockShmemSize(), hash_estimate_size(), InitializeParallelDSM(), LWLockShmemSize(), parallel_vacuum_init(), PGProcShmemSize(), PGSemaphoreShmemSize(), PMSignalShmemSize(), PredicateLockShmemInit(), PredicateLockShmemSize(), ProcArrayShmemInit(), ProcArrayShmemSize(), ProcSignalShmemSize(), ReplicationOriginShmemSize(), ReplicationSlotsShmemSize(), SharedInvalShmemSize(), shm_toc_estimate(), tuplesort_estimate_shared(), TwoPhaseShmemSize(), WaitLSNShmemSize(), WalSndShmemSize(), and XLOGShmemSize().
| Datum pg_get_shmem_allocations | ( | PG_FUNCTION_ARGS | ) |
Definition at line 510 of file shmem.c.
References CStringGetTextDatum, fb(), ShmemAllocatorData::free_offset, hash_seq_init(), hash_seq_search(), InitMaterializedSRF(), Int64GetDatum(), LW_SHARED, LWLockAcquire(), LWLockRelease(), PG_GET_SHMEM_SIZES_COLS, ShmemAllocator, ShmemIndex, ShmemSegHdr, PGShmemHeader::totalsize, tuplestore_putvalues(), and values.
| Datum pg_get_shmem_allocations_numa | ( | PG_FUNCTION_ARGS | ) |
Definition at line 567 of file shmem.c.
References CHECK_FOR_INTERRUPTS, CStringGetTextDatum, DEBUG1, elog, ERROR, fb(), firstNumaTouch, hash_seq_init(), hash_seq_search(), i, InitMaterializedSRF(), Int32GetDatum(), Int64GetDatum(), LW_SHARED, LWLockAcquire(), LWLockRelease(), palloc0_array, palloc_array, PG_GET_SHMEM_NUMA_SIZES_COLS, pg_get_shmem_pagesize(), pg_numa_get_max_node(), pg_numa_init(), pg_numa_query_pages(), pg_numa_touch_mem_if_required, ShmemIndex, ShmemSegHdr, PGShmemHeader::totalsize, tuplestore_putvalues(), TYPEALIGN, TYPEALIGN_DOWN, UINT64_FORMAT, and values.
Definition at line 738 of file shmem.c.
References Assert, fb(), GetHugePageSize(), HUGE_PAGES_ON, huge_pages_status, HUGE_PAGES_UNKNOWN, and IsUnderPostmaster.
Referenced by pg_buffercache_os_pages_internal(), and pg_get_shmem_allocations_numa().
| Datum pg_numa_available | ( | PG_FUNCTION_ARGS | ) |
Definition at line 265 of file shmem.c.
References ShmemBase, and ShmemEnd.
Referenced by ReleasePredXact(), and ShmemInitStruct().
Definition at line 182 of file shmem.c.
References ereport, errcode(), errmsg(), ERROR, fb(), and ShmemAllocRaw().
Referenced by CreateLWLocks(), PGReserveSemaphores(), ShmemInitStruct(), and StatsShmemInit().
Definition at line 216 of file shmem.c.
References Assert, CACHELINEALIGN, fb(), ShmemAllocatorData::free_offset, ShmemAllocator, ShmemBase, ShmemLock, ShmemSegHdr, SpinLockAcquire, and SpinLockRelease.
Referenced by ShmemAlloc(), ShmemAllocNoError(), and ShmemInitStruct().
| HTAB * ShmemInitHash | ( | const char * | name, |
| int64 | init_size, | ||
| int64 | max_size, | ||
| HASHCTL * | infoP, | ||
| int | hash_flags | ||
| ) |
Definition at line 323 of file shmem.c.
References fb(), HASH_ALLOC, HASH_ATTACH, hash_create(), HASH_DIRSIZE, hash_get_shared_size(), hash_select_dirsize(), HASH_SHARED_MEM, name, ShmemAllocNoError(), and ShmemInitStruct().
Referenced by InitBufTable(), InitShmemIndex(), LockManagerShmemInit(), pgss_shmem_startup(), PredicateLockShmemInit(), and WaitEventCustomShmemInit().
Definition at line 378 of file shmem.c.
References ShmemIndexEnt::allocated_size, Assert, CACHELINEALIGN, ereport, errcode(), errmsg(), ERROR, fb(), HASH_ENTER_NULL, HASH_REMOVE, hash_search(), ShmemAllocatorData::index, IsUnderPostmaster, ShmemIndexEnt::location, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), name, ShmemAddrIsValid(), ShmemAlloc(), ShmemAllocator, ShmemAllocRaw(), ShmemIndex, and ShmemIndexEnt::size.
Referenced by AioShmemInit(), ApplyLauncherShmemInit(), AsyncShmemInit(), AutoVacuumShmemInit(), BackendStatusShmemInit(), BackgroundWorkerShmemInit(), BTreeShmemInit(), BufferManagerShmemInit(), CheckpointerShmemInit(), CommitTsShmemInit(), dsm_shmem_init(), DSMRegistryShmemInit(), InitProcGlobal(), injection_shmem_startup(), InjectionPointShmemInit(), LockManagerShmemInit(), LogicalDecodingCtlShmemInit(), MultiXactShmemInit(), pgaio_worker_shmem_init(), PgArchShmemInit(), pgss_shmem_startup(), PMSignalShmemInit(), PredicateLockShmemInit(), ProcArrayShmemInit(), ProcSignalShmemInit(), ReplicationOriginShmemInit(), ReplicationSlotsShmemInit(), SerialInit(), SharedInvalShmemInit(), ShmemInitHash(), SimpleLruInit(), SlotSyncShmemInit(), StatsShmemInit(), StrategyInitialize(), SyncScanShmemInit(), test_aio_shmem_startup(), TwoPhaseShmemInit(), VarsupShmemInit(), WaitEventCustomShmemInit(), WaitLSNShmemInit(), WalRcvShmemInit(), WalSndShmemInit(), WalSummarizerShmemInit(), XLogPrefetchShmemInit(), XLogRecoveryShmemInit(), and XLOGShmemInit().
Definition at line 109 of file shmem.c.
Referenced by pg_get_shmem_allocations_numa().
|
static |
Definition at line 104 of file shmem.c.
Referenced by InitShmemAllocator(), pg_get_shmem_allocations(), ShmemAllocRaw(), and ShmemInitStruct().
|
static |
Definition at line 101 of file shmem.c.
Referenced by InitShmemAllocator(), ShmemAddrIsValid(), and ShmemAllocRaw().
|
static |
Definition at line 102 of file shmem.c.
Referenced by InitShmemAllocator(), and ShmemAddrIsValid().
Definition at line 106 of file shmem.c.
Referenced by InitShmemAllocator(), InitShmemIndex(), pg_get_shmem_allocations(), pg_get_shmem_allocations_numa(), and ShmemInitStruct().
| slock_t* ShmemLock |
Definition at line 105 of file shmem.c.
Referenced by GetLWTrancheName(), InitShmemAllocator(), LWLockNewTrancheId(), and ShmemAllocRaw().
|
static |
Definition at line 100 of file shmem.c.
Referenced by InitShmemAllocator(), pg_get_shmem_allocations(), pg_get_shmem_allocations_numa(), and ShmemAllocRaw().