GCC Newspaper
NOVEMBER 30, 2026
libgomp — Proposed

libgomp: Implement GOMP_WAIT_POLICY to use pv-barrier-sync

Implement GOMP_WAIT_POLICY to enable pv-barrier-sync, which dynamically adjusts thread spin/block behavior based on host contention.

This patch implements the GOMP_WAIT_POLICY environment variable for libgomp, introducing the ‘pv-barrier-sync’ policy. This policy leverages the ‘phantom_average’ metric from host monitoring to dynamically decide whether threads should spin or block at barriers. This aims to optimize performance in virtualized environments by maximizing spinning during low contention and immediately blocking when host-side contention is detected.

In the Thread 1 participant
  1. NchangRoy proposer

    Introduces the GOMP_WAIT_POLICY environment variable and the 'pv-barrier-sync' policy, enabling dynamic spin/block behavior at barriers based on host scheduling metrics to improve performance in virtual machines.

    “This patch introduces phantom_average to libgomp barrier wait policy implemented with the help of GOMP_WAIT_POLICY, a new libgomp environment variable, which when set to "pvsched" uses phantom_average to dynamically decide whether to spin or block on a per-barrier and per-thread basis at runtime. The pv-barrier-sync policy changes this behavior by exploiting as many spin iterations as possible a…”

In Details

This RFC proposes the implementation of GOMP_WAIT_POLICY for libgomp, focusing on the pv-barrier-sync strategy. This policy dynamically tunes the wait behavior at OpenMP barriers. Instead of a fixed spin count, it leverages the phantom_average metric (obtained via eBPF from the host) to decide whether to spin or block. This adaptive approach is crucial for performance in oversubscribed virtual machine environments where host scheduler preemptions can significantly impact guest application progress.

For Context
GOMP_WAIT_POLICY
A new environment variable for libgomp that controls the strategy threads use when waiting at synchronization points like barriers.
pv-barrier-sync
A paravirtualized barrier synchronization policy that dynamically adjusts thread waiting behavior based on host scheduling conditions.
phantom_average
A metric derived from host monitoring (eBPF) indicating the degree of scheduling contention experienced by guest vCPUs.
vCPU
Virtual Central Processing Unit, a software emulation of a physical CPU that runs on a host machine's physical CPU.
eBPF
Extended Berkeley Packet Filter, a technology allowing safe, sandboxed execution of code within the Linux kernel, used here for performance monitoring.
shared memory
Memory that can be accessed by multiple processes or, in this context, by the host and guest VM via mechanisms like QEMU's ivshmem.
Filed Under: libgompOpenMPvirtualizationperformanceeBPF