Skip to content

use memory windows to invalidate request buffers; resolves issue-5729#6542

Open
tpashkin wants to merge 1 commit into
mainfrom
users/tpashkin/rdma-memory-windows
Open

use memory windows to invalidate request buffers; resolves issue-5729#6542
tpashkin wants to merge 1 commit into
mainfrom
users/tpashkin/rdma-memory-windows

Conversation

@tpashkin

@tpashkin tpashkin commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

use memory windows to invalidate request buffers

@tpashkin tpashkin linked an issue Jul 16, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Note

This is an automated comment that will be appended during run.

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4756s): some tests FAILED for commit 9097af8.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4123 4121 0 0 2 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4394s): some tests FAILED for commit 9097af8.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4123 4121 0 0 2 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4440s): some tests FAILED for commit 9097af8.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4123 4121 0 0 2 0 0

@tpashkin tpashkin changed the title wip use memory windows to invalidate request buffers; resolves issue-5729 Jul 16, 2026
@tpashkin

Copy link
Copy Markdown
Collaborator Author

Current version works, but is extremely slow. Next step would be to set up memory windows cache

@EvgeniyKozev @yegorskii I'll be on vacation for the next 2 weeks, so feel free to pick this up

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9097af8dcc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

with_lock (AllocationLock) {
if (requestBytes) {
req->InBuffer = SendBuffers.AcquireBuffer(requestBytes);
req->InMemoryWindow = Verbs->CreateMemoryWindow(Connection->pd);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Gate memory-window allocation on the config

When UseMemoryWindows is left at its default false, non-empty requests still call CreateMemoryWindow here, so the normal RDMA path now depends on ibv_alloc_mw(IBV_MW_TYPE_2) succeeding. On providers or devices that do not support type-2 memory windows, or when MW resources are exhausted, ordinary requests fail allocation and disconnect even though the feature was not enabled; only allocate these windows when Config.UseMemoryWindows is true.

Useful? React with 👍 / 👎.

<< req->State);
}
}
// request has been cancelled before bind completed

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Return the send WR after canceled bind completions

With memory windows enabled, a cancellation or timeout while the request is in either bind state removes it from ActiveRequests; when that bind completion arrives, this ActiveRequests.Get(reqId) path falls through to the comment and never returns send to SendQueue. Unlike SendRequestCompleted, this permanently loses a send WR for each such cancellation/timeout, eventually preventing new requests from being dequeued until reconnect/flush timeout.

Useful? React with 👍 / 👎.

.mw = req->InMemoryWindow.get(),
.rkey = req->InMemoryWindow->rkey,
.bind_info = {
.mr = req->InBuffer.GetMemoryRegion(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Register buffer MRs for MW binding

When UseMemoryWindows is enabled, this bind uses the pooled buffer's MR, but those pools are still registered in CreateQP() with only IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_* and not IBV_ACCESS_MW_BIND. Providers reject IBV_WR_BIND_MW against an MR that was not registered for memory-window binding, so the new mode cannot successfully send requests until the buffer-pool registration flags include IBV_ACCESS_MW_BIND.

Useful? React with 👍 / 👎.

Comment on lines +119 to +120
NVerbs::TMemoryWindowPtr InMemoryWindow = NVerbs::NullPtr;
NVerbs::TMemoryWindowPtr OutMemoryWindow = NVerbs::NullPtr;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Invalidate MWs before freeing pooled buffers

These new MW members are still alive while TRequest::~TRequest() runs its body, and that body calls FreeRequest() before member destruction. With UseMemoryWindows and a custom buffer allocation (for example requests larger than MaxChunkAlloc), FreeRequest() can deregister/free the MR backing InBuffer or OutBuffer while the corresponding MW is still bound to it; invalidate/deallocate the windows before releasing the pooled buffers.

Useful? React with 👍 / 👎.

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.

Invalidate request buffers

1 participant