GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libgomp Performance Win

Introduce new scalable barriers for linux/futex_waitv target.

New flat and tree barriers enhance libgomp performance on Linux 5.16+ with futex_waitv, offering tunable wait policies.

This patch introduces two new scalable barrier implementations, ‘flat’ and ‘tree’, optimized for the linux/futex_waitv target, leveraging the futex_waitv syscall from Linux 5.16. These barriers offer improved performance, with flat barriers typically better for active waiting and tree barriers for passive waiting. The choice of barrier can be influenced by wait policy (OMP_WAIT_POLICY) and new environment variables (GOMP_BARRIER_TYPE, GOMP_FORKJOIN_BARRIER_TYPE), allowing users to tune synchronization behavior. A centralized barrier is also retained for specific use cases.

In Details

This commit introduces new scalable barrier implementations ('flat' and 'tree') within libgomp, targeting the linux/futex_waitv syscall. The 'flat' barrier uses per-thread arrival flags and a coordinator thread (ID 0) to wait, generally performing better with OMP_WAIT_POLICY=active. The 'tree' barrier, a hypercube variant, is optimized for OMP_WAIT_POLICY=passive. It also provides a centralized barrier from the original Linux implementation. Barrier selection is dynamic, based on wait policy, context (end of parallel region), and explicit environment variables (GOMP_BARRIER_TYPE, `GOM…

For Context
libgomp
The GNU implementation of OpenMP runtime library, providing support for parallel programming constructs in C, C++, and Fortran.
futex_waitv
A Linux system call introduced in version 5.16 that allows waiting on multiple futexes efficiently. It's a more scalable alternative to repeated individual futex waits.
barrier
A synchronization primitive in parallel programming that causes threads to wait until all participating threads have reached a certain point in the program's execution before any of them can proceed.
OMP_WAIT_POLICY
An environment variable in OpenMP that controls the thread waiting behavior. 'active' typically means busy-waiting, while 'passive' typically means yielding the CPU or sleeping.
flat barrier
A type of barrier synchronization where each thread has an arrival flag, and a designated thread (often thread 0) waits for all other threads to signal their arrival.
tree barrier
A barrier synchronization method that organizes threads in a tree-like structure to reduce contention, often performing better under high thread counts or specific wait policies.
Filed Under: libgompOpenMPbarrierperformancelinux