System call free user mode persistent memory direct mapping and persistence method

By using direct mapping in user space, explicit persistence instructions, and direct block device writes, the problem of direct mapping and persistence of persistent memory in file system-less environments is solved, achieving zero-copy read/write and data consistency, and is suitable for microkernel environments without file systems.

CN123178292APending Publication Date: 2026-11-27WUHAN YINGHANYUAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611564966.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-10
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Existing technologies cannot achieve direct mapping of persistent memory, data persistence, and reliable writing to persistent media in user space in runtime environments without file systems, virtual file systems, and memory-mapped system calls. Furthermore, they suffer from kernel path switching and cache copying issues.

Method used

The method of direct mapping of persistent memory in user space without system calls is adopted, which includes direct mapping in user space, explicit persistence instruction sequence, storage fence and direct drive writing of user space block device, avoiding kernel path and cache level, and completing persistent memory access and data writing directly in user space.

Benefits of technology

It enables direct mapping and persistence of persistent memory in user space, eliminating the overhead of system calls and kernel mode switching, achieving zero-copy read and write, and ensuring data consistency and reliability in the event of crashes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123178292A_ABST
    Figure CN123178292A_ABST
Patent Text Reader

Abstract

The application discloses a system-call-free user-mode persistent memory direct mapping and persistent method, which is applied to a microkernel environment without a file system and a virtual file system. The method constructs a persistent memory mapping area by pure memory operation in the user mode, and does not initiate any system call throughout. Non-temporary storage instructions are executed on target data in the mapping area, so that the data bypasses a cache level and is directly written into the persistent memory. Storage fence instructions are executed after the non-temporary storage instructions, so that the writing is sequentially visible to the persistent memory. Pre-write log pages and data pages are directly written into logical block addresses of a persistent medium by a user-mode block device driver, and a writing path does not pass through a virtual file system, a page cache and a kernel block layer. The application eliminates system call and kernel path overheads, realizes a zero-copy data path, and guarantees crash consistency by means of storage fence and device refresh commands.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Direct mapping and persistence methods for user-space persistent memory without system calls Technical Field

[0002] This invention relates to the field of computer storage technology, and specifically to a method, system, storage medium, and electronic device for performing direct mapping of persistent memory regions, explicit persistence of modified data, and direct drive writing to block devices in user space under a microkernel operating environment without a file system, a virtual file system, or memory-mapped system calls. Background Technology

[0003] Existing persistent memory databases typically expose persistent memory as a file, using memory-mapped system calls and specifying synchronization mapping flags to map this file into the process address space. After writing, to ensure data bypasses the cache hierarchy and reaches the persistent medium, cache write-back instructions are used to write back line by line, and then storage fencing is used to finish. This type of scheme requires both mapping establishment and deallocation to go through the kernel system call path, with page caches and kernel block layers involved in the data path, leading to context switching, extra copies, and cache pollution. Furthermore, it relies on the file system and page cache semantics, making it undeployable in environments without a file system.

[0004] Another approach involves writing logs and data pages back to persistent media via the kernel's general block layer, which is also constrained by the virtual file system and kernel scheduling. In a microkernel environment without a file system, all requests to open non-device paths fail and are closed, rendering persistent paths dependent on file semantics completely unavailable. Therefore, a technical solution is needed that completes mapping, persistence, and block device access entirely in user space without initiating system calls. Summary of the Invention

[0005] The technical problem to be solved by this invention is: how to establish a persistent memory access window, persist modified data, and reliably write to persistent media without going through the kernel path and page cache in a runtime environment without a file system, virtual file system, or memory-mapped system calls, and ensure data consistency after a crash.

[0006] To solve the above-mentioned technical problems, the technical solution adopted by the present invention is: a method for direct mapping and persistence of user-mode persistent memory without system calls, comprising the following steps.

[0007] Step S1, User-space direct mapping: A persistent memory mapping region is constructed in user space using pure memory operations, without initiating any system calls throughout the process.

