fix(io): use anonymous mmap + cudaHostRegister for io_uring bounce buffers#954
Draft
mbrobbel wants to merge 2 commits into
Draft
fix(io): use anonymous mmap + cudaHostRegister for io_uring bounce buffers#954mbrobbel wants to merge 2 commits into
mbrobbel wants to merge 2 commits into
Conversation
…ffers
The uring_reactor registers its pinned bounce slots as io_uring fixed
buffers via io_uring_register_buffers(). On the non-NUMA path these were
allocated with cudaHostAlloc(), whose VMA is backed by the NVIDIA device
file. io_uring's buffer registration requires anonymous, non-file-backed
memory and rejects file-backed VMAs with EOPNOTSUPP ("Operation not
supported") on kernels that still carry the explicit vma->vm_file check
(pre-6.x, e.g. 5.4 on a DGX A100). Newer kernels delegate the check to
GUP and accept CUDA-pinned mappings, which is why it only failed on the
older kernel.
Allocate the non-NUMA slots with mmap(MAP_ANONYMOUS) + cudaHostRegister
instead. The VMA stays anonymous so registration succeeds on all kernel
versions; cudaHostRegister pins it in place without changing the backing,
so GPU-pinned H2D copies still work. This is exactly the existing NUMA
path minus the node binding (numa_alloc_onnode is itself anonymous mmap +
mbind), and MAP_ANONYMOUS is page-aligned, satisfying the O_DIRECT
device-read fd.
Also make slot allocation exception-safe: factor the per-slot free into
release_bounce_slot() and have the ctor release any already-populated
slots if a later slot fails to allocate or pin, since the dtor does not
run for a partially constructed object.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
@aminaramoon what did the fix end up being? |
Collaborator
|
@GregoryKimball it will be ready later in the week, if you need it now, we can reopen this PR and merge it today. but the entire IO stack is being revamped and merged early next week |
aminaramoon
approved these changes
Jun 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Loading the extension on an older kernel (reported on a DGX A100, kernel
5.4.0-182-generic) aborts at startup:"Operation not supported"isEOPNOTSUPP. Theuring_reactorregisters its pinned bounce slots as io_uring fixed buffers viaio_uring_register_buffers(). On the non-NUMA path (the scan_manager default,numa_node = -1) those slots were allocated withcudaHostAlloc(), whose VMA is backed by the NVIDIA device file.IORING_REGISTER_BUFFERSrequires anonymous, non-file-backed memory and rejects file-backed VMAs withEOPNOTSUPP. Kernels that still carry the explicitvma->vm_filecheck (pre-6.x) therefore reject CUDA-pinned memory; newer kernels delegate the check to GUP and accept it — which is why this only reproduces on the older kernel. (Not aRLIMIT_MEMLOCK/ENOMEMorio_uring_disabled/EPERMissue.)Fix
Allocate the non-NUMA bounce slots with
mmap(MAP_ANONYMOUS)+cudaHostRegisterinstead ofcudaHostAlloc:io_uring_register_buffers()succeeds on all kernel versions.cudaHostRegisterpins it in place without changing the backing, so GPU-pinned H2D copies are unaffected.numa_alloc_onnodeis itself anonymousmmap+mbind), so the approach is already exercised in the multi-GPU path.MAP_ANONYMOUSis page-aligned, satisfying theO_DIRECTdevice-read fd's alignment requirement.Also makes slot allocation exception-safe: the per-slot free is factored into
release_bounce_slot(), and the constructor now releases any already-populated slots if a later slot fails to allocate or pin (the destructor does not run for a partially-constructed object, so the previous code could leak pinned host memory on a mid-loop failure).🤖 Generated with Claude Code