HomeFreeBSD

sx: Add `sx_has_waiters()` macro

Description

sx: Add sx_has_waiters() macro

This macro will return non-zero if there are threads waiting for this
lock; otherwise, it will return zero.

The function assumes (but does not assert) that the caller already holds
the lock and that it is interested in other threads waiting for it to
release the lock.

The motivation to add this is the implementation of
rwsem_is_contended() in linuxkpi.

This Linux function indicates the same thing to the caller: if other
threads are waiting for this semaphore.

The amdgpu DRM driver started to use rwsem_is_contended() in Linux
6.12.

Reviewed by: bz, olce
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56443

Details

Provenance
dumbbellAuthored on Apr 12 2026, 5:20 PM
Reviewer
bz
Differential Revision
D56443: sx: Add `sx_has_waiters()` macro
Parents
rG65dc0e9071a5: linuxkpi: Define `VFM_*()` macros in <asm/cpu_device_id.h>
Branches
Unknown
Tags
Unknown