[0008] Step S2, explicit persistence instruction sequence: execute non-temporary storage instructions on the target data within the mapped area, so that the data bypasses the cache level and is directly written to persistent memory, achieving a persistence effect equivalent to cache write-back instructions.

[0009] Step S3, Storage Fence: Execute a storage fence instruction after the non-temporary storage instruction to make the aforementioned writes visible to persistent memory in sequence, and encapsulate the storage fence and the full memory barrier into a unified barrier interface for upper layer calls.

[0010] Step S4, User-space block device direct drive: Write-ahead log pages and data pages are directly written to the logical block address of persistent media via the user-space block device driver, and a refresh command is sent to the device controller to confirm persistence. The write path does not pass through the virtual file system, page cache, and kernel block layer.

[0011] In one implementation, the page multiple of the mapped region in step S1 is verified by compile-time assertions; the mapping module does not contain input / output, network, or system calls; the mapping adapter holds the underlying buffer indefinitely by allocating capacity first and then transferring ownership; the user-mode memory area is directly allocated and registered; the method runs in a microkernel environment without a standard library, and all requests to open non-device paths are closed upon failure.

[0012] In one implementation, the non-temporary storage instructions in step S2 are written in batches at the vector register granularity; the barrier interface in step S3 distinguishes between storage fences and full memory barriers; step S4 also passes the log pages and data pages to the page manager for conversion into logical block addresses before direct writing, and then sends a refresh command to the controller to ensure power-down consistency. In one implementation, the vector register granularity is 256 bits; the user-space block device driver is a user-space NVMe driver; and the write-ahead log area is 64 pages.

[0013] This invention also provides a user-mode persistent memory direct mapping and persistence system without system calls, a computer-readable storage medium, and an electronic device, the technical concept of which corresponds to the above-described methods. The electronic device includes a memory and a processor; the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above-described methods; the computer-readable storage medium stores the computer program.

[0014] The beneficial effects of this invention are as follows.

[0015] First, the three paths of persistent memory mapping, persistence, and disk writing are all located in user space, without system calls or kernel mode switching, thus eliminating system call overhead and kernel block layer copying.

[0016] Second, the data path does not involve page cache, achieving zero-copy read and write.

[0017] Third, non-temporary storage commands and storage fences ensure persistent ordering, which, together with block device refresh commands, achieves crash consistency.

[0018] Fourth, the solution does not depend on a file system and can run directly in a microkernel without a file system. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the overall process of the method of the present invention; Figure 2 A schematic diagram of user-space direct mapping and persistence instruction sequences; Figure 3 A schematic diagram of the direct drive write path for user-mode block devices. Detailed Implementation

[0020] The present invention will now be described in further detail with reference to the accompanying drawings. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the invention.

[0021] like Figure 1 As shown, the overall flow of the method of the present invention, from top to bottom, is as follows: Step S1: User-space direct mapping; Step S2: Explicit persistence of instruction sequences; Step S3: Storage fencing; Step S4: User-space block device direct drive. All four steps are completed in user space without initiating any system calls.

[0022] like Figure 2 As shown, the detailed process of user-mode direct mapping and persistence instruction sequence is as follows: The mapping region is constructed at compile time using constant functions; the address is verified to be an integer multiple of the preset page size using compile-time assertions; non-temporary storage instructions are executed on the target data, bypassing the cache level for writing; and the process concludes with storage fencing and full memory barriers. The entire process does not involve page caching or initiate any system calls.

[0023] Example 1: Construction of direct user-mode mapping. The mapper is implemented as a constant function, with compile-time assertions verifying page multiples. The module contains no input / output, network, or system calls. The mapping adapter holds the underlying buffer long-term by transferring ownership after capacity allocation; user-mode memory is directly allocated and registered, bypassing the kernel. The runtime environment is a microkernel without standard libraries, and all open requests for non-device paths are closed upon failure.

