NP-RDMA: Using Commodity RDMA without Pinning Memory

Huijun Shen, Guo Chen, Bojie Li, Xingtong Lin, Xingyu Zhang, Xizheng Wang, Amit Geron, Shamir Rabinovitch, Haifeng Lin, Han Ruan, Lijun Li, Jingbin Zhou, Kun TanarXiv 2023 · DOI

TL;DR

This paper introduces NP-RDMA, a novel software-only approach that eliminates the need for memory pinning in RDMA operations, a long-standing bottleneck. By leveraging commodity RDMA NICs and intelligent use of IOMMU/SMMU, NP-RDMA enables dynamic page fault handling with minimal overhead, significantly improving memory utilization and application initialization times.

What Problem Does This Paper Address?

Remote Direct Memory Access (RDMA) is a powerful technology for low-latency, high-throughput data transfers in data centers. However, a critical requirement for RDMA is "memory pinning," where memory regions used for communication must be locked in physical memory. This pinning prevents on-demand paging and swapping, leading to several issues:

  • Reduced Memory Utilization: Pages that are never accessed still occupy physical memory, hindering efficient memory management.
  • Slow Initialization: Large memory applications can take minutes to initialize due to the time required to pin vast amounts of memory.
  • Complicated Programming: Applications must often manage pinned buffers and perform explicit data copies, negating some of RDMA's zero-copy benefits.
  • Limited Scalability: The inability to swap out memory restricts the effective capacity of systems, especially when using tiered storage.

Existing solutions often rely on specialized hardware (NICs with page fault support) or involve complex software-hardware co-design, which are difficult to deploy widely.

Methods

NP-RDMA tackles the memory pinning problem with a clever, two-pronged software approach that works with commodity RDMA NICs:

  1. Optimistic One-Sided Operations:
    • Signature Pages: Instead of mapping invalid virtual addresses to NULL, NP-RDMA maps them to a special "signature page" filled with magic numbers. When an RDMA operation reads data, it checks if the data matches these magic numbers. If it does, it might indicate a page fault, or it could be a genuine data match (a rare coincidence).
  2. Black-Hole Pages: For writes, a similar "black-hole page" is used to detect faults without overwriting the signature page.
  3. Page Versioning: For large transfers, instead of checking data content, NP-RDMA tracks a version number for each page. Odd versions indicate the page is present, while even versions signal it's been swapped out. This allows for efficient detection of page presence without full data checks.
  4. IOMMU/SMMU Integration: The system leverages the IOMMU (Intel) or SMMU (ARM) to manage the mapping of virtual addresses to physical memory. This allows NP-RDMA to intercept page faults without modifying the NIC's internal translation tables.
  5. Catch-All Two-Sided Operations:
    • If the optimistic check suggests a page fault, NP-RDMA gracefully falls back to a two-sided operation. This involves the initiator sending a request to the target, which then pins the necessary pages, performs the data transfer (often via a reverse RDMA Write/Read), and signals completion.
  6. Short Message Optimization: For small messages, data can be sent "inline" within the control messages to reduce latency.
  7. Configurable Ordering: To handle potential ordering issues between faulting and non-faulting operations, NP-RDMA provides configurable ordering constraints.

The entire system is implemented as an LD_PRELOAD library, making it transparent to existing RDMA applications.

Datasets

Not discussed in the paper. The evaluation uses micro-benchmarks and real-world applications like Spark and enterprise storage systems.

Key Insights and Ideas

  • Commodity NICs are Sufficient: The most significant insight is that the memory pinning problem can be solved effectively using only software and existing, widely available RDMA NICs, without requiring specialized hardware features for page fault handling.
  • Optimism Pays Off: The "optimistic" approach of assuming operations will succeed and only falling back when evidence suggests otherwise is key to achieving near-zero overhead for non-faulting operations.
  • Leveraging OS Mechanisms: Clever use of OS features like MMU-notifiers (for swap-out) and IOMMU/SMMU for address translation is crucial for intercepting and handling page faults without kernel modifications.
  • Two-Tiered Fault Handling: The combination of a fast, optimistic one-sided check and a robust two-sided fallback mechanism provides a balanced solution for both performance and correctness.
  • Application Transparency: The LD_PRELOAD library approach ensures that existing RDMA applications can benefit from NP-RDMA without any code changes.

Key Results

  • Minimal Non-Fault Overhead: NP-RDMA adds only 0.1-2 µs latency for normal RDMA operations.
  • Fast Page Fault Handling:
    • Minor page faults incur only 3.5-5.7 µs additional latency.
  • Major page faults are handled in approximately 60 µs.
  • This is up to 500x faster than ODP (On-Demand Paging) which relies on advanced NICs and incurs much higher latencies (e.g., 16ms for remote minor faults).
  • Spark Performance:
    • Initialization time for a 300GB memory pool reduced from 120 seconds to 6 seconds (20x faster).
  • Physical memory usage reduced by 86% with only a 5.4% slowdown.
  • Enterprise Storage:
    • Capacity expansion by 5x using SSDs.
  • Average latency increased by only 10%.

Limitations and Future Work

  • Double Writes: In rare cases of concurrency or coincidence with magic numbers, an operation might be optimistically considered successful but then retried, leading to a page being written twice. The authors note that this is acceptable for idempotent operations like reads and writes according to InfiniBand specifications.
  • Hardware RDMA Virtualization: NP-RDMA's reliance on IOMMU/SMMU might not be compatible with hardware RDMA virtualization features.
  • Custom Memory Swapping: In production environments with custom memory swapping mechanisms, OS MMU-notifiers might not be sufficient, requiring custom callbacks.
  • Future Work: The authors suggest that future NIC hardware could potentially handle page faults more efficiently, but would need to support out-of-order execution and better notification mechanisms. They also envision future architectures where IOMMU/SMMU can directly manage NIC page tables, simplifying synchronization.

Summary updated

BibTeX
@misc{shen2023np,
  author = {Huijun Shen and Guo Chen and Bojie Li and Xingtong Lin and Xingyu Zhang and Xizheng Wang and Amit Geron and Shamir Rabinovitch and Haifeng Lin and Han Ruan and Lijun Li and Jingbin Zhou and Kun Tan},
  title = {{NP-RDMA: Using Commodity RDMA without Pinning Memory}},
  year = {2023},
  eprint = {2310.11062},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.11062},
}
Figure