|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "libpq/pqsignal.h"#include "miscadmin.h"#include "port/pg_bitutils.h"#include "postmaster/auxprocess.h"#include "postmaster/interrupt.h"#include "storage/aio.h"#include "storage/aio_internal.h"#include "storage/aio_subsys.h"#include "storage/io_worker.h"#include "storage/ipc.h"#include "storage/latch.h"#include "storage/proc.h"#include "tcop/tcopprot.h"#include "utils/injection_point.h"#include "utils/memdebug.h"#include "utils/ps_status.h"#include "utils/wait_event.h"
Go to the source code of this file.
Data Structures | |
| struct | PgAioWorkerSubmissionQueue |
| struct | PgAioWorkerSlot |
| struct | PgAioWorkerControl |
Macros | |
| #define | IO_WORKER_WAKEUP_FANOUT 2 |
Typedefs | |
| typedef struct PgAioWorkerSubmissionQueue | PgAioWorkerSubmissionQueue |
| typedef struct PgAioWorkerSlot | PgAioWorkerSlot |
| typedef struct PgAioWorkerControl | PgAioWorkerControl |
Functions | |
| static size_t | pgaio_worker_shmem_size (void) |
| static void | pgaio_worker_shmem_init (bool first_time) |
| static bool | pgaio_worker_needs_synchronous_execution (PgAioHandle *ioh) |
| static int | pgaio_worker_submit (uint16 num_staged_ios, PgAioHandle **staged_ios) |
| static size_t | pgaio_worker_queue_shmem_size (int *queue_size) |
| static size_t | pgaio_worker_control_shmem_size (void) |
| static int | pgaio_worker_choose_idle (void) |
| static bool | pgaio_worker_submission_queue_insert (PgAioHandle *ioh) |
| static int | pgaio_worker_submission_queue_consume (void) |
| static uint32 | pgaio_worker_submission_queue_depth (void) |
| static void | pgaio_worker_submit_internal (int num_staged_ios, PgAioHandle **staged_ios) |
| static void | pgaio_worker_die (int code, Datum arg) |
| static void | pgaio_worker_register (void) |
| static void | pgaio_worker_error_callback (void *arg) |
| void | IoWorkerMain (const void *startup_data, size_t startup_data_len) |
| bool | pgaio_workers_enabled (void) |
Variables | |
| const IoMethodOps | pgaio_worker_ops |
| int | io_workers = 3 |
| static int | io_worker_queue_size = 64 |
| static int | MyIoWorkerId |
| static PgAioWorkerSubmissionQueue * | io_worker_submission_queue |
| static PgAioWorkerControl * | io_worker_control |
| #define IO_WORKER_WAKEUP_FANOUT 2 |
Definition at line 52 of file method_worker.c.
| typedef struct PgAioWorkerControl PgAioWorkerControl |
| typedef struct PgAioWorkerSlot PgAioWorkerSlot |
| typedef struct PgAioWorkerSubmissionQueue PgAioWorkerSubmissionQueue |
| void IoWorkerMain | ( | const void * | startup_data, |
| size_t | startup_data_len | ||
| ) |
Definition at line 385 of file method_worker.c.
References ErrorContextCallback::arg, Assert(), AuxiliaryProcessMainCommon(), B_IO_WORKER, ErrorContextCallback::callback, CHECK_FOR_INTERRUPTS, ConfigReloadPending, DEBUG4, die, EmitErrorReport(), END_CRIT_SECTION, error_context_stack, HOLD_INTERRUPTS, i, PgAioWorkerControl::idle_worker_mask, INJECTION_POINT, PgAioCtl::io_handles, io_worker_control, IO_WORKER_WAKEUP_FANOUT, PgAioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), LWLockReleaseAll(), Min, MyBackendType, MyIoWorkerId, MyLatch, PG_exception_stack, pgaio_ctl, pgaio_debug_io, pgaio_io_get_iovec_length(), pgaio_io_perform_synchronously(), pgaio_io_process_completion(), pgaio_io_reopen(), pgaio_worker_choose_idle(), pgaio_worker_error_callback(), pgaio_worker_register(), pgaio_worker_submission_queue_consume(), pgaio_worker_submission_queue_depth(), PGC_SIGHUP, pqsignal, ErrorContextCallback::previous, proc_exit(), ProcessConfigFile(), procsignal_sigusr1_handler(), ResetLatch(), RESUME_INTERRUPTS, set_ps_display(), SetLatch(), ShutdownRequestPending, SIGALRM, SIGHUP, SignalHandlerForConfigReload(), SignalHandlerForShutdownRequest(), SIGPIPE, SIGUSR1, SIGUSR2, sprintf, START_CRIT_SECTION, UnBlockSig, VALGRIND_MAKE_MEM_UNDEFINED, WaitLatch(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and PgAioWorkerControl::workers.
|
static |
Definition at line 164 of file method_worker.c.
References Assert(), PgAioWorkerControl::idle_worker_mask, PgAioWorkerSlot::in_use, io_worker_control, pg_rightmost_one_pos64(), and PgAioWorkerControl::workers.
Referenced by IoWorkerMain(), and pgaio_worker_submit_internal().
|
static |
Definition at line 113 of file method_worker.c.
References MAX_IO_WORKERS.
Referenced by pgaio_worker_shmem_init(), and pgaio_worker_shmem_size().
|
static |
Definition at line 313 of file method_worker.c.
References Assert(), PgAioWorkerControl::idle_worker_mask, PgAioWorkerSlot::in_use, io_worker_control, PgAioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyIoWorkerId, MyLatch, and PgAioWorkerControl::workers.
Referenced by pgaio_worker_register().
|
static |
Definition at line 364 of file method_worker.c.
References arg, Assert(), B_IO_WORKER, errcontext, GetPGProcByNumber, MyBackendType, MyProcNumber, PgAioHandle::owner_procno, and PGPROC::pid.
Referenced by IoWorkerMain().
|
static |
Definition at line 234 of file method_worker.c.
References PgAioHandle::flags, IsUnderPostmaster, PGAIO_HF_REFERENCES_LOCAL, and pgaio_io_can_reopen().
Referenced by pgaio_worker_submit_internal().
|
static |
Definition at line 103 of file method_worker.c.
References io_worker_queue_size, and pg_nextpower2_32().
Referenced by pgaio_worker_shmem_init(), and pgaio_worker_shmem_size().
|
static |
Definition at line 330 of file method_worker.c.
References Assert(), elog, ERROR, i, PgAioWorkerControl::idle_worker_mask, PgAioWorkerSlot::in_use, io_worker_control, PgAioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MAX_IO_WORKERS, MyIoWorkerId, MyLatch, on_shmem_exit(), pgaio_worker_die(), and PgAioWorkerControl::workers.
Referenced by IoWorkerMain().
|
static |
Definition at line 132 of file method_worker.c.
References PgAioWorkerSubmissionQueue::head, i, PgAioWorkerControl::idle_worker_mask, PgAioWorkerSlot::in_use, io_worker_control, io_worker_submission_queue, PgAioWorkerSlot::latch, MAX_IO_WORKERS, pgaio_worker_control_shmem_size(), pgaio_worker_queue_shmem_size(), ShmemInitStruct(), PgAioWorkerSubmissionQueue::size, PgAioWorkerSubmissionQueue::tail, and PgAioWorkerControl::workers.
|
static |
Definition at line 120 of file method_worker.c.
References add_size(), pgaio_worker_control_shmem_size(), and pgaio_worker_queue_shmem_size().
|
static |
Definition at line 201 of file method_worker.c.
References PgAioWorkerSubmissionQueue::head, io_worker_submission_queue, PgAioWorkerSubmissionQueue::size, PgAioWorkerSubmissionQueue::sqes, and PgAioWorkerSubmissionQueue::tail.
Referenced by IoWorkerMain().
|
static |
Definition at line 217 of file method_worker.c.
References Assert(), PgAioWorkerSubmissionQueue::head, io_worker_submission_queue, PgAioWorkerSubmissionQueue::size, and PgAioWorkerSubmissionQueue::tail.
Referenced by IoWorkerMain().
|
static |
Definition at line 180 of file method_worker.c.
References DEBUG3, PgAioWorkerSubmissionQueue::head, io_worker_submission_queue, pgaio_debug, pgaio_io_get_id(), PgAioWorkerSubmissionQueue::size, PgAioWorkerSubmissionQueue::sqes, and PgAioWorkerSubmissionQueue::tail.
Referenced by pgaio_worker_submit_internal().
|
static |
Definition at line 294 of file method_worker.c.
References i, pgaio_io_prepare_submit(), and pgaio_worker_submit_internal().
|
static |
Definition at line 243 of file method_worker.c.
References Assert(), DEBUG4, i, io_worker_control, PgAioWorkerSlot::latch, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), pgaio_debug_io, pgaio_io_perform_synchronously(), PGAIO_SUBMIT_BATCH_SIZE, pgaio_worker_choose_idle(), pgaio_worker_needs_synchronous_execution(), pgaio_worker_submission_queue_insert(), SetLatch(), wakeup, and PgAioWorkerControl::workers.
Referenced by pgaio_worker_submit().
| bool pgaio_workers_enabled | ( | void | ) |
Definition at line 590 of file method_worker.c.
References io_method, and IOMETHOD_WORKER.
Referenced by maybe_adjust_io_workers().
|
static |
Definition at line 99 of file method_worker.c.
Referenced by IoWorkerMain(), pgaio_worker_choose_idle(), pgaio_worker_die(), pgaio_worker_register(), pgaio_worker_shmem_init(), and pgaio_worker_submit_internal().
|
static |
Definition at line 96 of file method_worker.c.
Referenced by pgaio_worker_queue_shmem_size().
|
static |
Definition at line 98 of file method_worker.c.
Referenced by pgaio_worker_shmem_init(), pgaio_worker_submission_queue_consume(), pgaio_worker_submission_queue_depth(), and pgaio_worker_submission_queue_insert().
| int io_workers = 3 |
Definition at line 93 of file method_worker.c.
Referenced by maybe_adjust_io_workers().
|
static |
Definition at line 97 of file method_worker.c.
Referenced by IoWorkerMain(), pgaio_worker_die(), and pgaio_worker_register().
| const IoMethodOps pgaio_worker_ops |
Definition at line 83 of file method_worker.c.