[0024] Example 2: Explicit Persistence Instruction Sequence and Memory Fence. Non-temporary storage writes are performed on the target data at the vector register granularity, bypassing the cache level and directly reaching persistent memory. In one implementation, this granularity is 256 bits. Storage fence instructions are then executed. The storage fence and full memory barrier are encapsulated as a storage fence interface and a memory barrier interface, respectively. The persistence process calls the storage fence interface to finish after the non-temporary storage instruction sequence is completed, and the full memory barrier interface handles write synchronization between multiple cores.

[0025] Example 3, direct drive for user-mode block devices. For example... Figure 3As shown, the persistence layer accesses the user-space block device via function calls. In one implementation, this is a user-space NVMe driver, which sequentially executes controller probing, namespace read / write, and controller refresh commands. The write-ahead log area and data area are directly written after being converted to logical block addresses by the page manager. In one implementation, the write-ahead log area is 64 pages. After completion, a refresh command is issued to the controller. The entire process involves no virtual file system, page cache, or kernel block layer.

[0026] In an alternative implementation, the vector register granularity may also employ other bit widths; the user-space block device driver may also employ block device protocols other than NVMe. These alternative implementations still fall within the scope of the technical concept claimed in this invention.

Claims

1. A method for direct mapping and persistence of user-space persistent memory without system calls, characterized in that, Includes the following steps: Step S1, User-space direct mapping: A persistent memory mapping region is constructed in user space using pure memory operations, without initiating any system calls throughout the process; Step S2, Explicit Persistence Instruction Sequence: Execute non-temporary storage instructions on the target data within the mapped region, enabling the data to bypass the cache level and be directly written to persistent memory; Step S3, Storage Fence: Execute storage fence instructions after the non-temporary storage instructions, making the writes visible to persistent memory in sequence; Step S4, User-space Block Device Direct Drive: Write-ahead log pages and data pages are directly written to the logical block address of the persistent medium via the user-space block device driver, and the write path does not pass through the virtual file system, page cache, and kernel block layer.

2. The method according to claim 1, characterized in that, The persistent memory mapping region mentioned in step S1 is constructed by a constant function at compile time, and the target address is verified to be an integer multiple of the preset page size by a compile-time assertion; the mapping adapter holds the underlying buffer for a long time by allocating contiguous memory with capacity and transferring ownership after allocation, or directly allocating a memory region in user space and registering it as a user space memory region; the method runs in a microkernel environment without a standard library, and all requests to open non-device paths are closed upon failure.

3. The method according to claim 1, characterized in that, The non-temporary storage instruction in step S2 is a non-temporary storage write instruction executed at the vector register granularity. When writing, it bypasses the cache level and goes directly to persistent memory. Its persistence effect is equivalent to cache write-back instructions.

4. The method according to claim 1, characterized in that, The fence in step S3 includes two levels: storage fence and full memory barrier, which are encapsulated as storage fence interface and memory barrier interface, respectively. After the non-temporary storage instruction sequence is completed, the persistence process calls the storage fence interface to finish, and uses the full memory barrier interface to handle write synchronization between multiple cores.

5. The method according to claim 1, characterized in that, In step S4, the user-mode block device is accessed via function calls through the user-mode block device driver, and the controller probe, namespace read / write, and controller refresh commands are executed sequentially. The log pages and data pages are written directly after being converted into logical block addresses by the page manager. After the writing is completed, a refresh command is sent to the device controller to confirm persistence.

6. The method according to claim 5, characterized in that, The persistent memory mapping area is divided into a write-ahead log area and a data area. Write-ahead log pages are written to the persistent medium first, and the corresponding data pages are written later. The writing order is guaranteed by the storage fence in step S3 to restore consistency after power failure.

7. A user-mode persistent memory direct mapping and persistence system without system calls, characterized in that, include: The mapping module is used to construct persistent memory-mapped regions in user space using pure memory operations without initiating any system calls; The persistence module is used to execute non-temporary storage instructions on the target data within the mapped area, and then execute storage fence instructions thereafter. The barrier interface module provides encapsulated calls for storage fencing and full memory barriers; the block device driver module writes write-ahead log pages and data pages directly to the logical block address of persistent media, without going through the virtual file system, page cache, and kernel block layer.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.