WO2024108825A1 - Memory backup acceleration method, apparatus and device, and non-volatile readable storage medium - Google Patents

Memory backup acceleration method, apparatus and device, and non-volatile readable storage medium Download PDF

Info

Publication number
WO2024108825A1
WO2024108825A1 PCT/CN2023/081742 CN2023081742W WO2024108825A1 WO 2024108825 A1 WO2024108825 A1 WO 2024108825A1 CN 2023081742 W CN2023081742 W CN 2023081742W WO 2024108825 A1 WO2024108825 A1 WO 2024108825A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
local
remote
fpga
host
Prior art date
Application number
PCT/CN2023/081742
Other languages
French (fr)
Chinese (zh)
Inventor
刘伟
宿栋栋
沈艳梅
Original Assignee
浪潮(北京)电子信息产业有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 浪潮(北京)电子信息产业有限公司 filed Critical 浪潮(北京)电子信息产业有限公司
Publication of WO2024108825A1 publication Critical patent/WO2024108825A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/76Architectures of general purpose stored program computers
    • G06F15/78Architectures of general purpose stored program computers comprising a single central processing unit
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]

Definitions

  • the present application relates to the field of server technology, and in particular to a memory backup acceleration method; and also to a memory backup acceleration device, equipment and a non-volatile readable storage medium.
  • the purpose of the present application is to provide a memory backup acceleration method that can improve the operating speed of the system.
  • Another purpose of the present application is to provide a memory backup acceleration device, equipment and non-volatile readable storage medium, all of which have the above technical effects.
  • a memory backup acceleration method comprising:
  • the target data is backed up to the on-chip memory of the local FPGA;
  • the target data is backed up to a remote memory array device.
  • backing up the target data to a remote memory array device includes:
  • the target data is transmitted to the remote FPGA, and the target data is stored in the on-chip memory of the remote FPGA;
  • the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
  • transmitting the target data to the remote FPGA includes:
  • the target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
  • it also includes:
  • the host memory When accessing data, if the data to be accessed is located in the host memory, the host memory is accessed;
  • the data to be accessed is located in the on-chip memory of the local FPGA, the data to be accessed is copied from the on-chip memory of the local FPGA to the host memory, and the host memory is accessed;
  • the data to be accessed is located in a remote memory array device, the data to be accessed is copied from the remote memory array device to the host memory, and the host memory is accessed.
  • the method further includes:
  • the method further includes:
  • copying the to-be-accessed data from the remote memory array device to the host memory includes:
  • the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device, copying the data to be accessed from the on-chip memory of the remote FPGA to the local memory;
  • the data to be accessed is located in the remote memory of the remote memory array device, the data to be accessed is copied from the remote memory to the local memory.
  • it also includes:
  • the space occupied by the data to be accessed in the on-chip memory of the local FPGA is released.
  • it also includes:
  • the space occupied by the data to be accessed in the remote memory array device is released.
  • releasing the space occupied by the to-be-accessed data in the remote memory array device includes:
  • the space occupied by the data to be accessed in the remote memory is released.
  • it also includes:
  • the target data is backed up to the on-chip memory of the local FPGA or the remote memory array device, the space of the local memory occupied by the target data is released.
  • releasing the space of the local memory occupied by the target data includes:
  • it also includes:
  • host memory is allocated and a memory mapping is established.
  • allocating host memory and establishing memory mapping further includes:
  • the local host does not have a memory mapping, determine whether the host memory space of the local host is sufficient;
  • the host memory space of the local host is sufficient, the host memory is allocated and a memory mapping is established.
  • establishing a memory map includes:
  • it also includes:
  • recording information of the device where the target data to be backed up is located includes:
  • the local FPGA number of the target data and the remote memory array device number are determined as the information of the device where the target data is located and recorded, wherein the information of the device where the target data is located is used to copy the backed up target data back to the local memory when the target data is accessed.
  • a memory backup acceleration device comprising:
  • a judgment module used for judging whether there is allocatable space in the on-chip memory of the local FPGA when the host memory space of the local host is insufficient;
  • a first backup module configured to back up the target data to the on-chip memory of the local FPGA if there is allocatable space in the on-chip memory of the local FPGA;
  • the second backup module is used to back up the target data to a remote memory array device if there is no allocatable space in the on-chip memory of the local FPGA.
  • the present application also provides a memory backup acceleration device, including:
  • a processor is used to implement the steps of any of the above-mentioned memory backup acceleration methods when executing the above-mentioned computer program.
  • the present application also provides a non-volatile readable storage medium, on which a computer program is stored.
  • a computer program is stored on which a computer program is stored.
  • the memory backup acceleration method provided in the present application includes: when the host memory space of the local host is insufficient, determining whether there is allocatable space in the on-chip memory of the local FPGA; if there is allocatable space in the on-chip memory of the local FPGA, backing up the target data to the on-chip memory of the local FPGA; if there is no allocatable space in the on-chip memory of the local FPGA, backing up the target data to a remote memory array device.
  • the memory backup acceleration method provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, and can effectively improve the speed of system operation.
  • the memory backup acceleration device, equipment and non-volatile readable storage medium provided in this application all have the above technical effects. fruit.
  • FIG1 is a schematic diagram of an existing hardware architecture
  • FIG2 is a schematic diagram of existing software logic
  • FIG3 is a schematic diagram of a flow chart of a memory backup acceleration method provided in an embodiment of the present application.
  • FIG4 is a schematic diagram of a hardware architecture provided in an embodiment of the present application.
  • FIG5 is a schematic diagram of a software logic provided in an embodiment of the present application.
  • FIG6 is a schematic diagram of a memory backup acceleration device provided in an embodiment of the present application.
  • FIG. 7 is a schematic diagram of a memory backup acceleration device provided in an embodiment of the present application.
  • the core of this application is to provide a memory backup acceleration method, which can improve the operating speed of the system.
  • Another core of this application is to provide a memory backup acceleration device, equipment and non-volatile readable storage medium, all of which have the above technical effects.
  • the relevant technical solution is that when the application needs to access the memory, the operating system executes the processing logic shown in Figure 2, which is recorded as the swap processing logic. It mainly includes backing up the long-unused data from the local memory to the swap partition in the hard disk when the local memory of the host is insufficient, freeing up memory space for new data; if the data to be accessed this time is backed up to the swap partition, the data to be accessed is copied from the swap partition to the local memory before accessing the local memory.
  • the present application provides a memory backup acceleration method, which aims to increase the operating speed of the system.
  • FIG. 3 is a flow chart of a memory backup acceleration method provided in an embodiment of the present application. Referring to FIG. 3 , the method includes:
  • the local host includes a local FPGA in addition to the CPU chip and local memory.
  • the local FPGA is connected to the processor core through a PCIe (peripheral component interconnect express, a high-speed serial computer expansion bus standard) bridge, and the processor core can access the local FPGA through the address bus -> PCIe bridge.
  • the local FPGA can access the local memory through the PCIe bridge -> address bus.
  • the local FPGA can expose part of the on-chip memory for the processor core to access.
  • the remote memory array device may be a physical carrier specially set up to back up the data in the host memory of the local host, or may be another server.
  • the local memory When the remaining capacity of the local memory drops to a preset threshold, the local memory is considered insufficient. For example, when the remaining capacity of the local memory drops to 10%, the local memory is considered insufficient.
  • the target data may be data that has not been used for a period of time. In order to obtain a faster access rate, this embodiment gives priority to the use of the on-chip memory of the local FPGA. When the local memory is insufficient, the on-chip memory of the local FPGA is used as the backup carrier of the target data, and the target data is backed up to the on-chip memory of the local FPGA.
  • the memory of the remote memory array device is used as the backup carrier of the target data, and the target data is backed up to the memory of the remote memory array device.
  • the remaining capacity of the local FPGA drops to a preset threshold, it can be considered that the on-chip memory space of the local FPGA is insufficient.
  • the remaining capacity of the local FPGA is less than the size of the target data, it can be considered that the on-chip memory space of the local FPGA is insufficient.
  • the information of the device where the backed-up target data is located (for example, the number of the local FPGA, the number of the remote memory array device, etc.) and its memory address must be recorded so that when the program accesses the target data in the future, the backed-up target data can be copied back to the local memory.
  • the memory management module is responsible for the management of the on-chip memory of the local FPGA, the on-chip memory of the remote FPGA, and the remote memory, which mainly includes memory allocation, memory recycling, and judging whether there is enough memory available.
  • backing up the target data to a remote memory array device includes:
  • the target data is transmitted to the remote FPGA, and the target data is stored in the on-chip memory of the remote FPGA;
  • the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
  • the remote memory array device includes a remote memory and a remote FPGA.
  • the remote memory and the remote FPGA may be connected via a PCIe bridge.
  • the remote FPGA and the remote memory may be directly connected without a PCIe bridge.
  • the target data is preferentially backed up in the on-chip memory of the remote FPGA in the remote memory array device. If the on-chip memory space of the remote FPGA is insufficient, the target data is stored in the remote memory of the remote memory array device.
  • transmitting the target data to the remote FPGA includes:
  • the target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
  • both the local FPGA and the remote FPGA are provided with RDMA transmission modules, and the local host and the remote memory array device are connected to the RDMA network via the RDMA transmission module.
  • RDMA is the abbreviation of Remote Direct Memory Access, which means remote direct address access.
  • the local node can directly access the memory of the remote node.
  • the so-called direct means that it can bypass the complex TCP/IP (TCP, Transmission Control Protocol) (IP, Internet Protocol) network protocol stack of traditional Ethernet to read and write the memory of the peer node just like accessing local memory.
  • TCP Transmission Control Protocol
  • IP Internet Protocol
  • the CPU of the peer node does not participate in the reading and writing process, and most of the work of this reading and writing process is completed by hardware rather than software.
  • the above target data is preferentially transferred to the remote FPGA through the RDMA module and stored in the on-chip memory of the remote FPGA. If the on-chip memory space of the remote FPGA is insufficient, the target data is transferred to the remote FPGA through the RDMA module, and the remote FPGA stores the target data in the remote memory through the PCIe bridge or directly.
  • the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
  • it also includes:
  • the space of the local memory occupied by the target data is released.
  • the memory mapping (page table entry) of the local memory occupied by the target data is deleted to release the space of the local memory occupied by the target data.
  • it also includes:
  • the host memory When accessing data, if the data to be accessed is located in the host memory, the host memory is accessed;
  • If the data to be accessed is located in the on-chip memory of the local FPGA, copy the data to be accessed from the on-chip memory of the local FPGA to the host memory, and access the host memory;
  • the data to be accessed is located in the remote memory array device, the data to be accessed is copied from the remote memory array device to the host memory, and the host memory is accessed.
  • the data to be accessed in the host memory is directly accessed. If the data to be accessed is located in the on-chip memory of the local FPGA, the data to be accessed is first copied from the on-chip memory of the local FPGA to the host memory through the PCIe bridge, and then the data to be accessed copied from the host memory is accessed. If the data to be accessed is located in a remote memory array device, when the local host and the remote memory array device are connected to the RDMA network through an RDMA transmission module, the data to be accessed is first copied to the host memory through the RDMA transmission module, and then the data to be accessed copied from the host memory is accessed.
  • the copying of the to-be-accessed data from the remote memory array device to the host memory includes:
  • the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device, copying the data to be accessed from the on-chip memory of the remote FPGA to the local memory;
  • the data to be accessed is located in the remote memory of the remote memory array device, the data to be accessed is copied from the remote memory to the local memory.
  • it also includes:
  • the space occupied by the data to be accessed in the on-chip memory of the local FPGA is released.
  • the space occupied by the to-be-accessed data in the remote memory array device is released.
  • the space occupied by the data to be accessed in the on-chip memory of the local FPGA is released.
  • the space occupied by the data to be accessed in the remote memory array is released.
  • the releasing of the space occupied by the to-be-accessed data in the remote memory array device comprises:
  • the remote memory is released. The space occupied by the data to be accessed.
  • the data to be accessed is located in the on-chip memory of the remote FPGA, after the data to be accessed is copied from the on-chip memory of the remote FPGA to the host memory, the space occupied by the data to be accessed in the on-chip memory of the remote FPGA is released. If the data to be accessed is located in the remote memory, after the data to be accessed is copied from the remote memory to the host memory, the space occupied by the data to be accessed in the remote memory is released.
  • it also includes:
  • host memory is allocated and memory mapping is established.
  • the local host does not establish a memory mapping, determining whether the host memory space of the local host is sufficient;
  • the host memory space of the local host is sufficient, the host memory is allocated and a memory mapping is established.
  • the application when the application starts to access the host memory, it first determines whether a memory mapping has been established. If so, the memory access instruction is executed to access the host memory. If the memory mapping has not been established, it is determined whether the host memory space of the local host is sufficient. If the host memory space of the local host is sufficient, the host memory is allocated and the memory mapping is established. If the host memory space of the local host is insufficient, steps S101 to S103 are executed.
  • Establishing a memory mapping refers to establishing a mapping relationship between a virtual address and a physical address by creating a page table entry for the MMU (Memory Management Unit) in the CPU to query.
  • MMU Memory Management Unit
  • data writing (such as the operation of assigning a value to the address pointed to by a pointer in C language code) is an essential operation.
  • the following takes the assignment operation as an example to explain an optional implementation method:
  • the application directly assigns a value to an address. This address is a virtual address and has not yet been assigned an actual physical address, so the CPU will generate a page fault exception.
  • the page fault processing part of the operating system finds that there are not enough local physical addresses for address mapping, so it executes the processing logic of steps S101 to S103, which is recorded as rdma_swap processing logic.
  • the rdma_swap processing logic when it is found that the on-chip memory of the local FPGA is insufficient, the data that has not been used for a long time in the local memory is backed up to the memory of the remote memory array device.
  • the optional process is:
  • rdma_sq_wr.opcode IBV_WR_RDMA_WRITE; //RDMA operation instruction code
  • rdma_sgl.addr local_addr; //The local memory address where the data not used for a long time is located
  • the RDMA transmission module After the RDMA transmission module completes the processing, it deletes the memory mapping of the data that has not been used for a long time, and releases the space for the address that is currently being accessed.
  • the existing swap processing logic in the operating system as shown in FIG. 2 can be replaced by the rdma_swap processing logic provided in this application. It is also possible to add new logic based on the swap processing logic, that is, to be compatible with the original swap processing logic. If new logic is added based on the swap processing logic, modifications can be made in the "swap processing logic". Before saving the data to the swap partition in the hard disk, first determine whether there is available on-chip memory of the local FPGA or available memory of a remote memory array device. If so, run the processing logic shown in FIG. 5; if not, run the original swap processing logic.
  • the memory backup acceleration method provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, and can effectively improve the speed of system operation.
  • the present application also provides a memory backup acceleration device, and the device described below can be referred to in correspondence with the method described above.
  • Figure 6 is a schematic diagram of a memory backup acceleration device provided in an embodiment of the present application. As shown in Figure 6, the device includes:
  • the judgment module 10 is used to judge whether there is allocatable space in the on-chip memory of the local FPGA when the host memory space of the local host is insufficient;
  • a first backup module 20 configured to back up the target data to the on-chip memory of the local FPGA if there is allocatable space in the on-chip memory of the local FPGA;
  • the second backup module 30 is used to back up the target data to a remote memory array device if there is no allocatable space in the on-chip memory of the local FPGA.
  • the second backup module 30 includes:
  • a first backup unit is configured to transmit the target data to the remote FPGA in the remote memory array device if there is allocatable space in the on-chip memory of the remote FPGA, and store the target data in the on-chip memory of the remote FPGA;
  • the second backup unit is used to transfer the target data to the remote FPGA if there is no allocatable space in the on-chip memory of the remote FPGA, and store the target data in the remote memory of the remote memory array device via the remote FPGA.
  • the first backup unit and the second backup unit may be used to:
  • the target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
  • a first access module configured to access the host memory if the data to be accessed is located in the host memory
  • a second access module is used for copying the data to be accessed from the on-chip memory of the local FPGA to the host memory and accessing the host memory if the data to be accessed is located in the on-chip memory of the local FPGA;
  • the third access module is used for copying the data to be accessed from the remote memory array device to the host memory and accessing the host memory if the data to be accessed is located in the remote memory array device.
  • the third access module includes:
  • a first copying unit configured to copy the data to be accessed from the on-chip memory of the remote FPGA to the local memory if the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device;
  • the second copying unit is used for copying the data to be accessed from the remote memory to the local memory if the data to be accessed is located in the remote memory of the remote memory array device.
  • the first space release module is used to release the space occupied by the data to be accessed in the on-chip memory of the local FPGA after copying the data to be accessed from the on-chip memory of the local FPGA to the host memory.
  • the second space releasing module is used to release the space occupied by the data to be accessed in the remote memory array device after copying the data to be accessed from the remote memory array device to the host memory.
  • the second space release module includes:
  • a first releasing unit configured to release the space occupied by the to-be-accessed data in the on-chip memory of the remote FPGA if the to-be-accessed data is copied from the on-chip memory of the remote FPGA to the local memory;
  • the second releasing unit is used for releasing the space occupied by the data to be accessed in the remote memory if the data to be accessed is copied from the remote memory to the local memory.
  • the third space releasing unit is used to release the space of the local memory occupied by the target data after backing up the target data to the on-chip memory of the local FPGA or the remote memory array device.
  • the memory mapping establishment module is used to allocate host memory and establish memory mapping when the host memory space of the local host is sufficient.
  • a first determination module is used to determine whether the local host has established a memory mapping
  • a second determination module is used to determine whether the host memory space of the local host is sufficient if the local host does not establish a memory mapping
  • the memory mapping establishment module allocates host memory and establishes a memory map.
  • the recording module is used to record the information of the device where the backed-up target data is located and the address of the memory in the device where the target data is stored.
  • the memory backup acceleration device uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, and can effectively improve the speed of system operation.
  • the present application also provides a memory backup acceleration device, as shown in FIG. 7 , the device includes a memory 1 and a processor 2 .
  • Memory 1 used for storing computer programs
  • Processor 2 is used to execute the computer program to implement the following steps:
  • the memory backup acceleration device uses the memory of the local FPGA on the local host and the remote memory array
  • the device's memory serves as a physical carrier for backing up data in the host memory of the local host, replacing the traditional solution of using a hard disk as a data backup carrier, which can effectively improve the speed of system operation.
  • the present application also provides a non-volatile readable storage medium, on which a computer program is stored.
  • a computer program is stored on a non-volatile readable storage medium, on which a computer program is stored.
  • the non-volatile readable storage medium provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, which can effectively improve the speed of system operation.
  • the non-volatile readable storage medium may include: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
  • the steps of the methods or algorithms described in the embodiments disclosed herein may be implemented directly using hardware, software modules executed by a processor, or a combination of the two.
  • the software modules may be placed in random access memory (RAM), internal memory, read-only storage, or other storage mediums.
  • RAM random access memory
  • the memory may be stored in a memory device (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The present application relates to the technical field of servers, and discloses a memory backup acceleration method, comprising: when a host memory space of a local host is insufficient, determining whether there is an allocable space on an on-chip memory of a local FPGA; if there is an allocable space on the on-chip memory of the local FPGA, backing up target data into the on-chip memory of the local FPGA; and if there is no allocable space on the on-chip memory of the local FPGA, backing up the target data into a remote memory array device. The method uses the memory of the local FPGA on the local host and the memory of the remote memory array device as physical carriers for backing up data in the host memory of the local host, thereby effectively increasing the running speed of a system. The present application further discloses a memory backup acceleration apparatus and device, and a non-volatile readable storage medium, which all have the described technical effect.

Description

内存备份加速方法、装置、设备及非易失性可读存储介质Memory backup acceleration method, device, equipment and non-volatile readable storage medium
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2022年11月21日提交中国专利局,申请号为202211458494.9,申请名称为“内存备份加速方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on November 21, 2022, with application number 202211458494.9, and application name “Memory backup acceleration method, device, equipment and computer-readable storage medium”, all contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及服务器技术领域,特别涉及一种内存备份加速方法;还涉及一种内存备份加速装置、设备以及非易失性可读存储介质。The present application relates to the field of server technology, and in particular to a memory backup acceleration method; and also to a memory backup acceleration device, equipment and a non-volatile readable storage medium.
背景技术Background technique
早期的计算机或者现在使用8位/16位MCU(Microcontroller Unit,微控制单元)的嵌入式设备,程序是直接运行在物理内存上的。所谓直接运行在物理内存上指的是程序在运行时所访问的地址都是物理地址。这种程序直接运行在物理内存上的方式实现简单,但是存在物理内存不足、程序运行的地址不确定、内存使用率低等缺陷。为此,当前引入了虚拟内存管理技术。虚拟内存管理技术的基本思想是程序使用的内存的总大小可以超过物理内存的大小,操作系统把当前使用的部分数据放在内存中,而把其他未被使用的部分保存在硬盘上。In early computers or embedded devices using 8-bit/16-bit MCUs (Microcontroller Units), programs run directly on physical memory. Running directly on physical memory means that all addresses accessed by the program during runtime are physical addresses. This method of running programs directly on physical memory is simple to implement, but it has defects such as insufficient physical memory, uncertain program running addresses, and low memory utilization. For this reason, virtual memory management technology is currently introduced. The basic idea of virtual memory management technology is that the total size of memory used by the program can exceed the size of physical memory, and the operating system puts part of the currently used data in the memory, and saves the other unused parts on the hard disk.
虚拟内存管理技术虽然解决了直接在物理内存上运行程序的诸多缺陷,但也存在一些问题,例如,程序运行过程中,操作系统需要花费时间去维护更新页表(CPU(Central Processing Unit,中央处理器)中内存管理单元,通过查询页表将虚拟地址转换为物理地址),添加和删除表项,也称为建立和删除内存映射。在程序需要的内存空间大于系统中现有的物理内存时,操作系统需要频繁的将数据在物理内存和硬盘间搬移,而传统硬盘的数据传输速率(数量级为0.1GB/s)要远远慢于内存的访问速率(数量级为10GB/s),如此严重降低了系统整体运行的速度。Although virtual memory management technology solves many defects of running programs directly on physical memory, there are still some problems. For example, during the running of the program, the operating system needs to spend time to maintain and update the page table (the memory management unit in the CPU (Central Processing Unit) converts virtual addresses to physical addresses by querying the page table), add and delete table entries, also known as establishing and deleting memory mapping. When the memory space required by the program is larger than the existing physical memory in the system, the operating system needs to frequently move data between the physical memory and the hard disk. The data transfer rate of the traditional hard disk (on the order of 0.1GB/s) is much slower than the memory access rate (on the order of 10GB/s), which seriously reduces the overall operation speed of the system.
有鉴于此,如何提高系统的运行速度已成为本领域技术人员亟待解决的技术问题。In view of this, how to improve the operating speed of the system has become a technical problem that needs to be solved urgently by those skilled in the art.
发明内容 Summary of the invention
本申请的目的是提供一种内存备份加速方法,能够提高系统的运行速度。本申请的另一个目的是提供一种内存备份加速装置、设备以及非易失性可读存储介质,均具有上述技术效果。The purpose of the present application is to provide a memory backup acceleration method that can improve the operating speed of the system. Another purpose of the present application is to provide a memory backup acceleration device, equipment and non-volatile readable storage medium, all of which have the above technical effects.
为解决上述技术问题,本申请提供了一种内存备份加速方法,包括:In order to solve the above technical problems, the present application provides a memory backup acceleration method, comprising:
当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;When the host memory space of the local host is insufficient, it is determined whether there is allocatable space in the on-chip memory of the local FPGA;
若本地FPGA的片上内存存在可分配空间,则将目标数据备份到本地FPGA的片上内存中;If there is allocatable space in the on-chip memory of the local FPGA, the target data is backed up to the on-chip memory of the local FPGA;
若本地FPGA的片上内存不存在可分配空间,则将目标数据备份到远端内存阵列设备中。If there is no allocatable space in the on-chip memory of the local FPGA, the target data is backed up to a remote memory array device.
在一些实施例中,将目标数据备份到远端内存阵列设备中包括:In some embodiments, backing up the target data to a remote memory array device includes:
若远端内存阵列设备中的远端FPGA的片上内存存在可分配空间,则将目标数据传输到远端FPGA,并将目标数据存入远端FPGA的片上内存中;If there is allocatable space in the on-chip memory of the remote FPGA in the remote memory array device, the target data is transmitted to the remote FPGA, and the target data is stored in the on-chip memory of the remote FPGA;
若远端FPGA的片上内存不存在可分配空间,则将目标数据传输到远端FPGA,并经由远端FPGA将目标数据存入远端内存阵列设备的远端内存中。If there is no allocatable space in the on-chip memory of the remote FPGA, the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
在一些实施例中,将目标数据传输到远端FPGA包括:In some embodiments, transmitting the target data to the remote FPGA includes:
通过本地FPGA的RDMA传输模块,将目标数据传输到远端FPGA。The target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
在一些实施例中,还包括:In some embodiments, it also includes:
当访问数据时,若待访问数据位于主机内存中,则访问主机内存;When accessing data, if the data to be accessed is located in the host memory, the host memory is accessed;
若待访问数据位于本地FPGA的片上内存中,则将待访问数据从本地FPGA的片上内存中复制到主机内存,并访问主机内存;If the data to be accessed is located in the on-chip memory of the local FPGA, the data to be accessed is copied from the on-chip memory of the local FPGA to the host memory, and the host memory is accessed;
若待访问数据位于远端内存阵列设备中,则将待访问数据从远端内存阵列设备复制到主机内存,并访问主机内存。If the data to be accessed is located in a remote memory array device, the data to be accessed is copied from the remote memory array device to the host memory, and the host memory is accessed.
在一些实施例中,在当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间之前,方法还包括:In some embodiments, when the host memory space of the local host is insufficient, before determining whether there is allocatable space in the on-chip memory of the local FPGA, the method further includes:
比对当本地主机的主机内存空间与第一预设阈值;Comparing the host memory space of the local host with a first preset threshold;
在当本地主机的主机内存空间小于或者等于第一预设阈值的情况下,确定当本地主机的主机内存空间不足。When the host memory space of the local host is less than or equal to the first preset threshold, it is determined that the host memory space of the local host is insufficient.
在一些实施例中,在若本地FPGA的片上内存不存在可分配空间,则将目标数据备份到远端内存阵列设备中之前,方法还包括:In some embodiments, if there is no allocatable space in the on-chip memory of the local FPGA, before backing up the target data to the remote memory array device, the method further includes:
在本地FPGA的剩余容量降至第二预设阈值的情况下,确定本地FPGA的片上内存不存在 可分配空间,或者,When the remaining capacity of the local FPGA drops to a second preset threshold, it is determined that the on-chip memory of the local FPGA does not exist. Allocate space, or,
在本地FPGA的剩余容量小于目标数据的大小的情况下,确定本地FPGA的片上内存不存在可分配空间。When the remaining capacity of the local FPGA is smaller than the size of the target data, it is determined that there is no allocatable space in the on-chip memory of the local FPGA.
在一些实施例中,将待访问数据从远端内存阵列设备复制到主机内存包括:In some embodiments, copying the to-be-accessed data from the remote memory array device to the host memory includes:
若待访问数据位于远端内存阵列设备的远端FPGA的片上内存中,则将待访问数据从远端FPGA的片上内存复制到本地内存;If the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device, copying the data to be accessed from the on-chip memory of the remote FPGA to the local memory;
若待访问数据位于远端内存阵列设备的远端内存中,则将待访问数据从远端内存复制到本地内存。If the data to be accessed is located in the remote memory of the remote memory array device, the data to be accessed is copied from the remote memory to the local memory.
在一些实施例中,还包括:In some embodiments, it also includes:
将待访问数据从本地FPGA的片上内存中复制到主机内存后,释放本地FPGA的片上内存中待访问数据占据的空间。After the data to be accessed is copied from the on-chip memory of the local FPGA to the host memory, the space occupied by the data to be accessed in the on-chip memory of the local FPGA is released.
在一些实施例中,还包括:In some embodiments, it also includes:
将待访问数据从远端内存阵列设备复制到主机内存后,释放远端内存阵列设备中待访问数据占据的空间。After the data to be accessed is copied from the remote memory array device to the host memory, the space occupied by the data to be accessed in the remote memory array device is released.
在一些实施例中,释放远端内存阵列设备中待访问数据占据的空间包括:In some embodiments, releasing the space occupied by the to-be-accessed data in the remote memory array device includes:
若将待访问数据从远端FPGA的片上内存复制到本地内存,则释放远端FPGA的片上内存中待访问数据占据的空间;If the data to be accessed is copied from the on-chip memory of the remote FPGA to the local memory, the space occupied by the data to be accessed in the on-chip memory of the remote FPGA is released;
若将待访问数据从远端内存复制到本地内存,则释放远端内存中待访问数据占据的空间。If the data to be accessed is copied from the remote memory to the local memory, the space occupied by the data to be accessed in the remote memory is released.
在一些实施例中,还包括:In some embodiments, it also includes:
将目标数据备份到本地FPGA的片上内存中或远端内存阵列设备中后,释放目标数据所占据的本机内存的空间。After the target data is backed up to the on-chip memory of the local FPGA or the remote memory array device, the space of the local memory occupied by the target data is released.
在一些实施例中,释放目标数据所占据的本机内存的空间,包括:In some embodiments, releasing the space of the local memory occupied by the target data includes:
删除目标数据所占据的本地内存的内存映射。Delete the memory mapping of the local memory occupied by the target data.
在一些实施例中,还包括:In some embodiments, it also includes:
当本地主机的主机内存空间足够时,分配主机内存,并建立内存映射。When the host memory space of the local host is sufficient, host memory is allocated and a memory mapping is established.
在一些实施例中,当本地主机的主机内存空间足够时,分配主机内存,并建立内存映射前还包括:In some embodiments, when the host memory space of the local host is sufficient, allocating host memory and establishing memory mapping further includes:
判断本地主机是否已建立内存映射;Determine whether the local host has established memory mapping;
若本地主机未建立内存映射,则判断本地主机的主机内存空间是否足够; If the local host does not have a memory mapping, determine whether the host memory space of the local host is sufficient;
若本地主机的主机内存空间足够,则分配主机内存,并建立内存映射。If the host memory space of the local host is sufficient, the host memory is allocated and a memory mapping is established.
在一些实施例中,建立内存映射,包括:In some embodiments, establishing a memory map includes:
通过创建页表的表项建立虚拟地址和物理地址之间的映射关系,得到内存映射。By creating page table entries, a mapping relationship between virtual addresses and physical addresses is established to obtain a memory mapping.
在一些实施例中,还包括:In some embodiments, it also includes:
记录备份的目标数据所在设备的信息以及设备中存储目标数据的内存的地址。Record the information of the device where the target data to be backed up is located and the address of the memory in the device where the target data is stored.
在一些实施例中,记录备份的目标数据所在设备的信息,包括:In some embodiments, recording information of the device where the target data to be backed up is located includes:
将目标数据的本地FPGA的编号、远程内存阵列设备的编号确定为目标数据所在设备的信息进行记录,其中,目标数据所在设备的信息用于在目标数据被访问时,将备份的目标数据重新复制到本机内存中。The local FPGA number of the target data and the remote memory array device number are determined as the information of the device where the target data is located and recorded, wherein the information of the device where the target data is located is used to copy the backed up target data back to the local memory when the target data is accessed.
为解决上述技术问题,本申请还提供了一种内存备份加速装置,包括:In order to solve the above technical problems, the present application also provides a memory backup acceleration device, comprising:
判断模块,用于当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;A judgment module, used for judging whether there is allocatable space in the on-chip memory of the local FPGA when the host memory space of the local host is insufficient;
第一备份模块,用于若上述本地FPGA的片上内存存在可分配空间,则将目标数据备份到上述本地FPGA的片上内存中;A first backup module, configured to back up the target data to the on-chip memory of the local FPGA if there is allocatable space in the on-chip memory of the local FPGA;
第二备份模块,用于若上述本地FPGA的片上内存不存在可分配空间,则将上述目标数据备份到远端内存阵列设备中。The second backup module is used to back up the target data to a remote memory array device if there is no allocatable space in the on-chip memory of the local FPGA.
为解决上述技术问题,本申请还提供了一种内存备份加速设备,包括:In order to solve the above technical problems, the present application also provides a memory backup acceleration device, including:
存储器,用于存储计算机程序;Memory for storing computer programs;
处理器,用于执行上述计算机程序时实现如上任一项上述的内存备份加速方法的步骤。A processor is used to implement the steps of any of the above-mentioned memory backup acceleration methods when executing the above-mentioned computer program.
为解决上述技术问题,本申请还提供了一种非易失性可读存储介质,上述非易失性可读存储介质上存储有计算机程序,上述计算机程序被处理器执行时实现如上任一项上述的内存备份加速方法的步骤。In order to solve the above technical problems, the present application also provides a non-volatile readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned memory backup acceleration methods are implemented.
本申请所提供的内存备份加速方法,包括:当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;若上述本地FPGA的片上内存存在可分配空间,则将目标数据备份到上述本地FPGA的片上内存中;若上述本地FPGA的片上内存不存在可分配空间,则将上述目标数据备份到远端内存阵列设备中。The memory backup acceleration method provided in the present application includes: when the host memory space of the local host is insufficient, determining whether there is allocatable space in the on-chip memory of the local FPGA; if there is allocatable space in the on-chip memory of the local FPGA, backing up the target data to the on-chip memory of the local FPGA; if there is no allocatable space in the on-chip memory of the local FPGA, backing up the target data to a remote memory array device.
可见,本申请所提供的内存备份加速方法,使用本地主机上的本地FPGA的内存与远端内存阵列设备的内存作为备份本地主机的主机内存中数据的物理载体,替代了传统的以硬盘作为数据备份载体的方案,能够有效的提高系统运行的速度。It can be seen that the memory backup acceleration method provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, and can effectively improve the speed of system operation.
本申请所提供的内存备份加速装置、设备以及非易失性可读存储介质均具有上述技术效 果。The memory backup acceleration device, equipment and non-volatile readable storage medium provided in this application all have the above technical effects. fruit.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对相关技术和实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the relevant technologies and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
图1为现有硬件架构的示意图;FIG1 is a schematic diagram of an existing hardware architecture;
图2为现有软件逻辑的示意图;FIG2 is a schematic diagram of existing software logic;
图3为本申请实施例所提供的一种内存备份加速方法的流程示意图;FIG3 is a schematic diagram of a flow chart of a memory backup acceleration method provided in an embodiment of the present application;
图4为本申请实施例所提供的一种硬件架构的示意图;FIG4 is a schematic diagram of a hardware architecture provided in an embodiment of the present application;
图5为本申请实施例所提供的一种软件逻辑的示意图;FIG5 is a schematic diagram of a software logic provided in an embodiment of the present application;
图6为本申请实施例所提供的一种内存备份加速装置的示意图;FIG6 is a schematic diagram of a memory backup acceleration device provided in an embodiment of the present application;
图7为本申请实施例所提供的一种内存备份加速设备的示意图。FIG. 7 is a schematic diagram of a memory backup acceleration device provided in an embodiment of the present application.
具体实施方式Detailed ways
本申请的核心是提供一种内存备份加速方法,能够提高系统的运行速度。本申请的另一个核心是提供一种内存备份加速装置、设备以及非易失性可读存储介质,均具有上述技术效果。The core of this application is to provide a memory backup acceleration method, which can improve the operating speed of the system. Another core of this application is to provide a memory backup acceleration device, equipment and non-volatile readable storage medium, all of which have the above technical effects.
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
参考图1与图2所示,相关技术方案是当应用程序需要访问内存时,操作系统执行图2所示的处理逻辑记为swap处理逻辑。主要包括当主机的本地内存不足时,将长期不用的数据从本地内存备份到硬盘中的swap分区,为新数据腾出内存空间;如果本次待访问数据被备份到了swap分区,则将待访问数据再从swap分区复制到本地内存后,访问本地内存。然而,采用上述技术方案会严重降低系统整体运行的速度,为此,本申请提供了一种内存备份加速方法,旨在提高系统的运行速度。 Referring to Figures 1 and 2, the relevant technical solution is that when the application needs to access the memory, the operating system executes the processing logic shown in Figure 2, which is recorded as the swap processing logic. It mainly includes backing up the long-unused data from the local memory to the swap partition in the hard disk when the local memory of the host is insufficient, freeing up memory space for new data; if the data to be accessed this time is backed up to the swap partition, the data to be accessed is copied from the swap partition to the local memory before accessing the local memory. However, the use of the above technical solution will seriously reduce the overall operating speed of the system. For this reason, the present application provides a memory backup acceleration method, which aims to increase the operating speed of the system.
请参考图3,图3为本申请实施例所提供的一种内存备份加速方法的流程示意图,参考图3所示,该方法包括:Please refer to FIG. 3 , which is a flow chart of a memory backup acceleration method provided in an embodiment of the present application. Referring to FIG. 3 , the method includes:
S101:当本地主机的主机内存空间不足时,判断本地FPGA(Field Programmable Gate Array,现场可编程门阵列)的片上内存是否存在可分配空间;S101: When the host memory space of the local host is insufficient, determine whether there is allocatable space in the on-chip memory of the local FPGA (Field Programmable Gate Array);
S102:若上述本地FPGA的片上内存存在可分配空间,则将目标数据备份到上述本地FPGA的片上内存中;S102: If there is allocatable space in the on-chip memory of the local FPGA, back up the target data to the on-chip memory of the local FPGA;
S103:若上述本地FPGA的片上内存不存在可分配空间,则将上述目标数据备份到远端内存阵列设备中。S103: If there is no allocatable space in the on-chip memory of the local FPGA, the target data is backed up to a remote memory array device.
参考图4所示,本地主机除CPU芯片与本地内存外,还包括本地FPGA。本地FPGA与处理器核通过PCIe(peripheral component interconnect express,一种高速串行计算机扩展总线标准)桥连接,处理器核可以通过地址总线->PCIe桥访问本地FPGA。本地FPGA可以通过PCIe桥->地址总线访问本机内存。本地FPGA可暴露部分片上内存供处理器核访问。As shown in Figure 4, the local host includes a local FPGA in addition to the CPU chip and local memory. The local FPGA is connected to the processor core through a PCIe (peripheral component interconnect express, a high-speed serial computer expansion bus standard) bridge, and the processor core can access the local FPGA through the address bus -> PCIe bridge. The local FPGA can access the local memory through the PCIe bridge -> address bus. The local FPGA can expose part of the on-chip memory for the processor core to access.
远端内存阵列设备可以为专门设置的作为备份本地主机的主机内存中数据的物理载体,也可以为其他服务器。The remote memory array device may be a physical carrier specially set up to back up the data in the host memory of the local host, or may be another server.
当本地内存的剩余容量降至某个预设阈值时,认为本地内存不足。例如,本地内存的剩余容量降至10%时,认为本地内存不足。目标数据可以为一段时间内未使用的数据。为了获得较快访问速率,本实施例优先使用本地FPGA的片上内存。当本地内存不足时,优先使用本地FPGA的片上内存作为目标数据的备份载体,将目标数据备份到本地FPGA的片上内存中。如果本地FPGA不存在可分配存储空间,即片上内存的空间不足,则使用远程内存阵列设备的内存作为目标数据的备份载体,将目标数据备份到远程内存阵列设备的内存中。当本地FPGA的剩余容量降至某个预设阈值时,可认为本地FPGA的片上内存的空间不足。或者当本地FPGA的剩余容量小于目标数据的大小时,可认为本地FPGA的片上内存的空间不足。When the remaining capacity of the local memory drops to a preset threshold, the local memory is considered insufficient. For example, when the remaining capacity of the local memory drops to 10%, the local memory is considered insufficient. The target data may be data that has not been used for a period of time. In order to obtain a faster access rate, this embodiment gives priority to the use of the on-chip memory of the local FPGA. When the local memory is insufficient, the on-chip memory of the local FPGA is used as the backup carrier of the target data, and the target data is backed up to the on-chip memory of the local FPGA. If there is no allocatable storage space in the local FPGA, that is, the on-chip memory space is insufficient, the memory of the remote memory array device is used as the backup carrier of the target data, and the target data is backed up to the memory of the remote memory array device. When the remaining capacity of the local FPGA drops to a preset threshold, it can be considered that the on-chip memory space of the local FPGA is insufficient. Or when the remaining capacity of the local FPGA is less than the size of the target data, it can be considered that the on-chip memory space of the local FPGA is insufficient.
备份的目标数据所在的设备的信息(例如,本地FPGA的编号、远程内存阵列设备的编号等)及其内存地址都需记录下来,以便将来程序访问目标数据时,将备份的目标数据重新复制到本机内存中。The information of the device where the backed-up target data is located (for example, the number of the local FPGA, the number of the remote memory array device, etc.) and its memory address must be recorded so that when the program accesses the target data in the future, the backed-up target data can be copied back to the local memory.
本机FPGA的片上内存、远端FPGA的片上内存以及远端内存的管理工作由内存管理模块负责,主要包括内存分配,内存回收,判断是否有足够的内存可用等。The memory management module is responsible for the management of the on-chip memory of the local FPGA, the on-chip memory of the remote FPGA, and the remote memory, which mainly includes memory allocation, memory recycling, and judging whether there is enough memory available.
在一些实施例中,上述将上述目标数据备份到远端内存阵列设备中包括:In some embodiments, backing up the target data to a remote memory array device includes:
若上述远端内存阵列设备中的远端FPGA的片上内存存在可分配空间,则将上述目标数据传输到上述远端FPGA,并将上述目标数据存入上述远端FPGA的片上内存中; If there is allocatable space in the on-chip memory of the remote FPGA in the remote memory array device, the target data is transmitted to the remote FPGA, and the target data is stored in the on-chip memory of the remote FPGA;
若上述远端FPGA的片上内存不存在可分配空间,则将上述目标数据传输到上述远端FPGA,并经由上述远端FPGA将上述目标数据存入上述远端内存阵列设备的远端内存中。If there is no allocatable space in the on-chip memory of the remote FPGA, the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
参考图4所示,本实施例中,远端内存阵列设备包括远端内存与远端FPGA。其中,远端内存与远端FPGA之间可通过PCIe桥连接。或者,对于能够直接访问远端内存的远端FPGA,远端FPGA与远端内存可直接连接,而不需要PCIe桥。As shown in FIG4 , in this embodiment, the remote memory array device includes a remote memory and a remote FPGA. The remote memory and the remote FPGA may be connected via a PCIe bridge. Alternatively, for a remote FPGA that can directly access the remote memory, the remote FPGA and the remote memory may be directly connected without a PCIe bridge.
当要将上述目标数据备份到远端内存阵列设备中时,优先将上述目标数据备份到远端内存阵列设备中的远端FPGA的片上内存中。如果远端FPGA的片上内存空间不足,则将上述目标数据存入上述远端内存阵列设备的远端内存中。When the target data is to be backed up in the remote memory array device, the target data is preferentially backed up in the on-chip memory of the remote FPGA in the remote memory array device. If the on-chip memory space of the remote FPGA is insufficient, the target data is stored in the remote memory of the remote memory array device.
为了提高系统的运行速度,在一些实施例中,将上述目标数据传输到上述远端FPGA包括:In order to improve the operating speed of the system, in some embodiments, transmitting the target data to the remote FPGA includes:
通过上述本地FPGA的RDMA传输模块,将上述目标数据传输到上述远端FPGA。The target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
参考图4所示,本实施例中本地FPGA与远端FPGA中均设置有RDMA传输模块,本地主机与远端内存阵列设备之间通过RDMA传输模块与RDMA网络连接。As shown in FIG. 4 , in this embodiment, both the local FPGA and the remote FPGA are provided with RDMA transmission modules, and the local host and the remote memory array device are connected to the RDMA network via the RDMA transmission module.
RDMA为Remote Direct Memory Access的缩写,意为远程直接地址访问。通过RDMA,本端节点可以直接访问远端节点的内存。所谓直接指的是可以像访问本地内存一样,绕过传统以太网复杂的TCP/IP(TCP,Transmission Control Protocol,传输控制协议)(IP,Internet Protocol,网际互连协议)网络协议栈去读写对端节点的内存,这个读写过程中对端节点的CPU不参与,而且这个读写过程的大部分工作由硬件而不是软件完成。RDMA is the abbreviation of Remote Direct Memory Access, which means remote direct address access. Through RDMA, the local node can directly access the memory of the remote node. The so-called direct means that it can bypass the complex TCP/IP (TCP, Transmission Control Protocol) (IP, Internet Protocol) network protocol stack of traditional Ethernet to read and write the memory of the peer node just like accessing local memory. The CPU of the peer node does not participate in the reading and writing process, and most of the work of this reading and writing process is completed by hardware rather than software.
当本地内存以及本地FPGA的片上内存空间不足时,优先通过RDMA模块将上述目标数据传输到远端FPGA,并存入远端FPGA的片上内存中。如果远端FPGA的片上内存空间不足,则通过RDMA模块将目标数据传输到远端FPGA,并由远端FPGA通过PCIe桥或直接将目标数据存入远端内存。When the local memory and the on-chip memory space of the local FPGA are insufficient, the above target data is preferentially transferred to the remote FPGA through the RDMA module and stored in the on-chip memory of the remote FPGA. If the on-chip memory space of the remote FPGA is insufficient, the target data is transferred to the remote FPGA through the RDMA module, and the remote FPGA stores the target data in the remote memory through the PCIe bridge or directly.
若上述远端FPGA的片上内存不存在可分配空间,则将上述目标数据传输到上述远端FPGA,并经由上述远端FPGA将上述目标数据存入上述远端内存阵列设备的远端内存中。If there is no allocatable space in the on-chip memory of the remote FPGA, the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
进一步,在一些实施例中,还包括:Furthermore, in some embodiments, it also includes:
将目标数据备份到上述本地FPGA的片上内存中或远端内存阵列设备中后,释放上述目标数据所占据的上述本机内存的空间。After backing up the target data to the on-chip memory of the local FPGA or the remote memory array device, the space of the local memory occupied by the target data is released.
参考图5所示,将目标数据备份到本地FPGA的片上内存中或远端内存阵列设备中后,删除目标数据所占据的本地内存的内存映射(页表项),以释放上述目标数据所占据的上述本机内存的空间。 Referring to FIG. 5 , after backing up the target data to the on-chip memory of the local FPGA or the remote memory array device, the memory mapping (page table entry) of the local memory occupied by the target data is deleted to release the space of the local memory occupied by the target data.
进一步,在一些实施例中,还包括:Furthermore, in some embodiments, it also includes:
当访问数据时,若待访问数据位于主机内存中,则访问上述主机内存;When accessing data, if the data to be accessed is located in the host memory, the host memory is accessed;
若上述待访问数据位于上述本地FPGA的片上内存中,则将上述待访问数据从上述本地FPGA的片上内存中复制到上述主机内存,并访问上述主机内存;If the data to be accessed is located in the on-chip memory of the local FPGA, copy the data to be accessed from the on-chip memory of the local FPGA to the host memory, and access the host memory;
若上述待访问数据位于上述远端内存阵列设备中,则将上述待访问数据从上述远端内存阵列设备复制到上述主机内存,并访问上述主机内存。If the data to be accessed is located in the remote memory array device, the data to be accessed is copied from the remote memory array device to the host memory, and the host memory is accessed.
在一些实施例中,如果待访问数据位于主机内存中,则直接访问主机内存中的待访问数据。如果待访问数据位于本地FPGA的片上内存中,则首先通过PCIe桥将待访问数据从本地FPGA的片上内存复制到主机内存中,然后再访问主机内存中复制过来的待访问数据。如果待访问数据位于远端内存阵列设备中,在本地主机与远端内存阵列设备之间通过RDMA传输模块与RDMA网络连接的情况下,首先通过RDMA传输模块将待访问数据复制到主机内存中,然后再访问主机内存中复制过来的待访问数据。In some embodiments, if the data to be accessed is located in the host memory, the data to be accessed in the host memory is directly accessed. If the data to be accessed is located in the on-chip memory of the local FPGA, the data to be accessed is first copied from the on-chip memory of the local FPGA to the host memory through the PCIe bridge, and then the data to be accessed copied from the host memory is accessed. If the data to be accessed is located in a remote memory array device, when the local host and the remote memory array device are connected to the RDMA network through an RDMA transmission module, the data to be accessed is first copied to the host memory through the RDMA transmission module, and then the data to be accessed copied from the host memory is accessed.
其中,对应于远端内存阵列设备包括远端FPGA与远端内存的实施例,上述将上述待访问数据从上述远端内存阵列设备复制到上述主机内存包括:Wherein, corresponding to the embodiment in which the remote memory array device includes a remote FPGA and a remote memory, the copying of the to-be-accessed data from the remote memory array device to the host memory includes:
若上述待访问数据位于上述远端内存阵列设备的远端FPGA的片上内存中,则将上述待访问数据从上述远端FPGA的片上内存复制到上述本地内存;If the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device, copying the data to be accessed from the on-chip memory of the remote FPGA to the local memory;
若上述待访问数据位于上述远端内存阵列设备的远端内存中,则将上述待访问数据从上述远端内存复制到上述本地内存。If the data to be accessed is located in the remote memory of the remote memory array device, the data to be accessed is copied from the remote memory to the local memory.
进一步,在一些实施例中,还包括:Furthermore, in some embodiments, it also includes:
将上述待访问数据从上述本地FPGA的片上内存中复制到上述主机内存后,释放上述本地FPGA的片上内存中上述待访问数据占据的空间。After the data to be accessed is copied from the on-chip memory of the local FPGA to the host memory, the space occupied by the data to be accessed in the on-chip memory of the local FPGA is released.
将上述待访问数据从上述远端内存阵列设备复制到上述主机内存后,释放上述远端内存阵列设备中上述待访问数据占据的空间。After the to-be-accessed data is copied from the remote memory array device to the host memory, the space occupied by the to-be-accessed data in the remote memory array device is released.
参考图5所示,通过PCIe桥将待访问数据从本地FPGA的片上内存中复制到主机内存后,释放本地FPGA的片上内存中待访问数据占据的空间。通过RDMA模块将待访问数据从远端内存阵列设备复制到主机内存后,释放远端内存阵列中待访问数据占据的空间。As shown in FIG5 , after the data to be accessed is copied from the on-chip memory of the local FPGA to the host memory via the PCIe bridge, the space occupied by the data to be accessed in the on-chip memory of the local FPGA is released. After the data to be accessed is copied from the remote memory array device to the host memory via the RDMA module, the space occupied by the data to be accessed in the remote memory array is released.
其中,上述释放上述远端内存阵列设备中上述待访问数据占据的空间包括:The releasing of the space occupied by the to-be-accessed data in the remote memory array device comprises:
若将上述待访问数据从上述远端FPGA的片上内存复制到上述本地内存,则释放上述远端FPGA的片上内存中上述待访问数据占据的空间;If the data to be accessed is copied from the on-chip memory of the remote FPGA to the local memory, the space occupied by the data to be accessed in the on-chip memory of the remote FPGA is released;
若将上述待访问数据从上述远端内存复制到上述本地内存,则释放上述远端内存中上述 待访问数据占据的空间。If the data to be accessed is copied from the remote memory to the local memory, the remote memory is released. The space occupied by the data to be accessed.
即,如果待访问数据位于远端FPGA的片上内存中,当将待访问数据从远端FPGA的片上内存复制到主机内存后,释放远端FPGA的片上内存中待访问数据占据的空间。如果待访问数据位于远端内存中,当将待访问数据从远端内存复制到主机内存后,释放远端内存中待访问数据占据的空间。That is, if the data to be accessed is located in the on-chip memory of the remote FPGA, after the data to be accessed is copied from the on-chip memory of the remote FPGA to the host memory, the space occupied by the data to be accessed in the on-chip memory of the remote FPGA is released. If the data to be accessed is located in the remote memory, after the data to be accessed is copied from the remote memory to the host memory, the space occupied by the data to be accessed in the remote memory is released.
进一步,在一些实施例中,还包括:Furthermore, in some embodiments, it also includes:
当上述本地主机的主机内存空间足够时,分配主机内存,并建立内存映射。When the host memory space of the local host is sufficient, host memory is allocated and memory mapping is established.
其中,上述当上述本地主机的主机内存空间足够时,分配主机内存,并建立内存映射前还包括:Wherein, when the host memory space of the local host is sufficient, the host memory is allocated, and before the memory mapping is established, the following steps are also included:
判断本地主机是否已建立内存映射;Determine whether the local host has established memory mapping;
若上述本地主机未建立内存映射,则判断上述本地主机的主机内存空间是否足够;If the local host does not establish a memory mapping, determining whether the host memory space of the local host is sufficient;
若上述本地主机的主机内存空间足够,则分配主机内存,并建立内存映射。If the host memory space of the local host is sufficient, the host memory is allocated and a memory mapping is established.
参考图5所示,应用程序开始访问主机内存时,首先判断是否已建立内存映射,如果已建立,则执行内存访问指令访问主机内存。如果未建立内存映射,则判断本地主机的主机内存空间是否足够。如果本地主机的主机内存空间足够,则分配主机内存,建立内存映射。如果本地主机的主机内存空间不足,则执行步骤S101~步骤S103。建立内存映射是指建立虚拟地址和物理地址之间的映射关系,方法是创建页表的表项,供CPU中的MMU(Memory Management Unit,内存管理单元)查询。As shown in FIG5 , when the application starts to access the host memory, it first determines whether a memory mapping has been established. If so, the memory access instruction is executed to access the host memory. If the memory mapping has not been established, it is determined whether the host memory space of the local host is sufficient. If the host memory space of the local host is sufficient, the host memory is allocated and the memory mapping is established. If the host memory space of the local host is insufficient, steps S101 to S103 are executed. Establishing a memory mapping refers to establishing a mapping relationship between a virtual address and a physical address by creating a page table entry for the MMU (Memory Management Unit) in the CPU to query.
在应用程序中,数据写入(例如C语言代码中给指针指向的地址赋值的操作)都是必不可少的操作。以下以赋值操作为例,阐述一种可选的实施方式:In applications, data writing (such as the operation of assigning a value to the address pointed to by a pointer in C language code) is an essential operation. The following takes the assignment operation as an example to explain an optional implementation method:
应用程序直接给某个地址赋值。此地址为虚拟地址,尚未分配实际的物理地址,故CPU会产生缺页异常。The application directly assigns a value to an address. This address is a virtual address and has not yet been assigned an actual physical address, so the CPU will generate a page fault exception.
*p=A;*p=A;
上述语句到处理器层面执行时,执行的是数据赋值指令,例如“STRB WO,[<address>]”。When the above statements are executed at the processor level, data assignment instructions are executed, such as "STRB WO, [<address>]".
CPU产生缺页异常后,操作系统的缺页处理部分发现没有足够的本地物理地址可做地址映射,于是执行步骤S101~S103的处理逻辑,记为rdma_swap处理逻辑。After the CPU generates a page fault exception, the page fault processing part of the operating system finds that there are not enough local physical addresses for address mapping, so it executes the processing logic of steps S101 to S103, which is recorded as rdma_swap processing logic.
rdma_swap处理逻辑中,当发现本地FPGA的片上内存不够用时,将本机内存中长期不用的数据备份到远端内存阵列设备的内存中。In the rdma_swap processing logic, when it is found that the on-chip memory of the local FPGA is insufficient, the data that has not been used for a long time in the local memory is backed up to the memory of the remote memory array device.
可选过程为: The optional process is:
1.向本机FPGA中的RDMA传输模块发出RDMA_WRITE指令。1. Issue an RDMA_WRITE instruction to the RDMA transport module in the local FPGA.
rdma_sq_wr.opcode=IBV_WR_RDMA_WRITE;//RDMA操作指令码rdma_sq_wr.opcode = IBV_WR_RDMA_WRITE; //RDMA operation instruction code
rdma_sgl.addr=local_addr;//长期不用的数据所在的本机内存地址rdma_sgl.addr = local_addr; //The local memory address where the data not used for a long time is located
rdma_sq_wr.sg_list=&rdma_sgl:rdma_sq_wr.sg_list=&rdma_sgl:
rdma_sq_wr.wr.rdma.remote_addr=remote_addr;//远端目的地址rdma_sq_wr.wr.rdma.remote_addr = remote_addr; //remote destination address
ibv_post_send(qp,&rdma_sq_wr,&bad_wr);//发布命令给RDMA传输模块ibv_post_send(qp, &rdma_sq_wr, &bad_wr); //Post command to RDMA transmission module
2、等待RDMA传输模块处理完成。2. Wait for the RDMA transmission module to complete processing.
ibv_poll_cq(cq,1,&wc);ibv_poll_cq(cq,1,&wc);
RDMA传输模块处理完成后,删除长期不用的数据所在的内存映射,释放空间给当前正在访问的地址使用。After the RDMA transmission module completes the processing, it deletes the memory mapping of the data that has not been used for a long time, and releases the space for the address that is currently being accessed.
实际应用中,可通过本申请所提供的rdma_swap处理逻辑替换操作系统中现有的如图2所示的swap处理逻辑。也可以在swap处理逻辑的基础上,添加新逻辑,即与原有swap处理逻辑兼容。如果是在swap处理逻辑的基础上,添加新逻辑,可在“swap处理逻辑”中做修改,在将数据保存到硬盘中的swap分区前,先判断是否有可用的本机FPGA的片上内存或可用的远端内存阵列设备的内存。如果有,则运行如图5所示的处理逻辑;如果没有,则运行原有的swap处理逻辑。In practical applications, the existing swap processing logic in the operating system as shown in FIG. 2 can be replaced by the rdma_swap processing logic provided in this application. It is also possible to add new logic based on the swap processing logic, that is, to be compatible with the original swap processing logic. If new logic is added based on the swap processing logic, modifications can be made in the "swap processing logic". Before saving the data to the swap partition in the hard disk, first determine whether there is available on-chip memory of the local FPGA or available memory of a remote memory array device. If so, run the processing logic shown in FIG. 5; if not, run the original swap processing logic.
综上上述,本申请所提供的内存备份加速方法,使用本地主机上的本地FPGA的内存与远端内存阵列设备的内存作为备份本地主机的主机内存中数据的物理载体,替代了传统的以硬盘作为数据备份载体的方案,能够有效的提高系统运行的速度。In summary, the memory backup acceleration method provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, and can effectively improve the speed of system operation.
本申请还提供了一种内存备份加速装置,下文描述的该装置可以与上文描述的方法相互对应参照。请参考图6,图6为本申请实施例所提供的一种内存备份加速装置的示意图,结合图6所示,该装置包括:The present application also provides a memory backup acceleration device, and the device described below can be referred to in correspondence with the method described above. Please refer to Figure 6, which is a schematic diagram of a memory backup acceleration device provided in an embodiment of the present application. As shown in Figure 6, the device includes:
判断模块10,用于当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;The judgment module 10 is used to judge whether there is allocatable space in the on-chip memory of the local FPGA when the host memory space of the local host is insufficient;
第一备份模块20,用于若上述本地FPGA的片上内存存在可分配空间,则将目标数据备份到上述本地FPGA的片上内存中;A first backup module 20, configured to back up the target data to the on-chip memory of the local FPGA if there is allocatable space in the on-chip memory of the local FPGA;
第二备份模块30,用于若上述本地FPGA的片上内存不存在可分配空间,则将上述目标数据备份到远端内存阵列设备中。The second backup module 30 is used to back up the target data to a remote memory array device if there is no allocatable space in the on-chip memory of the local FPGA.
在上述实施例的基础上,作为一种可选的实施方式,上述第二备份模块30包括: Based on the above embodiment, as an optional implementation, the second backup module 30 includes:
第一备份单元,用于若上述远端内存阵列设备中的远端FPGA的片上内存存在可分配空间,则将上述目标数据传输到上述远端FPGA,并将上述目标数据存入上述远端FPGA的片上内存中;A first backup unit is configured to transmit the target data to the remote FPGA in the remote memory array device if there is allocatable space in the on-chip memory of the remote FPGA, and store the target data in the on-chip memory of the remote FPGA;
第二备份单元,用于若上述远端FPGA的片上内存不存在可分配空间,则将上述目标数据传输到上述远端FPGA,并经由上述远端FPGA将上述目标数据存入上述远端内存阵列设备的远端内存中。The second backup unit is used to transfer the target data to the remote FPGA if there is no allocatable space in the on-chip memory of the remote FPGA, and store the target data in the remote memory of the remote memory array device via the remote FPGA.
在上述实施例的基础上,作为一种可选的实施方式,上述第一备份单元与上述第二备份单元可以用于:Based on the above embodiment, as an optional implementation manner, the first backup unit and the second backup unit may be used to:
通过上述本地FPGA的RDMA传输模块,将上述目标数据传输到上述远端FPGA。The target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
第一访问模块,用于当访问数据时,若待访问数据位于主机内存中,则访问上述主机内存;A first access module, configured to access the host memory if the data to be accessed is located in the host memory;
第二访问模块,用于若上述待访问数据位于上述本地FPGA的片上内存中,则将上述待访问数据从上述本地FPGA的片上内存中复制到上述主机内存,并访问上述主机内存;A second access module is used for copying the data to be accessed from the on-chip memory of the local FPGA to the host memory and accessing the host memory if the data to be accessed is located in the on-chip memory of the local FPGA;
第三访问模块,用于若上述待访问数据位于上述远端内存阵列设备中,则将上述待访问数据从上述远端内存阵列设备复制到上述主机内存,并访问上述主机内存。The third access module is used for copying the data to be accessed from the remote memory array device to the host memory and accessing the host memory if the data to be accessed is located in the remote memory array device.
在上述实施例的基础上,作为一种可选的实施方式,上述第三访问模块包括:Based on the above embodiment, as an optional implementation manner, the third access module includes:
第一复制单元,用于若上述待访问数据位于上述远端内存阵列设备的远端FPGA的片上内存中,则将上述待访问数据从上述远端FPGA的片上内存复制到上述本地内存;A first copying unit, configured to copy the data to be accessed from the on-chip memory of the remote FPGA to the local memory if the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device;
第二复制单元,用于若上述待访问数据位于上述远端内存阵列设备的远端内存中,则将上述待访问数据从上述远端内存复制到上述本地内存。The second copying unit is used for copying the data to be accessed from the remote memory to the local memory if the data to be accessed is located in the remote memory of the remote memory array device.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
第一空间释放模块,用于将上述待访问数据从上述本地FPGA的片上内存中复制到上述主机内存后,释放上述本地FPGA的片上内存中上述待访问数据占据的空间。The first space release module is used to release the space occupied by the data to be accessed in the on-chip memory of the local FPGA after copying the data to be accessed from the on-chip memory of the local FPGA to the host memory.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
第二空间释放模块,用于将上述待访问数据从上述远端内存阵列设备复制到上述主机内存后,释放上述远端内存阵列设备中上述待访问数据占据的空间。The second space releasing module is used to release the space occupied by the data to be accessed in the remote memory array device after copying the data to be accessed from the remote memory array device to the host memory.
在上述实施例的基础上,作为一种可选的实施方式,上述第二空间释放模块包括:Based on the above embodiment, as an optional implementation manner, the second space release module includes:
第一释放单元,用于若将上述待访问数据从上述远端FPGA的片上内存复制到上述本地内存,则释放上述远端FPGA的片上内存中上述待访问数据占据的空间; A first releasing unit, configured to release the space occupied by the to-be-accessed data in the on-chip memory of the remote FPGA if the to-be-accessed data is copied from the on-chip memory of the remote FPGA to the local memory;
第二释放单元,用于若将上述待访问数据从上述远端内存复制到上述本地内存,则释放上述远端内存中上述待访问数据占据的空间。The second releasing unit is used for releasing the space occupied by the data to be accessed in the remote memory if the data to be accessed is copied from the remote memory to the local memory.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
第三空间释放单元,用于将目标数据备份到上述本地FPGA的片上内存中或远端内存阵列设备中后,释放上述目标数据所占据的上述本机内存的空间。The third space releasing unit is used to release the space of the local memory occupied by the target data after backing up the target data to the on-chip memory of the local FPGA or the remote memory array device.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
内存映射建立模块,用于当上述本地主机的主机内存空间足够时,分配主机内存,并建立内存映射。The memory mapping establishment module is used to allocate host memory and establish memory mapping when the host memory space of the local host is sufficient.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
第一判断模块,用于判断本地主机是否已建立内存映射;A first determination module is used to determine whether the local host has established a memory mapping;
第二判断模块,用于若上述本地主机未建立内存映射,则判断上述本地主机的主机内存空间是否足够;A second determination module is used to determine whether the host memory space of the local host is sufficient if the local host does not establish a memory mapping;
若上述本地主机的主机内存空间足够,则上述内存映射建立模块分配主机内存,并建立内存映射。If the host memory space of the local host is sufficient, the memory mapping establishment module allocates host memory and establishes a memory map.
在上述实施例的基础上,作为一种可选的实施方式,还包括:Based on the above embodiment, as an optional implementation manner, it also includes:
记录模块,用于记录备份的上述目标数据所在设备的信息以及上述设备中存储上述目标数据的内存的地址。The recording module is used to record the information of the device where the backed-up target data is located and the address of the memory in the device where the target data is stored.
本申请所提供的内存备份加速装置,使用本地主机上的本地FPGA的内存与远端内存阵列设备的内存作为备份本地主机的主机内存中数据的物理载体,替代了传统的以硬盘作为数据备份载体的方案,能够有效的提高系统运行的速度。The memory backup acceleration device provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, and can effectively improve the speed of system operation.
本申请还提供了一种内存备份加速设备,参考图7所示,该设备包括存储器1和处理器2。The present application also provides a memory backup acceleration device, as shown in FIG. 7 , the device includes a memory 1 and a processor 2 .
存储器1,用于存储计算机程序;Memory 1, used for storing computer programs;
处理器2,用于执行计算机程序实现如下的步骤:Processor 2 is used to execute the computer program to implement the following steps:
当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;若上述本地FPGA的片上内存存在可分配空间,则将目标数据备份到上述本地FPGA的片上内存中;若上述本地FPGA的片上内存不存在可分配空间,则将上述目标数据备份到远端内存阵列设备中。When the host memory space of the local host is insufficient, determine whether there is allocatable space in the on-chip memory of the local FPGA; if there is allocatable space in the on-chip memory of the local FPGA, back up the target data to the on-chip memory of the local FPGA; if there is no allocatable space in the on-chip memory of the local FPGA, back up the target data to a remote memory array device.
本申请所提供的内存备份加速设备,使用本地主机上的本地FPGA的内存与远端内存阵列 设备的内存作为备份本地主机的主机内存中数据的物理载体,替代了传统的以硬盘作为数据备份载体的方案,能够有效的提高系统运行的速度。The memory backup acceleration device provided in this application uses the memory of the local FPGA on the local host and the remote memory array The device's memory serves as a physical carrier for backing up data in the host memory of the local host, replacing the traditional solution of using a hard disk as a data backup carrier, which can effectively improve the speed of system operation.
对于本申请所提供的设备的介绍请参照上述方法实施例,本申请在此不做赘述。For an introduction to the equipment provided in this application, please refer to the above method embodiments, and this application will not go into details here.
本申请还提供了一种非易失性可读存储介质,该非易失性可读存储介质上存储有计算机程序,计算机程序被处理器执行时可实现如下的步骤:The present application also provides a non-volatile readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:
当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;若上述本地FPGA的片上内存存在可分配空间,则将目标数据备份到上述本地FPGA的片上内存中;若上述本地FPGA的片上内存不存在可分配空间,则将上述目标数据备份到远端内存阵列设备中。When the host memory space of the local host is insufficient, determine whether there is allocatable space in the on-chip memory of the local FPGA; if there is allocatable space in the on-chip memory of the local FPGA, back up the target data to the on-chip memory of the local FPGA; if there is no allocatable space in the on-chip memory of the local FPGA, back up the target data to a remote memory array device.
本申请所提供的非易失性可读存储介质,使用本地主机上的本地FPGA的内存与远端内存阵列设备的内存作为备份本地主机的主机内存中数据的物理载体,替代了传统的以硬盘作为数据备份载体的方案,能够有效的提高系统运行的速度。The non-volatile readable storage medium provided in the present application uses the memory of the local FPGA on the local host and the memory of the remote memory array device as the physical carrier for backing up the data in the host memory of the local host, replacing the traditional solution of using the hard disk as the data backup carrier, which can effectively improve the speed of system operation.
该非易失性可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The non-volatile readable storage medium may include: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
对于本申请所提供的非易失性可读存储介质的介绍请参照上述方法实施例,本申请在此不做赘述。For an introduction to the non-volatile readable storage medium provided in this application, please refer to the above method embodiment, and this application will not go into details here.
说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置、设备以及非易失性可读存储介质而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other. For the devices, equipment, and non-volatile readable storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the method part description.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储 器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in the embodiments disclosed herein may be implemented directly using hardware, software modules executed by a processor, or a combination of the two. The software modules may be placed in random access memory (RAM), internal memory, read-only storage, or other storage mediums. The memory may be stored in a memory device (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the technical field.
以上对本申请所提供的内存备份加速方法、装置、设备以及非易失性可读存储介质进行了详细介绍。本文中应用了可选的个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以对本申请进行若干改进和修饰,这些改进和修饰也落入本申请权利要求的保护范围。 The memory backup acceleration method, device, equipment and non-volatile readable storage medium provided by the present application are introduced in detail above. Optional examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.

Claims (20)

  1. 一种内存备份加速方法,其特征在于,包括:A memory backup acceleration method, characterized by comprising:
    当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;When the host memory space of the local host is insufficient, it is determined whether there is allocatable space in the on-chip memory of the local FPGA;
    若所述本地FPGA的片上内存存在可分配空间,则将目标数据备份到所述本地FPGA的片上内存中;If there is allocatable space in the on-chip memory of the local FPGA, backing up the target data to the on-chip memory of the local FPGA;
    若所述本地FPGA的片上内存不存在可分配空间,则将所述目标数据备份到远端内存阵列设备中。If there is no allocatable space in the on-chip memory of the local FPGA, the target data is backed up to a remote memory array device.
  2. 根据权利要求1所述的内存备份加速方法,其特征在于,所述将所述目标数据备份到远端内存阵列设备中包括:The memory backup acceleration method according to claim 1, characterized in that backing up the target data to a remote memory array device comprises:
    若所述远端内存阵列设备中的远端FPGA的片上内存存在可分配空间,则将所述目标数据传输到所述远端FPGA,并将所述目标数据存入所述远端FPGA的片上内存中;If there is allocatable space in the on-chip memory of the remote FPGA in the remote memory array device, the target data is transmitted to the remote FPGA, and the target data is stored in the on-chip memory of the remote FPGA;
    若所述远端FPGA的片上内存不存在可分配空间,则将所述目标数据传输到所述远端FPGA,并经由所述远端FPGA将所述目标数据存入所述远端内存阵列设备的远端内存中。If there is no allocatable space in the on-chip memory of the remote FPGA, the target data is transmitted to the remote FPGA, and the target data is stored in the remote memory of the remote memory array device via the remote FPGA.
  3. 根据权利要求1所述的内存备份加速方法,其特征在于,将所述目标数据传输到所述远端FPGA包括:The memory backup acceleration method according to claim 1, wherein transmitting the target data to the remote FPGA comprises:
    通过所述本地FPGA的RDMA传输模块,将所述目标数据传输到所述远端FPGA。The target data is transmitted to the remote FPGA through the RDMA transmission module of the local FPGA.
  4. 根据权利要求1所述的内存备份加速方法,其特征在于,还包括:The memory backup acceleration method according to claim 1, further comprising:
    当访问数据时,若待访问数据位于所述主机内存中,则访问所述主机内存;When accessing data, if the data to be accessed is located in the host memory, accessing the host memory;
    若所述待访问数据位于所述本地FPGA的片上内存中,则将所述待访问数据从所述本地FPGA的片上内存中复制到所述主机内存,并访问所述主机内存;If the data to be accessed is located in the on-chip memory of the local FPGA, copying the data to be accessed from the on-chip memory of the local FPGA to the host memory, and accessing the host memory;
    若所述待访问数据位于所述远端内存阵列设备中,则将所述待访问数据从所述远端内存阵列设备复制到所述主机内存,并访问所述主机内存。If the data to be accessed is located in the remote memory array device, the data to be accessed is copied from the remote memory array device to the host memory, and the host memory is accessed.
  5. 根据权利要求1所述的内存备份加速方法,其特征在于,在所述当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间之前,所述方法还包括:The memory backup acceleration method according to claim 1 is characterized in that, before determining whether there is allocatable space in the on-chip memory of the local FPGA when the host memory space of the local host is insufficient, the method further comprises:
    比对所述当本地主机的主机内存空间与第一预设阈值;Comparing the host memory space of the local host with a first preset threshold;
    在所述当本地主机的主机内存空间小于或者等于所述第一预设阈值的情况下,确定所述当本地主机的主机内存空间不足。 In a case where the host memory space of the local host is less than or equal to the first preset threshold, it is determined that the host memory space of the local host is insufficient.
  6. 根据权利要求1所述的内存备份加速方法,其特征在于,在若所述本地FPGA的片上内存不存在可分配空间,则将所述目标数据备份到远端内存阵列设备中之前,所述方法还包括:The memory backup acceleration method according to claim 1, characterized in that before backing up the target data to the remote memory array device if there is no allocatable space in the on-chip memory of the local FPGA, the method further comprises:
    在所述本地FPGA的剩余容量降至第二预设阈值的情况下,确定所述本地FPGA的片上内存不存在可分配空间,或者,When the remaining capacity of the local FPGA drops to a second preset threshold, it is determined that there is no allocatable space in the on-chip memory of the local FPGA, or,
    在所述本地FPGA的剩余容量小于所述目标数据的大小的情况下,确定所述本地FPGA的片上内存不存在可分配空间。When the remaining capacity of the local FPGA is smaller than the size of the target data, it is determined that no allocatable space exists in the on-chip memory of the local FPGA.
  7. 根据权利要求4所述的内存备份加速方法,其特征在于,所述将所述待访问数据从所述远端内存阵列设备复制到所述主机内存包括:The memory backup acceleration method according to claim 4, characterized in that copying the to-be-accessed data from the remote memory array device to the host memory comprises:
    若所述待访问数据位于所述远端内存阵列设备的远端FPGA的片上内存中,则将所述待访问数据从所述远端FPGA的片上内存复制到所述本地内存;If the data to be accessed is located in the on-chip memory of the remote FPGA of the remote memory array device, copying the data to be accessed from the on-chip memory of the remote FPGA to the local memory;
    若所述待访问数据位于所述远端内存阵列设备的远端内存中,则将所述待访问数据从所述远端内存复制到所述本地内存。If the data to be accessed is located in the remote memory of the remote memory array device, the data to be accessed is copied from the remote memory to the local memory.
  8. 根据权利要求7所述的内存备份加速方法,其特征在于,还包括:The memory backup acceleration method according to claim 7, further comprising:
    将所述待访问数据从所述本地FPGA的片上内存中复制到所述主机内存后,释放所述本地FPGA的片上内存中所述待访问数据占据的空间。After the to-be-accessed data is copied from the on-chip memory of the local FPGA to the host memory, the space occupied by the to-be-accessed data in the on-chip memory of the local FPGA is released.
  9. 根据权利要求7所述的内存备份加速方法,其特征在于,还包括:The memory backup acceleration method according to claim 7, further comprising:
    将所述待访问数据从所述远端内存阵列设备复制到所述主机内存后,释放所述远端内存阵列设备中所述待访问数据占据的空间。After the to-be-accessed data is copied from the remote memory array device to the host memory, the space occupied by the to-be-accessed data in the remote memory array device is released.
  10. 根据权利要求9所述的内存备份加速方法,其特征在于,所述释放所述远端内存阵列设备中所述待访问数据占据的空间包括:The memory backup acceleration method according to claim 9, wherein releasing the space occupied by the to-be-accessed data in the remote memory array device comprises:
    若将所述待访问数据从所述远端FPGA的片上内存复制到所述本地内存,则释放所述远端FPGA的片上内存中所述待访问数据占据的空间;If the data to be accessed is copied from the on-chip memory of the remote FPGA to the local memory, the space occupied by the data to be accessed in the on-chip memory of the remote FPGA is released;
    若将所述待访问数据从所述远端内存复制到所述本地内存,则释放所述远端内存中所述待访问数据占据的空间。If the data to be accessed is copied from the remote memory to the local memory, the space occupied by the data to be accessed in the remote memory is released.
  11. 根据权利要求1所述的内存备份加速方法,其特征在于,还包括:The memory backup acceleration method according to claim 1, further comprising:
    将目标数据备份到所述本地FPGA的片上内存中或所述远端内存阵列设备中后,释放所述目标数据所占据的所述本机内存的空间。After backing up the target data to the on-chip memory of the local FPGA or the remote memory array device, the space of the local memory occupied by the target data is released.
  12. 根据权利要求11所述的内存备份加速方法,其特征在于,所述释放所述目标数据所占据的所述本机内存的空间,包括:The memory backup acceleration method according to claim 11, characterized in that the releasing of the space of the local memory occupied by the target data comprises:
    删除所述目标数据所占据的本地内存的内存映射。 Delete the memory mapping of the local memory occupied by the target data.
  13. 根据权利要求1所述的内存备份加速方法,其特征在于,还包括:The memory backup acceleration method according to claim 1, further comprising:
    当所述本地主机的主机内存空间足够时,分配主机内存,并建立内存映射。When the host memory space of the local host is sufficient, host memory is allocated and memory mapping is established.
  14. 根据权利要求13所述的内存备份加速方法,其特征在于,所述当所述本地主机的主机内存空间足够时,分配主机内存,并建立内存映射前还包括:The memory backup acceleration method according to claim 13, characterized in that when the host memory space of the local host is sufficient, the host memory is allocated, and before the memory mapping is established, it also includes:
    判断本地主机是否已建立内存映射;Determine whether the local host has established memory mapping;
    若所述本地主机未建立内存映射,则判断所述本地主机的主机内存空间是否足够;If the local host does not establish a memory mapping, determining whether the host memory space of the local host is sufficient;
    若所述本地主机的主机内存空间足够,则分配主机内存,并建立内存映射。If the host memory space of the local host is sufficient, host memory is allocated and a memory mapping is established.
  15. 根据权利要求14所述的内存备份加速方法,其特征在于,所述建立内存映射,包括:The memory backup acceleration method according to claim 14, wherein the establishing of the memory mapping comprises:
    通过创建页表的表项建立虚拟地址和物理地址之间的映射关系,得到所述内存映射。The mapping relationship between the virtual address and the physical address is established by creating a table entry of the page table to obtain the memory mapping.
  16. 根据权利要求1所述的内存备份加速方法,其特征在于,还包括:The memory backup acceleration method according to claim 1, further comprising:
    记录备份的所述目标数据所在设备的信息以及所述设备中存储所述目标数据的内存的地址。Record the information of the device where the backed-up target data is located and the address of the memory in the device that stores the target data.
  17. 根据权利要求1所述的内存备份加速方法,其特征在于,所述记录备份的所述目标数据所在设备的信息,包括:The memory backup acceleration method according to claim 1, wherein the information of the device where the target data to be backed up is located includes:
    将所述目标数据的本地FPGA的编号、远程内存阵列设备的编号确定为所述目标数据所在设备的信息进行记录,其中,所述目标数据所在设备的信息用于在所述目标数据被访问时,将备份的所述目标数据重新复制到本机内存中。The number of the local FPGA of the target data and the number of the remote memory array device are determined as the information of the device where the target data is located and recorded, wherein the information of the device where the target data is located is used to re-copy the backed-up target data to the local memory when the target data is accessed.
  18. 一种内存备份加速装置,其特征在于,包括:A memory backup acceleration device, characterized by comprising:
    判断模块,用于当本地主机的主机内存空间不足时,判断本地FPGA的片上内存是否存在可分配空间;A judgment module, used for judging whether there is allocatable space in the on-chip memory of the local FPGA when the host memory space of the local host is insufficient;
    第一备份模块,用于若所述本地FPGA的片上内存存在可分配空间,则将目标数据备份到所述本地FPGA的片上内存中;A first backup module, configured to back up the target data to the on-chip memory of the local FPGA if there is allocatable space in the on-chip memory of the local FPGA;
    第二备份模块,用于若所述本地FPGA的片上内存不存在可分配空间,则将所述目标数据备份到远端内存阵列设备中。The second backup module is used to back up the target data to a remote memory array device if there is no allocatable space in the on-chip memory of the local FPGA.
  19. 一种内存备份加速设备,其特征在于,包括:A memory backup acceleration device, comprising:
    存储器,用于存储计算机程序;Memory for storing computer programs;
    处理器,用于执行所述计算机程序时实现如权利要求1至12任一项所述的内存备份加速方法的步骤。 A processor, configured to implement the steps of the memory backup acceleration method as described in any one of claims 1 to 12 when executing the computer program.
  20. 一种非易失性可读存储介质,其特征在于,所述非易失性可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至12任一项所述的内存备份加速方法的步骤。 A non-volatile readable storage medium, characterized in that a computer program is stored on the non-volatile readable storage medium, and when the computer program is executed by a processor, the steps of the memory backup acceleration method as described in any one of claims 1 to 12 are implemented.
PCT/CN2023/081742 2022-11-21 2023-03-15 Memory backup acceleration method, apparatus and device, and non-volatile readable storage medium WO2024108825A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211458494.9 2022-11-21
CN202211458494.9A CN115756962A (en) 2022-11-21 2022-11-21 Memory backup acceleration method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2024108825A1 true WO2024108825A1 (en) 2024-05-30

Family

ID=85333939

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/081742 WO2024108825A1 (en) 2022-11-21 2023-03-15 Memory backup acceleration method, apparatus and device, and non-volatile readable storage medium

Country Status (2)

Country Link
CN (1) CN115756962A (en)
WO (1) WO2024108825A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115756962A (en) * 2022-11-21 2023-03-07 浪潮(北京)电子信息产业有限公司 Memory backup acceleration method, device, equipment and computer readable storage medium
CN117493259B (en) * 2023-12-28 2024-04-05 苏州元脑智能科技有限公司 Data storage system, method and server

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112540941A (en) * 2019-09-21 2021-03-23 华为技术有限公司 Data forwarding chip and server
CN113505063A (en) * 2021-07-05 2021-10-15 中航机载系统共性技术有限公司 FPGA logic test method and device
CN113868155A (en) * 2021-11-30 2021-12-31 苏州浪潮智能科技有限公司 Memory space expansion method and device, electronic equipment and storage medium
WO2022001128A1 (en) * 2020-06-30 2022-01-06 浪潮电子信息产业股份有限公司 Fpga board memory data reading method and apparatus, and medium
CN114089926A (en) * 2022-01-20 2022-02-25 阿里云计算有限公司 Management method of distributed storage space, computing equipment and storage medium
CN115756962A (en) * 2022-11-21 2023-03-07 浪潮(北京)电子信息产业有限公司 Memory backup acceleration method, device, equipment and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112540941A (en) * 2019-09-21 2021-03-23 华为技术有限公司 Data forwarding chip and server
WO2022001128A1 (en) * 2020-06-30 2022-01-06 浪潮电子信息产业股份有限公司 Fpga board memory data reading method and apparatus, and medium
CN113505063A (en) * 2021-07-05 2021-10-15 中航机载系统共性技术有限公司 FPGA logic test method and device
CN113868155A (en) * 2021-11-30 2021-12-31 苏州浪潮智能科技有限公司 Memory space expansion method and device, electronic equipment and storage medium
CN114089926A (en) * 2022-01-20 2022-02-25 阿里云计算有限公司 Management method of distributed storage space, computing equipment and storage medium
CN115756962A (en) * 2022-11-21 2023-03-07 浪潮(北京)电子信息产业有限公司 Memory backup acceleration method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN115756962A (en) 2023-03-07

Similar Documents

Publication Publication Date Title
WO2024108825A1 (en) Memory backup acceleration method, apparatus and device, and non-volatile readable storage medium
US11748278B2 (en) Multi-protocol support for transactions
US7707337B2 (en) Object-based storage device with low process load and control method thereof
US9092426B1 (en) Zero-copy direct memory access (DMA) network-attached storage (NAS) file system block writing
US8775755B2 (en) Peer-to-peer transcendent memory
WO2015169145A1 (en) Memory management method and device
US20220334975A1 (en) Systems and methods for streaming storage device content
US9769081B2 (en) Buffer manager and methods for managing memory
WO2013170730A1 (en) Dma transmission method and system
WO2019233322A1 (en) Resource pool management method and apparatus, resource pool control unit, and communication device
WO2021057489A1 (en) Method and device for virtual machine memory management
WO2012122796A1 (en) Method for creating virtual machine, virtual machine monitor and virtual machine system
JPWO2009069326A1 (en) Network boot system
CN112612623B (en) Method and equipment for managing shared memory
WO2023093418A1 (en) Data migration method and apparatus, and electronic device
WO2023125524A1 (en) Data storage method and system, storage access configuration method and related device
JP2021501941A (en) Memory block reclaim method and memory block reclaim device
US9552295B2 (en) Performance and energy efficiency while using large pages
CN107577492A (en) The NVM block device drives method and system of accelerating file system read-write
US20240053917A1 (en) Storage device, operation method of storage device, and storage system using the same
EP4099171A1 (en) Systems, methods, and apparatus for page migration in memory systems
WO2022170769A1 (en) Communication method, apparatus, and system
US20060277326A1 (en) Data transfer system and method
US11789634B2 (en) Systems and methods for processing copy commands
CN113742115A (en) Method for processing page fault by processor