Zero Copy Memory Reclaim via Copy-on-Write
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Zero copy techniques in networking face issues due to delays between granting direct memory access (DMA) to a network interface controller (NIC) and completing data transmission, leading to potential memory page lockouts and transport overhead, preventing memory pages from being modified or reused during transmission.
Innovation Solution
Implementing a method that locks or pins memory pages for zero copy transmission, using a timer to determine if the transmission is taking too long, and applying a copy-on-write policy to allow modifications and reclaim the memory page for other uses, ensuring efficient resource utilization without corrupting data being transmitted.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Loss of energy
If zero copy technique is used to grant NIC direct memory access to memory page, then transport overhead is reduced, but memory page cannot be released or modified until transmission completes
Solution Approach 1:
The patent implements copy-on-write mechanism that creates a copy of the memory page when the application attempts to modify it during zero copy transmission. This allows the original memory page to remain locked for NIC access while the application can modify the copy, resolving the contradiction between maintaining zero copy efficiency and enabling memory reusability.
Solution Approach 2:
The patent dynamically adjusts memory page access rights based on transmission status. The memory page is locked during active transmission to prevent modifications, but the system dynamically creates copies or releases locks when appropriate, transforming the static memory access model into a dynamic one that adapts to transmission needs.
2Reliability
If memory page is locked for zero copy transmission, then data integrity during transmission is ensured, but memory page cannot be reused causing delays
Solution Approach 1:
When the application needs to modify a locked memory page during transmission, the system creates a copy of the page. The original remains locked and intact for NIC transmission, ensuring data integrity, while the copy can be freely modified by the application, eliminating the time delay caused by waiting for transmission completion.
Solution Approach 2:
The patent segments the memory page usage into separate copies - one dedicated to NIC transmission and another for application modification. This segmentation allows both data integrity during transmission and application flexibility to coexist without mutual interference.
3Adaptability or versatility
If traditional copying method is used to transfer data to socket buffer, then memory page can be released and reused, but transport overhead increases
Solution Approach 1:
Instead of copying data to a socket buffer before transmission, the patent uses copy-on-write to create a copy of the memory page only when modification is needed. This eliminates unnecessary copying overhead while maintaining the ability to release and reuse memory pages through the copy-on-write mechanism.
Data Source
AI summary
A processing device receives a request to provide a hardware device with direct memory access to a contents of a virtual memory location in application memory of an application. Responsive to the request, the processing device locks the virtual memory location. The processing device makes a determination to reclaim a physical memory location mapped to the virtual memory location. The processing device then determines whether the hardware device has completed the access to a physical memory location mapped to the virtual memory location. Responsive to determining that the hardware device has not completed the access to the physical memory location, the processing device implements a copy-on-write policy for the virtual memory location.


