160 if (offset >
seghdr->totalsize)
163 errmsg(
"out of shared memory (%zu bytes requested)",
194 errmsg(
"out of shared memory (%zu bytes requested)",
237 *allocated_size = size;
428 errmsg(
"could not create ShmemIndex entry for data structure \"%s\"",
439 if (result->
size != size)
443 (
errmsg(
"ShmemIndex entry size is wrong for data structure"
444 " \"%s\": expected %zu, actual %zu",
462 errmsg(
"not enough shared memory for data structure"
463 " \"%s\" (%zu bytes requested)",
492 errmsg(
"requested shared memory size overflows size_t")));
507 errmsg(
"requested shared memory size overflows size_t")));
515#define PG_GET_SHMEM_SIZES_COLS 4
530 memset(nulls, 0,
sizeof(nulls));
572#define PG_GET_SHMEM_NUMA_SIZES_COLS 3
587 elog(
ERROR,
"libnuma initialization failed or NUMA is not supported on this platform");
621 elog(
DEBUG1,
"NUMA: page-faulting shared memory segments for proper NUMA readouts");
643 (
char *)
ent->location +
ent->allocated_size);
644 total_len = (endptr - startptr);
673 elog(
ERROR,
"failed NUMA pages inquiry status: %m");
696 elog(
ERROR,
"invalid NUMA node id outside of allowed range "
701 memset(nulls, 0,
sizeof(nulls));
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define CACHELINEALIGN(LEN)
#define TYPEALIGN(ALIGNVAL, LEN)
#define Assert(condition)
#define TYPEALIGN_DOWN(ALIGNVAL, LEN)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
Size hash_get_shared_size(HASHCTL *info, int flags)
int64 hash_select_dirsize(int64 num_entries)
void * hash_seq_search(HASH_SEQ_STATUS *status)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errcode(int sqlerrcode)
#define ereport(elevel,...)
#define palloc_array(type, count)
#define palloc0_array(type, count)
#define PG_RETURN_BOOL(x)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
static bool pg_mul_size_overflow(size_t a, size_t b, size_t *result)
static bool pg_add_size_overflow(size_t a, size_t b, size_t *result)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
#define CHECK_FOR_INTERRUPTS()
PGDLLIMPORT int pg_numa_get_max_node(void)
#define pg_numa_touch_mem_if_required(ptr)
PGDLLIMPORT int pg_numa_query_pages(int pid, unsigned long count, void **pages, int *status)
PGDLLIMPORT int pg_numa_init(void)
static Datum Int64GetDatum(int64 X)
static Datum Int32GetDatum(int32 X)
bool ShmemAddrIsValid(const void *addr)
Datum pg_get_shmem_allocations_numa(PG_FUNCTION_ARGS)
Datum pg_numa_available(PG_FUNCTION_ARGS)
void InitShmemAllocator(PGShmemHeader *seghdr)
Datum pg_get_shmem_allocations(PG_FUNCTION_ARGS)
void InitShmemIndex(void)
Size add_size(Size s1, Size s2)
Size pg_get_shmem_pagesize(void)
#define PG_GET_SHMEM_NUMA_SIZES_COLS
void * ShmemAllocNoError(Size size)
Size mul_size(Size s1, Size s2)
void * ShmemAlloc(Size size)
HTAB * ShmemInitHash(const char *name, int64 init_size, int64 max_size, HASHCTL *infoP, int hash_flags)
#define PG_GET_SHMEM_SIZES_COLS
static PGShmemHeader * ShmemSegHdr
static void * ShmemAllocRaw(Size size, Size *allocated_size)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
static ShmemAllocatorData * ShmemAllocator
static bool firstNumaTouch
#define SHMEM_INDEX_KEYSIZE
static void SpinLockRelease(volatile slock_t *lock)
static void SpinLockAcquire(volatile slock_t *lock)
static void SpinLockInit(volatile slock_t *lock)
void GetHugePageSize(Size *hugepagesize, int *mmap_flags)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)