Skip to content

UCT/IB: Skip madvise with DONT_FORK if kernel supports RDMA copy-on-fork#11573

Open
tvegas1 wants to merge 4 commits into
openucx:masterfrom
tvegas1:ibv_fork_unneeded
Open

UCT/IB: Skip madvise with DONT_FORK if kernel supports RDMA copy-on-fork#11573
tvegas1 wants to merge 4 commits into
openucx:masterfrom
tvegas1:ibv_fork_unneeded

Conversation

@tvegas1

@tvegas1 tvegas1 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

What

Detect IBV_FORK_UNNEEDED in the IB fork-init path and skip UCX-side fork initialization handling in that case.

Why

When the kernel supports RDMA copy-on-fork, libibverbs does not need MADV_DONTFORK tracking. That old path can split VMAs on every registration and hit vm.max_map_count, causing madvise() to fail with ENOMEM even when physical memory is available.

How

Add configure checks for IBV_FORK_UNNEEDED and ibv_is_fork_initialized(). In uct_ib_fork_init(), return success with fork_init unset when libibverbs reports fork handling is unneeded.

Comment thread src/uct/ib/base/ib_md.c
static int uct_ib_fork_init_is_unneeded()
{
#if HAVE_DECL_IBV_IS_FORK_INITIALIZED && HAVE_DECL_IBV_FORK_UNNEEDED
if (ibv_is_fork_initialized() == IBV_FORK_UNNEEDED) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/uct/ib/base/ib_md.c Outdated
@tvegas1

tvegas1 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

/azp run UCX PR

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

tomerg-nvidia
tomerg-nvidia previously approved these changes Jun 25, 2026
Comment thread src/uct/ib/base/ib_md.c Outdated
}
}

static int uct_ib_is_fork_init_unneeded()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe uct_ib_is_fork_unneeded()
i'd even call it uct_ib_is_fork_needed() but it will not be consistent with verbs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tvegas1: uct_ib_fork_init_is_unneeded
@guy-ealey-morag request: uct_ib_is_fork_init_unneeded
@brminich request: uct_ib_is_fork_unneeded / uct_ib_is_fork_needed

are we all ok with uct_ib_is_fork_init_needed? i think it is ibv_fork_init call that is either needed or not.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me

@tvegas1 tvegas1 dismissed stale reviews from tomerg-nvidia and guy-ealey-morag via 35f2287 June 26, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants