WO2022262623A1 - 一种数据交换方法及装置 - Google Patents
一种数据交换方法及装置 Download PDFInfo
- Publication number
- WO2022262623A1 WO2022262623A1 PCT/CN2022/097694 CN2022097694W WO2022262623A1 WO 2022262623 A1 WO2022262623 A1 WO 2022262623A1 CN 2022097694 W CN2022097694 W CN 2022097694W WO 2022262623 A1 WO2022262623 A1 WO 2022262623A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- swap
- memory
- request
- exchange
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/10—Address translation
- G06F12/1009—Address translation using page tables, e.g. page table structures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0866—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0893—Caches characterised by their organisation or structure
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0866—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
- G06F12/0868—Data transfer between cache memory and other subsystems, e.g. storage devices or host systems
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/12—Replacement control
- G06F12/121—Replacement control using replacement algorithms
- G06F12/126—Replacement control using replacement algorithms with special data handling, e.g. priority of data or instructions, handling errors or pinning
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/14—Protection against unauthorised use of memory or access to memory
- G06F12/1458—Protection against unauthorised use of memory or access to memory by checking the subject access rights
- G06F12/1483—Protection against unauthorised use of memory or access to memory by checking the subject access rights using an access-table, e.g. matrix or list
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/14—Protection against unauthorised use of memory or access to memory
- G06F12/1458—Protection against unauthorised use of memory or access to memory by checking the subject access rights
- G06F12/1491—Protection against unauthorised use of memory or access to memory by checking the subject access rights in a hierarchical protection system, e.g. privilege levels, memory rings
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/10—Providing a specific technical effect
- G06F2212/1004—Compatibility, e.g. with legacy hardware
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/10—Providing a specific technical effect
- G06F2212/1016—Performance improvement
- G06F2212/1024—Latency reduction
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/10—Providing a specific technical effect
- G06F2212/1032—Reliability improvement, data loss prevention, degraded operation etc
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2212/00—Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
- G06F2212/50—Control mechanisms for virtual memory, cache or TLB
- G06F2212/502—Control mechanisms for virtual memory, cache or TLB using adaptive policy
Definitions
- the present application relates to the field of storage technologies, and in particular to a data exchange method and device.
- the normal operation of the host is inseparable from the operating system, such as the Linux operating system.
- the operating system kernel supports memory swapping, that is, swapping out data in the memory of the host to a storage device, or swapping data in the storage device into the memory.
- various applications are installed on the host. With the diversified development of applications, the requirements of various applications for memory exchange show a trend of diversification. For example, different applications may want to use different storage devices when swapping memory.
- the storage device used by the operating system kernel for memory exchange is usually a general-purpose fixed device, which cannot meet the diverse needs of various applications for the storage device.
- the present application provides a data exchange method and device, which solves the problem that the memory exchange mechanism of the operating system kernel cannot meet the diverse requirements of different applications.
- the present application provides a data exchange method, which is applied to a host computer.
- the host computer is installed with an operating system and a target application. storage device.
- the specific solution includes: the host obtains the exchange request of the target application, and calls the user mode interface to perform operations on the storage device according to the exchange request.
- the swap request is a swap-in request or a swap-out request, and the swap-out request is used to request that the data of the target application be written into the storage device from the memory of the host.
- the swap-in request is used to request to write the data in the storage device into the memory.
- memory exchange in the user state is realized by setting the user state interface of the application in the user state space, and calling the user state interface to swap out or swap in the data of the application. Therefore, different user-mode interfaces can be set for different applications.
- the different user-mode interfaces correspond to different storage devices, providing users with a customized user-mode memory exchange framework, and meeting the diverse needs of different applications for storage devices. , enabling users to design the memory swap mechanism they want.
- the above-mentioned method of "calling the user mode interface to perform operations on the storage device according to the swap request" may include: the host responds to the swap-out request, Determine the first data of the target application in the memory, and release the mapping relationship between the first virtual address and the first physical address in the pre-stored page table, assign the second virtual address to the first data, and establish the relationship between the second virtual address and the first physical address.
- the mapping relationship of physical addresses may include: the host responds to the swap-out request, Determine the first data of the target application in the memory, and release the mapping relationship between the first virtual address and the first physical address in the pre-stored page table, assign the second virtual address to the first data, and establish the relationship between the second virtual address and the first physical address.
- the host calls the user mode interface, writes the first data indicated by the first physical address corresponding to the second virtual address from the memory into the storage device, and establishes a mapping relationship between the first virtual address and the first swap entry in the page table.
- the first exchange entry is used to indicate the location of the first data in the storage device.
- the first virtual address is the virtual address of the first data in the virtual memory
- the first physical address is the address of the first data in the memory.
- the data exchange method provided in the present application may further include: the host cancels the mapping relationship between the second virtual address and the first physical address, and deletes the first data in the memory.
- the memory usage can be saved and the memory usage rate can be increased.
- the data exchange method provided in the present application may further include: the host sets the state information of the first virtual address as first information, and the first information is used to indicate that the first virtual address corresponds to
- the exchange type of the first data is a user state exchange type.
- the above method of "obtaining the exchange request of the target application” may include: the host acquires the virtual address of the second data to be accessed, and When the state information of the virtual address of the second data is the first information, the second data is the data of the target application, and the memory does not include the second data, a swap-in request is generated.
- the first information is used to indicate that the exchange type of the second data is a user mode exchange type.
- the above-mentioned method of "calling the user mode interface to perform operations on the storage device according to the swap request" may include: the host obtains the second data according to the pre-stored page table in response to the swap-in request The second exchange entry corresponding to the virtual address of the second exchange entry, call the user mode interface, write the second data indicated by the second exchange entry from the storage device into the memory, and then establish the virtual address of the second data and the physical address of the second data in the page table Address mapping relationship.
- the physical address of the second data is the address of the second data in the memory.
- the data exchange method provided in the present application may further include: the host establishes a swap-out thread and a swap-in thread after the target application is started. Wherein, the swap-out thread is used to execute the swap-out operation of the first data, and the swap-in thread is used to execute the swap-in operation of the second data.
- the above method of "establishing a swap-out thread and a swap-in thread” may include: the host establishes a swap-out thread and a swap-in thread when the target application is included in a pre-stored white list. thread.
- Whitelist includes at least one app that supports memory swapping.
- the present application provides a data exchange device.
- the data exchange device includes various modules for performing the data exchange method of the above first aspect or any possible implementation manner of the above first aspect.
- the present application provides a host, where the host includes a memory and a processor.
- the memory and processor are coupled.
- the memory is used to store computer program code, which includes computer instructions.
- the processor executes the computer instruction, the host executes the data exchange method according to the first aspect and any possible implementation manner thereof.
- the present application provides a chip system, which is applied to a host.
- a system-on-a-chip includes one or more interface circuits, and one or more processors.
- the interface circuit and the processor are interconnected by wires; the interface circuit is used to receive signals from the memory of the host computer and send signals to the processor, the signals include computer instructions stored in the memory.
- the processor executes the computer instruction
- the host executes the data exchange method according to the first aspect and any possible implementation manner thereof.
- the present application provides a computer-readable storage medium, the computer-readable storage medium includes computer instructions, and when the computer instructions are run on a host, the host executes the first aspect and any possible implementation thereof. data exchange method.
- the present application provides a computer program product, the computer program product includes computer instructions, and when the computer instructions are run on the host computer, the host computer executes the data exchange method according to the first aspect and any possible implementation thereof .
- FIG. 1 is a schematic diagram of a data exchange system provided by an embodiment of the present application.
- FIG. 2 is one of a schematic structural diagram of a host provided in an embodiment of the present application.
- Fig. 3 is a second structural schematic diagram of a host computer provided by the embodiment of the present application.
- FIG. 4a is a schematic diagram of data swapping out of the user state provided by the embodiment of the present application.
- FIG. 4b is a schematic diagram of a scene where the first data is swapped out according to the embodiment of the present application.
- FIG. 5 is a schematic diagram of data exchange in the user state provided by the embodiment of the present application.
- FIG. 6 is a schematic flowchart of a data exchange method provided in an embodiment of the present application.
- FIG. 7 is one of the structural schematic diagrams of the data exchange device provided by the embodiment of the present application.
- FIG. 8 is the second schematic diagram of the structure of the data exchange device provided by the embodiment of the present application.
- words such as “exemplary” or “for example” are used as examples, illustrations or illustrations. Any embodiment or design scheme described as “exemplary” or “for example” in the embodiments of the present application shall not be interpreted as being more preferred or more advantageous than other embodiments or design schemes. Rather, the use of words such as “exemplary” or “such as” is intended to present related concepts in a concrete manner.
- first and second are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of indicated technical features. Thus, a feature defined as “first” and “second” may explicitly or implicitly include one or more of these features. In the description of the embodiments of the present application, unless otherwise specified, "plurality” means two or more.
- cold data refers to data that is accessed infrequently but still needs to be retained for a long time.
- the cold data can be stored in the storage device through the memory exchange mechanism.
- the operating system kernel executes the memory swap process as follows: when the memory of the host is insufficient, the operating system kernel writes data with low access frequency in the memory, that is, cold data, from the memory to the storage device, and deletes the cold data in the memory. data. When the data written to the storage device needs to be accessed in the memory, the operating system kernel can write the data from the storage device into the memory.
- the storage device used by the operating system kernel for memory exchange is usually a general-purpose fixed device, it cannot meet the diverse needs of various applications for storage devices.
- an embodiment of the present application provides a data exchange method, which is applied to a host.
- the host is installed with an operating system and a target application.
- the operating system includes a user state space.
- the user state space is provided with a user state interface of the target application, and the user state interface corresponds to a storage device. After the host obtains the exchange request of the target application, it can call the user mode interface to perform operations on the storage device according to the exchange request.
- the swap request When the swap request is a swap-out request, it is used to request that the data of the target application be written into the storage device from the memory of the host, and when the swap request is a swap-in request, it is used to request to write the data in the storage device into the memory.
- memory exchange in the user state is realized by setting the user state interface of the application in the user state space, and calling the user state interface to swap out or swap in the data of the application. Therefore, different user mode interfaces can be set for different applications, and the different user mode interfaces correspond to different storage devices, which meets the diverse requirements of different applications for storage devices.
- the operating system is an indispensable system software for a host, and it is the soul of the entire host.
- Common operating systems may include Windows operating systems, Linux operating systems, and the like.
- the operating system can include user mode space and kernel mode space.
- the user state space is the active space of the application, and is used to store program codes and data of the application.
- the kernel state space is the active space of the operating system, and is used to store program codes and data of the operating system or the operating system kernel.
- the hardware resources of the host that can be accessed by the applications or processes in the user mode space are limited, and can only access part of the hardware resources.
- the operating system or kernel in the kernel space has the authority to access all hardware resources of the host, and can access all hardware resources of the host.
- applications in the user space cannot directly access the hardware resources of the host, but can access hardware resources through operating system calls, library functions, and scripts.
- FIG. 1 shows a structure of the data exchange system.
- the data exchange system may include: a host 11 and a storage device 12 .
- the host 11 and the storage device 12 are connected by wired communication or wireless communication.
- the host 11 is configured to obtain the exchange request of the target application installed on the host 11, and according to the exchange request, call the user mode interface of the target application set in the user mode space to perform operations on the storage device 12 corresponding to the user mode interface.
- the operating system installed on the host 11 includes a user mode space.
- the user mode interface of each target application can be set in the user mode space, that is, one target application corresponds to one user mode interface.
- the user mode interfaces corresponding to different applications may be the same or different.
- one user mode interface corresponds to one storage device.
- the storage devices corresponding to the same user mode interface may be the same or different, and the storage devices corresponding to different user mode interfaces may be the same or different.
- the user-mode interface corresponding to each application and the storage device corresponding to each user-mode interface can be pre-configured in the host, and are not limited here.
- the host 11 may be a terminal device, a server, a cloud computing platform, and the like.
- the terminal device may be a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a computer, and the like.
- the host is used as an example to illustrate the server.
- the storage device 12 may be a memory of a host other than the host 11, or may be a storage medium.
- the type of the storage medium may be non-volatile flash memory (not and flash, NAND flash), storage class memory (storage class memory, SCM), and the like.
- the operating system installed on the host 11 may include not only the user mode space, but also the kernel mode space.
- the kernel mode space can be provided with a kernel mode interface, and the kernel mode interface corresponds to a storage device, which is a device used by the operating system kernel for memory exchange.
- the type of the storage device is usually NAND flash, SCM, etc.
- the data exchange system shown in FIG. 1 is only used as an example, and is not used to limit the technical solutions of the embodiments of the present application. Those skilled in the art should understand that in a specific implementation process, the data exchange system may also include other nodes, and the number of nodes may also be determined according to specific needs, without limitation.
- Fig. 2 shows a structure of the above-mentioned host.
- the host may include a processor 201 and a memory 202 for implementing the data exchange method provided in the embodiment of the present application.
- the processor 201 can be a general-purpose central processing unit (central processing unit, CPU), a microprocessor, a specific application integrated circuit (application-specific integrated circuit, ASIC), or one or more for controlling the execution of the program program of this application integrated circuit.
- CPU central processing unit
- ASIC application-specific integrated circuit
- the processor 201 is configured to process requests from outside the host, such as other hosts, and is also configured to process requests generated inside the host.
- the processor 201 may be configured to process a swap request acquired by the host, where the swap request is a swap-out request or a swap-in request.
- the memory 202 refers to an internal memory directly exchanging data with the processor 201. It can read and write data at any time, and the speed is very fast. It is used as a temporary data storage for the operating system or other running programs.
- the memory 202 includes at least two types of memory, for example, the memory can be a random access memory or a read only memory (read only memory, ROM).
- the random access memory may be dynamic random access memory (dynamic random access memory, DRAM), or SCM.
- DRAM is a kind of semiconductor memory, and like most random access memory (random access memory, RAM), it belongs to a kind of volatile memory (volatile memory).
- SCM is a composite storage technology that combines the characteristics of traditional storage devices and memory at the same time.
- Storage-class memory can provide faster read and write speeds than hard disks, but slower access speeds than DRAM, and cheaper than DRAM in terms of cost.
- DRAM and the SCM are only exemplary in this embodiment of the application, and the memory 202 may also include other random access memories, such as static random access memory (static random access memory, SRAM).
- SRAM static random access memory
- the read-only memory for example, it may be programmable read-only memory (programmable read only memory, PROM), erasable programmable read-only memory (erasable programmable read only memory, EPROM), etc., but not limited thereto.
- the memory 202 can also be a dual in-line memory module or a dual in-line memory module (DIMM), that is, a module composed of DRAM, or a solid state disk (SSD).
- DIMM dual in-line memory module
- the memory 202 may exist independently and be coupled with the processor 201 .
- the memory 202 can also be integrated with the processor 201 .
- multiple memories may be configured in the host, and the multiple memories may be of the same type or of different types.
- the embodiment of the present application does not limit the quantity and type of memory of the host, and only one memory 202 is shown in FIG. 2 as an example.
- the memory 202 can be configured to have a power saving function.
- the power saving function means that the data stored in the memory 202 will not be lost when the system is powered off and then powered on again. Memory with power retention is called non-volatile memory.
- the memory 202 stores program codes and data of applications installed on the host, and codes and data of operating systems installed on the host.
- the application is a program running on the basis of the operating system.
- the structure shown in FIG. 2 does not constitute a limitation to the host. Except for the components shown in FIG. 2, the host may include more or less components than those shown in the illustration, or combine certain components , or different component arrangements. For example, the host may also include input and output devices such as a sound card, an optical drive, a hard disk, a monitor, a keyboard, a mouse, a stereo, a tablet, a microphone, and a camera.
- input and output devices such as a sound card, an optical drive, a hard disk, a monitor, a keyboard, a mouse, a stereo, a tablet, a microphone, and a camera.
- FIG. 3 shows a structure of the host.
- an operating system and at least one target application are installed on the host.
- An operating system may include a user-mode space and a kernel-mode space.
- the user mode space includes program code and data of each application in at least one application
- the kernel mode space includes program code and data of the operating system kernel.
- the user mode space is provided with a user mode interface of each application in at least one application.
- the program code of each application may include the driver program or protocol stack corresponding to the user mode interface of the application, and the user mode interface of the application can be called by running the driver program or protocol stack .
- the user space may include preloaded modules, swapped out modules, and swapped in modules.
- the kernel state space may include a page table management module and a page fault exception reporting module. These modules can cooperate to complete the memory exchange mechanism in user mode.
- a target application is used as an example to introduce the memory swap method in the user mode in detail. The memory swap methods of other target applications are similar and will not be repeated here.
- the page table management module is used to manage the page table of the host.
- the page table is a structure of data storage, which is used to store the mapping relationship between the virtual address (virtual address, VA) and the physical address (physical address, PA) of the data.
- the virtual address is the logical address of the data in the virtual memory
- the physical address is the real address of the data in the memory.
- the data stored in the page table may be implemented through a hash table.
- the preloading module is used to establish a swap-out thread and a swap-in thread after the target application is started, and initialize related resources.
- the swap-out thread is used to execute the swap-out operation of the first data
- the swap-in thread is used to execute the swap-in operation of the second data.
- Relevant resources refer to various resources required for swapping out of the first data or swapping in of the second data.
- related resources may include page tables.
- the related resources may also include swap memory (swap cache).
- the swap memory is a part of storage space divided from the memory of the host, and is used to temporarily store the first data when the first data is swapped out from the memory to the storage device. After the swap memory is full of data, the data in the swap memory is stored in the storage device.
- the preloading module is specifically used to create a swap-out thread and a swap-in thread and initialize related resources by loading the program code of the target application in the user mode space after the target application is started.
- the preload module can first determine whether the target application is included in the pre-stored whitelist before creating the swap-out thread and the swap-in thread.
- the list includes at least one application that supports memory swapping.
- the preloading module creates a swap-out thread and a swap-in thread; otherwise, the preloading module does not perform any operation.
- the applications included in the white list may be applications that occupy a large amount of memory, for example, game applications, video applications, and the like. Applications that occupy less memory, such as calendars and calculators, are usually not included in the whitelist, because the data volume of such applications is small, and there is no need for memory swap. In this way, by setting the white list in advance, only some specific applications are supported to perform memory swap, which can save memory overhead and improve the performance of the host.
- the swap-out module can wait to receive a swap-out request, and the swap-in module can wait to receive a swap-in request.
- FIG. 4a shows a swapping out process of the first data.
- the swapping out module is configured to acquire a swapping out request of a target application, and invoke a swapping out thread to swap out the first data.
- the swap-out request is used to request to write the data of the target application from the memory of the host to the storage device corresponding to the user mode interface of the target application.
- the swap-out module may generate a swap-out request for the target application in response to the user's swap-out operation on the target application.
- the swap-out module may also generate a swap-out request for the target application when it is determined that the memory for running the target application is insufficient. This embodiment of the present application does not limit the triggering manner of the swap-out request.
- the memory capacity of the host is 13G, and the host has currently run two applications, occupying 10G of memory. At this point the user launches another application. If the host needs to occupy 5G of memory to run the other application, the host generates a swap out request for the other application when it determines that the memory for running the other application is insufficient.
- the swap-out module is further configured to determine in memory the first data to be swapped out of the target application in response to the swap-out request of the target application.
- the first data may be cold data of the target application, that is, data that the target application has a low access frequency but requires long-term storage.
- the first data may be historical record data of the game application.
- the swap-out module is further configured to determine whether the first data of the target application is allowed to be swapped out after the first data of the target application is determined. If it is determined that the first data is not allowed to be swapped out, the swapping out module ends the swapping out process of the first data. If it is determined that the first data is allowed to be swapped out, the swap-out module may send a message to the page table management module by calling the customized interface. The message is used for the swap-out module to notify the page table management module that the first data is data to be swapped out.
- the customized interface refers to the communication interface between the user mode space and the kernel mode space.
- the page table management module after receiving the message sent by the swap out module, can release the mapping relationship between the first virtual address and the first physical address of the first data in the pre-stored page table, and assign the second virtual address to the first data. address, and establish a mapping relationship between the second virtual address and the first physical address. Finally, the page table management module is further configured to return the second virtual address of the first data to the swap-out module through a customized interface.
- the first virtual address and the second virtual address are two different virtual addresses of the first data in the virtual memory
- the first physical address is a real address of the first data in the memory.
- the page table management module is further configured to set the state information of the first virtual address as the first information after receiving the message from the swap-out module in the user state space, the second The information is used to indicate that the exchange type of the first data corresponding to the first virtual address is a user state exchange type.
- the page table management module is further configured to set the state information of the first virtual address as second information after receiving the message from the swap-out module in the kernel space, and the second information is used to indicate the first virtual address
- the corresponding exchange type of the first data is a kernel state exchange type.
- the swap-out module is also used to receive the second virtual address of the first data sent by the page table management module, call the user mode interface of the target application by running the driver program or protocol stack of the target application, and according to the second virtual address in the page table
- the mapping relationship between the virtual address and the first physical address, the first data indicated by the first physical address corresponding to the second virtual address is written from the memory into the storage device corresponding to the user mode interface, and the data written into the storage device is third data. After the storage device successfully writes the third data, it can return the first swap entry (swap entry) to the swap-out module through the user mode interface.
- the first exchange entry is used to indicate the location of the third data in the storage device.
- the swap-out module may call the user-mode interface of the target application, first write the first data from the internal memory into the swap memory, and then write the first data into the swap memory. Data is exchanged data. After the storage space of the swap memory is full, the swap data may be written from the swap memory into the storage device corresponding to the user mode interface. At this time, the data written into the storage device is the third data.
- the first data, the third data, and the swap data are the same data stored in the internal memory, the storage device, and the swap memory, respectively. Only the storage location of the data changes, and the content of the data remains the same. Moreover, after the first data is written into the storage device from the internal memory, when the first data needs to be accessed in the internal memory, the third data may be written from the storage device into the internal memory. In this case, the virtual address of the data written into the memory and the virtual address of the first data are the same virtual address.
- the swap out module is further configured to send the first swap entry to the page table management module through the customized interface after receiving the first swap entry.
- the page table management module is further configured to, after receiving the first swap entry, establish a mapping relationship between the first virtual address and the first swap entry in the page table.
- the page table management module is further configured to release the mapping relationship between the second virtual address and the first physical address in the page table, and delete the first data in the memory. In this way, the swapping out of the first data is completed, and by releasing the storage space of the first data in the memory, the memory usage can be saved and the memory usage ratio can be increased.
- the page table management module is further configured to set the state information of the first switch entry as the third information after establishing the mapping relationship between the first virtual address and the first switch entry.
- the third information is used to indicate that the third data indicated by the first swap entry is data swapped out from the internal memory to the storage device.
- Fig. 5 shows the swap-in process of the second data.
- the swap-in module is configured to obtain a swap-in request of the target application, and call a swap-in thread to swap in the second data.
- the swap-in request is used to request to write data in the storage device corresponding to the user mode interface of the target application into the memory.
- the viewing operation can be performed on the host.
- the processor of the host generates a data access request in response to the viewing operation of the user, and sends the data access request to the page table management module.
- the data access request may include data access information, for example, the data access information may be a virtual address of the second data.
- the page table management module can query the virtual address of the second data in the page table. If the data location information corresponding to the virtual address of the second data in the page table is a physical address, it indicates that the second data is stored in the memory, and at this time, the second data can be obtained in the memory according to the physical address.
- the page table management module may send an indication message to the page fault reporting module to trigger the page fault reporting.
- the page fault reporting module receives the indication message sent by the page table management module, it can determine whether the swap-in operation is a swap-in of the kernel mode or a swap-in of the user mode.
- the page fault exception reporting module may determine whether the state information of the virtual address of the second data in the page table is the first information or the second information.
- the page fault reporting module can generate a change-in request of the target application under the condition that the second data is determined to be the data of the target application, and then send a request to the user state through the user exception handling function (userfaultfd) or signal processing function (signal).
- the swap-in module in the space sends a swap-in request of the target application, and the swap-in request may include the virtual address of the second data. In this way, the swap-in module in the user state space can obtain the swap-in request of the target application.
- the page fault exception reporting module may send a swap-in request to the swap-in module in the kernel space, so that the swap-in module performs the swap-in of the second data.
- the above-mentioned second data is data swapped out from the internal memory to the storage device, and the above-mentioned userfaultfd or signal may be registered during the swap-out process of the second data. Specifically, it may be registered after the swap-out module determines that the second data is allowed to be swapped out.
- the process of swapping out the second data is the same as the process of swapping out the first data in the above embodiment, and will not be repeated here.
- the swap-in module is also used to call the customized interface in response to the swap-in request of the target application, obtain the second swap entry corresponding to the virtual address of the second data in the page table through the page table management module, and call the target application's
- the user mode interface writes the second data indicated by the second exchange entry into the memory from the storage device corresponding to the user mode interface.
- the swap-in module may first apply for a third virtual address and a third physical address. After applying for the address, the swap-in module may copy the second data from the storage device to a location corresponding to the third physical address, and establish a mapping relationship between the third virtual address and the third physical address. At this time, the data stored in the third physical address is the fourth data.
- the swap-in module may instruct the page table management module to apply for a new physical address for the second data, and copy the fourth data indicated by the third physical address corresponding to the third virtual address to the position corresponding to the new physical address, and
- the mapping relationship between the virtual address of the second data and the physical address of the second data is established in the page table, the mapping relationship between the third virtual address and the third physical address is released, and the fourth data stored in the third physical address is deleted.
- the data stored in the physical address of the second data is fifth data. In this way, the swap-in of the second data is completed, and the data can be read and written in the memory.
- the swap-in module may call the user-mode interface of the target application, write the second data from the storage device corresponding to the user-mode interface into a buffer, and write the second data into the buffer
- the data is buffered data.
- the buffered data is written from the buffer to the position corresponding to the third physical address, and the data written in the third physical address is the fourth data.
- the fourth data is copied from the third physical address to the location corresponding to the physical address of the second data, and the data written in the physical address of the second data is the fifth data.
- the above-mentioned buffer is also a part of the storage space divided in the memory, and is used to temporarily store the data when the second data in the storage device is swapped into the memory. After the physical address is applied for the second data in the memory, the data in the buffer is written into the applied physical address, so as to avoid the problem of slow switching speed of the host due to the slow reading and writing speed of the storage device.
- the second data, the fourth data, the fifth data and the buffer data are respectively stored in the storage device, the third physical address of the internal memory, the physical address of the second data in the internal memory and the buffer of the same data. Only the storage location of the data changes, and the content of the data remains the same. Moreover, if the second data is the data that writes the initial data from the memory into the storage device, then the virtual address of the initial data and the virtual address of the fifth data are the same virtual address.
- the host may perform some or all of the steps in the embodiment of the present application, and these steps are only examples, and the embodiment of the present application may also perform other steps or variations of various steps.
- each step may be performed in a different order presented in the embodiment of the present application, and it may not be necessary to perform all the steps in the embodiment of the present application.
- the specific structure of the execution body of the data exchange method is not particularly limited in the embodiment of the present application, as long as the method provided in the embodiment of the present application can be realized.
- the execution subject of the data exchange method provided in the embodiment of the present application may be a host, or a component applied to the host, such as a chip, which is not limited in the embodiment of the present application.
- the following embodiments are described by taking the execution subject of the data exchange method as the host as an example.
- the data exchange method provided by the embodiment of the present application may include the following steps 601 - 613 .
- step 601 is a preparatory operation performed by the preloaded module in the user state space before performing memory swap.
- Steps 602 to 608 are the process of swapping out the first data from the internal memory to the storage device.
- Steps 609 to 613 are the process of swapping the second data from the storage device to the internal memory.
- the host After the target application is started, the host creates a swap-out thread and a swap-in thread under the condition that the target application is included in a pre-stored white list.
- the white list includes at least one application that supports memory swap.
- the swap-out thread is used to perform a swap-out operation of the first data
- the swap-in thread is used to perform a swap-in operation of the second data.
- step 601 reference may be made to the relevant description of creating a swap-out thread and a swap-in thread by the preloading module in another embodiment, and details are not repeated here.
- the host obtains a swap-out request of the target application.
- the host determines first data of the target application in memory in response to the swap-out request.
- the host cancels the mapping relationship between the first virtual address and the first physical address in the prestored page table, and sets the state information of the first virtual address as the first information.
- the first virtual address is a virtual address of the first data in the virtual memory
- the first physical address is an address of the first data in the memory
- the host allocates a second virtual address to the first data, and establishes a mapping relationship between the second virtual address and the first physical address.
- the host calls the user mode interface, and writes the first data indicated by the first physical address corresponding to the second virtual address from the memory to the storage device.
- the host establishes a mapping relationship between the first virtual address and the first switch entry in the page table.
- the first exchange entry is used to indicate the location of the first data in the storage device.
- the host cancels the mapping relationship between the second virtual address and the first physical address, and deletes the first data in the memory.
- steps 602 to 608 reference may be made to the relevant description of swapping out the first data from the internal memory to the storage device by the swapping out module and the page table management module in another embodiment, which will not be repeated here.
- the host acquires the virtual address of the second data to be accessed.
- the host When the status information of the virtual address of the second data is the first information, the second data is the data of the target application, and the memory does not include the second data, the host generates a swap-in request of the target application.
- the host acquires a second swap entry corresponding to the virtual address of the second data according to the prestored page table.
- the host calls the user mode interface, and writes the second data indicated by the second swap entry from the storage device into the memory.
- the host establishes a mapping relationship between the virtual address of the second data and the physical address of the second data in the page table.
- the physical address of the second data is the address of the second data in the memory.
- steps 609 to 613 please refer to the relevant description of swapping the second data from the storage device to the internal memory by the swap-in module, the page table management module, and the page fault reporting module in another embodiment. This will not be repeated here.
- An embodiment of the present application provides a data exchange method, which is applied to a host.
- the host is installed with an operating system and a target application.
- the operating system includes a user state space.
- the user state space is provided with a user state interface of the target application, and the user state interface corresponds to a storage device.
- the host can call the user mode interface to perform operations on the storage device according to the exchange request.
- the swap request is a swap-out request, it is used to request that the data of the target application be written into the storage device from the memory of the host, and when the swap request is a swap-in request, it is used to request to write the data in the storage device into the memory.
- memory exchange in the user state is realized by setting the user state interface of the application in the user state space, and calling the user state interface to swap out or swap in the data of the application. Therefore, different user-mode interfaces can be set for different applications.
- the different user-mode interfaces correspond to different storage devices, providing users with a customized user-mode memory exchange framework, and meeting the diverse needs of different applications for storage devices. , enabling users to design the memory swap mechanism they want.
- the performance of the memory swap in the user mode is higher than that in the kernel mode.
- the driver or protocol stack of the current storage device has been moved up to the user mode, so that the memory swap mechanism in the kernel mode cannot use the storage device moved up to the user mode.
- the embodiment of the present application implements a memory exchange mechanism in the user state, and the mechanism can use a storage device moved up to the user state.
- Table 2 shows performance-related parameters of the user mode memory swap mechanism. It can be seen from Table 1 that when the host swaps out data, the performance loss is only 2%, and the performance loss of the kernel state memory swap mechanism is greater than 2%.
- FIG. 7 it is a schematic structural diagram of a data exchange device 70 provided in the embodiment of the present application.
- the data exchange device 70 may be a host, or a CPU in the host, or a control module in the host, or a client in the host.
- the data exchange device 70 is used to execute the data exchange method shown in FIG. 6 .
- the data exchange device 70 may include an acquisition unit 71 and a processing unit 72 .
- the obtaining unit 71 is configured to obtain a swap request of the target application, the swap request is a swap-in request or a swap-out request, the swap-out request is used to request that the data of the target application be written from the memory of the host to the storage device, and the swap-in request is used to request Write data from storage device to memory.
- the acquiring unit 71 may be configured to execute step 602 and step 610 .
- the processing unit 72 is configured to invoke the user mode interface to perform operations on the storage device according to the exchange request obtained by the obtaining unit 71 .
- the swap request is a swap-out request
- the processing unit 72 is specifically configured to, in response to the swap-out request, determine the first data of the target application in the memory, and release the first virtual address and the first physical address in the pre-stored page table.
- the address mapping relationship is to allocate a second virtual address to the first data, and establish a mapping relationship between the second virtual address and the first physical address.
- call the user mode interface write the first data indicated by the first physical address corresponding to the second virtual address from the memory into the storage device, and establish a mapping relationship between the first virtual address and the first swap entry in the page table.
- the first exchange entry is used to indicate the location of the first data in the storage device.
- the first virtual address is a virtual address of the first data in the virtual memory
- the first physical address is an address of the first data in the memory.
- the data exchange device 70 further includes a canceling unit 73 and a deleting unit 74 .
- the release unit 73 is configured to release the mapping relationship between the second virtual address and the first physical address.
- the release unit 73 may be configured to perform the release of the mapping relationship between the second virtual address and the first physical address in step 608 .
- a deleting unit 74 configured to delete the first data in the memory.
- the deleting unit 74 may be configured to perform step 608 of deleting the first data in the memory.
- the data exchange device 70 further includes a setting unit 75 .
- the setting unit 75 is configured to set the state information of the first virtual address as first information, and the first information is used to indicate that the exchange type of the first data corresponding to the first virtual address is a user state exchange type.
- the acquiring unit 71 is specifically configured to: acquire the virtual address of the second data to be accessed; the state information at the virtual address of the second data is the first information, and the second data is When the data of the target application does not include the second data in the memory, a swap request is generated, and the first information is used to indicate that the swap type of the second data is a user mode swap type.
- the processing unit 72 is specifically configured to: in response to the swap-in request, obtain the second swap entry corresponding to the virtual address of the second data according to the pre-stored page table;
- the second data is written into the memory from the storage device; the mapping relationship between the virtual address of the second data and the physical address of the second data is established in the page table, and the physical address of the second data is the address of the second data in the memory.
- the data exchange device 70 further includes an establishment unit 76 .
- the establishment unit 76 is configured to establish a swap-out thread and a swap-in thread after the target application is started, the swap-out thread is used to execute the swap-out operation of the first data, and the swap-in thread is used to execute the swap-in operation of the second data.
- the establishment unit 76 may be used to execute step 601 .
- the establishing unit 76 is specifically configured to establish a swap-out thread and a swap-in thread when the target application is included in a pre-stored white list, and the white list includes at least one application that supports memory swap.
- the data exchange device 70 provided in the embodiment of the present application includes but is not limited to the above modules.
- the acquiring unit 71, the processing unit 72, the releasing unit 73, the deleting unit 74, the setting unit 75 and the establishing unit 76 can be realized by calling the program code in the memory 202 by the processor 201 shown in FIG. 2 .
- the specific execution process reference may be made to the description of the data exchange method shown in FIG. 6 , which will not be repeated here.
- Another embodiment of the present application also provides a computer-readable storage medium, where computer instructions are stored in the computer-readable storage medium, and when the computer instructions are run on the host, the host executes the method in the method described in the above method embodiment. The individual steps performed by the host.
- a system-on-a-chip includes one or more interface circuits, and one or more processors.
- the interface circuit and the processor are interconnected by wires.
- the interface circuit is used to receive signals from the memory of the host and send signals to the processor, the signals including computer instructions stored in the memory.
- the processor executes the computer instruction, the host executes various steps performed by the host in the method flow shown in the above method embodiments.
- a computer program product is also provided.
- the computer program product includes computer instructions.
- the host computer executes the steps executed by the host computer in the method flow shown in the above method embodiments. various steps.
- all or part of them may be implemented by software, hardware, firmware or any combination thereof.
- a software program When implemented using a software program, it may be implemented in whole or in part in the form of a computer program product.
- the computer program product includes one or more computer instructions.
- computer-executed instructions When computer-executed instructions are loaded and executed on a computer, the processes or functions according to the embodiments of the present application are generated in whole or in part.
- a computer can be a general purpose computer, special purpose computer, a computer network, or other programmable apparatus.
- Computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, e.g.
- the computer-readable storage medium may be any available medium that can be accessed by a computer, or may contain one or more data storage devices such as servers and data centers that can be integrated with the medium.
- the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, or a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (solid state disk, SSD)), etc.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Software Systems (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
Claims (18)
- 一种数据交换方法,应用于主机,其特征在于,所述主机安装有操作系统和目标应用,所述操作系统包括用户态空间,所述用户态空间设置有所述目标应用的用户态接口,所述用户态接口对应一个存储设备,包括:获取所述目标应用的交换请求,所述交换请求为换入请求或换出请求,所述换出请求用于请求将所述目标应用的数据从所述主机的内存写入所述存储设备,所述换入请求用于请求将所述存储设备中的数据写入所述内存;根据所述交换请求,调用所述用户态接口对所述存储设备执行操作。
- 根据权利要求1所述的数据交换方法,其特征在于,所述交换请求为所述换出请求,所述根据所述交换请求,调用所述用户态接口对所述存储设备执行操作,包括:响应于所述换出请求,在所述内存中确定所述目标应用的第一数据;解除预存的页表中的第一虚拟地址与第一物理地址的映射关系,所述第一虚拟地址为所述第一数据在虚拟内存的虚拟地址,所述第一物理地址为所述第一数据在所述内存中的地址;为所述第一数据分配第二虚拟地址,并建立所述第二虚拟地址与所述第一物理地址的映射关系;调用所述用户态接口,将所述第二虚拟地址对应的所述第一物理地址指示的所述第一数据从所述内存写入所述存储设备;在所述页表中建立所述第一虚拟地址与第一交换入口的映射关系,所述第一交换入口用于指示所述第一数据在所述存储设备中的位置。
- 根据权利要求2所述的数据交换方法,其特征在于,所述数据交换方法还包括:解除所述第二虚拟地址与所述第一物理地址的映射关系,删除所述内存中的所述第一数据。
- 根据权利要求2或3所述的数据交换方法,其特征在于,所述数据交换方法还包括:将所述第一虚拟地址的状态信息设置为第一信息,所述第一信息用于指示所述第一虚拟地址对应的所述第一数据的交换类型为用户态交换类型。
- 根据权利要求1所述的数据交换方法,其特征在于,所述交换请求为所述换入请求,所述获取所述目标应用的交换请求,包括:获取待访问的第二数据的虚拟地址;在所述第二数据的虚拟地址的状态信息为第一信息,所述第二数据为所述目标应用的数据,且所述内存中未包括所述第二数据的情况下,生成所述换入请求,所述第一信息用于指示所述第二数据的交换类型为用户态交换类型。
- 根据权利要求5所述的数据交换方法,其特征在于,所述根据所述交换请求,调用所述用户态接口对所述存储设备执行操作,包括:响应于所述换入请求,根据预存的页表获取所述第二数据的虚拟地址对应的第二交换入口;调用所述用户态接口,将所述第二交换入口指示的所述第二数据从所述存储设备写入所述内存;在所述页表中建立所述第二数据的虚拟地址与所述第二数据的物理地址的映射关系,所述第二数据的物理地址为所述第二数据在所述内存中的地址。
- 根据权利要求1-6中任一项所述的数据交换方法,其特征在于,在所述获取所述目标应用的交换请求之前,所述数据交换方法还包括:在所述目标应用启动后,建立换出线程和换入线程,所述换出线程用于执行第一数据的换出操作,所述换入线程用于执行第二数据的换入操作。
- 根据权利要求7所述的数据交换方法,其特征在于,所述建立换出线程和换入线程,包括:在所述目标应用包含在预存的白名单的情况下,建立所述换出线程和所述换入线程,所述白名单中包括至少一个支持内存交换的应用。
- 一种数据交换装置,位于主机,其特征在于,所述主机安装有操作系统和目标应用,所述操作系统包括用户态空间,所述用户态空间设置有所述目标应用的用户态接口,所述用户态接口对应一个存储设备,所述数据交换装置包括:获取单元,用于获取所述目标应用的交换请求,所述交换请求为换入请求或换出请求,所述换出请求用于请求将所述目标应用的数据从所述主机的内存写入所述存储设备,所述换入请求用于请求将所述存储设备中的数据写入所述内存;处理单元,用于根据所述获取单元获取的所述交换请求,调用所述用户态接口对所述存储设备执行操作。
- 根据权利要求9所述的数据交换装置,其特征在于,所述交换请求为所述换出请求,所述处理单元,具体用于:响应于所述换出请求,在所述内存中确定所述目标应用的第一数据;解除预存的页表中的第一虚拟地址与第一物理地址的映射关系,所述第一虚拟地址为所述第一数据在虚拟内存的虚拟地址,所述第一物理地址为所述第一数据在所述内存中的地址;为所述第一数据分配第二虚拟地址,并建立所述第二虚拟地址与所述第一物理地址的映射关系;调用所述用户态接口,将所述第二虚拟地址对应的所述第一物理地址指示的所述第一数据从所述内存写入所述存储设备;在所述页表中建立所述第一虚拟地址与第一交换入口的映射关系,所述第一交换入口用于指示所述第一数据在所述存储设备中的位置。
- 根据权利要求10所述的数据交换装置,其特征在于,所述数据交换装置还包括:解除单元和删除单元;所述解除单元,用于解除所述第二虚拟地址与所述第一物理地址的映射关系;所述删除单元,用于删除所述内存中的所述第一数据。
- 根据权利要求10或11所述的数据交换装置,其特征在于,所述数据交换装置还包括:设置单元;所述设置单元,用于将所述第一虚拟地址的状态信息设置为第一信息,所述第一信息用于指示所述第一虚拟地址对应的所述第一数据的交换类型为用户态交换类型。
- 根据权利要求9所述的数据交换装置,其特征在于,所述交换请求为所述换入 请求,所述获取单元,具体用于:获取待访问的第二数据的虚拟地址;在所述第二数据的虚拟地址的状态信息为第一信息,所述第二数据为所述目标应用的数据,且所述内存中未包括所述第二数据的情况下,生成所述换入请求,所述第一信息用于指示所述第二数据的交换类型为用户态交换类型。
- 根据权利要求13所述的数据交换装置,其特征在于,所述处理单元,具体用于:响应于所述换入请求,根据预存的页表获取所述第二数据的虚拟地址对应的第二交换入口;调用所述用户态接口,将所述第二交换入口指示的所述第二数据从所述存储设备写入所述内存;在所述页表中建立所述第二数据的虚拟地址与所述第二数据的物理地址的映射关系,所述第二数据的物理地址为所述第二数据在所述内存中的地址。
- 根据权利要求9-14中任一项所述的数据交换装置,其特征在于,所述数据交换装置还包括:建立单元;所述建立单元,用于在所述目标应用启动后,建立换出线程和换入线程,所述换出线程用于执行第一数据的换出操作,所述换入线程用于执行第二数据的换入操作。
- 根据权利要求15所述的数据交换装置,其特征在于,所述建立单元,具体用于:在所述目标应用包含在预存的白名单的情况下,建立所述换出线程和所述换入线程,所述白名单中包括至少一个支持内存交换的应用。
- 一种数据交换装置,其特征在于,所述数据交换装置包括存储器和处理器;所述存储器和所述处理器耦合;所述存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令;当所述处理器执行所述计算机指令时,所述数据交换装置执行如权利要求1-8中任意一项所述的数据交换方法。
- 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在数据交换装置上运行时,使得所述数据交换装置执行如权利要求1-8中任意一项所述的数据交换方法。
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| EP22824103.0A EP4354305B1 (en) | 2021-06-16 | 2022-06-08 | Data exchange method and apparatus |
| US18/541,176 US12498878B2 (en) | 2021-06-16 | 2023-12-15 | Data swapping method and apparatus |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202110669020.8A CN115481052B (zh) | 2021-06-16 | 2021-06-16 | 一种数据交换方法及装置 |
| CN202110669020.8 | 2021-06-16 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US18/541,176 Continuation US12498878B2 (en) | 2021-06-16 | 2023-12-15 | Data swapping method and apparatus |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2022262623A1 true WO2022262623A1 (zh) | 2022-12-22 |
Family
ID=84419453
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2022/097694 Ceased WO2022262623A1 (zh) | 2021-06-16 | 2022-06-08 | 一种数据交换方法及装置 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US12498878B2 (zh) |
| EP (1) | EP4354305B1 (zh) |
| CN (1) | CN115481052B (zh) |
| WO (1) | WO2022262623A1 (zh) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| KR20240063607A (ko) * | 2022-11-03 | 2024-05-10 | 삼성전자주식회사 | 데이터 및 데이터 블록을 제공하는 스왑 메모리 장치, 이의 동작하는 방법, 및 이를 포함하는 전자 장치의 동작하는 방법 |
| CN116319627B (zh) * | 2023-03-17 | 2025-12-16 | 苏州元脑智能科技有限公司 | 数据的获取方法及装置、存储介质及电子装置 |
| CN116431540A (zh) * | 2023-03-27 | 2023-07-14 | 华为技术有限公司 | 通信方法、装置、系统及存储介质 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070094643A1 (en) * | 2005-10-25 | 2007-04-26 | Anderson Eric A | System and method for writing captured data from kernel-level to a file |
| CN108989432A (zh) * | 2018-07-20 | 2018-12-11 | 南京中兴新软件有限责任公司 | 用户态的文件发送方法、文件接收方法和文件收发装置 |
| CN111522512A (zh) * | 2020-04-22 | 2020-08-11 | 深圳忆联信息系统有限公司 | 优化的冷热数据分离方法、装置、计算机设备及存储介质 |
| CN112214168A (zh) * | 2020-09-27 | 2021-01-12 | 湖南智存合壹信息科技有限公司 | 设定固态硬盘冷热数据的方法及数据存储系统 |
Family Cites Families (14)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7085909B2 (en) * | 2003-04-29 | 2006-08-01 | International Business Machines Corporation | Method, system and computer program product for implementing copy-on-write of a file |
| CN102110196B (zh) * | 2009-12-25 | 2015-04-29 | 中国长城计算机深圳股份有限公司 | 并行运行多用户操作系统间的数据安全传输方法及系统 |
| CN102779244B (zh) * | 2011-05-11 | 2015-03-25 | 奇智软件(北京)有限公司 | 一种文件操作的执行方法及装置 |
| EP3217294B1 (en) * | 2014-11-28 | 2018-11-28 | Huawei Technologies Co. Ltd. | File access method and apparatus and storage device |
| US9720846B2 (en) * | 2015-05-28 | 2017-08-01 | Red Hat Israel, Ltd. | Memory swap for direct memory access by a device assigned to a guest operating system |
| US9678687B2 (en) * | 2015-09-25 | 2017-06-13 | Mcafee, Inc. | User mode heap swapping |
| CN105760275A (zh) * | 2016-02-22 | 2016-07-13 | 汉柏科技有限公司 | 一种基于Linux的监控用户态进程内存状态方法及系统 |
| CN107885666B (zh) * | 2016-09-28 | 2021-07-20 | 华为技术有限公司 | 一种内存管理方法和装置 |
| CN110121114B (zh) * | 2018-02-07 | 2021-08-27 | 华为技术有限公司 | 发送流数据的方法及数据发送设备 |
| CN110554911A (zh) * | 2018-05-30 | 2019-12-10 | 阿里巴巴集团控股有限公司 | 内存访问与分配方法、存储控制器及系统 |
| CN110895515B (zh) * | 2018-09-12 | 2024-11-05 | 南京中兴新软件有限责任公司 | 内存缓存管理方法、多媒体服务器及计算机存储介质 |
| CN111143072B (zh) | 2019-12-29 | 2023-09-08 | 浪潮(北京)电子信息产业有限公司 | 用户态程序内存分配方法、系统及相关组件 |
| CN112948318B (zh) * | 2021-03-09 | 2022-12-06 | 西安奥卡云数据科技有限公司 | 一种Linux操作系统下基于RDMA的数据传输方法及装置 |
| US20220398199A1 (en) * | 2021-06-15 | 2022-12-15 | Vmware, Inc. | User-space remote memory paging |
-
2021
- 2021-06-16 CN CN202110669020.8A patent/CN115481052B/zh active Active
-
2022
- 2022-06-08 WO PCT/CN2022/097694 patent/WO2022262623A1/zh not_active Ceased
- 2022-06-08 EP EP22824103.0A patent/EP4354305B1/en active Active
-
2023
- 2023-12-15 US US18/541,176 patent/US12498878B2/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070094643A1 (en) * | 2005-10-25 | 2007-04-26 | Anderson Eric A | System and method for writing captured data from kernel-level to a file |
| CN108989432A (zh) * | 2018-07-20 | 2018-12-11 | 南京中兴新软件有限责任公司 | 用户态的文件发送方法、文件接收方法和文件收发装置 |
| CN111522512A (zh) * | 2020-04-22 | 2020-08-11 | 深圳忆联信息系统有限公司 | 优化的冷热数据分离方法、装置、计算机设备及存储介质 |
| CN112214168A (zh) * | 2020-09-27 | 2021-01-12 | 湖南智存合壹信息科技有限公司 | 设定固态硬盘冷热数据的方法及数据存储系统 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP4354305A4 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN115481052B (zh) | 2025-12-05 |
| US20240143220A1 (en) | 2024-05-02 |
| US12498878B2 (en) | 2025-12-16 |
| EP4354305A4 (en) | 2024-08-07 |
| CN115481052A (zh) | 2022-12-16 |
| EP4354305B1 (en) | 2025-08-06 |
| EP4354305A1 (en) | 2024-04-17 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN113674133B (zh) | Gpu集群共享显存系统、方法、装置及设备 | |
| CN112596960B (zh) | 一种分布式存储服务切换方法及装置 | |
| US12498878B2 (en) | Data swapping method and apparatus | |
| EP4439312A1 (en) | Data storage method and system, storage access configuration method and related device | |
| US20140095769A1 (en) | Flash memory dual in-line memory module management | |
| US10241550B2 (en) | Affinity aware parallel zeroing of memory in non-uniform memory access (NUMA) servers | |
| US20220253252A1 (en) | Data processing method and apparatus | |
| WO2021008425A1 (zh) | 一种系统启动方法以及相关设备 | |
| CN115729438A (zh) | 数据访问方法、装置及存储介质 | |
| CN116126742A (zh) | 内存访问方法、装置、服务器及存储介质 | |
| CN110162395B (zh) | 一种内存分配的方法及装置 | |
| CN115934585A (zh) | 内存管理方法、装置和计算机设备 | |
| US9697047B2 (en) | Cooperation of hoarding memory allocators in a multi-process system | |
| CN115421787A (zh) | 指令执行方法、装置、设备、系统、程序产品及介质 | |
| WO2022222977A1 (zh) | 用于运行云业务实例的物理服务器的内存管理方法和装置 | |
| CN114518962A (zh) | 内存的管理方法及装置 | |
| CN115309665A (zh) | 计算机设备及内存注册方法 | |
| US11940917B2 (en) | System and method for network interface controller based distributed cache | |
| CN107402818A (zh) | 一种客户端读写缓存分离的方法及系统 | |
| CN112114962A (zh) | 一种内存分配方法及装置 | |
| WO2021120843A1 (zh) | 云主机内存分配方法及云主机、设备及存储介质 | |
| CN107209738A (zh) | 储存存储器直接访问 | |
| CN119718709A (zh) | 数据读写方法、服务器及存储介质 | |
| CN114528123A (zh) | 数据访问方法、装置、设备及计算机可读存储介质 | |
| WO2017113329A1 (zh) | 一种主机集群中缓存管理方法及主机 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22824103 Country of ref document: EP Kind code of ref document: A1 |
|
| WWE | Wipo information: entry into national phase |
Ref document number: 2022824103 Country of ref document: EP |
|
| ENP | Entry into the national phase |
Ref document number: 2022824103 Country of ref document: EP Effective date: 20231220 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| WWG | Wipo information: grant in national office |
Ref document number: 2022824103 Country of ref document: EP |
