WO2024082702A1 - Data processing method and apparatus, and chip and computer-readable storage medium - Google Patents

Data processing method and apparatus, and chip and computer-readable storage medium Download PDF

Info

Publication number
WO2024082702A1
WO2024082702A1 PCT/CN2023/103852 CN2023103852W WO2024082702A1 WO 2024082702 A1 WO2024082702 A1 WO 2024082702A1 CN 2023103852 W CN2023103852 W CN 2023103852W WO 2024082702 A1 WO2024082702 A1 WO 2024082702A1
Authority
WO
WIPO (PCT)
Prior art keywords
physical page
storage medium
memory
cache
data
Prior art date
Application number
PCT/CN2023/103852
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 WO2024082702A1 publication Critical patent/WO2024082702A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0882Page mode
    • 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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management

Definitions

  • the present application relates to the field of storage technology, and in particular to a data processing method, device, chip and computer-readable storage medium.
  • the processor usually reads the data to be migrated from one storage medium in the hybrid memory system first, and then writes the read data to be migrated to another storage medium in the hybrid memory system.
  • the above data migration process depends on the progress of data transfer, and the reading process of all the data to be migrated must be completed before the operation of writing the data to be migrated to another storage medium can be performed, which increases the time of data migration and reduces the efficiency of data migration.
  • the present application provides a data processing method, device, chip and computer-readable storage medium, which can improve data migration efficiency.
  • a data processing method is provided, which is applied to a hybrid memory system, the hybrid memory system comprising a first storage medium and a second storage medium, wherein access performance of the first storage medium is better than access performance of the second storage medium, and the method comprises the following steps: first obtaining a first migration detection result of a first physical page used as memory of an electronic device in the first storage medium; if the first migration detection result satisfies a first data migration condition, then selecting a second physical page from the second storage medium, wherein the second physical page is a candidate physical page used as memory in the second storage medium; thereafter, using the second physical page as memory, and using the first physical page as a cache of the second physical page.
  • This method uses the first physical page as a cache of a candidate physical page in the second storage medium when the first migration detection result of the first physical page meets the first data migration condition, and uses the candidate physical page as a memory physical page in the second storage medium, so that the data in the first physical page becomes the cache data of the memory physical page in the second storage medium, avoiding the data in the first physical page from being written back to the second storage medium later, and also avoiding the written-back data from being migrated to the first storage medium again, thereby simplifying the data migration process, reducing the overhead of reading and writing data back and forth during the data migration process, and improving the data migration efficiency.
  • the second physical page is used as memory by converting the candidate state of the second physical page into a memory state, wherein the candidate state is used to indicate that the corresponding physical page is a candidate physical page, and the memory state is used to indicate that the corresponding physical page is used as memory.
  • the second physical page can be used as a memory by converting the state of the second physical page, and the implementation manner is simple and convenient.
  • the first mapping relationship is used to indicate that the first physical page is in a memory state
  • the media address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs
  • the first memory address is used to indicate the position of the first physical page in the memory when it is used as a memory.
  • the first mapping relationship is also used to indicate that the physical page associated with the first memory address is in a memory state.
  • the media address of the physical page in the candidate state in the second storage medium i.e., the candidate physical page
  • the media address of the second physical page in the candidate list is deleted, and the media address in the first mapping relationship is modified to the media address of the second physical page to realize the conversion of the candidate state of the second physical page into a memory state.
  • the first physical page in the memory state is recorded by the first mapping relationship and the candidate physical page is recorded by the candidate list, and then the second physical page can be replaced by the first mapping relationship by deleting the record of the second physical page in the candidate list.
  • the first physical page is used as memory, and the implementation is simple.
  • the first physical page is used as a cache of the second physical page by converting the memory state of the first physical page to a cache state and associating the second physical page with the first physical page.
  • the memory state is used to indicate that the corresponding physical page is used as a memory
  • the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page.
  • the first physical page can be used as a cache of the second physical page, and the implementation manner is simple.
  • the above-mentioned method of converting the memory state of the first physical page into a cache state and associating the second physical page with the first physical page includes: first invalidating the first mapping relationship between the media address of the first physical page and the first memory address in the hybrid memory system; and then establishing a second mapping relationship between the media address of the first physical page and the media address of the second physical page, wherein the first mapping relationship is used to indicate that the first physical page is in a memory state, the media address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, the memory address is used to indicate the position of the corresponding physical page in the memory when it is used as memory, and the second mapping relationship is used to indicate that the first physical page is a cache of the associated second physical page.
  • the first physical page is not in the memory state, and by establishing the second mapping relationship, the first physical page becomes the cache of the second physical page.
  • the implementation manner is simple.
  • the method also includes the following steps: obtaining a second migration detection result of the third physical page in the second storage medium, and if the second migration detection result meets the second data migration condition, selecting a fourth physical page from the first storage medium, wherein the third physical page is a physical page used as memory in the second storage medium and the fourth physical page is a cache of the third physical page in the first storage medium; thereafter, the fourth physical page is used as memory and the third physical page is used as a candidate physical page.
  • the fourth physical page replaces the third physical page as memory.
  • the fourth physical page was a cache of the third physical page, and the fourth physical page may cache data of the third physical page. If the fourth physical page caches all the data of the third physical page, there is no need to migrate data from the third physical page, which simplifies the data migration process and improves data migration efficiency.
  • the first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as memory in the second storage medium, and each cache physical page is used as a cache for the associated physical page. Based on this, the fourth physical page is selected from the first storage medium by determining a cache physical page associated with the third physical page in at least one cache physical page as the fourth physical page.
  • the fourth physical page is used as memory by disassociating the third physical page from the fourth physical page and converting the cache state of the fourth physical page to a memory state, wherein the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page, and the memory state is used to indicate that the corresponding physical page is used as memory.
  • the fourth physical page is no longer a cache of the third physical page.
  • the fourth physical page can be used as memory.
  • the implementation method is simple.
  • a third mapping relationship is provided between the media address of the third physical page and the second memory address in the hybrid memory system, the third mapping relationship is used to indicate that the third physical page is in a memory state, the media address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, and the memory address is used to indicate the position of the corresponding physical page in the memory when it is used as a memory.
  • converting the cache state of the fourth physical page to the memory state includes:
  • the fourth physical page can be placed in a memory state by modifying the third mapping relationship, and the implementation manner is simple.
  • the method before the fourth physical page is used as memory, the method further includes the following steps: querying the third physical page for data that has not been cached to the fourth physical page, and migrating the queried data to the fourth physical page.
  • whether the cache line of the fourth physical page stores data is recorded by the cache line status.
  • the above-mentioned query of the data in the third physical page that has not been cached to the fourth physical page and the implementation process of migrating the queried data to the fourth physical page include: obtaining the cache line status of the cache line of the fourth physical page, if the cache status indicates that the cache line does not store data, migrating the data in the storage space corresponding to the cache line in the third physical page to the cache line.
  • the method after obtaining the second migration detection result of the third physical page in the second storage medium, the method also includes the following steps: if the second migration detection result meets the third data migration condition, writing the data stored in the fourth physical page to the third physical page; and releasing the association between the third physical page and the fourth physical page.
  • the storage space of the fourth physical page can be released so that the data of other physical pages in the second storage medium can be cached after the fourth physical page to improve the access efficiency of other physical pages.
  • the association between the third physical page and the fourth physical page is removed by invalidating a fourth mapping relationship between the media address of the third physical page and the media address of the fourth physical page, wherein the media address is used to indicate the location of the corresponding physical page in the storage medium.
  • the method also includes: obtaining an access request for a first target physical page in a hybrid memory system; if the first target physical page belongs to a first storage medium, accessing the first target physical page based on the access request; if the first target physical page belongs to a second storage medium, accessing a second target physical page associated with the first target physical page in the first storage medium based on the access request, the second target physical page being a cache of the first target physical page.
  • the first target physical page to be accessed belongs to the first storage medium, then based on the access request, the first target physical page is accessed, and since the access performance of the first storage medium is higher than that of the second storage medium, the first target physical page in the first storage medium can be quickly accessed. If the first target physical page belongs to the second storage medium, then based on the access request, the second target physical page associated with the first target physical page in the first storage medium is accessed, and since the access performance of the first storage medium is higher than that of the second storage medium, the second target physical page in the first storage medium can be quickly accessed.
  • a data processing device which includes modules for executing the data processing method in the first aspect or any possible implementation of the first aspect.
  • a chip is provided, wherein the chip is used to implement the operating steps of the data processing method in the first aspect or any possible implementation of the first aspect.
  • a computer-readable storage medium wherein at least one program code is stored in the storage medium, and the program code is read by a processor to enable a chip to execute the operation steps of the above-mentioned data processing method.
  • a computer program product or a computer program which includes a program code, and the program code is stored in a computer-readable storage medium.
  • the processor of the chip reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the chip executes the method provided in the above-mentioned first aspect or various optional implementations of the first aspect.
  • FIG1 is a schematic diagram of a hybrid memory system for applying a data processing method provided by the present application
  • FIG2 is a structural diagram of an electronic device using a hybrid memory system 1A provided by the present application.
  • FIG3 is a structural diagram of an electronic device using a hybrid memory system 1B provided by the present application.
  • FIG4 is a flow chart of a data processing method provided by the present application.
  • FIG5 is a flow chart of a data migration detection provided by the present application.
  • FIG6 is a flow chart of a method for accessing a hybrid memory system provided by the present application.
  • FIG7 is a schematic diagram of the structure of a data processing device provided by the present application.
  • FIG8 is a schematic diagram of the structure of another data processing device provided by the present application.
  • FIG. 9 is a schematic diagram of the structure of a chip provided in the present application.
  • the present application provides a data processing method applied to a hybrid memory system.
  • the hybrid memory system includes two storage media (such as a first storage medium and a second storage medium) with different access performances.
  • a memory physical page in the first storage medium that is, a physical page used as a memory
  • the memory physical page is the physical page of data to be migrated to the second storage medium (that is, the physical page to be migrated).
  • the method uses the physical page to be migrated as a cache of a candidate physical page in the second storage medium instead of a memory physical page, and uses the candidate physical page as a memory physical page in the second storage medium, so that the data in the physical page to be migrated becomes the cache data of the memory physical page in the second storage medium, and skips the process of migrating the data in the physical page to be migrated to the second storage medium.
  • the process simplifies the data migration process, thereby improving the efficiency of data migration.
  • FIG1 is a schematic diagram of a hybrid memory system for applying a data processing method provided by the present application.
  • the hybrid memory system 100 includes a plurality of storage media 11, a controller 12, and a manager 13.
  • the plurality of storage media 11 include a high bandwidth memory (HBM) 111, a solid state disk (SSD) 112, and a double data rate synchronous dynamic random access memory (DDR) 113.
  • HBM high bandwidth memory
  • SSD solid state disk
  • DDR double data rate synchronous dynamic random access memory
  • Each storage medium 11 corresponds to a controller 12.
  • the controller 12 corresponding to HBM 111 is an HBM controller 121
  • the controller 12 corresponding to SSD 112 is an SSD controller 122
  • the controller 12 corresponding to DDR is a DDR controller 123.
  • the controller 12 is used to control the storage medium 11 managed by it to exchange data with the outside.
  • Multiple storage media 11 are used to store data (such as computer program code or business data) and support application access.
  • the access performance of the multiple storage media 11 is different, where access performance refers to the performance that affects the storage medium in processing access requests, such as the access delay or access bandwidth of the storage medium, where the access request is used to indicate access to the storage medium, the access delay is the average time it takes for the storage medium to process the access request, and the access bandwidth is the bandwidth used when the storage medium receives the access request or returns the access result of the access request.
  • the types of multiple storage media 11 may also include other storage media that can be used as memory, such as phase change memory (PCM), magnetic random access memory (MRAM), and static random access memory (SRAM).
  • PCM phase change memory
  • MRAM magnetic random access memory
  • SRAM static random access memory
  • the hybrid memory system 100 involved in the present application includes two or more types of storage media, but there is no limitation on the type of storage media and the number of each type of storage media.
  • the hybrid memory system 100 may also include more than three types of storage media and controllers for each type of storage media.
  • the above-mentioned multiple types of storage media may also be uniformly managed by one class or one controller.
  • the following embodiment is described by taking the storage medium 11 shown in FIG1 as including HBM111, SSD112 and DDR113 as an example.
  • the manager 13 is connected to the controllers 12 of the various storage media 11.
  • the manager 13 can also serve as an interface for the hybrid memory system 100 to communicate with the outside, for receiving access requests for accessing the storage medium 12 from outside the hybrid memory system 100, and returning access results to the outside based on the access requests.
  • the manager 13 is implemented by software, hardware, or a combination of software and hardware.
  • the manager 13 includes code running on a computing instance.
  • the computing instance includes at least one of a virtual machine and a container.
  • the computing instance may be one or more.
  • the manager 13 includes code running on multiple virtual machines/containers.
  • the multiple virtual machines/containers used to run the code may be distributed in the same region or in different regions.
  • the multiple virtual machines/containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with close geographical locations.
  • a region may include multiple AZs.
  • VPC virtual private cloud
  • multiple VPCs for running the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs.
  • VPC virtual private cloud
  • usually one VPC is set in one region, and the cross-region communication between two VPCs in the same region and between VPCs in different regions requires the setting of a communication gateway in each VPC, and the interconnection between VPCs is realized through the communication gateway.
  • the manager 13 may be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD).
  • the PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC) or any combination thereof.
  • CPLD complex programmable logical device
  • FPGA field-programmable gate array
  • GAL generic array logic
  • DPU data processing unit
  • SoC system on chip
  • the hybrid memory system 100 is applied to an electronic device, which may be a server or a terminal device, wherein the server is, for example, a cloud server, a central server, an edge server, a remote server in a remote data center, or a local server in a local data center, etc.
  • the terminal device is, for example, a desktop computer, a laptop computer, or a smart phone, etc.
  • the storage medium 11 may be an on-chip memory inside the electronic device, or a memory external to a processor in the electronic device, or a storage medium in a storage device extended by the electronic device through a serial bus.
  • the serial bus is, for example, a high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIE).
  • the bus may be a computer express link (CXL) bus, a cache coherent interconnect for accelerators (CCIX) bus, a unified bus (UB or Ubus), or the like, which is used to interconnect devices.
  • CXL computer express link
  • CCIX cache coherent interconnect for accelerators
  • UBA unified bus
  • the embodiment of the present application does not limit the location of the storage medium 11 in the electronic device in the hybrid memory system 100.
  • the hybrid memory system 100 is taken as a hybrid memory system 1A as an example, and is introduced in combination with the electronic device 200 shown in Figure 2, wherein Figure 2 is a structural diagram of an electronic device provided by the present application that applies the hybrid memory system 1A.
  • the electronic device 200 includes a hybrid memory system 1A, a processor 201, and a cache 202.
  • the electronic device 200 is also connected to a storage device 203 via a PCIE/CXL/CCIX bus.
  • the storage media 11 in the hybrid memory system 1A are storage media 11a to storage media 11d, and the controllers of the storage media 11a to 11d are controllers 12a, 12b, 12c, and 12d, respectively.
  • the storage medium 11a is a memory integrated on the processor 201 chip, etc.
  • the storage medium 11b is an external memory of the processor 201, such as a memory inserted on the computer motherboard of the electronic device 200.
  • the storage medium 11c and the storage medium 11d are memories in the storage device 203, and the controller 12c of the storage medium 11c and the controller 12d of the storage medium 11d are also located in the storage device 230.
  • the processor 201 may also integrate multiple storage media on the chip and add them to the hybrid memory system 1A, the processor 201 may also add multiple storage media externally to the hybrid memory system 1A, and the storage device 203 may also have more than two storage media added to the hybrid memory system 1A. It should be understood that for the three locations of the computer mainboard of the electronic device 200 (including the storage medium external to the processor 20), on the chip of the processor 201, and the storage device external to the electronic device 200, the hybrid memory system 1A may include storage media in at least one of these three locations.
  • the processor 201 also includes at least one processor core 211, and the processor core 211 is connected to the manager 13a of the hybrid memory system 1A through the cache 102, so that the access request of the processor core 211 to any storage medium in the hybrid memory system 1A can be sent to the manager 11a, and the manager 13a returns the access result to the processor 201 based on the received access request.
  • the manager 13a is integrated in the host memory bridge between the cache 202 and each controller. Alternatively, the manager 13a is used as a separate chip to connect the host memory bridge and each controller.
  • the storage medium in the hybrid memory system 100 is only composed of the storage medium in the storage device extended by the electronic device through the serial bus.
  • the hybrid memory system 100 is taken as an example as follows, and is introduced in conjunction with the electronic device 300 shown in FIG.
  • FIG3 is a structural diagram of an electronic device using a hybrid memory system 1B provided by the present application.
  • the electronic device 300 includes a processor 301, a cache 302, at least one storage medium 303, and a controller 304 for each storage medium 303.
  • the electronic device 300 is connected to a storage device 305 via a PCIE/CXL/CCIX bus.
  • the storage device 305 includes a hybrid memory system 1B.
  • the hybrid memory system 1B includes a manager 13b, a storage medium 11e, a controller 12e of the storage medium 11e, a storage medium 11f, and a controller 12f of the storage medium 11.
  • the controllers 12e and 12f are both connected to the manager 13b.
  • FIG3 is an example in which the hybrid memory system 13b includes two storage media. In some embodiments, the hybrid memory system 13b includes more than two storage media.
  • the embodiment of the present application does not limit the type of the storage medium 11 in the hybrid memory system 13b.
  • the hybrid memory system 13b shown in Figure 3 is an example of the hybrid memory system 100, and the manager 13b is an example of the manager 13. If the manager 13b is used as a hardware functional unit, unlike Figure 2, in the embodiment shown in Figure 3, the manager 13b is located in the storage device connected to the electronic device, while the manager 13a shown in Figure 2 is located in the electronic device.
  • Figures 2 and 3 are both illustrated using the example of an electronic device including a cache.
  • the manager 13 of the hybrid memory system connects the processor in the electronic device and the controllers of each storage medium.
  • the processor can be implemented in at least one hardware form of application-specific integrated circuit (ASIC), digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA).
  • ASIC application-specific integrated circuit
  • DSP digital signal processing
  • FPGA field-programmable gate array
  • PDA programmable logic array
  • the processor can also have other hardware implementations, which are not limited in this application.
  • the processor is, for example, a central processing unit (CPU).
  • the processor can also be implemented using a graphics processing unit (GPU) or a data processing unit (DPU).
  • the GPU is responsible for rendering and drawing the content to be displayed on the display screen.
  • the processor also includes an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
  • AI artificial intelligence
  • FIG. 4 is a flow chart of a data processing method provided by the present application.
  • the data processing method is applied to a hybrid memory system.
  • the system includes a first storage medium and a second storage medium, wherein the hybrid memory system is any of the hybrid memory systems described above, and the first storage medium and the second storage medium are any two storage media with different access performances in the hybrid memory system.
  • the access performance of the first storage medium is better than the access performance of the second storage medium, for example, the access latency of the first storage medium is lower than the access latency of the second storage medium, or the access bandwidth of the first storage medium is higher than the access bandwidth of the second storage medium.
  • Any storage medium in the first storage medium and the second storage medium includes a plurality of physical pages, and the physical page is used to store data, and the physical page is the basic unit of data migration.
  • the physical pages in the first storage medium are divided into memory physical pages and cache physical pages, and the number of memory physical pages in the first storage medium is generally greater than the number of cache physical pages.
  • the physical pages in the second storage medium are divided into memory physical pages and candidate physical pages, and the number of memory physical pages in the second storage medium is greater than the number of candidate physical pages.
  • the memory physical pages in the first storage medium and the second storage medium are used as the memory of the electronic device where the hybrid memory system is located.
  • the manager of the hybrid memory system uniformly addresses the memory physical pages of multiple storage media in the hybrid memory system, and obtains the physical addresses of each memory physical page, so as to organize the memory physical pages in the hybrid memory system into memory visible to the processor.
  • the physical address of each memory physical page is used to indicate the location of the memory physical page in the memory.
  • the physical address is the page frame number of the memory physical page in the hybrid memory system.
  • the manager also assigns a virtual address to each physical memory page in the memory.
  • the application can perceive the virtual address and access the physical memory page through the virtual address. It can be understood that the memory is used as a storage space visible to the application, and this memory is also called the visible memory of the application.
  • the cache physical pages in the first storage medium are used to form a cache space of the second storage medium, and the cache space is used to cache data in the second storage medium.
  • the cache physical page serves as a cache of the memory physical page in the second storage medium to cache the data of the memory physical page in the second storage medium.
  • the cache physical page in the first storage medium can be accessed first, and if there is no data cached in the cache physical page, the memory physical page can be accessed, or the cache physical page can be accessed after the data in the memory physical page is cached in the cache physical page.
  • the candidate physical page in the second storage medium is a candidate physical page in the second storage medium for use as memory, or the candidate physical page can also be understood as a physical page in the second storage medium to be added to the memory. No data is stored in the candidate physical page, and the candidate physical page is an idle physical page.
  • the manager In order to distinguish between memory physical pages, cache physical pages and candidate physical pages, the manager records the status of the memory physical page as the memory status, the status of the cache physical page as the cache status, and the status of the candidate physical page as the candidate status, wherein the memory status is used to indicate that the corresponding physical page is used as memory, that is, to indicate that the corresponding physical page is a memory physical page.
  • the cache status is used to indicate that the corresponding physical page is a cache of an associated physical page, and the physical page associated with the corresponding physical page is a memory physical page in the second storage medium.
  • the candidate status is used to indicate that the corresponding physical page is a candidate physical page.
  • the data processing method provided in the present application is executed by a manager in the hybrid memory system.
  • the manager migrates data between the first storage medium and the second storage medium by switching the usage of physical pages in the hybrid memory system.
  • the data processing method includes the following steps.
  • Step 401 The manager obtains a first migration detection result of a first physical page in a first storage medium.
  • the first physical page is a physical page used as memory in the first storage medium. It can be understood that the first physical page is any memory physical page in the first storage medium.
  • the first migration detection result is used to indicate the number of times the first physical page has been accessed. In some embodiments, the first migration detection result is also used to indicate whether the first physical page supports data migration.
  • the manager performs a data migration test on the first physical page in the first storage medium to obtain the first migration test result, and then determines whether the first physical page is a memory physical page to be involved in data migration based on the first migration test result.
  • the manager periodically obtains access statistics of the first physical page to perform data migration detection on the first physical page, wherein the access statistics include the number of times the corresponding physical page is accessed within a period of time.
  • FIG5 is a flowchart of a data migration detection provided by the present application, and the data migration detection process shown in FIG5 includes the following steps.
  • Step 4011 The manager counts the number of times each physical memory page in the hybrid memory system is accessed.
  • the manager establishes a mapping relationship between each memory physical page in the first storage medium and the second storage medium and the access statistics information. Initially, the number of accesses in the access statistics information of each memory physical page is 0.
  • the processor When the processor is running an application, if the application has a need to access a certain memory physical page, it triggers the processor to send an access request for the memory physical page to the manager.
  • the manager receives the access request, it adds 1 to the number of accesses in the access statistics information corresponding to the memory physical page according to the memory address of the memory physical page to be accessed in the access request.
  • the memory address corresponds to the location of the physical page in the memory when it is used as memory.
  • the memory address is a physical address associated with the memory physical page or a virtual address associated with the memory physical page.
  • mapping relationship between each memory physical page in the first storage medium and the second storage medium and the access statistical information is stored in a page mapping table.
  • the page mapping table is stored in the first storage medium or the manager and maintained by the manager.
  • the page mapping table includes multiple mapping table entries, each of which includes the memory address of a memory physical page and access statistics.
  • the manager adds 1 to the number of accesses in the access statistics corresponding to the memory address.
  • the memory address is used as the physical address, and each mapping table entry is arranged in the page mapping table in the order of the size of the physical addresses associated with each memory physical page.
  • Table 1 the mapping table entry where the memory address 00000001 is located is located in the first row of the page mapping table, and the mapping table entry where the memory address 00000002 is located is located in the second row of the page mapping table.
  • each mapping table entry in order to record more information about the memory physical page, each mapping table entry also includes at least one of a medium address, a medium attribute identifier, and a migration capability identifier of a memory physical page, wherein the medium address is used to indicate the location of the corresponding physical page in the storage medium to which it belongs, and the medium attribute identifier is used to indicate the storage medium to which the corresponding physical page belongs.
  • the hybrid memory system includes a first storage medium DDR and a second storage medium SSD.
  • the medium address 000001 indicates the first physical page in the first storage medium DDR, which is the memory physical page of the associated memory address 00000001 in the hybrid memory system, that is, the first memory physical page in the memory provided in the hybrid memory system.
  • Table 1 uses characters (such as "DDR", "SSD") as an example to show the medium attribute identifier.
  • the manager assigns a medium number to each storage medium in the hybrid memory system, and the medium attribute identifier is the medium number of the storage medium.
  • the migration capability identifier is used to indicate whether the corresponding physical page supports data migration, wherein the migration capability identifier includes a first migration capability identifier and a second migration capability identifier, the first migration capability identifier is used to indicate that the corresponding physical page supports data migration, and the second migration capability identifier is used to indicate that the corresponding physical page does not support data migration.
  • the first migration capability identifier is 1 and the second migration capability identifier is 0.
  • the first migration capability identifier is 0 and the second migration capability identifier is 1.
  • the migration capability identifier of each memory physical page can be configured according to business needs or instructions.
  • the embodiment of the present application does not limit the configuration method of the migration capability identifier.
  • Step 4012 The manager uses the first duration as a migration cycle, and obtains the number of times each memory physical page is accessed when a migration cycle ends each time the migration cycle begins.
  • the first duration can be set according to the specific implementation scenario.
  • the embodiment of the present application does not limit the value of the first duration.
  • the manager obtains the number of times each memory physical page is accessed from the page migration table.
  • Step 4013 The manager determines a first migration threshold, a second migration threshold, and a third migration threshold according to the number of times each memory physical page is accessed.
  • the first migration threshold is a migration threshold that triggers the migration of data from the memory physical page in the first storage medium to the memory physical page in the second storage medium.
  • the second migration threshold is a migration threshold that triggers the migration of data from the memory physical page in the second storage medium to the memory physical page in the first storage medium.
  • the third migration threshold is a migration threshold that triggers the migration of data from the cache physical page in the second storage medium to the memory physical page in the second storage medium, which can also be understood as a migration threshold that triggers the memory physical page in the second storage medium to reclaim cache data.
  • the second migration threshold is greater than the first migration threshold, the first migration threshold is generally greater than the third migration threshold, and the first migration threshold is greater than 0.
  • the manager sorts the number of accesses of each memory physical page to obtain a number sequence, and uses the number of accesses at the first target position, the second target position, and the third target position in the number sequence as the first migration threshold, the second migration threshold, and the third migration threshold, respectively.
  • the first target position, the second target position, and the third target position can be set according to a specific implementation method, and it can be ensured that the second migration threshold is greater than the first migration threshold, and the first migration threshold is greater than the third migration threshold.
  • the manager can also use other strategies to determine the first migration threshold, the second migration threshold, and the third migration threshold, which is not limited in this embodiment of the present application.
  • the manager stores the migration threshold determined in the previous migration cycle. After a new migration threshold is determined during this migration process, the stored migration threshold is modified to the new one. Migration threshold.
  • the manager modifies the migration threshold determined in the previous migration cycle to a new migration threshold. If the manager is not configured with the requirement information, the manager does not modify the migration threshold determined in the previous migration cycle, and uses the migration threshold determined in the previous migration cycle as the migration threshold for this data migration detection.
  • step 4013 is an optional step.
  • the manager is configured with a first migration threshold, a second migration threshold and a third migration threshold. Each migration cycle shares the configured first migration threshold, second migration threshold and third migration threshold. There is no need to modify the first migration threshold, the second migration threshold and the third migration threshold, and there is no need to execute step 4013.
  • Step 4014 The manager determines whether the number of accesses of each memory physical page needs to be reset based on the configured second requirement information. If reset is required, the manager resets the number of accesses of each memory physical page to 0, and jumps to execute the above step 4011. The manager starts counting the number of accesses of each memory physical page from 0 and enters the next migration cycle. If reset is not required, the manager jumps to execute the above step 4011. The manager continues counting from the current number of accesses of each memory physical page and enters the next migration cycle.
  • the manager does not count the number of times each physical memory page is accessed, and a statistical unit outside the manager counts the number of times each physical memory page is accessed, and at the end of each migration cycle, the manager obtains the number of times each physical memory page is accessed from the statistical unit.
  • the statistical unit may be a hardware unit or a software unit.
  • the manager After the manager obtains the number of times the first physical page is accessed, the manager compares the number of times the first physical page is accessed with the first migration threshold. If the number of times the first physical page is accessed is less than or equal to the first migration threshold, it means that the first physical page is not frequently accessed, and the data stored in the first physical page is cold data.
  • the first physical page is a cold page, which triggers the manager to migrate the cold data to a second storage medium with low access performance.
  • the migration process is shown in steps 402 to 404 below.
  • Step 402 If the first migration detection result meets the first data migration condition, the manager selects a second physical page from the second storage medium, where the second physical page is a candidate physical page used as a memory in the second storage medium.
  • the first migration detection result satisfies the first data migration condition including that the number of accesses to the first physical page is less than or equal to the first migration threshold.
  • the first migration detection result satisfies the first data migration condition including that the number of accesses to the first physical page is less than or equal to the first migration threshold, and the first physical page supports data migration.
  • the manager obtains the number of accesses to the first physical page from the page mapping table, or obtains the number of accesses to the first physical page from the statistical unit. If the obtained number of accesses to the first physical page is less than or equal to the first migration threshold, the first migration detection result satisfies the first data migration condition.
  • the manager obtains the number of accesses of the first physical page and the migration capability identifier from the page mapping table.
  • the number of accesses of the first physical page is less than or equal to the first migration threshold, if the migration capability identifier is the first migration capability identifier, it means that the first physical page supports data migration, and the first migration detection result satisfies the first data migration condition.
  • the manager After determining that the first migration detection result satisfies the first data migration condition, the manager determines the second physical page from the candidate physical pages used as memory in the second storage medium. In a possible implementation, the manager stores the state of at least one physical page in the second storage medium as a candidate state to indicate that the at least one physical page is a candidate physical page in the second storage medium, and then the manager selects one of the at least one physical page as the second physical page.
  • the manager records each candidate physical page in the second storage medium that is in a candidate state through a candidate list corresponding to the second storage medium.
  • the candidate list is used to store the media addresses of each candidate physical page in the second storage medium that is in a candidate state.
  • the manager randomly obtains a media address from the candidate list, or obtains the first media address in the candidate list, and uses the candidate physical page indicated by the media address obtained from the candidate list as the second physical page.
  • Step 403 The manager uses the second physical page as memory.
  • the manager implements step 403 by converting the state of the second physical page. For example, the manager converts the candidate state of the second physical page to the memory state.
  • the manager For each memory physical page in the hybrid memory system, the manager indicates that the memory physical page is in the memory state through the mapping relationship between the media address of each memory physical page and the memory address in the hybrid system. In some embodiments, the manager records the mapping relationship between the media address of each memory physical page and the memory address in the hybrid memory system through a page mapping table. Taking the page mapping table shown in Table 1 above as an example, each mapping table entry includes the memory address, media address and media attribute identifier of a memory physical page, and the memory address, media address and media attribute identifier in the same mapping table entry are the mapping relationship between the media address of a memory physical page and the allocated memory address.
  • the page mapping table may record at least one of the migration capability identifier and access statistics of the memory physical page, or may not record the migration capability identifier and access statistics of the memory physical page. At least one item of the information, the migration capability identifier of the memory physical page, and at least one item of the access statistical information may also be recorded in other tables.
  • the first mapping relationship between the medium address of the first physical page and the first memory address in the hybrid memory system, and the first mapping relationship is used to indicate that the first physical page is in a memory state.
  • the first memory address is used to indicate the location of the first physical page in the memory when it is used as a memory. It can be understood that the first memory address is a physical address or a virtual address associated with the first physical page in the hybrid memory system.
  • Step 4031 The manager deletes the media address of the second physical page in the candidate list, where the candidate list is used to store the media addresses of candidate physical pages used as memory in the second storage medium.
  • the manager deletes the first media address in the candidate list, and the remaining media addresses in the candidate list are shifted one position toward the direction of the first media address in sequence, so that the first media address in the remaining media addresses becomes the first media address in the candidate list.
  • the second physical page By deleting the medium address of the second physical page in the selection list, the second physical page is placed in a candidate state, so that the second physical page does not have the identity of a candidate physical page.
  • Step 4032 The manager modifies the media address of the first physical page in the first mapping relationship to the media address of the second physical page.
  • the manager modifies the media address of the first physical page in the first mapping table entry to the media address of the second physical page, and modifies the media attribute identifier of the first storage medium in the first mapping table entry to the media attribute identifier of the second storage medium, so that the second physical page is associated with the first memory address in the first mapping table entry, and the second physical page replaces the first physical page as the memory physical page indicated by the first memory address.
  • the manager also clears the access count in the access statistics information of the first physical page in the first mapping table entry to 0, or does not clear the access count to 0, and continues to count based on the access count.
  • the manager also modifies the migration capability identifier of the first physical page in the first mapping table entry to the migration capability identifier of the second physical page.
  • the manager does not modify the media address of the first physical page in the first mapping relationship, but deletes the first mapping relationship and establishes a mapping relationship between the first memory address associated with the first physical page and the media address of the second physical page.
  • the method for establishing the mapping relationship can refer to the method for establishing the first mapping relationship, and will not be repeated here.
  • Step 404 The manager uses the first physical page as a cache for the second physical page.
  • the manager implements step 403 by converting the state of the first physical page. For example, the manager converts the memory state of the first physical page to the cache state, associates the second physical page in the cache state with the first physical page, so that the first physical page becomes the cache of the second physical page. At this time, the first physical page is a cache physical page in the first storage medium.
  • the manager indicates that the cached physical page is in a cache state and that the cached physical page is a cache of an associated memory physical page through a mapping relationship between the media address of the cached physical page and the media address of the memory physical page in the second storage medium.
  • the mapping relationship between the media address of the cached physical page and the media address of the memory physical page in the second storage medium is stored through a cache mapping table.
  • the cache mapping table is stored in the first storage medium or the manager and maintained by the manager.
  • the cache mapping table includes multiple cache table entries, each cache table entry includes a media address of a cache physical page in a first storage medium (i.e., a cache address) and a media address of a memory physical page in a second storage medium in a second storage medium, to indicate that the cache physical page is associated with the memory physical page, and the cache physical page is a cache of the memory physical page.
  • a cache table entry includes a media address of a cache physical page in a first storage medium (i.e., a cache address) and a media address of a memory physical page in a second storage medium in a second storage medium, to indicate that the cache physical page is associated with the memory physical page, and the cache physical page is a cache of the memory physical page.
  • Step 4041 The manager invalidates a first mapping relationship between a media address of the first physical page and a first memory address in the hybrid memory system. Tie.
  • the first physical page is not in the memory state, and at this time, the first physical page is not a memory physical page in the hybrid memory system.
  • the method of invalidating the first mapping relationship for example, modifying the medium address of the first physical page in the first mapping relationship or deleting the first mapping relationship in the above-mentioned step 4032. It should be understood that if step 4032 has been executed, step 4041 is not executed.
  • Step 4042 The manager establishes a second mapping relationship between the media address of the first physical page and the media address of the second physical page.
  • the manager uses the media address of the first physical page as the media address in the first storage medium and the media address of the second physical page as the media address in the second storage medium, and adds a first cache entry in the cache mapping table.
  • the first cache entry also establishes the second mapping relationship.
  • each cache entry also includes a valid flag, a page cache state of a cache physical page, and at least one of a memory address associated with a memory physical page in the second storage medium.
  • the valid flag is used to indicate whether the cache entry is valid, and the valid flag includes a first valid flag and a second valid flag.
  • the first valid flag is used to indicate that the cache entry is valid, and the second valid flag is used to indicate that the cache entry is invalid.
  • the first valid flag is 1 and the second valid flag is 0 for illustration. In other embodiments, the first valid flag is 0 and the second valid flag is 1.
  • the page cache state of a cache physical page is used to indicate whether each cache line in the cache physical page stores data of a corresponding storage space in an associated memory physical page.
  • the page cache state of the cache physical page includes a first page cache state and a second page cache state, wherein the first page cache state is used to indicate whether each cache line in the cache physical page stores data, and the second cache state is used to indicate whether the data in each cache line in the cache physical page is the same as the data in the corresponding storage space in the associated memory physical page, wherein any cache behavior is a cache of a corresponding storage space in an associated memory physical page, and is used to store data in a corresponding storage space in an associated memory physical page.
  • the first cache state includes multiple first cache line states, each of which is used to indicate whether data is stored in a cache line in a cache physical page. As shown in Table 2, if the first cache line state of a cache line is 1, it indicates that data is stored in the cache line, and if the first cache line state of a cache line is 0, it indicates that there is no data in the cache line. In other embodiments, the first cache line state is 0 to indicate that data is stored in the cache line, and the first cache line state is 1 to indicate that no data is stored in the cache line.
  • the second cache state includes multiple second cache line states, each second cache line state is used to indicate whether the data in a cache line in a cache physical page is the same as the data in the corresponding storage space in the associated memory physical page, as shown in Table 2, if the second cache line state of a cache line is 1, it indicates that the data in the cache line is the same as the data in the corresponding storage space in the associated memory physical page, and if the second cache line state of a cache line is 0, it indicates that the data in the cache line is not the same as the data in the corresponding storage space in the associated memory physical page.
  • the second cache line state of 1 indicates that the data in the cache line is not the same as the data in the corresponding storage space in the associated memory physical page, and the second cache line state of 1 indicates that the data in the cache line is the same as the data in the corresponding storage space in the associated memory physical page.
  • the manager when adding a first cache entry to the cache mapping table, stores the valid flag in the first cache entry as a first valid flag (e.g., 1) to indicate that the first cache entry is valid.
  • a first valid flag e.g. 1
  • the manager stores the first cache state of the cache line in the first page cache state as indicating that data is stored in the cache line (e.g., stored as 1), and if the cache line does not store data, the manager stores the first cache state of the cache line in the first page cache state as indicating that data is not stored in the cache line (e.g., stored as 0).
  • the manager since the second physical page is originally a cache physical page and no data is stored in the second physical page, for any cache line in the first physical page, the manager stores the second cache state of the cache line in the second page cache state as indicating that the data in the cache line is different from the data in the corresponding storage space in the first physical page (e.g., stored as 0).
  • the data to be migrated in the storage medium with high access performance is first read, and then the data to be migrated is written to the storage medium with low access performance. If this part of data is frequently accessed, this part of data is migrated to the storage medium with high access performance.
  • the first migration detection result meets the first data migration condition, the data in the first physical page needs to be written back to the second storage medium. Considering that the data in the first physical page is written back to the second storage medium, it may be migrated back to the first storage medium from the second storage medium later.
  • the manager uses the second physical page instead of the first physical page as memory, switches the first physical page to the cache of the second physical page, completes the data migration, avoids writing the data in the first physical page back to the second storage medium later, and can also avoid migrating the written back data to the first storage medium again, thereby reducing the overhead of reading and writing data back and forth during the data migration process and improving the data migration efficiency.
  • the second physical page is used as memory instead of the first physical page to ensure that the memory visible to the application remains unchanged, and avoids page faults when the application accesses the first memory address previously associated with the first physical page.
  • the manager also performs data migration detection on the memory physical pages in the second storage medium to detect the memory physical pages in the second storage medium to be involved in data migration, and performs related data migration operations, such as steps 405 to 411 described below.
  • Step 405 The manager obtains a second migration detection result of the third physical page in the second storage medium.
  • the third physical page is a physical page used as memory in the second storage medium. It can be understood that the third physical page is any memory physical page in the second storage medium.
  • the second migration detection result is used to indicate the number of times the third physical page has been accessed. In some embodiments, the second migration detection result is also used to indicate whether the first physical page supports data migration. In some embodiments, the second migration detection result is also used to indicate that there is data in the third physical page that has been cached by the cached physical page.
  • the manager performs a data migration test on the third physical page in the second storage medium to obtain the second migration test result, and then determines whether the third physical page is a memory physical page to be involved in data migration based on the second migration test result.
  • the manager periodically obtains access statistics of the third physical page to perform data migration detection on the third physical page.
  • the manager uses the first time length as a migration cycle. At the end of each migration cycle, the manager obtains access statistics corresponding to the media address in the second storage medium recorded in the page mapping table, wherein the media address in the second storage medium recorded in the page mapping table is also the media address of the memory physical page in the second storage medium.
  • the access information corresponding to the media address of the third physical page in the second storage medium is obtained, the data migration detection of the third physical page is completed.
  • the manager uses the second duration as the migration cycle, and at the end of each migration cycle, obtains each memory address recorded in the cache mapping table or the media address in the second storage medium, and each memory address obtained is also the memory address associated with a memory physical page in the first storage medium, and each media address obtained is also the media address of a memory physical page in the second storage medium.
  • the manager queries the access statistics corresponding to the any media address in the page mapping table to complete the data migration detection of a memory physical page in the second storage medium associated with the any address. If the memory physical page in the second storage medium associated with the any address is the third physical page, the data migration detection of the third physical page is also completed.
  • the second duration may be equal to the first duration, or may not be equal to the first duration.
  • the data migration detection on the third physical page can be performed simultaneously with the data migration detection on the first physical page, or can be performed at different times, that is, step 401 and step 405 can be performed simultaneously, or can be performed at different times.
  • step 401 the manager performs data migration detection on the first physical page in the first storage medium and the third physical page in the second storage medium, and no longer executes step 405, and the process shown in steps 402 to 404 is processed in parallel with the process shown in steps 406 to 411 described below.
  • the manager After the manager obtains the access statistics information of the third physical page, the number of accesses of the third physical page in the access statistics is compared with the second migration threshold. If the number of accesses of the third physical page is greater than or equal to the second migration threshold, it means that the third physical page is frequently accessed, and the data stored in the third physical page is hot data.
  • the third physical page is a hot page, then the manager is triggered to migrate the hot data to the first storage medium with high access performance, so that the hot data can be quickly accessed in the first storage medium later.
  • the migration process is shown in steps 406 to 409 below.
  • Step 406 If the second migration detection result meets the second data migration condition, the manager selects a fourth physical page from the first storage medium, where the fourth physical page is a cache of the third physical page in the first storage medium.
  • the second migration detection result satisfies the second data migration condition, which includes any one of the following situations 1 to 3.
  • Case 1 The number of accesses to the third physical page is greater than or equal to the second migration threshold.
  • Case 2 The number of accesses to the third physical page is greater than or equal to the second migration threshold, and the third physical page supports data migration.
  • Case 3 The number of accesses to the third physical page is greater than or equal to the second migration threshold, the third physical page supports data migration, and the third physical page contains data that has been cached by the cached physical page.
  • the manager obtains the number of accesses to the third physical page from the page mapping table, or obtains the number of accesses to the third physical page from the statistical unit. If the obtained number of accesses to the third physical page is greater than or equal to the second migration threshold, the second migration detection result satisfies the second data migration condition.
  • the manager obtains the number of accesses and the migration capability identifier of the third physical page from the page mapping table.
  • the number of accesses of the third physical page is greater than or equal to the second migration threshold, if the migration capability identifier is the first migration capability identifier, it means that the third physical page supports data migration, and the second migration detection result satisfies the second data migration condition.
  • the manager obtains the number of accesses and the migration capability identifier of the third physical page from the page mapping table. If the number of accesses of the third physical page is greater than or equal to the second migration threshold and the migration capability identifier is the first migration capability identifier, the manager determines The fourth physical page associated with the third physical page in the first storage medium can be understood to be a cache physical page associated with the third physical page in the first storage medium. Afterwards, the first page cache state of the fourth physical page is queried from the cache mapping table, and if the query finds that the first page cache state indicates that the cache line in the fourth physical page stores data, then the second migration detection result satisfies the second data migration condition.
  • the first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as memory in the second storage medium, and each cache physical page is used as a cache for the associated physical page. It can be understood that the at least one cache physical page is a cache physical page recorded by a valid cache page table entry in the cache mapping table.
  • the manager determines the cache physical page associated with the third physical page in the at least one cache physical page as the fourth physical page. For example, the manager queries the second cache page table entry including the media address of the third physical page in at least one (valid) cache page table entry in the cache mapping table, and if the second cache page table entry is found, the cache physical page indicated by the media address in the first storage medium recorded in the second cache page table entry is used as the fourth physical page.
  • the manager queries the first page cache status of multiple cache physical pages from the cache mapping table. If the first page cache status of any cache physical page indicates that the cache row in the cache physical page stores data, the cache physical page is taken as the fourth physical page, and the number of times the third physical page is accessed and the migration capability identifier are queried from the page mapping table according to the memory address of the third physical page associated with the fourth physical page in the cache mapping table. If the number of times the third physical page is accessed is greater than or equal to the second migration threshold, and the migration capability identifier is the first migration capability identifier, then the second migration detection result satisfies the second data migration condition.
  • Step 407 The manager queries the third physical page for data that has not been cached to the fourth physical page, and migrates the queried data to the fourth physical page.
  • the manager determines whether there is data in the third physical page that has not been cached to the fourth physical page by querying the cache line status of each cache line in the fourth physical page, and then migrates the uncached data to the fourth physical page.
  • the manager obtains the cache line status of the cache line of the fourth physical page, where the cache line status is used to indicate whether the cache line stores data. If the cache line status indicates that the cache line does not store data, the data in the storage space corresponding to the cache line in the third physical page is migrated to the cache line.
  • the cache line state of the cache line is the first cache line state of the cache line.
  • the manager obtains the first cache line state of each cache line in the fourth physical page from the second cache table entry in the cache mapping table. For any cache line in the fourth physical page, if the first cache line state of any cache line indicates that any cache line does not store data, the manager queries whether the storage space corresponding to the cache line in the third physical page stores data. If data is stored in the storage space, the manager stores the data in the storage space to the any cache line.
  • a data cache request is made to the second storage medium, and the data cache request is used to indicate caching the data in the storage space corresponding to the at least one cache line in the second storage medium.
  • the manager stores the data in the storage space corresponding to any cache line to the any cache line.
  • the second storage medium will not return the data in the storage space corresponding to any cache line to the manager based on the data cache request. At this time, the manager does not store data in any cache line.
  • the manager does not perform step 407 .
  • Step 408 The manager uses the fourth physical page as memory.
  • the manager implements step 408 by converting the state of the fourth physical page, such as the following steps 4081 to 4082.
  • Step 4081 The manager releases the association between the third physical page and the fourth physical page.
  • the fourth mapping relationship between the media address of the third physical page and the media address of the fourth physical page is invalidated.
  • the fourth mapping relationship is used to indicate that the fourth physical page is a cache of the associated third physical page.
  • the association between the third physical page and the fourth physical page is released, and the fourth physical page is not in a cache state.
  • the fourth mapping relationship is stored through the second cache mapping table entry in the cache mapping table, and the method of invalidating the fourth mapping relationship includes changing the valid identifier in the second cache mapping table entry from the first valid identifier to the second valid identifier to indicate that the second cache mapping table entry is invalid, or deleting the second cache mapping table entry in the cache mapping table.
  • Step 4082 The manager converts the cache state of the fourth physical page to a memory state.
  • mapping relationship between the medium address of the third physical page and the second memory address in the hybrid memory system.
  • the relationship is used to indicate that the third physical page is in a memory state
  • the second memory address is used to indicate the location of the third physical page in the memory when it is used as memory. It can be understood that the second memory address is the physical address or virtual address associated with the third physical page in the hybrid memory system.
  • the manager modifies the media address of the third physical page in the third mapping relationship into the media address of the fourth physical page.
  • the manager uses the memory address recorded in the second cache entry and the media address in the second storage medium as the second memory address and the media address associated with the third physical page, respectively. For any of the second memory address and the media address associated with the third physical page, the manager queries the second mapping entry including the any address in the page mapping table, so that the second mapping entry records the second memory address and the media address associated with the third physical page. Therefore, the second mapping entry is used to record the third mapping relationship.
  • the manager modifies the media address of the third physical page in the second mapping entry to the media address of the fourth physical page, and modifies the media attribute identifier of the second storage medium in the second mapping entry to the media attribute identifier of the first storage medium, so that the fourth physical page is associated with the second memory address in the second mapping entry, and the fourth physical page replaces the third physical page and becomes the memory physical page indicated by the second memory address.
  • the manager also modifies the access statistics information of the third physical page in the second mapping entry to the access statistics information of the fourth physical page, and also modifies the migration capability identifier of the third physical page in the second mapping entry to the migration capability identifier of the fourth physical page.
  • the manager does not modify the media address of the first physical page in the third mapping relationship, but deletes the third mapping relationship and establishes a mapping relationship between the second memory address associated with the third physical page and the media address of the fourth physical page.
  • the establishment method of this mapping relationship can refer to the establishment method of the first mapping relationship, which will not be repeated here.
  • Step 409 The manager uses the third physical page as a candidate physical page.
  • the manager deletes the data in the third physical page, making the third physical page an idle physical page, and then records the state of the third physical page as a candidate state to indicate that the third physical page is a candidate physical page.
  • the manager does not delete the data in the third physical page for the time being, and records the state of the third physical page as a candidate state.
  • the third physical page switches from the candidate state to the memory state, when the application writes data to the memory address associated with the third physical page, the data stored in the third physical page is first deleted, and then the data is written to the third physical page, or data is written to the third physical page in an overwrite manner.
  • the state of the third physical page is recorded as a candidate state in, for example, the manager adds the medium address of the third physical page to the candidate list of the second storage medium, such as adding the medium address of the third physical page to the end of the candidate list.
  • the data to be migrated in the storage medium with low access performance is first read, and then the data to be migrated is written to the storage medium with high access performance.
  • the data in the third physical page needs to be migrated to the first storage medium.
  • the fourth physical page associated with the third physical page in the first storage medium is a cache of the third physical page
  • the fourth physical page may cache the data of the third physical page.
  • the manager uses the fourth physical page as memory and the third physical page as a candidate physical page, so that the fourth physical page replaces the third physical page as memory.
  • the manager will at most migrate the data that has not been cached to the fourth physical page of the first storage medium, without migrating all the data in the third physical page, thereby reducing the overhead caused by transmitting data during the data migration process and improving the data migration efficiency.
  • the fourth physical page is used as memory instead of the third physical page to ensure that the memory visible to the application remains unchanged, thereby avoiding a page fault when the application accesses the second memory address previously associated with the third physical page.
  • the manager after the manager obtains the access statistics of the third physical page, it compares the number of accesses of the third physical page in the access statistics with the third migration threshold. If the number of accesses of the third physical page is less than or equal to the third migration threshold, it means that the third physical page is not frequently accessed, and the data stored in the third physical page is cold data.
  • the third physical page is a cold page. To avoid the cold data in the third physical page occupying the cache physical page, the manager is triggered to migrate the cold data in the cache physical page associated with the third physical page to the third physical page. The migration process is shown in steps 410 to 411 below.
  • Step 410 If the second migration detection result meets the third data migration condition, the manager writes the data stored in the fourth physical page into the third physical page.
  • the second migration detection result satisfies the third data migration condition, including that the number of accesses to the third physical page is less than or equal to a third migration threshold, and that the third physical page contains data that has been cached by the cached physical page.
  • the manager obtains the number of accesses to the third physical page from the page mapping table, or obtains the number of accesses to the third physical page from the statistical unit. If the obtained number of accesses to the third physical page is less than or equal to the third migration threshold, the manager queries the cache mapping table for a fourth physical page associated with the third physical page in the first storage medium, and queries the cache mapping table for the fourth physical page. If the query finds that the first page cache state indicates that the cache line in the fourth physical page stores data, the second migration detection result satisfies the third data migration condition, and the manager writes the data stored in the fourth physical page into the third physical page.
  • the manager changes the memory physical page indicated by the media address of the second storage medium recorded in the valid cache page table entry to the third physical page, and changes the memory physical page indicated by the media address of the first storage medium recorded in the valid cache page table entry to the fourth physical page, and obtains the access statistical number of the third physical page from the page mapping table according to the media address or memory address of the second storage medium recorded in the valid cache page table entry, wherein the access statistical number of the third physical page is also the access statistical number of the fourth physical page, and if the access statistical number is less than or equal to the third migration threshold, the second migration detection result satisfies the third data migration condition, triggering the manager to write the data stored in the fourth physical page to the third physical page.
  • the manager writes the data stored in the fourth physical page to the third physical page.
  • the manager generates a first data write request based on the data stored in the fourth physical page, and the first data write request is used to indicate that the data is written to the third physical page.
  • the manager sends the first data write request to the controller of the second storage medium, and the controller writes the data to the third physical page according to the first data write request.
  • Step 411 The manager releases the association between the third physical page and the fourth physical page.
  • this step 411 is similar to 4081, and here, the embodiment of the present application will not repeat step 411.
  • the manager After the association between the third physical page and the fourth physical page is released, the manager adds the medium of the fourth physical page to the cache list of the first storage medium, and the cache list is used to store the cache physical pages in the first storage medium that are in the cache state and have not been used. Afterwards, when there is a demand for caching a memory physical page in the second storage medium to a cache physical page, the manager obtains the media address of an unused cache physical page from the cache list, establishes a mapping relationship between the media address of the cache physical page and the media address of the memory physical page, and uses the cache physical page as the cache of the memory physical page. Afterwards, the manager caches the data in the memory physical page to the cache physical page, and when receiving an access request to the memory physical page, caches the data in the memory physical page to the cache physical page.
  • the manager When the second migration detection result meets the third data migration condition, the manager writes the data stored in the fourth physical page to the third physical page, releases the association between the third physical page and the fourth physical page, and releases the occupation of the fourth physical page by the third physical page, thereby reclaiming the cache space provided by the fourth physical page, so that the fourth physical page can be allocated as a new cache for use by other memory physical pages in the second storage medium.
  • steps 406 to 409 and steps 410 to 411 may also be processed in parallel.
  • the data processing method shown in Figure 4 uses the first physical page as a cache of a candidate physical page in the second storage medium and uses the candidate physical page as a memory physical page in the second storage medium when the first migration detection result of the first physical page in the first storage medium meets the first data migration condition, so that the data in the first physical page becomes the cache data of the memory physical page in the second storage medium, avoiding the data in the first physical page from being written back to the second storage medium later, and also avoiding the written-back data from being migrated to the first storage medium again, thereby simplifying the data migration process, reducing the overhead of reading and writing data back and forth during the data migration process, and improving the data migration efficiency.
  • Figure 4 introduces the process of simplifying the data migration process by converting the state of the memory physical page in the first storage medium.
  • the application may also access the memory physical page in the first storage medium or the second storage medium.
  • Figure 6 the process of the application accessing the memory physical page in the hybrid memory system is introduced as follows.
  • FIG. 6 is a flow chart of a method for accessing a hybrid memory system provided by the present application, and the access method includes the following steps.
  • Step 601 A processor in an electronic device sends an access request to a first target physical page in a hybrid memory system to a manager.
  • the first target physical page is any memory physical page in the first storage medium or the second storage medium.
  • the access request includes a third memory address associated with the first physical target page.
  • the memory address in the page mapping table as the physical address of the memory physical page as an example
  • the application when the processor is running an application, if the application has an access requirement for a virtual address in the hybrid memory system, the application generates an access request including the virtual address, and the processor obtains the physical address corresponding to the virtual address (i.e., the third memory address) by querying the page mapping table, converts the virtual address in the access request into the third memory address, and then sends an access request including the third memory address to the manager.
  • the memory physical page associated with the third memory address is also the first target physical page.
  • the access request may be a data read request or a data write request, wherein the data read request is used to indicate reading the data stored in the memory address, and the data write request is used to indicate writing target data to the memory address.
  • the data write request also includes the target data to be written.
  • Step 602 The manager obtains an access request to a first target physical page in the hybrid memory system.
  • the manager searches the page mapping table for a third mapping table entry including the third memory address in the access request, obtains the media address of the first target physical page from the queried third mapping table entry, and converts the physical address in the access request into the media address. If the third mapping table entry records the number of times the first target physical page has been accessed, the manager will be accessed 1.
  • Step 603 If the first target physical page belongs to the first storage medium, the manager accesses the first target physical page based on the access request.
  • the access request hits the first storage medium.
  • the manager accesses the first target physical page in the first storage medium based on the access request. For example, the manager sends an access request including the media address of the first target physical page to the controller of the first storage medium (referred to as the first controller), and the first controller accesses the first target physical page based on the received access request, and returns the access result of the third memory address to the manager. The manager then returns the access result to the processor.
  • accessing the target physical page refers to data read from the first target physical page
  • the access result includes data read from the first target physical page based on the data read request.
  • accessing the first target physical page refers to writing target data to the first target physical page, and the access result is used to indicate that writing to the first target physical page is completed.
  • Step 604 If the first target physical page belongs to the second storage medium, the manager accesses a second target physical page associated with the first target physical page in the first storage medium based on the access request, where the second target physical page is a cache of the first target physical page.
  • the media attribute identifier in the third mapping table entry is the media attribute identifier of the second storage medium, it means that the first target physical page is a memory physical page in the second storage medium, not a memory physical page in the first storage medium, then the access request hits the second storage medium but not the first storage medium.
  • step 604 is described as follows.
  • the manager accesses the cache physical page in the first storage medium to determine whether the data write request hits the cache physical page in the first storage medium. For example, based on the third memory address or media address of the first target physical, the manager queries the third memory address or media address in the valid cache table entry of the cache mapping table. If the third cache page table entry including the third memory address or media address is queried, then the data write request hits the cache physical page in the first storage medium. For example, the cache physical page indicated by the first storage medium address in the third cache page table entry is the cache physical page hit by the data write request, and the cache physical page is also the second target physical page. If the third cache page table entry cannot be queried, the data write request does not hit the cache physical page in the first storage medium.
  • the manager obtains the media address of the second target physical page from the third cache page table entry, modifies the media address of the first target physical page in the data write request to the media address of the second target physical page, and sends the modified data write request to the first controller.
  • the first controller writes the target data to the second target physical page in the first storage medium according to the received data write request, and returns the access result to the manager, which returns the access result to the processor.
  • the manager updates the first cache line state of any cache line so that the updated first cache line state indicates that there is data in the cache line, and also updates the second cache line state of any cache line so that the updated second cache line state indicates that the data in the cache line is different from the data in the corresponding storage space in the first target physical page. If the first cache line state of any cache line is used to indicate that the cache line stores data, the manager will no longer update the first cache line state. However, since new data is written to the first cache line, the manager will also update the second cache line state of any cache line, so that the updated second cache line state indicates that the data in the cache line is different from the data in the corresponding storage space in the first target physical page.
  • the manager allocates a cache physical page for the first target physical page. For example, the manager obtains a media address in the cache list and establishes a mapping relationship between the media address and the first target physical page in the cache mapping table to indicate that the third target physical page indicated by the media address is the cache of the first target physical page.
  • the manager modifies the media address of the first target physical page in the data write request to the media address of the third target physical page, and the manager sends the modified data write request to the first controller.
  • the first controller writes the target data to the third target physical page in the first storage medium according to the received data write request, and returns the access result to the manager, and the manager returns the access result to the processor.
  • the manager since the target data is new data, if the target data is written to at least one cache line of the third target physical page, for any cache line in the at least one cache line, the manager sets the first cache line state of any cache line to indicate that the cache line stores data, and sets the second cache line state of any cache line to indicate that the data in the cache line is different from the data in the corresponding storage space in the first target physical page.
  • the step 604 is repeated. The following is introduced.
  • the manager accesses the cached physical page in the first storage medium to determine whether the data read request hits the cached physical page in the first storage medium. This process can refer to the process of determining whether the data write request hits the cached physical page above.
  • the manager modifies the media address of the first target physical page in the data read request to the media address of the second target physical page, and sends the modified data read request to the first controller.
  • the first controller reads data from the second target physical page in the first storage medium based on the received data read request, and returns the access result to the manager, which returns the access result to the processor.
  • the manager sends a modified data read request to the controller of the second storage medium (referred to as the second controller), and the second controller reads data from the first target physical page in the second storage medium according to the received data read request, and returns the access result to the manager, and the manager returns the access result to the processor.
  • the manager also allocates a cache physical page to the first target physical page. Assuming that the third target physical page in the first storage medium is allocated to the first target physical page as the cache of the first target physical page, the manager obtains the data read from the first target physical page from the access result, and writes the read data to the third target physical page.
  • the manager sets the first cache line state of any cache line to indicate that the cache line stores data, and sets the second cache line state of any cache line to indicate that the data in the cache line is the same as the data in the corresponding storage space in the first target physical page.
  • the method shown in FIG6 is that after obtaining an access request to a first target physical page in a hybrid memory system, if the first target physical page to be accessed belongs to the first storage medium, the first target physical page is accessed based on the access request, and since the access performance of the first storage medium is higher than that of the second storage medium, the first target physical page in the first storage medium can be quickly accessed. If the first target physical page belongs to the second storage medium, based on the access request, the second target physical page associated with the first target physical page in the first storage medium is accessed, and since the access performance of the first storage medium is higher than that of the second storage medium, the second target physical page in the first storage medium can be quickly accessed.
  • FIG. 7 is a schematic diagram of the structure of a data processing device provided by the present application. As shown in FIG. 7 , the device 700 includes a mapping module 701 , a migration module 702 , a cache management module 703 and a media management module 704 .
  • the mapping module 701 is used to maintain the page mapping table, convert the memory address in the access request sent by the processor into a media address, and the media address is used to indicate the memory physical page to be accessed. If the memory physical page to be accessed is a memory physical page in the first storage medium, the access request is sent to the first storage medium; if the memory physical page to be accessed is a memory physical page in the second storage medium, the access request is sent to the cache management module 703.
  • the mapping module 701 is also used to perform data migration detection on the memory physical pages in the hybrid memory system. If a memory physical page that meets the data migration conditions is detected, the migration module 702 is notified to perform data migration on the memory physical page.
  • the process of the migration module 702 performing data migration on the memory physical page can refer to the data processing method shown in Figure 4.
  • the cache management module 703 is used to maintain the cache mapping table. After receiving an access request, it queries whether the access request hits the cache physical page (i.e., cache) in the first storage medium. If the cache physical page is hit, the medium address in the access request is modified to the medium address of the cache physical page that is hit, and the modified access request is sent to the first storage medium. If the cache physical page is not hit, a new cache physical page is allocated to the memory physical page to be accessed in the second storage medium. If the access request is a data write request, the data is written to the newly allocated cache physical page. If the access request is a data read request, the data is read from the memory physical page to be accessed in the second storage medium, the read data is written to the newly allocated cache physical page, and the read data is returned to the processor by the original path.
  • the cache physical page i.e., cache
  • the medium address in the access request is modified to the medium address of the cache physical page that is hit, and the modified access request is sent to the first storage medium. If the cache
  • the media management module 704 is used to initialize and manage other modules in the device 700, such as initializing the migration period, migration threshold, etc. In some embodiments, the media management module 704 is also used to maintain a candidate list of the second storage medium.
  • the device 700 also includes an access control module 705, and the access control module 705 is used to convert the data format of the received access request so that the data format of the converted access request can meet the requirements of the second storage medium or the controller of the second storage medium, send the converted access request to the second storage medium or the controller of the second storage medium, and return the access result via the original route.
  • the media management module 704 is also used to maintain the NVME queue of the NVME SSD, which is used to store blocking IO (BIO) requests.
  • the access control module 705 converts the access request into a BIO request, adds the BIO request to the NVME queue, notifies the NVME SSD to execute the BIO request in the NVME queue, and then the NVME SSD obtains the BIO request from the NVME queue and returns the access result to the access control module 705 based on the BIO request.
  • the access control module 705 converts the access request into an access command recognizable by the DDR interface and sends the access command to the PCM to read or write data to the PCM.
  • the access request received by the access control module 705 may be an access request sent by the migration module 702 to the second storage medium when performing data migration, or may be an access request sent by the cache management module 703 .
  • FIG8 is a schematic diagram of the structure of a data processing device provided by the present application.
  • the device 800 shown in FIG8 may be a manager or a part of a manager of the hybrid memory system of the previous embodiments, and is used to execute the data processing method executed by the manager.
  • the device 800 is applied to the hybrid memory system, and the hybrid memory system includes a first storage medium and a second storage medium.
  • the access performance of the first storage medium is better than the access performance of the second storage medium.
  • the device 800 includes:
  • An acquisition module 801 is configured to acquire a first migration detection result of a first physical page in the first storage medium, where the first physical page is a physical page used as a memory in the first storage medium;
  • a selection module 802 is configured to select a second physical page from the second storage medium if the first migration detection result satisfies a first data migration condition, where the second physical page is a candidate physical page used as a memory in the second storage medium;
  • the second processing module 804 is configured to use the first physical page as a cache for the second physical page.
  • the device 800 of the embodiment of the present application can be implemented by a CPU, an application-specific integrated circuit (ASIC), or a programmable logic device (PLD), and the above-mentioned PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC) or any combination thereof.
  • the device 800 can also implement the method shown in Figures 4 to 6 by software. When implemented by software, the device 800 and its various modules can also be software modules.
  • the first processing module 803 is used to: convert the candidate state of the second physical page into a memory state, the candidate state is used to indicate that the corresponding physical page is the candidate physical page, and the memory state is used to indicate that the corresponding physical page is used as the memory.
  • a first mapping relationship exists between the medium address of the first physical page and the first memory address in the hybrid memory system, the first mapping relationship is used to indicate that the first physical page is in the memory state, the medium address is used to indicate the position of the corresponding physical page in the storage medium, and the first memory address is used to indicate the position of the first physical page in the memory when the first physical page is used as a memory;
  • the first processing module 803 is used to: delete the media address of the second physical page in the candidate list, where the candidate list is used to store the media addresses of the candidate physical pages in the second storage medium used as the memory; and modify the media address in the first mapping relationship to the media address of the second physical page.
  • the second processing module 804 is used to: convert the memory state of the first physical page into a cache state, associate the second physical page with the first physical page, the memory state is used to indicate that the corresponding physical page is used as the memory, and the cache state is used to indicate that the corresponding physical page is the cache of the associated physical page.
  • the second processing module 804 is used to: invalidate a first mapping relationship between a media address of the first physical page and a first memory address in the hybrid memory system, the first mapping relationship being used to indicate that the first physical page is in the memory state, the media address being used to indicate a location of the corresponding physical page in a corresponding storage medium, and the memory address being used to indicate a location of the corresponding physical page in the memory when the corresponding physical page is used as memory; establish a second mapping relationship between the media address of the first physical page and the media address of the second physical page, the second mapping relationship being used to indicate that the first physical page is a cache of the associated second physical page.
  • the acquisition module 801 is further configured to acquire a second migration detection result of a third physical page in the second storage medium, where the third physical page is a physical page in the second storage medium used as the memory;
  • the selection module 802 is further configured to select a fourth physical page from the first storage medium if the second migration detection result satisfies a second data migration condition, wherein the fourth physical page is a cache of the third physical page in the first storage medium;
  • the first processing module 803 is further configured to use the fourth physical page as the memory;
  • the second processing module 804 is further configured to use the third physical page as the candidate physical page.
  • the first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as the memory in the second storage medium, and each cache physical page is used as a cache of the associated physical page;
  • the selection module 802 is further configured to determine a cache physical page associated with the third physical page in the at least one cache physical page as a fourth physical page.
  • the first processing module 803 is further used to: disassociate the third physical page from the fourth physical page; convert the cache state of the fourth physical page into a memory state, wherein the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page, and the memory state is used to indicate that the corresponding physical page is used as the memory.
  • a third mapping relationship is provided between the medium address of the third physical page and the second memory address in the hybrid memory system, the third mapping relationship is used to indicate that the third physical page is in the memory state, the medium address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, and the memory address is used to indicate the position of the corresponding physical page in the memory when the corresponding physical page is used as a memory;
  • the first processing module 803 is further configured to modify the medium address in the third mapping relationship to the medium address of the fourth physical page.
  • the device 800 further includes:
  • the data migration module is used to query the data in the third physical page that has not been cached to the fourth physical page, and migrate the queried data to the fourth physical page.
  • the data relocation module is used to: obtain a cache line status of the cache line of the fourth physical page, the cache line status being used to indicate whether the cache line stores data; if the cache line status indicates that the cache line does not store data, migrate data in the storage space corresponding to the cache line in the third physical page to the cache line.
  • the device 800 further includes:
  • a writing module configured to write the data stored in the fourth physical page into the third physical page if the second migration detection result satisfies a third data migration condition
  • the releasing module is used to release the association between the third physical page and the fourth physical page.
  • the release module is used to: invalidate a fourth mapping relationship between the media address of the third physical page and the media address of the fourth physical page, where the media address is used to indicate a location of a corresponding physical page in a corresponding storage medium.
  • the apparatus 800 further includes an access module
  • the acquisition module 801 is further used to acquire an access request to a first target physical page in the hybrid memory system
  • the access module is used to: if the first target physical page belongs to the first storage medium, access the first target physical page based on an access request; if the first target physical page belongs to the second storage medium, access the second target physical page associated with the first target physical page in the first storage medium based on the access request, and the second target physical page is a cache of the first target physical page.
  • the device corresponds to the manager in the above-mentioned method embodiment, and the modules in the device and the above-mentioned other operations and/or functions are respectively various steps and methods implemented by the manager in the method embodiment.
  • the specific details can be found in the above-mentioned method embodiment, and for the sake of brevity, they will not be repeated here.
  • any device in the device 700 and the device 800 when the device performs data processing, only the division of the above-mentioned functional modules is used as an example.
  • the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the device provided in the above embodiment and the above method embodiment belong to the same concept, and the specific implementation process is detailed in the above method embodiment, which will not be repeated here.
  • any one of the apparatuses 700 and 800 may be equivalent to the managers 13, 13a and 13b in FIG. 1 to FIG. 3, or equivalent to the execution components in the managers 13, 13a and 13b.
  • FIG9 is a schematic diagram of the structure of a chip provided by the present application.
  • the chip 900 includes a processor 901 and an interface circuit 902, wherein the interface circuit 902 is used to receive instructions and transmit them to the processor 901.
  • the processor 901 for example, can be a specific implementation form of the device 700 or the device 800, and can be used to execute the above-mentioned data processing method.
  • the processor 901 is coupled to the memory 903, and the memory 903 is used to store program code.
  • the chip system composed of the processor 901, the interface circuit 902 and the memory 903 implements the operation steps of the method in any of the method embodiments in FIG4 to FIG6.
  • processor 901 there is at least one processor 901 in the chip system.
  • the processor 901 may be a CPU or other general-purpose processor.
  • the processor 901 may also be one or more integrated circuits for implementing the solution of the present application, such as a digital signal processor (DSP), ASIC, PLD, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc.
  • DSP digital signal processor
  • ASIC application specific integrated circuits
  • PLD programmable logic device
  • PLD programmable logic device
  • discrete gate or transistor logic device discrete hardware component
  • the general-purpose processor may be a microprocessor or any conventional processor, etc.
  • the memory 903 in the chip system may be one or more.
  • the memory 903 may be integrated with the processor 901, or may be separately arranged with the processor 901, which is not limited in this application.
  • the memory 903 may be integrated with the processor 901 on the same chip, as shown in FIG9 , or the memory 903 may be arranged on different chips from the processor 901, and this application does not specifically limit the type of the memory 903 and the arrangement of the memory 903 and the processor 901.
  • the memory 903 may include a read-only memory and a random access memory, and provide instructions and data to the processor 901.
  • the memory 903 may also include a non-volatile random access memory.
  • the memory 903 may also store information about the device type.
  • the memory 903 may also be a volatile memory, or may include both volatile and non-volatile memories.
  • the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory.
  • the volatile memory can be a random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
  • the chip system can be FPGA, ASIC, SoC, CPU, network processor (NP), digital signal processor (DSP), microcontroller unit (MCU), PLD) or other integrated chips.
  • NP network processor
  • DSP digital signal processor
  • MCU microcontroller unit
  • PLD PLD
  • the present application also provides a computer-readable storage medium, such as a memory including a program code, which can be executed by a processor in an electronic device (or chip) to complete the data processing method in the above embodiment.
  • a computer-readable storage medium such as a memory including a program code, which can be executed by a processor in an electronic device (or chip) to complete the data processing method in the above embodiment.
  • the implementation of the computer-readable storage medium can refer to the memory 903 in Figure 9.
  • the present application also provides a computer program product or a computer program, which includes a program code, and the program code is stored in a computer-readable storage medium.
  • a processor reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the chip or electronic device where the processor is located executes the above-mentioned data processing method.
  • the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory so that the chip executes the data processing method in the above-mentioned method embodiments.
  • the devices, equipment, computer-readable storage media, computer program products or chips provided in this application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
  • the above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination.
  • the above embodiments can be implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions.
  • the computer program instructions When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present application of the present invention is generated in whole or in part.
  • the computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device.
  • the computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.).
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets.
  • the available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD) or a semiconductor medium.
  • the semiconductor medium can be a solid state disk (SSD).

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A data processing method and apparatus, and a chip and a computer-readable storage medium. The method is applied to a hybrid memory system, the hybrid memory system comprises a first storage medium and a second storage medium, and the access performance of the first storage medium is superior to the access performance of the second storage medium. The method comprises: acquiring a first migration detection result of a first physical page in a first storage medium, wherein the first physical page is a physical page used as a memory in the first storage medium; if the first migration detection result meets a first data migration condition, selecting a second physical page from a second storage medium, wherein the second physical page is a candidate physical page used as a memory in the second storage medium; using the second physical page as the memory; and using the first physical page as a cache of the second physical page.

Description

数据处理方法、装置、芯片以及计算机可读存储介质Data processing method, device, chip and computer readable storage medium
本申请要求于2022年10月20日提交的申请号为202211289255.5、发明名称为“数据处理方法、装置、芯片以及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese patent application No. 202211289255.5, filed on October 20, 2022, with invention name “Data processing method, device, chip and computer-readable storage medium”, the entire contents of which are incorporated by reference into this application.
技术领域Technical Field
本申请涉及存储技术领域,特别涉及一种数据处理方法、装置、芯片以及计算机可读存储介质。The present application relates to the field of storage technology, and in particular to a data processing method, device, chip and computer-readable storage medium.
背景技术Background technique
随着存储技术的发展,出现了大量不同种类的存储介质,不同种类的存储介质具有不同的访问性能,将多个不同种类的存储介质配置到电子设备,在电子设备中组成混合内存系统。电子设备中的处理器可以将混合内存系统中某种存储介质中的数据迁移至另一种存储介质,以便发挥不同种类的存储介质的优势访问性能。With the development of storage technology, a large number of different types of storage media have emerged. Different types of storage media have different access performances. Multiple different types of storage media are configured in electronic devices to form a hybrid memory system in the electronic devices. The processor in the electronic device can migrate data from a certain storage medium in the hybrid memory system to another storage medium in order to give full play to the advantages of different types of storage media in terms of access performance.
处理器通常先从混合内存系统中的一种存储介质读取待迁移数据,再将读取到的待迁移数据写入混合内存系统中的另一种存储介质。但是,上述数据迁移过程依赖于数据搬运的进度,需要先完成全部待迁移数据的读取处理,才能执行将待迁移数据写入另一种存储介质的操作,增加了数据迁移的时长,降低了数据迁移效率。The processor usually reads the data to be migrated from one storage medium in the hybrid memory system first, and then writes the read data to be migrated to another storage medium in the hybrid memory system. However, the above data migration process depends on the progress of data transfer, and the reading process of all the data to be migrated must be completed before the operation of writing the data to be migrated to another storage medium can be performed, which increases the time of data migration and reduces the efficiency of data migration.
发明内容Summary of the invention
本申请提供了一种数据处理方法、装置、芯片以及计算机可读存储介质,能够提高数据迁移效率。The present application provides a data processing method, device, chip and computer-readable storage medium, which can improve data migration efficiency.
第一方面,提供了一种数据处理方法,此方法应用于混合内存系统,混合内存系统包括第一存储介质和第二存储介质,其中,第一存储介质的访问性能优于第二存储介质的访问性能,此方法包括如下步骤:先获取第一存储介质中作为电子设备的内存使用的第一物理页的第一迁移检测结果;若第一迁移检测结果满足第一数据迁移条件,再从第二存储介质中选择第二物理页,其中,第二物理页为第二存储介质中作为内存使用的候选物理页;之后,将第二物理页作为内存使用,将第一物理页作为第二物理页的缓存。In a first aspect, a data processing method is provided, which is applied to a hybrid memory system, the hybrid memory system comprising a first storage medium and a second storage medium, wherein access performance of the first storage medium is better than access performance of the second storage medium, and the method comprises the following steps: first obtaining a first migration detection result of a first physical page used as memory of an electronic device in the first storage medium; if the first migration detection result satisfies a first data migration condition, then selecting a second physical page from the second storage medium, wherein the second physical page is a candidate physical page used as memory in the second storage medium; thereafter, using the second physical page as memory, and using the first physical page as a cache of the second physical page.
此方法通过在第一物理页的第一迁移检测结果满足第一数据迁移条件的情况下,将第一物理页作为第二存储介质中的候选物理页的缓存,将该候选物理页作为第二存储介质中的内存物理页,使得待第一物理页中的数据变成第二存储介质中内存物理页的缓存数据,避免之后将第一物理页中的数据写回至第二存储介质,也能够避免写回的数据再次迁移至第一存储介质,从而简化了数据迁移流程,减少了数据迁移过程中来回读取和写入数据的开销,提高了数据迁移效率。This method uses the first physical page as a cache of a candidate physical page in the second storage medium when the first migration detection result of the first physical page meets the first data migration condition, and uses the candidate physical page as a memory physical page in the second storage medium, so that the data in the first physical page becomes the cache data of the memory physical page in the second storage medium, avoiding the data in the first physical page from being written back to the second storage medium later, and also avoiding the written-back data from being migrated to the first storage medium again, thereby simplifying the data migration process, reducing the overhead of reading and writing data back and forth during the data migration process, and improving the data migration efficiency.
在一种可能的实现方式中,通过将第二物理页所处的候选状态转换为内存状态,来实现将第二物理页作为内存使用,其中,候选状态用于指示对应物理页作为候选物理页,内存状态用于指示对应物理页作为内存使用。In one possible implementation, the second physical page is used as memory by converting the candidate state of the second physical page into a memory state, wherein the candidate state is used to indicate that the corresponding physical page is a candidate physical page, and the memory state is used to indicate that the corresponding physical page is used as memory.
基于上述可能的实现方式,通过转换第二物理页的状态即可将第二物理页作为内存使用,实现方式简单方便。Based on the possible implementation manner described above, the second physical page can be used as a memory by converting the state of the second physical page, and the implementation manner is simple and convenient.
在另一种可能的实现方式中,第一物理页的介质地址与混合内存系统中的第一内存地址之间具有第一映射关系,第一映射关系用于指示第一物理页处于内存状态,介质地址用于指示对应物理页在所属存储介质中的位置,第一内存地址用于指示第一物理页作为内存使用时在内存的位置,可以理解的是,第一映射关系还用于指示第一内存地址关联的物理页处于内存状态,另外,还通过候选列表记录第二存储介质中处于候选状态的物理页(即候选物理页)的介质地址,基于此,删除候选列表中第二物理页的介质地址,将第一映射关系中的介质地址修改为第二物理页的介质地址,来实现将第二物理页所处的候选状态转换为内存状态。In another possible implementation, there is a first mapping relationship between the media address of the first physical page and the first memory address in the hybrid memory system, the first mapping relationship is used to indicate that the first physical page is in a memory state, the media address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, and the first memory address is used to indicate the position of the first physical page in the memory when it is used as a memory. It can be understood that the first mapping relationship is also used to indicate that the physical page associated with the first memory address is in a memory state. In addition, the media address of the physical page in the candidate state in the second storage medium (i.e., the candidate physical page) is recorded in a candidate list. Based on this, the media address of the second physical page in the candidate list is deleted, and the media address in the first mapping relationship is modified to the media address of the second physical page to realize the conversion of the candidate state of the second physical page into a memory state.
基于上述可能的实现方式,通过第一映射关系记录处于内存状态的第一物理页以及通过候选列表记录候选物理页,进而通过删除候选列表中关于第二物理页的记录以及第一映射关系,即可将第二物理页代替 第一物理页作为内存使用,实现方式简单。Based on the above possible implementation, the first physical page in the memory state is recorded by the first mapping relationship and the candidate physical page is recorded by the candidate list, and then the second physical page can be replaced by the first mapping relationship by deleting the record of the second physical page in the candidate list. The first physical page is used as memory, and the implementation is simple.
在另一种可能的实现方式中,通过将第一物理页所处的内存状态转换为缓存状态,将第二物理页与第一物理页关联,来实现将第一物理页作为第二物理页的缓存。其中,内存状态用于指示对应物理页作为内存使用,缓存状态用于指示对应物理页是关联的物理页的缓存。In another possible implementation, the first physical page is used as a cache of the second physical page by converting the memory state of the first physical page to a cache state and associating the second physical page with the first physical page. The memory state is used to indicate that the corresponding physical page is used as a memory, and the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page.
基于上述可能的实现方式,通过转换第一物理页的状态并建立第一物理页和第二物理页之间的关联,即可将第一物理页作为第二物理页的缓存,实现方式简单。Based on the possible implementation manner, by converting the state of the first physical page and establishing an association between the first physical page and the second physical page, the first physical page can be used as a cache of the second physical page, and the implementation manner is simple.
在另一种可能的实现方式中,上述将第一物理页所处的内存状态转换为缓存状态,将第二物理页与第一物理页关联的实现方式包括:先无效第一物理页的介质地址与混合内存系统中的第一内存地址之间的第一映射关系;再建立第一物理页的介质地址与第二物理页的介质地址之间的第二映射关系,其中,第一映射关系用于指示第一物理页处于内存状态,介质地址用于指示对应物理页在所属存储介质中的位置,内存地址用于指示对应物理作为内存使用时在内存的位置,第二映射关系用于指示第一物理页为关联的第二物理页的缓存。In another possible implementation, the above-mentioned method of converting the memory state of the first physical page into a cache state and associating the second physical page with the first physical page includes: first invalidating the first mapping relationship between the media address of the first physical page and the first memory address in the hybrid memory system; and then establishing a second mapping relationship between the media address of the first physical page and the media address of the second physical page, wherein the first mapping relationship is used to indicate that the first physical page is in a memory state, the media address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, the memory address is used to indicate the position of the corresponding physical page in the memory when it is used as memory, and the second mapping relationship is used to indicate that the first physical page is a cache of the associated second physical page.
基于上述可能的实现方式,通过无效第一映射关系,使得第一物理页不处于内存状态,通过建立第二映射关系,使得第一物理页成为第二物理页的缓存,实现方式简单。Based on the possible implementation manner, by invalidating the first mapping relationship, the first physical page is not in the memory state, and by establishing the second mapping relationship, the first physical page becomes the cache of the second physical page. The implementation manner is simple.
在另一种可能的实现方式中,此方法还包括如下步骤:获取第二存储介质中第三物理页的第二迁移检测结果,若第二迁移检测结果满足第二数据迁移条件,从第一存储介质中选择第四物理页,其中,第三物理页是第二存储介质中作为内存使用的物理页第四物理页是第一存储介质中第三物理页的缓存;之后,再将第四物理页作为内存使用,将第三物理页作为候选物理页。In another possible implementation, the method also includes the following steps: obtaining a second migration detection result of the third physical page in the second storage medium, and if the second migration detection result meets the second data migration condition, selecting a fourth physical page from the first storage medium, wherein the third physical page is a physical page used as memory in the second storage medium and the fourth physical page is a cache of the third physical page in the first storage medium; thereafter, the fourth physical page is used as memory and the third physical page is used as a candidate physical page.
基于上述可能的实现方式,通过将第四物理页作为内存使用,将第三物理页作为候选物理页,使得第四物理页代替第三物理页作为内存使用,之前第四物理页是第三物理页的缓存,第四物理页中可能缓存有第三物理页的数据,如果第四物理页缓存了第三物理页所有的数据,也就无需从第三物理页迁移数据,简化了数据迁移流程,提高了数据迁移效率。Based on the above possible implementation methods, by using the fourth physical page as memory and the third physical page as a candidate physical page, the fourth physical page replaces the third physical page as memory. Previously, the fourth physical page was a cache of the third physical page, and the fourth physical page may cache data of the third physical page. If the fourth physical page caches all the data of the third physical page, there is no need to migrate data from the third physical page, which simplifies the data migration process and improves data migration efficiency.
在另一种可能的实现方式中,第一存储介质包括至少一个缓存物理页,每个缓存物理页与第二存储介质中作为内存使用的一个物理页关联,每个缓存物理页用于作为关联的物理页的缓存,基于此,通过将至少一个缓存物理页中与第三物理页关联的缓存物理页,确定为第四物理页,来实现从第一存储介质中选择第四物理页。In another possible implementation, the first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as memory in the second storage medium, and each cache physical page is used as a cache for the associated physical page. Based on this, the fourth physical page is selected from the first storage medium by determining a cache physical page associated with the third physical page in at least one cache physical page as the fourth physical page.
在另一种可能的实现方式中,通过解除第三物理页与第四物理页之间的关联;将第四物理页所处的缓存状态转换为内存状态,来实现将第四物理页作为内存使用。其中,缓存状态用于指示对应物理页是关联的物理页的缓存,内存状态用于指示对应物理页作为内存使用。In another possible implementation, the fourth physical page is used as memory by disassociating the third physical page from the fourth physical page and converting the cache state of the fourth physical page to a memory state, wherein the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page, and the memory state is used to indicate that the corresponding physical page is used as memory.
基于上述可能的实现方式,通过解除第三物理页与第四物理页之间的关联,使得第四物理页不再是第三物理页的缓存,通过转换第四物理页的状态,使得第四物理页能够作为内存使用,实现方式简单。Based on the above possible implementation method, by releasing the association between the third physical page and the fourth physical page, the fourth physical page is no longer a cache of the third physical page. By converting the state of the fourth physical page, the fourth physical page can be used as memory. The implementation method is simple.
在另一种可能的实现方式中,第三物理页的介质地址与混合内存系统中的第二内存地址之间具有第三映射关系,第三映射关系用于指示第三物理页处于内存状态,介质地址用于指示对应物理页在所属存储介质中的位置,内存地址用于指示对应物理作为内存使用时在内存的位置,基于此,通过将第三映射关系中的介质地址修改为第四物理页的介质地址,来实现将第四物理页所处的缓存状态转换为内存状态包括:In another possible implementation, a third mapping relationship is provided between the media address of the third physical page and the second memory address in the hybrid memory system, the third mapping relationship is used to indicate that the third physical page is in a memory state, the media address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, and the memory address is used to indicate the position of the corresponding physical page in the memory when it is used as a memory. Based on this, by modifying the media address in the third mapping relationship to the media address of the fourth physical page, converting the cache state of the fourth physical page to the memory state includes:
基于上述可能的实现方式,通过修改第三映射关系,即可使得第四物理页处于内存状态,实现方式简单。Based on the possible implementation manner described above, the fourth physical page can be placed in a memory state by modifying the third mapping relationship, and the implementation manner is simple.
在另一种可能的实现方式中,将第四物理页作为内存使用之前,此方法还包括如下步骤:查询第三物理页中还未缓存到第四物理页的数据,将查询到的数据迁移至第四物理页。In another possible implementation, before the fourth physical page is used as memory, the method further includes the following steps: querying the third physical page for data that has not been cached to the fourth physical page, and migrating the queried data to the fourth physical page.
基于上述可能的实现方式,如果第三物理页中存在还未缓存到第四物理页的数据,说明此时第四物理页并没有缓存第三物理页所有的数据,因此,仅将未缓存的数据从第三物理页迁移至第四物理页,而无须迁移第三物理页中的所有数据,从而降低了数据迁移过程中传输数据所带来的开销,提高了数据迁移效率。Based on the above possible implementation methods, if there is data in the third physical page that has not yet been cached to the fourth physical page, it means that the fourth physical page does not cache all the data of the third physical page at this time. Therefore, only the uncached data is migrated from the third physical page to the fourth physical page, and there is no need to migrate all the data in the third physical page, thereby reducing the overhead caused by transmitting data during data migration and improving data migration efficiency.
在另一种可能的实现方式中,通过缓存行状态记录第四物理页的缓存行是否存储数据,基于此,上述查询第三物理页中还未缓存到第四物理页的数据,将查询到的数据迁移至第四物理页的实现过程包括:获取第四物理页的缓存行的缓存行状态,若缓存状态指示缓存行没有存储数据,将第三物理页中与缓存行对应的存储空间的数据迁移至缓存行。In another possible implementation, whether the cache line of the fourth physical page stores data is recorded by the cache line status. Based on this, the above-mentioned query of the data in the third physical page that has not been cached to the fourth physical page and the implementation process of migrating the queried data to the fourth physical page include: obtaining the cache line status of the cache line of the fourth physical page, if the cache status indicates that the cache line does not store data, migrating the data in the storage space corresponding to the cache line in the third physical page to the cache line.
基于上述可能的实现方式,通过获取第四物理页的缓存行状态,即可获悉第三物理页中是否存在还未 缓存的数据,而无需从第三物理页中查询还未缓存的数据,提高了数据迁移效率。Based on the above possible implementation, by obtaining the cache line status of the fourth physical page, it can be known whether there is any cache line in the third physical page that has not been The cached data does not need to be queried from the third physical page for the data that has not been cached, thereby improving the data migration efficiency.
在另一种可能的实现方式中,获取第二存储介质中第三物理页的第二迁移检测结果之后,此方法还包括如下步骤:若第二迁移检测结果满足第三数据迁移条件,将第四物理页所存储的数据写入第三物理页;解除第三物理页与第四物理页之间的关联。In another possible implementation, after obtaining the second migration detection result of the third physical page in the second storage medium, the method also includes the following steps: if the second migration detection result meets the third data migration condition, writing the data stored in the fourth physical page to the third physical page; and releasing the association between the third physical page and the fourth physical page.
基于上述可能的实现方式,能够释放第四物理页的存储空间,以便第四物理页之后可以缓存第二存储介质中其他物理页的数据,以提高其他物理页的访问效率。Based on the possible implementation manner described above, the storage space of the fourth physical page can be released so that the data of other physical pages in the second storage medium can be cached after the fourth physical page to improve the access efficiency of other physical pages.
在另一种可能的实现方式中,通过无效第三物理页的介质地址与第四物理页的介质地址之间的第四映射关系,来实现解除第三物理页与第四物理页之间的关联。其中,介质地址用于指示对应物理页在所属存储介质中的位置。In another possible implementation, the association between the third physical page and the fourth physical page is removed by invalidating a fourth mapping relationship between the media address of the third physical page and the media address of the fourth physical page, wherein the media address is used to indicate the location of the corresponding physical page in the storage medium.
在另一种可能的实现方式中,此方法还包括:获取对混合内存系统中第一目标物理页的访问请求;若第一目标物理页属于第一存储介质,基于访问请求,对第一目标物理页进行访问;若第一目标物理页属于第二存储介质,基于访问请求,对第一存储介质中与第一目标物理页关联的第二目标物理页进行访问,第二目标物理页为第一目标物理页的缓存。In another possible implementation, the method also includes: obtaining an access request for a first target physical page in a hybrid memory system; if the first target physical page belongs to a first storage medium, accessing the first target physical page based on the access request; if the first target physical page belongs to a second storage medium, accessing a second target physical page associated with the first target physical page in the first storage medium based on the access request, the second target physical page being a cache of the first target physical page.
基于上述可能的实现方式,若待访问的第一目标物理页属于第一存储介质,则基于访问请求,对第一目标物理页进行访问,由于第一存储介质访问性能高于第二存储介质,从而在访问第一存储介质中的第一目标物理页时能够快速访问。若第一目标物理页属于第二存储介质,基于访问请求,对第一存储介质中与第一目标物理页关联的第二目标物理页进行访问,由于第一存储介质访问性能高于第二存储介质,从而在访问第一存储介质中的第二目标物理页时能够快速访问。Based on the above possible implementations, if the first target physical page to be accessed belongs to the first storage medium, then based on the access request, the first target physical page is accessed, and since the access performance of the first storage medium is higher than that of the second storage medium, the first target physical page in the first storage medium can be quickly accessed. If the first target physical page belongs to the second storage medium, then based on the access request, the second target physical page associated with the first target physical page in the first storage medium is accessed, and since the access performance of the first storage medium is higher than that of the second storage medium, the second target physical page in the first storage medium can be quickly accessed.
第二方面,提供了一种数据处理装置,该装置包括用于执行第一方面或第一方面任一种可能实现方式中的数据处理方法的各个模块。In a second aspect, a data processing device is provided, which includes modules for executing the data processing method in the first aspect or any possible implementation of the first aspect.
第三方面,提供一种芯片,该芯片用于实现如第一方面或第一方面任一种可能实现方式中的数据处理方法的操作步骤。In a third aspect, a chip is provided, wherein the chip is used to implement the operating steps of the data processing method in the first aspect or any possible implementation of the first aspect.
第四方面,提供一种计算机可读存储介质,该存储介质中存储有至少一条程序代码,该程序代码由处理器读取以使芯片执行如上述数据处理方法的操作步骤。In a fourth aspect, a computer-readable storage medium is provided, wherein at least one program code is stored in the storage medium, and the program code is read by a processor to enable a chip to execute the operation steps of the above-mentioned data processing method.
第五方面,提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括程序代码,该程序代码存储在计算机可读存储介质中,芯片的处理器从计算机可读存储介质读取该程序代码,处理器执行该程序代码,使得该芯片执行上述第一方面或者第一方面的各种可选实现方式中提供的方法。In a fifth aspect, a computer program product or a computer program is provided, which includes a program code, and the program code is stored in a computer-readable storage medium. The processor of the chip reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the chip executes the method provided in the above-mentioned first aspect or various optional implementations of the first aspect.
本申请在上述各方面提供的实现方式的基础上,还可以进行进一步组合以提供更多实现方式。Based on the implementations provided in the above aspects, this application can also be further combined to provide more implementations.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1是本申请提供的一种应用数据处理方法的混合内存系统示意图;FIG1 is a schematic diagram of a hybrid memory system for applying a data processing method provided by the present application;
图2是本申请提供的一种应用混合内存系统1A的电子设备的结构图;FIG2 is a structural diagram of an electronic device using a hybrid memory system 1A provided by the present application;
图3是本申请提供的一种应用混合内存系统1B的电子设备的结构图;FIG3 is a structural diagram of an electronic device using a hybrid memory system 1B provided by the present application;
图4是本申请提供的一种数据处理方法的流程图;FIG4 is a flow chart of a data processing method provided by the present application;
图5是本申请提供的一种数据迁移检测的流程图;FIG5 is a flow chart of a data migration detection provided by the present application;
图6是本申请提供的一种混合内存系统的访问方法的流程图;FIG6 is a flow chart of a method for accessing a hybrid memory system provided by the present application;
图7是本申请提供的一种数据处理装置结构示意图;FIG7 is a schematic diagram of the structure of a data processing device provided by the present application;
图8是本申请提供的另一种数据处理装置的结构示意图;FIG8 is a schematic diagram of the structure of another data processing device provided by the present application;
图9是本申请提供的一种芯片的结构示意图。FIG. 9 is a schematic diagram of the structure of a chip provided in the present application.
具体实施方式Detailed ways
为了提高数据迁移的效率,本申请提供一种应用于混合内存系统的数据处理方法,混合内存系统包括具有不同访问性能的两种存储介质(如第一存储介质和第二存储介质),在第一存储介质中的某一内存物理页(即作为内存使用的物理页)满足数据迁移条件时,该内存物理页为待向第二存储介质迁移数据的物理页(即待迁移物理页),该方法通过将该待迁移物理页不再作为内存物理页,而是作为第二存储介质中某一候选物理页的缓存,将该候选物理页作为第二存储介质中的内存物理页,使得待迁移物理页中的数据变成第二存储介质中的内存物理页的缓存数据,跳过了将待迁移物理页中的数据迁移至第二存储介质的处理 过程,简化了数据迁移流程,从而提高了数据迁移效率。In order to improve the efficiency of data migration, the present application provides a data processing method applied to a hybrid memory system. The hybrid memory system includes two storage media (such as a first storage medium and a second storage medium) with different access performances. When a memory physical page in the first storage medium (that is, a physical page used as a memory) meets the data migration condition, the memory physical page is the physical page of data to be migrated to the second storage medium (that is, the physical page to be migrated). The method uses the physical page to be migrated as a cache of a candidate physical page in the second storage medium instead of a memory physical page, and uses the candidate physical page as a memory physical page in the second storage medium, so that the data in the physical page to be migrated becomes the cache data of the memory physical page in the second storage medium, and skips the process of migrating the data in the physical page to be migrated to the second storage medium. The process simplifies the data migration process, thereby improving the efficiency of data migration.
下面将结合附图对应用该数据处理方法的混合内存系统作进一步地详细描述。The hybrid memory system to which the data processing method is applied will be described in further detail below in conjunction with the accompanying drawings.
图1是本申请提供的一种应用数据处理方法的混合内存系统示意图,如图1所示,混合内存系统100包括多种存储介质11和控制器12、以及管理器13。如图1所示,多种存储介质11包括高速带宽内存(high bandwidth memory,HBM)111、固态硬盘(solid state Disk,SSD)112和双倍速率同步动态随机存储器(double data Rate SDRAM,DDR)113,每种存储介质11对应一个控制器12,如图1所示,HBM111对应的控制器12为HBM控制器121、SSD112对应的控制器12为SSD控制器122,DDR对应的控制器12为DDR控制器123,控制器12用于控制其管理的存储介质11对外进行数据交换。FIG1 is a schematic diagram of a hybrid memory system for applying a data processing method provided by the present application. As shown in FIG1 , the hybrid memory system 100 includes a plurality of storage media 11, a controller 12, and a manager 13. As shown in FIG1 , the plurality of storage media 11 include a high bandwidth memory (HBM) 111, a solid state disk (SSD) 112, and a double data rate synchronous dynamic random access memory (DDR) 113. Each storage medium 11 corresponds to a controller 12. As shown in FIG1 , the controller 12 corresponding to HBM 111 is an HBM controller 121, the controller 12 corresponding to SSD 112 is an SSD controller 122, and the controller 12 corresponding to DDR is a DDR controller 123. The controller 12 is used to control the storage medium 11 managed by it to exchange data with the outside.
多种存储介质11用于存储数据(如计算机程序代码或者业务数据),且支持应用程序访问,多种存储介质11的访问性能不同,其中,访问性能是指影响存储介质处理访问请求的性能,例如存储介质的访问时延或者访问带宽,其中,访问请求用于指示访问存储介质,访问时延是存储介质处理访问请求的平均时间,访问带宽为存储介质接收访问请求或者返回访问请求的访问结果时所使用的带宽。Multiple storage media 11 are used to store data (such as computer program code or business data) and support application access. The access performance of the multiple storage media 11 is different, where access performance refers to the performance that affects the storage medium in processing access requests, such as the access delay or access bandwidth of the storage medium, where the access request is used to indicate access to the storage medium, the access delay is the average time it takes for the storage medium to process the access request, and the access bandwidth is the bandwidth used when the storage medium receives the access request or returns the access result of the access request.
多个存储介质11的类型除了包括图1所示的HBM、SSD或者DDR以外,还可以包括其他能够作为内存使用的存储介质,例如,相变存储器(phase change memory,PCM)、磁性随机存储器(magnetic random access memory,MRAM)、静态随机存取存储器(static random-access memory,SRAM)。In addition to the HBM, SSD or DDR shown in Figure 1, the types of multiple storage media 11 may also include other storage media that can be used as memory, such as phase change memory (PCM), magnetic random access memory (MRAM), and static random access memory (SRAM).
应当理解的是,本申请所涉及的混合内存系统100包括两种或两种以上类型的存储介质,但对于存储介质的类型和每种类型的存储介质的数量不做限定,例如,混合内存系统100也可以包括3种以上的存储介质以及每种存储介质的控制器。此外,作为一种可能的实现方式,除了如图1所示每种存储介质均对应各自关联的控制器外,也可以由一类或一个控制器统一管理上述多种类的存储介质。为了便于描述,以下实施例以图1所示的存储介质11包括HBM111、SSD112以及DDR113为例进行说明。It should be understood that the hybrid memory system 100 involved in the present application includes two or more types of storage media, but there is no limitation on the type of storage media and the number of each type of storage media. For example, the hybrid memory system 100 may also include more than three types of storage media and controllers for each type of storage media. In addition, as a possible implementation method, in addition to each storage medium corresponding to its own associated controller as shown in FIG1, the above-mentioned multiple types of storage media may also be uniformly managed by one class or one controller. For ease of description, the following embodiment is described by taking the storage medium 11 shown in FIG1 as including HBM111, SSD112 and DDR113 as an example.
管理器13与多种存储介质11的控制器12连接,管理器13作为混合内存系统100中各个控制器12的上一级控制器,通过执行本申请提出的数据处理方法,在多种存储介质12之间实现数据迁移,以使得多种存储介质12能够发挥出各自访问性能的优势。可选地,管理器13还可以作为混合内存系统100对外通信的接口,用于接收来自混合内存系统100之外的用于访问存储介质12的访问请求,基于访问请求对外返回访问结果。The manager 13 is connected to the controllers 12 of the various storage media 11. The manager 13, as the upper-level controller of each controller 12 in the hybrid memory system 100, implements data migration between the various storage media 12 by executing the data processing method proposed in this application, so that the various storage media 12 can play the advantages of their respective access performance. Optionally, the manager 13 can also serve as an interface for the hybrid memory system 100 to communicate with the outside, for receiving access requests for accessing the storage medium 12 from outside the hybrid memory system 100, and returning access results to the outside based on the access requests.
管理器13通过软件实现、硬件实现或者软硬件结合的方式实现。管理器13作为软件功能单元的一种举例,管理器13包括运行在计算实例上的代码。其中,计算实例包括虚拟机、容器中的至少一种。进一步地,上述计算实例可以是一台或者多台。例如,管理器13包括运行在多个虚拟机/容器上的代码。另外,用于运行该代码的多个虚拟机/容器可能分布在相同的区域(region)中,也可能分布在不同的region中。进一步地,用于运行该代码的多个虚拟机/容器可能分布在相同的可用区(availability zone,AZ)中,也可能分布在不同的AZ中,每个AZ包括一个数据中心或多个地理位置相近的数据中心。其中,通常一个region可以包括多个AZ。The manager 13 is implemented by software, hardware, or a combination of software and hardware. As an example of a software functional unit, the manager 13 includes code running on a computing instance. The computing instance includes at least one of a virtual machine and a container. Furthermore, the computing instance may be one or more. For example, the manager 13 includes code running on multiple virtual machines/containers. In addition, the multiple virtual machines/containers used to run the code may be distributed in the same region or in different regions. Furthermore, the multiple virtual machines/containers used to run the code may be distributed in the same availability zone (AZ) or in different AZs, each AZ including one data center or multiple data centers with close geographical locations. Generally, a region may include multiple AZs.
当采用运行在计算实例上的代码实现管理器13时,用于运行该代码的多个虚拟机/容器可以分布在同一个虚拟私有云(virtual private cloud,VPC)中,也可以分布在多个VPC中。其中,通常一个VPC设置在一个region内,同一region内两个VPC之间,以及不同region的VPC之间跨区通信需在每个VPC内设置通信网关,经通信网关实现VPC之间的互连。When the code implementation manager 13 running on the computing instance is adopted, multiple virtual machines/containers for running the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Among them, usually one VPC is set in one region, and the cross-region communication between two VPCs in the same region and between VPCs in different regions requires the setting of a communication gateway in each VPC, and the interconnection between VPCs is realized through the communication gateway.
管理器13作为硬件功能单元的一种举例,管理器13可能是利用专用集成电路(application-specific integrated circuit,ASIC)实现或可编程逻辑器件(programmable logic device,PLD)实现的设备等。其中,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD)、现场可编程门阵列(field-programmable gate array,FPGA)、通用阵列逻辑(generic array logic,GAL)、数据处理单元(data processing unit,DPU)、片上系统(system on chip,SoC)或其任意组合实现。As an example of a hardware functional unit, the manager 13 may be a device implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC) or any combination thereof.
在一些实施例中,混合内存系统100应用于电子设备,该电子设备可能是服务器,也可能是终端设备,其中,服务器例如云服务器、中心服务器、边缘服务器、远端数据中心中的远端服务器或本地数据中心中的本地服务器等。终端设备例如台式机、笔记本电脑或者智能手机等。In some embodiments, the hybrid memory system 100 is applied to an electronic device, which may be a server or a terminal device, wherein the server is, for example, a cloud server, a central server, an edge server, a remote server in a remote data center, or a local server in a local data center, etc. The terminal device is, for example, a desktop computer, a laptop computer, or a smart phone, etc.
当混合内存系统100应用于电子设备时,存储介质11可能是电子设备内部的片上存储器(memory on chip),也可能是电子设备中处理器外挂的存储器,也可能是电子设备通过串行总线扩展的存储设备中的存储介质。其中,串行总线例如高速串行计算机扩展总线标准(peripheral component interconnect express,PCIE) 总线、计算机高速链接(compute express link,CXL)总线、加速器的缓存一致互联协议(cache coherent interconnect for accelerators,CCIX)总线、统一总线(unified bus,UB或Ubus)等实现设备间互联的总线,在此,本申请实施例对混合内存系统100中存储介质11在电子设备中的位置不做限定。When the hybrid memory system 100 is applied to an electronic device, the storage medium 11 may be an on-chip memory inside the electronic device, or a memory external to a processor in the electronic device, or a storage medium in a storage device extended by the electronic device through a serial bus. The serial bus is, for example, a high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIE). The bus may be a computer express link (CXL) bus, a cache coherent interconnect for accelerators (CCIX) bus, a unified bus (UB or Ubus), or the like, which is used to interconnect devices. Here, the embodiment of the present application does not limit the location of the storage medium 11 in the electronic device in the hybrid memory system 100.
为了进一步说明混合内存系统100的存储介质在电子设备中的位置,下面以混合内存系统100为混合内存系统1A为例,结合图2所示的电子设备200进行介绍,其中,图2是本申请提供的一种应用混合内存系统1A的电子设备的结构图,参见图2,电子设备200包括混合内存系统1A、处理器201以及缓存(cache)202,电子设备200还通过PCIE/CXL/CCIX总线连接存储设备203。In order to further illustrate the position of the storage medium of the hybrid memory system 100 in the electronic device, the hybrid memory system 100 is taken as a hybrid memory system 1A as an example, and is introduced in combination with the electronic device 200 shown in Figure 2, wherein Figure 2 is a structural diagram of an electronic device provided by the present application that applies the hybrid memory system 1A. Referring to Figure 2, the electronic device 200 includes a hybrid memory system 1A, a processor 201, and a cache 202. The electronic device 200 is also connected to a storage device 203 via a PCIE/CXL/CCIX bus.
如图2所示,混合内存系统1A中的存储介质11分别为存储介质11a至存储介质11d,存储介质11a至11d的控制器分别为控制器12a、12b、12c以及12d。其中,存储介质11a为处理器201片上集成的存储器等。存储介质11b为处理器201外挂存储器,例如电子设备200的计算机主板上插入的存储器。存储介质11c和存储介质11d为存储设备203中存储器,且存储介质11c的控制器12c以及存储介质11d的控制器12d也位于存储设备230中。在另一些实施例中,处理器201片上也可能集成多种存储介质加入到混合内存系统1A中,处理器201也可能外挂多种存储介质加入到混合内存系统1A中,存储设备203中也可能有2种以上的存储介质加入到混合内存系统1A中。应当理解的是,对电子设备200的计算机主板(包括处理器20外挂的存储介质)、处理器201的片上以及电子设备200外接的存储设备这三种位置,混合内存系统1A可能包括这三种位置中至少一种位置上的存储介质。As shown in FIG. 2 , the storage media 11 in the hybrid memory system 1A are storage media 11a to storage media 11d, and the controllers of the storage media 11a to 11d are controllers 12a, 12b, 12c, and 12d, respectively. Among them, the storage medium 11a is a memory integrated on the processor 201 chip, etc. The storage medium 11b is an external memory of the processor 201, such as a memory inserted on the computer motherboard of the electronic device 200. The storage medium 11c and the storage medium 11d are memories in the storage device 203, and the controller 12c of the storage medium 11c and the controller 12d of the storage medium 11d are also located in the storage device 230. In other embodiments, the processor 201 may also integrate multiple storage media on the chip and add them to the hybrid memory system 1A, the processor 201 may also add multiple storage media externally to the hybrid memory system 1A, and the storage device 203 may also have more than two storage media added to the hybrid memory system 1A. It should be understood that for the three locations of the computer mainboard of the electronic device 200 (including the storage medium external to the processor 20), on the chip of the processor 201, and the storage device external to the electronic device 200, the hybrid memory system 1A may include storage media in at least one of these three locations.
处理器201还包括至少一个处理器核心211,处理器核心211通过缓存102连接混合内存系统1A的管理器13a,以便处理器核心211对混合内存系统1A中任一存储介质的访问请求,能够下发至管理器11a,由管理器13a基于接收到访问请求,向处理器201返回访问结果。此时,管理器13a集成在缓存202和各个控制器之间的主机内存桥片(host memory bridge)中。或者,管理器13a作为一个单独的芯片,连接主机内存桥片和各个控制器。The processor 201 also includes at least one processor core 211, and the processor core 211 is connected to the manager 13a of the hybrid memory system 1A through the cache 102, so that the access request of the processor core 211 to any storage medium in the hybrid memory system 1A can be sent to the manager 11a, and the manager 13a returns the access result to the processor 201 based on the received access request. At this time, the manager 13a is integrated in the host memory bridge between the cache 202 and each controller. Alternatively, the manager 13a is used as a separate chip to connect the host memory bridge and each controller.
在另一些实施例中,混合内存系统100中的存储介质仅由电子设备通过串行总线扩展的存储设备中的存储介质组成。下面以混合内存系统100为混合内存系统1B为例,结合图3所示的电子设备300进行介绍。In other embodiments, the storage medium in the hybrid memory system 100 is only composed of the storage medium in the storage device extended by the electronic device through the serial bus. The hybrid memory system 100 is taken as an example as follows, and is introduced in conjunction with the electronic device 300 shown in FIG.
图3是本申请提供的一种应用混合内存系统1B的电子设备的结构图,参见图3,电子设备300包括处理器301、缓存(cache)302、至少一个存储介质303以及每个存储介质303的控制器304,电子设备300通过PCIE/CXL/CCIX总线连接存储设备305,存储设备305包括混合内存系统1B,混合内存系统1B包括管理器13b、存储介质11e、存储介质11e的控制器12e、存储介质11f以及存储介质11的控制器12f,控制器12e和12f均与管理器13b连接。其中,图3是混合内存系统13b包括两种存储介质为例示出的,在一些实施例中,混合内存系统13b包括2种以上的存储介质,在此,本申请实施例对混合内存系统13b中存储介质11的种类不做限定。FIG3 is a structural diagram of an electronic device using a hybrid memory system 1B provided by the present application. Referring to FIG3 , the electronic device 300 includes a processor 301, a cache 302, at least one storage medium 303, and a controller 304 for each storage medium 303. The electronic device 300 is connected to a storage device 305 via a PCIE/CXL/CCIX bus. The storage device 305 includes a hybrid memory system 1B. The hybrid memory system 1B includes a manager 13b, a storage medium 11e, a controller 12e of the storage medium 11e, a storage medium 11f, and a controller 12f of the storage medium 11. The controllers 12e and 12f are both connected to the manager 13b. FIG3 is an example in which the hybrid memory system 13b includes two storage media. In some embodiments, the hybrid memory system 13b includes more than two storage media. Here, the embodiment of the present application does not limit the type of the storage medium 11 in the hybrid memory system 13b.
可以理解的是,图3所示的混合内存系统13b为混合内存系统100的一种示例,管理器13b为管理器13的一种示例,若管理器13b作为硬件功能单元,和图2不同的是,在图3所示的实施例中,管理器13b位于电子设备所连接的存储设备中,而图2所示的管理器13a位于在电子设备中。It can be understood that the hybrid memory system 13b shown in Figure 3 is an example of the hybrid memory system 100, and the manager 13b is an example of the manager 13. If the manager 13b is used as a hardware functional unit, unlike Figure 2, in the embodiment shown in Figure 3, the manager 13b is located in the storage device connected to the electronic device, while the manager 13a shown in Figure 2 is located in the electronic device.
另外,图2和图3都是以电子设备包括缓存为例示出的,再另一些实施例中,应用混合内存系统的电子设备的处理器与各种存储介质之间不存在缓存,此时,应用混合内存系统的管理器13连接电子设备中处理器和各个存储介质的控制器。In addition, Figures 2 and 3 are both illustrated using the example of an electronic device including a cache. In other embodiments, there is no cache between the processor of the electronic device that uses the hybrid memory system and various storage media. In this case, the manager 13 of the hybrid memory system connects the processor in the electronic device and the controllers of each storage medium.
对于图2所示的处理器201以及图3所示的处理器301中的任一处理器,该处理器可以采用专用集成电路(application-specific integrated circuit,ASIC)、数字信号处理(digital signal processing,DSP)、现场可编程门阵列(field-programmable gate array,FPGA)、可编程逻辑阵列(programmable logic array,PLA)中的至少一种硬件形式来实现,当然,该处理器也可以有其他的硬件实现方式,对此本申请不做限定。处理器例如中央处理器(central processing unit,CPU),在一些实施例中,处理器还可以利用图像处理器(graphics processing unit,GPU)或数据处理单元(data processing unit,DPU)实现,GPU用于负责显示屏所需要显示的内容的渲染和绘制。在一些实施例中,该处理器还包括人工智能(artificial intelligence,AI)处理器,AI处理器用于处理有关机器学习的计算操作。For any processor in the processor 201 shown in FIG2 and the processor 301 shown in FIG3, the processor can be implemented in at least one hardware form of application-specific integrated circuit (ASIC), digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). Of course, the processor can also have other hardware implementations, which are not limited in this application. The processor is, for example, a central processing unit (CPU). In some embodiments, the processor can also be implemented using a graphics processing unit (GPU) or a data processing unit (DPU). The GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor also includes an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
接下来,基于上述介绍混合内存系统,对本申请提供的数据处理方法作如下介绍:Next, based on the above introduction of the hybrid memory system, the data processing method provided by this application is introduced as follows:
图4是本申请提供的一种数据处理方法的流程图,该数据处理方法应用于混合内存系统,该混合内存 系统包括第一存储介质和第二存储介质,其中,混合内存系统为上文介绍的任一种混合内存系统,第一存储介质和第二存储介质为混合内存系统中同一访问性能不同的任意两种存储介质。该第一存储介质的访问性能优于第二存储介质的访问性能,例如,第一存储介质的访问时延低于第二存储介质的访问时延,或者第一存储介质的访问带宽高于第二存储介质的访问带宽。FIG. 4 is a flow chart of a data processing method provided by the present application. The data processing method is applied to a hybrid memory system. The system includes a first storage medium and a second storage medium, wherein the hybrid memory system is any of the hybrid memory systems described above, and the first storage medium and the second storage medium are any two storage media with different access performances in the hybrid memory system. The access performance of the first storage medium is better than the access performance of the second storage medium, for example, the access latency of the first storage medium is lower than the access latency of the second storage medium, or the access bandwidth of the first storage medium is higher than the access bandwidth of the second storage medium.
对于第一存储介质和第二存储介质中的任一存储介质包括多个物理页(page),物理页用于存储数据,物理页为数据迁移的基本单位。其中,第一存储介质中的物理页分为内存物理页和缓存物理页,第一存储介质中内存物理页的个数一般会多于缓存物理页的个数。第二存储介质中的物理页分为内存物理页和候选物理页,第二存储介质中内存物理页的个数多于候选物理页的个数。第一存储介质和第二存储介质中的内存物理页作为混合内存系统所在电子设备的内存使用,例如,在初始化时,混合内存系统的管理器对混合内存系统中多种存储介质的内存物理页进行统一编址,得到各个内存物理页的物理地址,以将混合内存系统中的内存物理页组织成对处理器可见的内存。每个内存物理页的物理地址用于指示该内存物理页在该内存中的位置。该物理地址为该内存物理页在该混合内存系统中的页框号。另外,为了便于应用程序访问,管理器还为该内存中的各个内存物理页分别分配一个虚拟地址,应用程序能够感知该虚拟地址,应用程序通过虚拟地址对内存物理页进行访问,可以理解的是,内存用于为应用程序可见的存储空间,该内存也称为应用程序的可见内存。Any storage medium in the first storage medium and the second storage medium includes a plurality of physical pages, and the physical page is used to store data, and the physical page is the basic unit of data migration. Among them, the physical pages in the first storage medium are divided into memory physical pages and cache physical pages, and the number of memory physical pages in the first storage medium is generally greater than the number of cache physical pages. The physical pages in the second storage medium are divided into memory physical pages and candidate physical pages, and the number of memory physical pages in the second storage medium is greater than the number of candidate physical pages. The memory physical pages in the first storage medium and the second storage medium are used as the memory of the electronic device where the hybrid memory system is located. For example, during initialization, the manager of the hybrid memory system uniformly addresses the memory physical pages of multiple storage media in the hybrid memory system, and obtains the physical addresses of each memory physical page, so as to organize the memory physical pages in the hybrid memory system into memory visible to the processor. The physical address of each memory physical page is used to indicate the location of the memory physical page in the memory. The physical address is the page frame number of the memory physical page in the hybrid memory system. In addition, to facilitate application access, the manager also assigns a virtual address to each physical memory page in the memory. The application can perceive the virtual address and access the physical memory page through the virtual address. It can be understood that the memory is used as a storage space visible to the application, and this memory is also called the visible memory of the application.
第一存储介质中的缓存物理页用于组成第二存储介质的缓存空间,该缓存空间用于缓存第二存储介质中的数据。例如,缓存物理页作为第二存储介质中的内存物理页的缓存,以缓存第二存储介质中该内存物理页的数据。当有应用程序访问第二存储介质中的内存物理页时,可以优先访问第一存储介质中的缓存物理页,在缓存物理页中没有缓存到该内存物理页的数据的情况下,再访问该内存物理页,或者等待该内存物理页中的数据缓存到缓存物理页后,再访问缓存物理页。The cache physical pages in the first storage medium are used to form a cache space of the second storage medium, and the cache space is used to cache data in the second storage medium. For example, the cache physical page serves as a cache of the memory physical page in the second storage medium to cache the data of the memory physical page in the second storage medium. When an application accesses the memory physical page in the second storage medium, the cache physical page in the first storage medium can be accessed first, and if there is no data cached in the cache physical page, the memory physical page can be accessed, or the cache physical page can be accessed after the data in the memory physical page is cached in the cache physical page.
第二存储介质中的候选物理页为第二存储介质中候选的作为内存使用的物理页,或者,候选物理页也可以理解为第二存储介质中待加入内存的物理页。候选物理页中没有存储数据,候选物理页为空闲的物理页。The candidate physical page in the second storage medium is a candidate physical page in the second storage medium for use as memory, or the candidate physical page can also be understood as a physical page in the second storage medium to be added to the memory. No data is stored in the candidate physical page, and the candidate physical page is an idle physical page.
为区分内存物理页、缓存物理页以及候选物理页,管理器将内存物理页的状态记录为内存状态,将缓存物理页的状态记录缓存状态,将候选物理页的状态记录为候选状态,其中,内存状态用于指示对应物理页作为内存使用,也即是指示对应物理页作为内存物理页。缓存状态用于指示对应物理页是关联的物理页的缓存,对应物理页关联的物理页为第二存储介质中的内存物理页。候选状态用于指示对应物理页作为候选物理页。In order to distinguish between memory physical pages, cache physical pages and candidate physical pages, the manager records the status of the memory physical page as the memory status, the status of the cache physical page as the cache status, and the status of the candidate physical page as the candidate status, wherein the memory status is used to indicate that the corresponding physical page is used as memory, that is, to indicate that the corresponding physical page is a memory physical page. The cache status is used to indicate that the corresponding physical page is a cache of an associated physical page, and the physical page associated with the corresponding physical page is a memory physical page in the second storage medium. The candidate status is used to indicate that the corresponding physical page is a candidate physical page.
如图4所示,本申请提供的数据处理方法由该混合内存系统中的管理器来执行,该管理器通过切换混合内存系统中的物理页的使用方式,在第一存储介质和第二存储介质之间进行数据迁移,该数据处理方法包括如下步骤。As shown in Figure 4, the data processing method provided in the present application is executed by a manager in the hybrid memory system. The manager migrates data between the first storage medium and the second storage medium by switching the usage of physical pages in the hybrid memory system. The data processing method includes the following steps.
步骤401、管理器获取第一存储介质中第一物理页的第一迁移检测结果。Step 401: The manager obtains a first migration detection result of a first physical page in a first storage medium.
其中,第一物理页是第一存储介质中作为内存使用的物理页,可以理解的是,该第一物理页为第一存储介质中的任一内存物理页。该第一迁移检测结果用于指示第一物理页的被访问次数。在一些实施例中,该第一迁移检测结果还用于指示第一物理页是否支持数据迁移。The first physical page is a physical page used as memory in the first storage medium. It can be understood that the first physical page is any memory physical page in the first storage medium. The first migration detection result is used to indicate the number of times the first physical page has been accessed. In some embodiments, the first migration detection result is also used to indicate whether the first physical page supports data migration.
在一种可能的实现方式中,管理器对第一存储介质中的第一物理页进行数据迁移检测,得到该第一迁移检测结果,之后,再根据该第一迁移检测结果确定第一物理页是否为待参与数据迁移的内存物理页。In a possible implementation, the manager performs a data migration test on the first physical page in the first storage medium to obtain the first migration test result, and then determines whether the first physical page is a memory physical page to be involved in data migration based on the first migration test result.
示例性地,管理器通过周期性地获取第一物理页的访问统计信息,以对第一物理页进行数据迁移检测,其中,访问统计信息包括对应物理页在一段时间内的被访问次数。例如,图5所示的本申请提供的一种数据迁移检测的流程图,图5所示的数据迁移检测过程包括下述步骤。Exemplarily, the manager periodically obtains access statistics of the first physical page to perform data migration detection on the first physical page, wherein the access statistics include the number of times the corresponding physical page is accessed within a period of time. For example, FIG5 is a flowchart of a data migration detection provided by the present application, and the data migration detection process shown in FIG5 includes the following steps.
步骤4011、管理器对混合内存系统中的各个内存物理页的被访问次数进行计数。Step 4011: The manager counts the number of times each physical memory page in the hybrid memory system is accessed.
示例性地,管理器建立第一存储介质和第二存储介质中的各个内存物理页与访问统计信息之间的映射关系。初始时,各个内存物理页的访问统计信息中的被访问次数为0,处理器在运行应用程序的过程中,若应用程序有访问某一内存物理页的需求时,触发处理器向管理器发送对该内存物理页的访问请求。当管理器接收到该访问请求时,根据访问请求中待访问的该内存物理页的内存地址,将该内存物理页对应的访问统计信息中的被访问次数加1。其中,内存地址对应物理页作为内存使用时在内存的位置,例如,内存地址为内存物理页关联的物理地址或者为内存物理页的关联的虚拟地址。 Exemplarily, the manager establishes a mapping relationship between each memory physical page in the first storage medium and the second storage medium and the access statistics information. Initially, the number of accesses in the access statistics information of each memory physical page is 0. When the processor is running an application, if the application has a need to access a certain memory physical page, it triggers the processor to send an access request for the memory physical page to the manager. When the manager receives the access request, it adds 1 to the number of accesses in the access statistics information corresponding to the memory physical page according to the memory address of the memory physical page to be accessed in the access request. Among them, the memory address corresponds to the location of the physical page in the memory when it is used as memory. For example, the memory address is a physical address associated with the memory physical page or a virtual address associated with the memory physical page.
在一种可能的实现方式中,第一存储介质和第二存储介质中的各个内存物理页与访问统计信息之间的映射关系通过页面映射表来存储。该页面映射表存储在第一存储介质或者管理器,由管理器来维护。In a possible implementation, the mapping relationship between each memory physical page in the first storage medium and the second storage medium and the access statistical information is stored in a page mapping table. The page mapping table is stored in the first storage medium or the manager and maintained by the manager.
表1
Table 1
以表1的页面映射表为例,该页面映射表包括多个映射表项,每个映射表项包括一个内存物理页的内存地址以及访问统计信息。当接收到的访问请求携带该内存地址时,管理器将在内存地址对应的访问统计信息中的被访问次数加1。另外,由于各个内存物理页关联的物理地址是统一编址得到,为了便于查询,以内存地址为物理地址,每个映射表项按照各个内存物理页关联的物理地址的大小顺序,依次排列在页面映射表中。以表1为例,内存地址00000001所在的映射表项位于页面映射表的第一行,内存地址00000002所在的映射表项位于页面映射表的第二行。Taking the page mapping table in Table 1 as an example, the page mapping table includes multiple mapping table entries, each of which includes the memory address of a memory physical page and access statistics. When the received access request carries the memory address, the manager adds 1 to the number of accesses in the access statistics corresponding to the memory address. In addition, since the physical addresses associated with each memory physical page are obtained by unified addressing, in order to facilitate query, the memory address is used as the physical address, and each mapping table entry is arranged in the page mapping table in the order of the size of the physical addresses associated with each memory physical page. Taking Table 1 as an example, the mapping table entry where the memory address 00000001 is located is located in the first row of the page mapping table, and the mapping table entry where the memory address 00000002 is located is located in the second row of the page mapping table.
在另一些实施例中,为记录内存物理页更多的信息,每个映射表项还包括一个内存物理页的介质地址、介质属性标识以及迁移能力标识中的至少一项,其中,介质地址用于指示对应物理页在所属存储介质中的位置,介质属性标识用于指示对应物理页所属的存储介质。以表1为例,混合内存系统包括第一存储介质DDR和第二存储介质SSD,对于第一行的映射表项,介质地址000001指示第一存储介质DDR中的第一个物理页,该物理页为混合内存系统中的关联内存地址00000001的内存物理页,即混合内存系统中提供的内存中第一个内存物理页。表1以字符(如“DDR”、“SSD”)为例作为介质属性标识示出,在一些实施例中,管理器为混合内存系统中的每种存储介质分别分配一个介质编号,介质属性标识为存储介质的介质编号。In other embodiments, in order to record more information about the memory physical page, each mapping table entry also includes at least one of a medium address, a medium attribute identifier, and a migration capability identifier of a memory physical page, wherein the medium address is used to indicate the location of the corresponding physical page in the storage medium to which it belongs, and the medium attribute identifier is used to indicate the storage medium to which the corresponding physical page belongs. Taking Table 1 as an example, the hybrid memory system includes a first storage medium DDR and a second storage medium SSD. For the mapping table entry in the first row, the medium address 000001 indicates the first physical page in the first storage medium DDR, which is the memory physical page of the associated memory address 00000001 in the hybrid memory system, that is, the first memory physical page in the memory provided in the hybrid memory system. Table 1 uses characters (such as "DDR", "SSD") as an example to show the medium attribute identifier. In some embodiments, the manager assigns a medium number to each storage medium in the hybrid memory system, and the medium attribute identifier is the medium number of the storage medium.
迁移能力标识用于指示对应物理页是否支持数据迁移,其中,迁移能力标识包括第一迁移能力标识,第二迁移能力标识,第一迁移能力标识用于指示对应物理页支持数据迁移,第二迁移能力标识用于指示对应物理页不支持数据迁移。在表1中,以第一迁移能力标识为1,第二迁移能力标识为0示出,在另一些实施例中,第一迁移能力标识为0,第二迁移能力标识为1。另外,在页面映射表包括迁移能力标识的情况下,各个内存物理页的迁移能力标识可根据业务需求或者指令来配置,在此,本申请实施例对迁移能力标识的配置方式不做限定。The migration capability identifier is used to indicate whether the corresponding physical page supports data migration, wherein the migration capability identifier includes a first migration capability identifier and a second migration capability identifier, the first migration capability identifier is used to indicate that the corresponding physical page supports data migration, and the second migration capability identifier is used to indicate that the corresponding physical page does not support data migration. In Table 1, the first migration capability identifier is 1 and the second migration capability identifier is 0. In other embodiments, the first migration capability identifier is 0 and the second migration capability identifier is 1. In addition, in the case where the page mapping table includes a migration capability identifier, the migration capability identifier of each memory physical page can be configured according to business needs or instructions. Here, the embodiment of the present application does not limit the configuration method of the migration capability identifier.
步骤4012、管理器以第一时长为迁移周期,每进入到一个迁移周期,在该迁移周期结束时时,获取各个内存物理页的被访问次数。Step 4012: The manager uses the first duration as a migration cycle, and obtains the number of times each memory physical page is accessed when a migration cycle ends each time the migration cycle begins.
其中,第一时长可根据具体实施场景进行设置,在此,本申请实施例对第一时长的取值不做限定。Among them, the first duration can be set according to the specific implementation scenario. Here, the embodiment of the present application does not limit the value of the first duration.
例如,每进入到一个迁移周期,管理器从页面迁移表中获取各个内存物理页的被访问次数。For example, each time a migration cycle is entered, the manager obtains the number of times each memory physical page is accessed from the page migration table.
步骤4013、管理器根据各个内存物理页的被访问次数,确定第一迁移阈值、第二迁移阈值以及第三迁移阈值。Step 4013: The manager determines a first migration threshold, a second migration threshold, and a third migration threshold according to the number of times each memory physical page is accessed.
其中,第一迁移阈值是触发第一存储介质中的内存物理页向第二存储介质中的内存物理页迁移数据的迁移阈值。第二迁移阈值是触发第二存储介质中的内存物理页向第一存储介质中的内存物理页迁移数据的迁移阈值。第三迁移阈值是触发第二存储介质中的缓存物理页向第二存储介质中的内存物理页迁移数据的迁移阈值,也可以理解为,触发第二存储介质中的内存物理页回收缓存数据的迁移阈值。第二迁移阈值大于第一迁移阈值,第一迁移阈值一般大于第三迁移阈值,第一迁移阈值大于0。Among them, the first migration threshold is a migration threshold that triggers the migration of data from the memory physical page in the first storage medium to the memory physical page in the second storage medium. The second migration threshold is a migration threshold that triggers the migration of data from the memory physical page in the second storage medium to the memory physical page in the first storage medium. The third migration threshold is a migration threshold that triggers the migration of data from the cache physical page in the second storage medium to the memory physical page in the second storage medium, which can also be understood as a migration threshold that triggers the memory physical page in the second storage medium to reclaim cache data. The second migration threshold is greater than the first migration threshold, the first migration threshold is generally greater than the third migration threshold, and the first migration threshold is greater than 0.
如图5所示,管理器对各个内存物理页的被访问次数进行排序,得到次数序列,将次数序列中处于第一目标位置、第二目标位置以及第三目标位置的被访问次数分别作为第一迁移阈值、第二迁移阈值以及第三迁移阈值。其中,第一目标位置、第二目标位置以及第三目标位置可根据具体的实施方式进行设置,能够保证第二迁移阈值大于第一迁移阈值,第一迁移阈值大于第三迁移阈值即可。当然,管理器也可以采用其他策略确定第一迁移阈值、第二迁移阈值以及第三迁移阈值,对此,本申请实施例不做限定。As shown in FIG5 , the manager sorts the number of accesses of each memory physical page to obtain a number sequence, and uses the number of accesses at the first target position, the second target position, and the third target position in the number sequence as the first migration threshold, the second migration threshold, and the third migration threshold, respectively. Among them, the first target position, the second target position, and the third target position can be set according to a specific implementation method, and it can be ensured that the second migration threshold is greater than the first migration threshold, and the first migration threshold is greater than the third migration threshold. Of course, the manager can also use other strategies to determine the first migration threshold, the second migration threshold, and the third migration threshold, which is not limited in this embodiment of the present application.
对于第一迁移阈值、第二迁移阈值以及第三迁移阈值中的任一迁移阈值,管理器中存储有在上一个迁移周期中确定出的该迁移阈值,在本次迁移过程中确定出新的迁移阈值后,将存储的迁移阈值修改为新的 迁移阈值。在一些实施例中,若管理器中配置有用于指示该迁移阈值需要修改的第一需求信息,则管理器将上一个迁移周期中确定出的该迁移阈值修改为新的迁移阈值。若管理器中没有配置该需求信息,则管理器不对上一个迁移周期中确定出的该迁移阈值进行修改,将上一个迁移周期中确定出的该迁移阈值作为本次数据迁移检测的迁移阈值。For any of the first migration threshold, the second migration threshold, and the third migration threshold, the manager stores the migration threshold determined in the previous migration cycle. After a new migration threshold is determined during this migration process, the stored migration threshold is modified to the new one. Migration threshold. In some embodiments, if the manager is configured with first requirement information indicating that the migration threshold needs to be modified, the manager modifies the migration threshold determined in the previous migration cycle to a new migration threshold. If the manager is not configured with the requirement information, the manager does not modify the migration threshold determined in the previous migration cycle, and uses the migration threshold determined in the previous migration cycle as the migration threshold for this data migration detection.
其中,步骤4013为可选步骤,在一些实施例中,管理器中配置有第一迁移阈值、第二迁移阈值以及第三迁移阈值,每个迁移周期共享配置的第一迁移阈值、第二迁移阈值以及第三迁移阈值,无须修改第一迁移阈值、第二迁移阈值以及第三迁移阈值,也就不用执行步骤4013。Among them, step 4013 is an optional step. In some embodiments, the manager is configured with a first migration threshold, a second migration threshold and a third migration threshold. Each migration cycle shares the configured first migration threshold, second migration threshold and third migration threshold. There is no need to modify the first migration threshold, the second migration threshold and the third migration threshold, and there is no need to execute step 4013.
步骤4014、管理器根据配置的第二需求信息,确定各个内存物理页的被访问次数是否需要复位,若需要复位,则管理器将各个内存物理页的被访问次数复位为0,并跳转执行上述步骤4011,管理器对各个内存物理页的被访问次数从0开始计数,并进入下一个迁移周期。若不需要复位,管理器跳转执行上述步骤4011,管理器从各个内存物理页当前的被访问次数继续计数,并进入下一个迁移周期。Step 4014: The manager determines whether the number of accesses of each memory physical page needs to be reset based on the configured second requirement information. If reset is required, the manager resets the number of accesses of each memory physical page to 0, and jumps to execute the above step 4011. The manager starts counting the number of accesses of each memory physical page from 0 and enters the next migration cycle. If reset is not required, the manager jumps to execute the above step 4011. The manager continues counting from the current number of accesses of each memory physical page and enters the next migration cycle.
在另一些实施例中,管理器不对各个内存物理页的被访问次数进行计数,由管理器之外的统计单元,对各个内存物理页的被访问次数进行计数,每到在一个迁移周期结束时,管理器从统计单元获取各个内存物理页的被访问次数即可。其中,该统计单元可以是硬件形式的单元也可以是软件形式的单元。In other embodiments, the manager does not count the number of times each physical memory page is accessed, and a statistical unit outside the manager counts the number of times each physical memory page is accessed, and at the end of each migration cycle, the manager obtains the number of times each physical memory page is accessed from the statistical unit. The statistical unit may be a hardware unit or a software unit.
在管理器获取到第一物理页的被访问次数后,将第一物理页的被访问次数与第一迁移阈值进行比较,若第一物理页的被访问次数小于或等于第一迁移阈值,说明该第一物理页不被频繁访问,第一物理页中存储的数据为冷数据,第一物理页为冷页,触发管理器将该冷数据迁移到低访问性能的第二存储介质,迁移的过程参见下述步骤402至步骤404。After the manager obtains the number of times the first physical page is accessed, the manager compares the number of times the first physical page is accessed with the first migration threshold. If the number of times the first physical page is accessed is less than or equal to the first migration threshold, it means that the first physical page is not frequently accessed, and the data stored in the first physical page is cold data. The first physical page is a cold page, which triggers the manager to migrate the cold data to a second storage medium with low access performance. The migration process is shown in steps 402 to 404 below.
步骤402、若第一迁移检测结果满足第一数据迁移条件,管理器从第二存储介质中选择第二物理页,第二物理页为第二存储介质中作为内存使用的候选物理页。Step 402: If the first migration detection result meets the first data migration condition, the manager selects a second physical page from the second storage medium, where the second physical page is a candidate physical page used as a memory in the second storage medium.
其中,第一迁移检测结果满足第一数据迁移条件包括第一物理页的被访问次数小于或等于第一迁移阈值。或者,第一迁移检测结果满足第一数据迁移条件包括第一物理页的被访问次数小于或等于第一迁移阈值,且第一物理页支持数据迁移。The first migration detection result satisfies the first data migration condition including that the number of accesses to the first physical page is less than or equal to the first migration threshold. Alternatively, the first migration detection result satisfies the first data migration condition including that the number of accesses to the first physical page is less than or equal to the first migration threshold, and the first physical page supports data migration.
例如,管理器在当前的迁移周期结束时,从页面映射表中获取第一物理页的被访问次数,或者从统计单元获取第一物理页的被访问次数,若获取到的第一物理页的被访问次数小于或等于第一迁移阈值,则第一迁移检测结果满足第一数据迁移条件。For example, at the end of the current migration cycle, the manager obtains the number of accesses to the first physical page from the page mapping table, or obtains the number of accesses to the first physical page from the statistical unit. If the obtained number of accesses to the first physical page is less than or equal to the first migration threshold, the first migration detection result satisfies the first data migration condition.
或者,管理器从页面映射表中获取该第一物理页的被访问次数以及迁移能力标识,在第一物理页的被访问次数小于或等于第一迁移阈值的情况下,若该迁移能力标识为第一迁移能力标识,则说明该第一物理页支持数据迁移,则第一迁移检测结果满足第一数据迁移条件。Alternatively, the manager obtains the number of accesses of the first physical page and the migration capability identifier from the page mapping table. When the number of accesses of the first physical page is less than or equal to the first migration threshold, if the migration capability identifier is the first migration capability identifier, it means that the first physical page supports data migration, and the first migration detection result satisfies the first data migration condition.
在确定第一迁移检测结果满足第一数据迁移条件之后,管理器从第二存储介质中的作为内存使用的候选物理页,确定第二物理页。在一种可能的实现方式中,管理器将第二存储介质中的至少一个物理页的状态存储为候选状态,以指示该至少一个物理页为第二存储介质中的候选物理页,之后,该管理器选择该至少一个物理页中的一个物理页作为第二物理页。After determining that the first migration detection result satisfies the first data migration condition, the manager determines the second physical page from the candidate physical pages used as memory in the second storage medium. In a possible implementation, the manager stores the state of at least one physical page in the second storage medium as a candidate state to indicate that the at least one physical page is a candidate physical page in the second storage medium, and then the manager selects one of the at least one physical page as the second physical page.
例如,管理器通过第二存储介质对应的候选列表,来记录第二存储介质中处于候选状态的各个候选物理页。其中,候选列表用于存储第二存储介质中处于候选状态的各个候选物理页的介质地址。管理器从该候选列表中随机获取一个介质地址,或者,获取该候选列表中的第一个介质地址,将从该候选列表中获取到的介质地址所指示的候选物理页作为第二物理页。For example, the manager records each candidate physical page in the second storage medium that is in a candidate state through a candidate list corresponding to the second storage medium. The candidate list is used to store the media addresses of each candidate physical page in the second storage medium that is in a candidate state. The manager randomly obtains a media address from the candidate list, or obtains the first media address in the candidate list, and uses the candidate physical page indicated by the media address obtained from the candidate list as the second physical page.
步骤403、管理器将第二物理页作为内存使用。Step 403: The manager uses the second physical page as memory.
在一种可能的实现方式中,管理器通过转换第二物理页的状态,实现本步骤403。例如管理器第二物理页所处的候选状态转换为内存状态。In a possible implementation, the manager implements step 403 by converting the state of the second physical page. For example, the manager converts the candidate state of the second physical page to the memory state.
对于混合内存系统中的各个内存物理页,管理器通过各个内存物理页的介质地址与混合系统中的内存地址之间的映射关系,来指示内存物理页处于内存状态。在一些实施例中,管理器通过页面映射表记录,各个内存物理页的介质地址与混合内存系统中的内存地址之间的映射关系。以上述的表1所示的页面映射表为例,每个映射表项包括一个内存物理页的内存地址、介质地址以及介质属性标识,同一映射表项中的内存地址、介质地址以及介质属性标识也就是一个内存物理页的介质地址与分配得到的内存地址之间的映射关系。在页面映射表用于记录各个内存物理页的迁移状态的情况下,页面映射表可以记录内存物理页的迁移能力标识以及访问统计信息中的至少一项,也可以不记录内存物理页的迁移能力标识以及访问统计信 息中的至少一项,内存物理页的迁移能力标识以及访问统计信息中的至少一项也可以通过其他的表格记录。For each memory physical page in the hybrid memory system, the manager indicates that the memory physical page is in the memory state through the mapping relationship between the media address of each memory physical page and the memory address in the hybrid system. In some embodiments, the manager records the mapping relationship between the media address of each memory physical page and the memory address in the hybrid memory system through a page mapping table. Taking the page mapping table shown in Table 1 above as an example, each mapping table entry includes the memory address, media address and media attribute identifier of a memory physical page, and the memory address, media address and media attribute identifier in the same mapping table entry are the mapping relationship between the media address of a memory physical page and the allocated memory address. In the case where the page mapping table is used to record the migration status of each memory physical page, the page mapping table may record at least one of the migration capability identifier and access statistics of the memory physical page, or may not record the migration capability identifier and access statistics of the memory physical page. At least one item of the information, the migration capability identifier of the memory physical page, and at least one item of the access statistical information may also be recorded in other tables.
以第一物理页为例,第一物理页的介质地址与混合内存系统中的第一内存地址之间具有第一映射关系,第一映射关系用于指示第一物理页处于内存状态。第一内存地址用于指示第一物理页作为内存使用时在内存的位置,可以理解的是,第一内存地址为第一物理页在混合内存系统中关联的物理地址或者虚拟地址。Taking the first physical page as an example, there is a first mapping relationship between the medium address of the first physical page and the first memory address in the hybrid memory system, and the first mapping relationship is used to indicate that the first physical page is in a memory state. The first memory address is used to indicate the location of the first physical page in the memory when it is used as a memory. It can be understood that the first memory address is a physical address or a virtual address associated with the first physical page in the hybrid memory system.
在将第二物理页所处的候选状态转换为内存状态时,可以通过修改第一映射关系来实现。例如下述的步骤4031至步骤4032。When converting the candidate state of the second physical page to the memory state, it can be achieved by modifying the first mapping relationship, such as the following steps 4031 to 4032.
步骤4031、管理器删除候选列表中第二物理页的介质地址,候选列表用于存储第二存储介质中作为内存使用的候选物理页的介质地址。Step 4031: The manager deletes the media address of the second physical page in the candidate list, where the candidate list is used to store the media addresses of candidate physical pages used as memory in the second storage medium.
以第二物理页的介质地址为候选列表中的第一个介质地址为例,管理器删除候选列表的第一个介质地址,候选列表的剩余介质地址依次向第一个介质地址的方向移动一位,使得剩余介质地址中的第一个介质地址成为候选列表中的第一个介质地址。Taking the media address of the second physical page as the first media address in the candidate list as an example, the manager deletes the first media address in the candidate list, and the remaining media addresses in the candidate list are shifted one position toward the direction of the first media address in sequence, so that the first media address in the remaining media addresses becomes the first media address in the candidate list.
通过删除选列表中第二物理页的介质地址,使得第二物理页处于候选状态,从而第二物理页不具有候选物理页的身份。By deleting the medium address of the second physical page in the selection list, the second physical page is placed in a candidate state, so that the second physical page does not have the identity of a candidate physical page.
步骤4032、管理器将第一映射关系中的第一物理页的介质地址修改为第二物理页的介质地址。Step 4032: The manager modifies the media address of the first physical page in the first mapping relationship to the media address of the second physical page.
例如,对于页面映射表中包括第一物理页的介质地址的第一映射表项,管理器将第一映射表项中的第一物理页的介质地址修改为第二物理页的介质地址,将第一映射表项中第一存储介质的介质属性标识修改为第二存储介质的介质属性标识,从而使得第二物理页与第一映射表项中的第一内存地址关联,第二物理页也就替代了第一物理页作为第一内存地址所指示的内存物理页。当然,若第一映射表项中还记录有访问统计信息以及迁移能力标识,管理器还将第一映射表项中第一物理页的访问统计信息中的访问计数清0,或者,不将该访问计数清0,后续在该访问计数的基础上继续计数。管理器还将第一映射表项中第一物理页的迁移能力标识修改为第二物理页的迁移能力标识。For example, for the first mapping table entry that includes the media address of the first physical page in the page mapping table, the manager modifies the media address of the first physical page in the first mapping table entry to the media address of the second physical page, and modifies the media attribute identifier of the first storage medium in the first mapping table entry to the media attribute identifier of the second storage medium, so that the second physical page is associated with the first memory address in the first mapping table entry, and the second physical page replaces the first physical page as the memory physical page indicated by the first memory address. Of course, if the first mapping table entry also records access statistics information and a migration capability identifier, the manager also clears the access count in the access statistics information of the first physical page in the first mapping table entry to 0, or does not clear the access count to 0, and continues to count based on the access count. The manager also modifies the migration capability identifier of the first physical page in the first mapping table entry to the migration capability identifier of the second physical page.
或者,管理器不修改第一映射关系中的第一物理页的介质地址,而是删除第一映射关系,建立第一物理页关联的第一内存地址与第二物理页的介质地址之间的映射关系。该映射关系的建立方式可参考第一映射关系的建立方式,在此,不再赘述。Alternatively, the manager does not modify the media address of the first physical page in the first mapping relationship, but deletes the first mapping relationship and establishes a mapping relationship between the first memory address associated with the first physical page and the media address of the second physical page. The method for establishing the mapping relationship can refer to the method for establishing the first mapping relationship, and will not be repeated here.
步骤404、管理器将第一物理页作为第二物理页的缓存。Step 404: The manager uses the first physical page as a cache for the second physical page.
在一种可能的实现方式中,管理器通过转换第一物理页的状态,实现本步骤403。例如,管理器将第一物理页所处的内存状态转换为缓存状态,将处于缓存状态的第二物理页与第一物理页关联,使得第一物理页成为第二物理页的缓存,此时第一物理页为第一存储介质中的缓存物理页。In a possible implementation, the manager implements step 403 by converting the state of the first physical page. For example, the manager converts the memory state of the first physical page to the cache state, associates the second physical page in the cache state with the first physical page, so that the first physical page becomes the cache of the second physical page. At this time, the first physical page is a cache physical page in the first storage medium.
对于混合内存系统中的缓存物理页,管理器通过缓存物理页的介质地址与第二存储介质中的内存物理页的介质地址之间映射关系,来指示缓存物理页处于缓存状态,且缓存物理页为关联的内存物理页的缓存。在一种可能的实现方式中,缓存物理页的介质地址与第二存储介质中的内存物理页的介质地址之间映射关系通过缓存映射表来存储。该缓存映射表存储在第一存储介质或者管理器,由管理器来维护。For a cached physical page in a hybrid memory system, the manager indicates that the cached physical page is in a cache state and that the cached physical page is a cache of an associated memory physical page through a mapping relationship between the media address of the cached physical page and the media address of the memory physical page in the second storage medium. In one possible implementation, the mapping relationship between the media address of the cached physical page and the media address of the memory physical page in the second storage medium is stored through a cache mapping table. The cache mapping table is stored in the first storage medium or the manager and maintained by the manager.
表2
Table 2
以表2的缓存映射表为例,该缓存映射表包括多个缓存表项,每个缓存表项包括一个缓存物理页在第一存储介质中的介质地址(即缓存地址)以及第二存储介质中的一个内存物理页在第二存储介质中的介质地址,以指示缓存物理页与该内存物理页关联,该缓存物理页为该内存物理页的缓存。Taking the cache mapping table in Table 2 as an example, the cache mapping table includes multiple cache table entries, each cache table entry includes a media address of a cache physical page in a first storage medium (i.e., a cache address) and a media address of a memory physical page in a second storage medium in a second storage medium, to indicate that the cache physical page is associated with the memory physical page, and the cache physical page is a cache of the memory physical page.
在将第一物理页所处的内存状态转换为缓存状态,将处于缓存状态的第二物理页与第一物理页关联时,通过建立第一物理页的介质地址与第二物理页的介质地址之间的映射关系来实现。例如下述步骤4041至步骤4042。When the memory state of the first physical page is converted to the cache state and the second physical page in the cache state is associated with the first physical page, a mapping relationship between the media address of the first physical page and the media address of the second physical page is established, for example, steps 4041 to 4042 are described below.
步骤4041、管理器无效第一物理页的介质地址与混合内存系统中的第一内存地址之间的第一映射关 系。Step 4041: The manager invalidates a first mapping relationship between a media address of the first physical page and a first memory address in the hybrid memory system. Tie.
通过无效第一映射关系,使得第一物理页不处于内存状态,此时第一物理页不是混合内存系统中的内存物理页。其中,无效第一映射关系的方式,例如上述的步骤4032修改第一映射关系中第一物理页的介质地址或者删除第一映射关系。应当理解,若步骤4032已经执行完成,则不执行步骤4041。By invalidating the first mapping relationship, the first physical page is not in the memory state, and at this time, the first physical page is not a memory physical page in the hybrid memory system. The method of invalidating the first mapping relationship, for example, modifying the medium address of the first physical page in the first mapping relationship or deleting the first mapping relationship in the above-mentioned step 4032. It should be understood that if step 4032 has been executed, step 4041 is not executed.
步骤4042、管理器建立第一物理页的介质地址与第二物理页的介质地址之间的第二映射关系。Step 4042: The manager establishes a second mapping relationship between the media address of the first physical page and the media address of the second physical page.
例如,管理器以第一物理页的介质地址为第一存储介质中的介质地址,以第二物理页的介质地址为第二存储介质中的介质地址,在缓存映射表项中新增第一缓存表项,该第一缓存表项也即是建立的第二映射关系。For example, the manager uses the media address of the first physical page as the media address in the first storage medium and the media address of the second physical page as the media address in the second storage medium, and adds a first cache entry in the cache mapping table. The first cache entry also establishes the second mapping relationship.
在另一些实施例中,如表2所示,每个缓存表项还包括有效标识、一个缓存物理页的页缓存状态以及第二存储介质中的一个内存物理页关联的内存地址中的至少一项。其中,有效标识用于指示所在缓存表项是否有效,有效标识包括第一有效标识和第二有效标识,第一有效标识用于指示所在缓存表项有效,第二有效标识用于指示所在缓存表项无效。在表2中,以第一有效标识为1,第二有效标识为0为了示出,在另一些实施例中,第一有效标识为0,第二有效标识为1。In other embodiments, as shown in Table 2, each cache entry also includes a valid flag, a page cache state of a cache physical page, and at least one of a memory address associated with a memory physical page in the second storage medium. Among them, the valid flag is used to indicate whether the cache entry is valid, and the valid flag includes a first valid flag and a second valid flag. The first valid flag is used to indicate that the cache entry is valid, and the second valid flag is used to indicate that the cache entry is invalid. In Table 2, the first valid flag is 1 and the second valid flag is 0 for illustration. In other embodiments, the first valid flag is 0 and the second valid flag is 1.
一个缓存物理页的页缓存状态用于指示该缓存物理页中的各个缓存行是否存储有关联的内存物理页中对应存储空间的数据,如表2所示,缓存物理页的页缓存状态用包括第一页缓存状态以及第二页缓存状态,其中,第一页缓存状态用于指示该缓存物理页中的各个缓存行是否存储有数据,第二缓存状态用于指示该缓存物理页中的各个缓存行中的数据是否和关联的内存物理页中对应存储空间中的数据相同,其中,任一缓存行为是关联的内存物理页中对应存储空间的缓存,用于存储关联的内存物理页中对应存储空间中的数据。The page cache state of a cache physical page is used to indicate whether each cache line in the cache physical page stores data of a corresponding storage space in an associated memory physical page. As shown in Table 2, the page cache state of the cache physical page includes a first page cache state and a second page cache state, wherein the first page cache state is used to indicate whether each cache line in the cache physical page stores data, and the second cache state is used to indicate whether the data in each cache line in the cache physical page is the same as the data in the corresponding storage space in the associated memory physical page, wherein any cache behavior is a cache of a corresponding storage space in an associated memory physical page, and is used to store data in a corresponding storage space in an associated memory physical page.
第一缓存状态包括多个第一缓存行状态,每个第一缓存行状态用于指示缓存物理页中的一个缓存行中是否存储有数据。如表2所示,若一个缓存行的第一缓存行状态为1,则指示缓存行中存储有数据,若一个缓存行的第一缓存行状态为0,则指示缓存行中没有数据。在另一些实施例中,以第一缓存行状态为0指示缓存行中存储有数据,以第一缓存行状态为1指示缓存行中没有存储数据。The first cache state includes multiple first cache line states, each of which is used to indicate whether data is stored in a cache line in a cache physical page. As shown in Table 2, if the first cache line state of a cache line is 1, it indicates that data is stored in the cache line, and if the first cache line state of a cache line is 0, it indicates that there is no data in the cache line. In other embodiments, the first cache line state is 0 to indicate that data is stored in the cache line, and the first cache line state is 1 to indicate that no data is stored in the cache line.
第二缓存状态包括多个第二缓存行状态,每个第二缓存行状态用于指示缓存物理页中的一个缓存行中的数据是否和关联的内存物理页中对应存储空间中的数据相同,如表2所示,若一个缓存行的第二缓存行状态为1,则指示缓存行中的数据和关联的内存物理页中对应存储空间中的数据相同,若一个缓存行的第二缓存行状态为0,则指示该缓存行中的数据和关联的内存物理页中对应存储空间中的数据不相同。在另一些实施例中,以第二缓存行状态为1指示缓存行中的数据和关联的内存物理页中对应存储空间中的数据不相同,以第二缓存行状态为1指示缓存行中的数据和关联的内存物理页中对应存储空间中的数据相同。The second cache state includes multiple second cache line states, each second cache line state is used to indicate whether the data in a cache line in a cache physical page is the same as the data in the corresponding storage space in the associated memory physical page, as shown in Table 2, if the second cache line state of a cache line is 1, it indicates that the data in the cache line is the same as the data in the corresponding storage space in the associated memory physical page, and if the second cache line state of a cache line is 0, it indicates that the data in the cache line is not the same as the data in the corresponding storage space in the associated memory physical page. In other embodiments, the second cache line state of 1 indicates that the data in the cache line is not the same as the data in the corresponding storage space in the associated memory physical page, and the second cache line state of 1 indicates that the data in the cache line is the same as the data in the corresponding storage space in the associated memory physical page.
在缓存映射表包括有效标识、第一页缓存状态以及第二页缓存状态的情况下,在缓存映射表中添加第一缓存表项时,管理器将该第一缓存表项中的有效标识存储为第一有效标识(如1),以指示该第一缓存表项有效。对于第一物理页中的任一缓存行,若该缓存行中存储有数据,管理器将第一页缓存状态中该缓存行的第一缓存状态存储为用于指示该缓存行中存储有数据(例如存储为1),若该缓存行中没有存储数据,管理器将第一页缓存状态中该缓存行的第一缓存状态存储为用于指示该缓存行中没有存储数据(例如存储为0)。另外,由于第二物理页原本为缓存物理页,该第二物理页中没有存储数据,则对于第一物理页中的任一缓存行,管理器将第二页缓存状态中该缓存行的第二缓存状态存储为用于指示该缓存行中的数据和第一物理页中对应存储空间中的数据不同(例如存储为0)。In the case where the cache mapping table includes a valid flag, a first page cache state, and a second page cache state, when adding a first cache entry to the cache mapping table, the manager stores the valid flag in the first cache entry as a first valid flag (e.g., 1) to indicate that the first cache entry is valid. For any cache line in the first physical page, if the cache line stores data, the manager stores the first cache state of the cache line in the first page cache state as indicating that data is stored in the cache line (e.g., stored as 1), and if the cache line does not store data, the manager stores the first cache state of the cache line in the first page cache state as indicating that data is not stored in the cache line (e.g., stored as 0). In addition, since the second physical page is originally a cache physical page and no data is stored in the second physical page, for any cache line in the first physical page, the manager stores the second cache state of the cache line in the second page cache state as indicating that the data in the cache line is different from the data in the corresponding storage space in the first physical page (e.g., stored as 0).
在相关技术中,在将高访问性能的存储介质中的数据迁移至低访问性能的存储介质时,先读取高访问性能的存储介质中的待迁移数据,再将待迁移数据写入低访问性能的存储介质,之后这部分数据若被频繁访问,再将这部分数据迁移至高访问性能的存储介质。而本申请实施例中,若第一迁移检测结果满足第一数据迁移条件,则需要将第一物理页中的数据写回第二存储介质,考虑到之后第一物理页中的数据写回到第二存储介质后,后续还可能再次从第二存储介质迁移回第一存储介质,因此,管理器通过将第二物理页代替第一物理页作为内存使用,将第一物理页切换为第二物理页的缓存,完成数据迁移,避免之后将第一物理页中的数据写回至第二存储介质,也能够避免写回的数据再次迁移至第一存储介质,从而减少了数据迁移过程中来回读取和写入数据的开销,提高了数据迁移效率。另外,将第二物理页代替第一物理页作为内存使用,以确保对应用程序可见的内存不变,避免应用程序访问第一物理页之前关联的第一内存地址时出现缺页。 In the related art, when migrating data in a storage medium with high access performance to a storage medium with low access performance, the data to be migrated in the storage medium with high access performance is first read, and then the data to be migrated is written to the storage medium with low access performance. If this part of data is frequently accessed, this part of data is migrated to the storage medium with high access performance. In the embodiment of the present application, if the first migration detection result meets the first data migration condition, the data in the first physical page needs to be written back to the second storage medium. Considering that the data in the first physical page is written back to the second storage medium, it may be migrated back to the first storage medium from the second storage medium later. Therefore, the manager uses the second physical page instead of the first physical page as memory, switches the first physical page to the cache of the second physical page, completes the data migration, avoids writing the data in the first physical page back to the second storage medium later, and can also avoid migrating the written back data to the first storage medium again, thereby reducing the overhead of reading and writing data back and forth during the data migration process and improving the data migration efficiency. In addition, the second physical page is used as memory instead of the first physical page to ensure that the memory visible to the application remains unchanged, and avoids page faults when the application accesses the first memory address previously associated with the first physical page.
在另一些实施例中,管理器还对第二存储介质中的内存物理页进行数据迁移检测,以检测出第二存储介质中待参与数据迁移的内存物理页,并执行相关的数据迁移操作。例如下述步骤405至步骤411。In other embodiments, the manager also performs data migration detection on the memory physical pages in the second storage medium to detect the memory physical pages in the second storage medium to be involved in data migration, and performs related data migration operations, such as steps 405 to 411 described below.
步骤405、管理器获取第二存储介质中第三物理页的第二迁移检测结果。Step 405: The manager obtains a second migration detection result of the third physical page in the second storage medium.
其中,第三物理页是第二存储介质中作为内存使用的物理页,可以理解的是,第三物理页为第二存储介质中的任一内存物理页。该第二迁移检测结果用于指示第三物理页的被访问次数。在一些实施例中,该第二迁移检测结果还用于指示第一物理页是否支持数据迁移。在一些实施例中,该第二迁移检测结果还用于指示第三物理页中存在已被缓存物理页缓存的数据。Wherein, the third physical page is a physical page used as memory in the second storage medium. It can be understood that the third physical page is any memory physical page in the second storage medium. The second migration detection result is used to indicate the number of times the third physical page has been accessed. In some embodiments, the second migration detection result is also used to indicate whether the first physical page supports data migration. In some embodiments, the second migration detection result is also used to indicate that there is data in the third physical page that has been cached by the cached physical page.
在一种可能的实现方式中,管理器对第二存储介质中的第三物理页进行数据迁移检测,得到该第二迁移检测结果,之后,再根据该第二迁移检测结果确定第三物理页是否为待参与数据迁移的内存物理页。In a possible implementation, the manager performs a data migration test on the third physical page in the second storage medium to obtain the second migration test result, and then determines whether the third physical page is a memory physical page to be involved in data migration based on the second migration test result.
示例性地,管理器通过周期性地获取第三物理页的访问统计信息,以对第三物理页进行数据迁移检测。Exemplarily, the manager periodically obtains access statistics of the third physical page to perform data migration detection on the third physical page.
管理器以第一时长为一个迁移周期,每在一个迁移周期结束时,获取页面映射表中记录的第二存储介质中的介质地址对应的访问统计信息,其中,页面映射表中记录第二存储介质中的介质地址也即是第二存储介质中内存物理页的介质地址,当获取到第二存储介质中第三物理页这一内存物理页的介质地址对应的访问信息,也就完成了对第三物理页的数据迁移检测。The manager uses the first time length as a migration cycle. At the end of each migration cycle, the manager obtains access statistics corresponding to the media address in the second storage medium recorded in the page mapping table, wherein the media address in the second storage medium recorded in the page mapping table is also the media address of the memory physical page in the second storage medium. When the access information corresponding to the media address of the third physical page in the second storage medium is obtained, the data migration detection of the third physical page is completed.
或者,以第三物理页关联有第一存储介质中的内存物理页为例,管理器以第二时长为迁移周期,每在一个迁移周期结束时,获取缓存映射表中记录的各个内存地址或者第二存储介质中的介质地址,获取到的每个内存地址也即是第一存储介质中的一个内存物理页关联的内存地址,获取到的每个介质地址,也即是第二存储介质中一个内存物理页的介质地址。对于获取到的各个内存地址或第二存储介质中的介质地址中的任一地址,管理器基于该任一介质地址在页面映射表中查询该任一地址对应的访问统计信息,以完成对该任一地址关联的第二存储介质中的一个内存物理页的数据迁移检测,若该任一地址关联的第二存储介质中的内存物理页为第三物理页,也就完成了对该第三物理页的数据迁移检测。其中,第二时长可以等于第一时长,也可以不等于第一时长。Alternatively, taking the third physical page associated with a memory physical page in the first storage medium as an example, the manager uses the second duration as the migration cycle, and at the end of each migration cycle, obtains each memory address recorded in the cache mapping table or the media address in the second storage medium, and each memory address obtained is also the memory address associated with a memory physical page in the first storage medium, and each media address obtained is also the media address of a memory physical page in the second storage medium. For any of the obtained memory addresses or media addresses in the second storage medium, the manager queries the access statistics corresponding to the any media address in the page mapping table to complete the data migration detection of a memory physical page in the second storage medium associated with the any address. If the memory physical page in the second storage medium associated with the any address is the third physical page, the data migration detection of the third physical page is also completed. The second duration may be equal to the first duration, or may not be equal to the first duration.
另外,在管理器以第一时长为迁移周期,对第二存储介质中的内存物理页进行数据迁移检测的情况下,对第三物理页的数据迁移检测可以和对第一物理页的数据迁移检测同时执行,也可以不同时执行,也即是步骤401和步骤405可以同时执行,也可以不同时执行。或者在执行步骤401时,管理器对第一存储介质中的第一物理页以及第二存储介质中的第三物理页进行数据迁移检测,而不再执行步骤405,步骤402至步骤404所示的过程与下述步骤406至步骤411所示的过程并行处理。In addition, when the manager performs data migration detection on the memory physical page in the second storage medium with the first time length as the migration cycle, the data migration detection on the third physical page can be performed simultaneously with the data migration detection on the first physical page, or can be performed at different times, that is, step 401 and step 405 can be performed simultaneously, or can be performed at different times. Or when executing step 401, the manager performs data migration detection on the first physical page in the first storage medium and the third physical page in the second storage medium, and no longer executes step 405, and the process shown in steps 402 to 404 is processed in parallel with the process shown in steps 406 to 411 described below.
在管理器获取到第三物理页的访问统计信息后,将该访问统计信息中第三物理页的被访问次数分别第二迁移阈值进行比较,若第三物理页的被访问次数大于或等于第二迁移阈值,说明该第三物理页被频繁访问,第三物理页中存储的数据为热数据,第三物理页为热页,则触发管理器将该热数据迁移到高访问性能的第一存储介质,以便之后该热数据能够在第一存储介质中被快速访问到,迁移的过程参见下述步骤406至步骤409。After the manager obtains the access statistics information of the third physical page, the number of accesses of the third physical page in the access statistics is compared with the second migration threshold. If the number of accesses of the third physical page is greater than or equal to the second migration threshold, it means that the third physical page is frequently accessed, and the data stored in the third physical page is hot data. The third physical page is a hot page, then the manager is triggered to migrate the hot data to the first storage medium with high access performance, so that the hot data can be quickly accessed in the first storage medium later. The migration process is shown in steps 406 to 409 below.
步骤406、若第二迁移检测结果满足第二数据迁移条件,管理器从第一存储介质中选择第四物理页,第四物理页是第一存储介质中第三物理页的缓存。Step 406: If the second migration detection result meets the second data migration condition, the manager selects a fourth physical page from the first storage medium, where the fourth physical page is a cache of the third physical page in the first storage medium.
其中,第二迁移检测结果满足第二数据迁移条件包括下述情况1至情况3中的任一情况。The second migration detection result satisfies the second data migration condition, which includes any one of the following situations 1 to 3.
情况1、第三物理页的被访问次数大于或等于第二迁移阈值。Case 1: The number of accesses to the third physical page is greater than or equal to the second migration threshold.
情况2、第三物理页的被访问次数大于或等于第二迁移阈值,且第三物理页支持数据迁移。Case 2: The number of accesses to the third physical page is greater than or equal to the second migration threshold, and the third physical page supports data migration.
情况3、第三物理页的被访问次数大于或等于第二迁移阈值,第三物理页支持数据迁移,且第三物理页中存在已被缓存物理页缓存的数据。Case 3: The number of accesses to the third physical page is greater than or equal to the second migration threshold, the third physical page supports data migration, and the third physical page contains data that has been cached by the cached physical page.
对于情况1,管理器在当前的迁移周期结束时,从页面映射表中获取第三物理页的被访问次数,或者从统计单元获取第三物理页的被访问次数,若获取到的第三物理页的被访问次数大于或等于第二迁移阈值,则第二迁移检测结果满足第二数据迁移条件。For case 1, at the end of the current migration cycle, the manager obtains the number of accesses to the third physical page from the page mapping table, or obtains the number of accesses to the third physical page from the statistical unit. If the obtained number of accesses to the third physical page is greater than or equal to the second migration threshold, the second migration detection result satisfies the second data migration condition.
对于情况2,管理器从页面映射表中获取该第三物理页的被访问次数以及迁移能力标识,在第三物理页的被访问次数大于或等于第二迁移阈值的情况下,若该迁移能力标识为第一迁移能力标识,则说明该第三物理页支持数据迁移,则第二迁移检测结果满足第二数据迁移条件。For case 2, the manager obtains the number of accesses and the migration capability identifier of the third physical page from the page mapping table. When the number of accesses of the third physical page is greater than or equal to the second migration threshold, if the migration capability identifier is the first migration capability identifier, it means that the third physical page supports data migration, and the second migration detection result satisfies the second data migration condition.
对于情况3,管理器从页面映射表中获取该第三物理页的被访问次数以及迁移能力标识,在第三物理页的被访问次数大于或等于第二迁移阈值,且该迁移能力标识为第一迁移能力标识的情况下,管理器确定 第一存储介质中与第三物理页关联的第四物理页,可以理解的是,第四物理页为第一存储介质中与第三物理页关联的缓存物理页。之后,从缓存映射表中查询第四物理页的第一页缓存状态,若查询到该第一页缓存状态指示该第四物理页中的缓存行存储有数据,则第二迁移检测结果满足第二数据迁移条件。For case 3, the manager obtains the number of accesses and the migration capability identifier of the third physical page from the page mapping table. If the number of accesses of the third physical page is greater than or equal to the second migration threshold and the migration capability identifier is the first migration capability identifier, the manager determines The fourth physical page associated with the third physical page in the first storage medium can be understood to be a cache physical page associated with the third physical page in the first storage medium. Afterwards, the first page cache state of the fourth physical page is queried from the cache mapping table, and if the query finds that the first page cache state indicates that the cache line in the fourth physical page stores data, then the second migration detection result satisfies the second data migration condition.
接下来对确定第四物理页的过程如下介绍。Next, the process of determining the fourth physical page is introduced as follows.
其中,第一存储介质包括至少一个缓存物理页,每个缓存物理页与第二存储介质中作为内存使用的一个物理页关联,每个缓存物理页用于作为关联的物理页的缓存。可以理解的是,该至少一个缓存物理页为缓存映射表中的有效缓存页表项所记录的缓存物理页。The first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as memory in the second storage medium, and each cache physical page is used as a cache for the associated physical page. It can be understood that the at least one cache physical page is a cache physical page recorded by a valid cache page table entry in the cache mapping table.
基于此,管理器将该至少一个缓存物理页中与该第三物理页关联的缓存物理页,确定为第四物理页。例如,管理器在缓存映射表中的至少一个(有效的)缓存页表项,查询包括第三物理页的介质地址的第二缓存页表项,若查询到该第二缓存页表项,将该第二缓存页表项记录的第一存储介质中的介质地址所指示的缓存物理页作为第四物理页。Based on this, the manager determines the cache physical page associated with the third physical page in the at least one cache physical page as the fourth physical page. For example, the manager queries the second cache page table entry including the media address of the third physical page in at least one (valid) cache page table entry in the cache mapping table, and if the second cache page table entry is found, the cache physical page indicated by the media address in the first storage medium recorded in the second cache page table entry is used as the fourth physical page.
对于情况3,在另一些实施例中,管理器从缓存映射表中查询多个缓存物理页的第一页缓存状态,若任一缓存物理页的第一页缓存状态指示该缓存物理页中的缓存行存储有数据,则以该缓存物理页为第四物理页,根据缓存映射表中第四物理页关联的第三物理页的内存地址,从页面映射表中查询该第三物理页的被访问次数以及迁移能力标识,若第三物理页的被访问次数大于或等于第二迁移阈值,且该迁移能力标识为第一迁移能力标识,则第二迁移检测结果满足第二数据迁移条件。For situation 3, in other embodiments, the manager queries the first page cache status of multiple cache physical pages from the cache mapping table. If the first page cache status of any cache physical page indicates that the cache row in the cache physical page stores data, the cache physical page is taken as the fourth physical page, and the number of times the third physical page is accessed and the migration capability identifier are queried from the page mapping table according to the memory address of the third physical page associated with the fourth physical page in the cache mapping table. If the number of times the third physical page is accessed is greater than or equal to the second migration threshold, and the migration capability identifier is the first migration capability identifier, then the second migration detection result satisfies the second data migration condition.
步骤407、管理器查询第三物理页中还未缓存到第四物理页的数据,将查询到的数据迁移至第四物理页。Step 407: The manager queries the third physical page for data that has not been cached to the fourth physical page, and migrates the queried data to the fourth physical page.
在一种可能的实现方式中,管理器通过查询第四物理页中各个缓存行的缓存行状态,来确定第三物理页中是否存在还未缓存到第四物理页的数据,之后再将未缓存到的数据迁移直至第四物理页。In a possible implementation, the manager determines whether there is data in the third physical page that has not been cached to the fourth physical page by querying the cache line status of each cache line in the fourth physical page, and then migrates the uncached data to the fourth physical page.
例如,管理器获取第四物理页的缓存行的缓存行状态,缓存行状态用于指示缓存行是否存储有数据,若该缓存行状态指示该缓存行没有存储数据,将第三物理页中与该缓存行对应的存储空间的数据迁移至该缓存行。For example, the manager obtains the cache line status of the cache line of the fourth physical page, where the cache line status is used to indicate whether the cache line stores data. If the cache line status indicates that the cache line does not store data, the data in the storage space corresponding to the cache line in the third physical page is migrated to the cache line.
其中,缓存行的缓存行状态为缓存行的第一缓存行状态,示例性地,管理器在缓存映射表中的第二缓存表项,获取该第四物理页中的各个缓存行的第一缓存行状态。对于第四物理页中的任一缓存行,若任一缓存行的第一缓存行状态指示该任一缓存行没有存储数据,则管理器查询第三物理页中与该缓存行对应的存储空间是否存储有数据,若该存储空间中存储有数据,管理器将该存储空间中的数据存储至该任一缓存行。或者,若第四物理页中存在处于第一缓存行状态的至少一个缓存行,向第二存储介质发生数据缓存请求,该数据缓存请求用于指示缓存第二存储介质中该至少一个缓存行对应的存储空间中的数据,在第二存储介质基于该数据缓存请求,向管理器返回该至少一个缓存行中任一缓存行对应的存储空间中的数据的情况下,管理器将任一缓存行对应的存储空间中的数据存储至该任一缓存行。当然,若任一缓存行对应的存储空间中没有数据,第二存储介质基于该数据缓存请求不会向管理器返回任一缓存行对应的存储空间中的数据,此时,管理器不向该任一缓存行存储数据。Wherein, the cache line state of the cache line is the first cache line state of the cache line. Exemplarily, the manager obtains the first cache line state of each cache line in the fourth physical page from the second cache table entry in the cache mapping table. For any cache line in the fourth physical page, if the first cache line state of any cache line indicates that any cache line does not store data, the manager queries whether the storage space corresponding to the cache line in the third physical page stores data. If data is stored in the storage space, the manager stores the data in the storage space to the any cache line. Alternatively, if there is at least one cache line in the first cache line state in the fourth physical page, a data cache request is made to the second storage medium, and the data cache request is used to indicate caching the data in the storage space corresponding to the at least one cache line in the second storage medium. When the second storage medium returns the data in the storage space corresponding to any cache line in the at least one cache line to the manager based on the data cache request, the manager stores the data in the storage space corresponding to any cache line to the any cache line. Of course, if there is no data in the storage space corresponding to any cache line, the second storage medium will not return the data in the storage space corresponding to any cache line to the manager based on the data cache request. At this time, the manager does not store data in any cache line.
在该第四物理页中的各个缓存行的第一缓存行状态均指示存储有数据的情况下,第三物理页中不存在还未缓存到第四物理页的数据,此时,管理器不执行本步骤407。When the first cache line status of each cache line in the fourth physical page indicates that data is stored, there is no data in the third physical page that has not been cached to the fourth physical page. In this case, the manager does not perform step 407 .
步骤408、管理器将第四物理页作为内存使用。Step 408: The manager uses the fourth physical page as memory.
在一种可能的实现方式中,管理器通过转换第四物理页的状态,实现本步骤408。例如下述步骤4081至步骤4082。In a possible implementation, the manager implements step 408 by converting the state of the fourth physical page, such as the following steps 4081 to 4082.
步骤4081、管理器解除第三物理页与第四物理页之间的关联。Step 4081: The manager releases the association between the third physical page and the fourth physical page.
例如,无效第三物理页的介质地址与第四物理页的介质地址之间的第四映射关系,该第四映射关系用于指示第四物理页为关联的第三物理页的缓存,通过无效第四映射关系,来解除第三物理页与第四物理页之间的关联,同时使得第四物理页不处于缓存状态。For example, the fourth mapping relationship between the media address of the third physical page and the media address of the fourth physical page is invalidated. The fourth mapping relationship is used to indicate that the fourth physical page is a cache of the associated third physical page. By invalidating the fourth mapping relationship, the association between the third physical page and the fourth physical page is released, and the fourth physical page is not in a cache state.
其中,该第四映射关系通过缓存映射表中的第二缓存映射表项来存储,无效第四映射关系的方式包括将第二缓存映射表项中的有效标识由第一有效标识修改为第二有效标识,以指示该第二缓存映射表项无效,或者删除缓存映射表中的第二缓存映射表项。Among them, the fourth mapping relationship is stored through the second cache mapping table entry in the cache mapping table, and the method of invalidating the fourth mapping relationship includes changing the valid identifier in the second cache mapping table entry from the first valid identifier to the second valid identifier to indicate that the second cache mapping table entry is invalid, or deleting the second cache mapping table entry in the cache mapping table.
步骤4082、管理器将第四物理页所处的缓存状态转换为内存状态。Step 4082: The manager converts the cache state of the fourth physical page to a memory state.
其中,第三物理页的介质地址与混合内存系统中的第二内存地址之间具有第三映射关系,该第三映射 关系用于指示第三物理页处于内存状态,第二内存地址用于指示第三物理页作为内存使用时在内存的位置,可以理解的是,第二内存地址为第三物理页在混合内存系统中关联的物理地址或者虚拟地址。There is a third mapping relationship between the medium address of the third physical page and the second memory address in the hybrid memory system. The relationship is used to indicate that the third physical page is in a memory state, and the second memory address is used to indicate the location of the third physical page in the memory when it is used as memory. It can be understood that the second memory address is the physical address or virtual address associated with the third physical page in the hybrid memory system.
管理器将第三映射关系中的第三物理页的介质地址修改为第四物理页的介质地址。The manager modifies the media address of the third physical page in the third mapping relationship into the media address of the fourth physical page.
例如,管理器将第二缓存表项中记录的内存地址以及第二存储介质中的介质地址分别作为第三物理页关联的第二内存地址以及介质地址,对于第三物理页关联的第二内存地址以及介质地址中的任一地址,管理器在页面映射表中查询包括该任一地址的第二映射表项,从而第二映射表项中记录有第三物理页关联的第二内存地址以及介质地址,因此,第二映射表项用于记录第三映射关系。从而管理器将该第二映射表项中的第三物理页的介质地址修改为第四物理页的介质地址,将该第二映射表项中第二存储介质的介质属性标识修改为第一存储介质的介质属性标识,从而使得第四物理页与该第二映射表项中的第二内存地址关联,第四物理页也就替代了第三物理页,成为第二内存地址所指示的内存物理页。当然,若第二映射表项中还记录有访问统计信息以及迁移能力标识,管理器还将该第二映射表项中第三物理页的访问统计信息修改为第四物理页的访问统计信息,还将该第二映射表项中第三物理页的迁移能力标识修改为第四物理页的迁移能力标识。For example, the manager uses the memory address recorded in the second cache entry and the media address in the second storage medium as the second memory address and the media address associated with the third physical page, respectively. For any of the second memory address and the media address associated with the third physical page, the manager queries the second mapping entry including the any address in the page mapping table, so that the second mapping entry records the second memory address and the media address associated with the third physical page. Therefore, the second mapping entry is used to record the third mapping relationship. Thus, the manager modifies the media address of the third physical page in the second mapping entry to the media address of the fourth physical page, and modifies the media attribute identifier of the second storage medium in the second mapping entry to the media attribute identifier of the first storage medium, so that the fourth physical page is associated with the second memory address in the second mapping entry, and the fourth physical page replaces the third physical page and becomes the memory physical page indicated by the second memory address. Of course, if the second mapping entry also records the access statistics information and the migration capability identifier, the manager also modifies the access statistics information of the third physical page in the second mapping entry to the access statistics information of the fourth physical page, and also modifies the migration capability identifier of the third physical page in the second mapping entry to the migration capability identifier of the fourth physical page.
或者,管理器不修改第三映射关系中的第一物理页的介质地址,而是删除第三映射关系,建立第三物理页关联的第二内存地址与第四物理页的介质地址之间的映射关系。该映射关系的建立方式可参考第一映射关系的建立方式,在此不再赘述。Alternatively, the manager does not modify the media address of the first physical page in the third mapping relationship, but deletes the third mapping relationship and establishes a mapping relationship between the second memory address associated with the third physical page and the media address of the fourth physical page. The establishment method of this mapping relationship can refer to the establishment method of the first mapping relationship, which will not be repeated here.
步骤409、管理器将第三物理页作为候选物理页。Step 409: The manager uses the third physical page as a candidate physical page.
例如,若第三物理页中还存储有数据,管理器将第三物理页中的数据删除,使得第三物理页成为空闲物理页,之后,将第三物理页的状态记录为候选状态,以指示该第三物理页是候选物理页。或者,管理器暂不删除第三物理页中的数据,将第三物理页的状态记录为候选状态,当该第三物理页由候选状态切换为内存状态后,在应用程序向该第三物理页关联的内存地址写入数据时,先删除第三物理页中存储的数据,再向第三物理页写入数据,或者,以覆盖写的方式,向第三物理页写入数据。For example, if the third physical page still stores data, the manager deletes the data in the third physical page, making the third physical page an idle physical page, and then records the state of the third physical page as a candidate state to indicate that the third physical page is a candidate physical page. Alternatively, the manager does not delete the data in the third physical page for the time being, and records the state of the third physical page as a candidate state. When the third physical page switches from the candidate state to the memory state, when the application writes data to the memory address associated with the third physical page, the data stored in the third physical page is first deleted, and then the data is written to the third physical page, or data is written to the third physical page in an overwrite manner.
其中,将第三物理页的状态记录为候选状态的方式,例如,管理器在第二存储介质的候选列表中添加该第三物理页的介质地址,如在该候选列表末尾添加该第三物理页的介质地址。The state of the third physical page is recorded as a candidate state in, for example, the manager adds the medium address of the third physical page to the candidate list of the second storage medium, such as adding the medium address of the third physical page to the end of the candidate list.
在相关技术中,在将低访问性能的存储介质中的数据迁移至高访问性能的存储介质时,先读取低访问性能的存储介质中的待迁移数据,再将待迁移数据写入高访问性能的存储介质,而本申请实施例中,若第二迁移检测结果满足第二数据迁移条件,则需要将第三物理页中的数据迁移至第一存储介质,考虑到第一存储介质中第三物理页所关联的第四物理页是第三物理页的缓存,则第四物理页中可能缓存有第三物理页的数据,管理器通过将第四物理页作为内存使用,将第三物理页作为候选物理页,使得第四物理页代替第三物理页作为内存使用,如果第四物理页之前缓存了第三物理页所有的数据,也就无需从第三物理页迁移数据,简化了数据迁移流程,提高了数据迁移效率。另外,在第三物理页中存在还未缓存到第四物理页的数据的情况下,管理器最多将还未缓存的数据迁移至第一存储介质的第四物理页内,而无须迁移第三物理页中的所有数据,从而降低了数据迁移过程中传输数据所带来的开销,提高了数据迁移效率。并且,将第四物理页代替第三物理页作为内存使用,以确保对应用程序可见的内存不变,避免应用程序访问第三物理页之前关联的第二内存地址时出现缺页。In the related art, when migrating data in a storage medium with low access performance to a storage medium with high access performance, the data to be migrated in the storage medium with low access performance is first read, and then the data to be migrated is written to the storage medium with high access performance. In the embodiment of the present application, if the second migration detection result meets the second data migration condition, the data in the third physical page needs to be migrated to the first storage medium. Considering that the fourth physical page associated with the third physical page in the first storage medium is a cache of the third physical page, the fourth physical page may cache the data of the third physical page. The manager uses the fourth physical page as memory and the third physical page as a candidate physical page, so that the fourth physical page replaces the third physical page as memory. If the fourth physical page previously caches all the data of the third physical page, there is no need to migrate the data from the third physical page, which simplifies the data migration process and improves the data migration efficiency. In addition, in the case that there is data in the third physical page that has not been cached to the fourth physical page, the manager will at most migrate the data that has not been cached to the fourth physical page of the first storage medium, without migrating all the data in the third physical page, thereby reducing the overhead caused by transmitting data during the data migration process and improving the data migration efficiency. Furthermore, the fourth physical page is used as memory instead of the third physical page to ensure that the memory visible to the application remains unchanged, thereby avoiding a page fault when the application accesses the second memory address previously associated with the third physical page.
在另一些实施例中,在管理器获取到第三物理页的访问统计信息后,将该访问统计信息中第三物理页的被访问次数与第三迁移阈值进行比较,若第三物理页的被访问次数小于或等于第三迁移阈值,说明该第三物理页不被频繁访问,第三物理页中存储的数据为冷数据,第三物理页为冷页,为避免第三物理页中的冷数据占用缓存物理页,则触发管理器将第三物理页关联的缓存物理页中的该冷数据迁移到第三物理页,迁移的过程参见下述步骤410至步骤411。In other embodiments, after the manager obtains the access statistics of the third physical page, it compares the number of accesses of the third physical page in the access statistics with the third migration threshold. If the number of accesses of the third physical page is less than or equal to the third migration threshold, it means that the third physical page is not frequently accessed, and the data stored in the third physical page is cold data. The third physical page is a cold page. To avoid the cold data in the third physical page occupying the cache physical page, the manager is triggered to migrate the cold data in the cache physical page associated with the third physical page to the third physical page. The migration process is shown in steps 410 to 411 below.
步骤410、若第二迁移检测结果满足第三数据迁移条件,管理器将第四物理页所存储的数据写入第三物理页。Step 410: If the second migration detection result meets the third data migration condition, the manager writes the data stored in the fourth physical page into the third physical page.
其中,第二迁移检测结果满足第三数据迁移条件包括第三物理页的被访问次数小于或等于第三迁移阈值,且第三物理页中存在已被缓存物理页缓存的数据。The second migration detection result satisfies the third data migration condition, including that the number of accesses to the third physical page is less than or equal to a third migration threshold, and that the third physical page contains data that has been cached by the cached physical page.
例如,管理器在当前的迁移周期结束时,从页面映射表中获取第三物理页的被访问次数,或者从统计单元获取第三物理页的被访问次数,若获取到的第三物理页的被访问次数小于或等于第三迁移阈值,则管理器缓存映射表中查询第一存储介质中与第三物理页关联的第四物理页,从缓存映射表中查询第四物理页 的第一页缓存状态,若查询到该第一页缓存状态指示该第四物理页中的缓存行存储有数据,则第二迁移检测结果满足第三数据迁移条件,管理器将第四物理页所存储的数据写入第三物理页。For example, at the end of the current migration cycle, the manager obtains the number of accesses to the third physical page from the page mapping table, or obtains the number of accesses to the third physical page from the statistical unit. If the obtained number of accesses to the third physical page is less than or equal to the third migration threshold, the manager queries the cache mapping table for a fourth physical page associated with the third physical page in the first storage medium, and queries the cache mapping table for the fourth physical page. If the query finds that the first page cache state indicates that the cache line in the fourth physical page stores data, the second migration detection result satisfies the third data migration condition, and the manager writes the data stored in the fourth physical page into the third physical page.
或者,对于缓存映射表中的各个有效缓存页表项,管理器在当前的迁移周期结束时,将有效缓存页表项中记录的第二存储介质的介质地址所指示的内存物理页为第三物理页,将有效缓存页表项中记录的第一存储介质的介质地址所指示的内存物理页为第四物理页,根据有效缓存页表项中记录的第二存储介质的介质地址或者内存地址,从页面映射表中获取该第三物理页的访问统计次数,其中,该第三物理页的访问统计次数也即是第四物理页的访问统计次数,若访问统计次数小于或等于第三迁移阈值,则第二迁移检测结果满足第三数据迁移条件,触发管理器将第四物理页所存储的数据写入第三物理页。Alternatively, for each valid cache page table entry in the cache mapping table, at the end of the current migration cycle, the manager changes the memory physical page indicated by the media address of the second storage medium recorded in the valid cache page table entry to the third physical page, and changes the memory physical page indicated by the media address of the first storage medium recorded in the valid cache page table entry to the fourth physical page, and obtains the access statistical number of the third physical page from the page mapping table according to the media address or memory address of the second storage medium recorded in the valid cache page table entry, wherein the access statistical number of the third physical page is also the access statistical number of the fourth physical page, and if the access statistical number is less than or equal to the third migration threshold, the second migration detection result satisfies the third data migration condition, triggering the manager to write the data stored in the fourth physical page to the third physical page.
其中,管理器将第四物理页所存储的数据写入第三物理页的过程,例如,管理器基于第四物理中存储的数据,生成第一数据写入请求,第一数据写入请求用于指示向第三物理页写入该数据,之后,管理器向第二存储介质的控制器发送该第一数据写入请求,由控制器根据该第一数据写入请求,向第三物理页写入该数据。Among them, the manager writes the data stored in the fourth physical page to the third physical page. For example, the manager generates a first data write request based on the data stored in the fourth physical page, and the first data write request is used to indicate that the data is written to the third physical page. After that, the manager sends the first data write request to the controller of the second storage medium, and the controller writes the data to the third physical page according to the first data write request.
步骤411、管理器解除第三物理页与第四物理页之间的关联。Step 411: The manager releases the association between the third physical page and the fourth physical page.
其中,本步骤411与4081同理,在此,本申请实施例对步骤411不再赘述。Among them, this step 411 is similar to 4081, and here, the embodiment of the present application will not repeat step 411.
在第三物理页与第四物理页之间的关联解除完成后,该管理器将该第四物理页的介质添加到第一存储介质的缓存列表,该缓存列表用于存储第一存储介质中处于缓存状态,且还未使用的缓存物理页。之后,在有第二存储介质中的内存物理页有缓存到缓存物理页的需求时,管理器再从该缓存列表中,获取一个未使用的缓存物理页的介质地址,建立该缓存物理页的介质地址与该内存物理页的介质地址之间的映射关系,以该缓存物理页为该内存物理页的缓存,之后,管理器将该内存物理页中的数据缓存到该缓存物理页,在接收到对该内存物理页的访问请求时,将该内存物理页中的数据缓存到该缓存物理页。After the association between the third physical page and the fourth physical page is released, the manager adds the medium of the fourth physical page to the cache list of the first storage medium, and the cache list is used to store the cache physical pages in the first storage medium that are in the cache state and have not been used. Afterwards, when there is a demand for caching a memory physical page in the second storage medium to a cache physical page, the manager obtains the media address of an unused cache physical page from the cache list, establishes a mapping relationship between the media address of the cache physical page and the media address of the memory physical page, and uses the cache physical page as the cache of the memory physical page. Afterwards, the manager caches the data in the memory physical page to the cache physical page, and when receiving an access request to the memory physical page, caches the data in the memory physical page to the cache physical page.
在第二迁移检测结果满足第三数据迁移条件的情况下,管理器将第四物理页所存储的数据写入第三物理页,解除第三物理页与第四物理页之间的关联,以解除第三物理页对第四物理页的占用,从而回收到了第四物理页所提供的缓存空间,以便之后,将第四物理页作为新的缓存分配给第二存储介质中的其他内存物理页使用。When the second migration detection result meets the third data migration condition, the manager writes the data stored in the fourth physical page to the third physical page, releases the association between the third physical page and the fourth physical page, and releases the occupation of the fourth physical page by the third physical page, thereby reclaiming the cache space provided by the fourth physical page, so that the fourth physical page can be allocated as a new cache for use by other memory physical pages in the second storage medium.
上述是以管理器先执行步骤406至步骤409,再执行步骤410至步骤411为例进行介绍的,在另一些实施例中,步骤406至步骤409和步骤410至步骤411也可以并行处理。The above description is based on an example in which the manager first executes steps 406 to 409 and then executes steps 410 to 411. In other embodiments, steps 406 to 409 and steps 410 to 411 may also be processed in parallel.
图4所示的数据处理方法,通过在第一存储介质中第一物理页的第一迁移检测结果满足第一数据迁移条件的情况下,将第一物理页作为第二存储介质中的候选物理页的缓存,将该候选物理页作为第二存储介质中的内存物理页,使得待第一物理页中的数据变成第二存储介质中内存物理页的缓存数据,避免之后将第一物理页中的数据写回至第二存储介质,也能够避免写回的数据再次迁移至第一存储介质,从而简化了数据迁移流程,减少了数据迁移过程中来回读取和写入数据的开销,提高了数据迁移效率。The data processing method shown in Figure 4 uses the first physical page as a cache of a candidate physical page in the second storage medium and uses the candidate physical page as a memory physical page in the second storage medium when the first migration detection result of the first physical page in the first storage medium meets the first data migration condition, so that the data in the first physical page becomes the cache data of the memory physical page in the second storage medium, avoiding the data in the first physical page from being written back to the second storage medium later, and also avoiding the written-back data from being migrated to the first storage medium again, thereby simplifying the data migration process, reducing the overhead of reading and writing data back and forth during the data migration process, and improving the data migration efficiency.
图4介绍了通过转换第一存储介质中内存物理页的状态,简化数据迁移流程的过程,在图4所示的过程中,应用程序还可能访问第一存储介质或者第二存储介质中的内存物理页,接下来,结合图6对应用程序访问混合内存系统中的内存物理页的过程作如下介绍。Figure 4 introduces the process of simplifying the data migration process by converting the state of the memory physical page in the first storage medium. In the process shown in Figure 4, the application may also access the memory physical page in the first storage medium or the second storage medium. Next, combined with Figure 6, the process of the application accessing the memory physical page in the hybrid memory system is introduced as follows.
其中,图6是本申请提供的一种混合内存系统的访问方法的流程图,该访问方法包括如下步骤。6 is a flow chart of a method for accessing a hybrid memory system provided by the present application, and the access method includes the following steps.
步骤601、电子设备中的处理器向管理器发送对混合内存系统中第一目标物理页的访问请求。Step 601: A processor in an electronic device sends an access request to a first target physical page in a hybrid memory system to a manager.
其中,该第一目标物理页为第一存储介质或第二存储介质中的任一内存物理页。该访问请求包括该第一物理目标页关联的第三内存地址。The first target physical page is any memory physical page in the first storage medium or the second storage medium. The access request includes a third memory address associated with the first physical target page.
以页面映射表中的内存地址为内存物理页的物理地址为例,处理器在运行应用程序时,若应用程序对该混合内存系统中的某一虚拟地址有访问需求,应用程序生成包括该虚拟地址的访问请求,处理器通过查询页面映射表获取该虚拟地址对应的物理地址(即第三内存地址),将该访问请求中的虚拟地址转换为第三内存地址,再向管理器发送包括第三内存地址的访问请求,此时该第三内存地址所关联的内存物理页也即是第一目标物理页。Taking the memory address in the page mapping table as the physical address of the memory physical page as an example, when the processor is running an application, if the application has an access requirement for a virtual address in the hybrid memory system, the application generates an access request including the virtual address, and the processor obtains the physical address corresponding to the virtual address (i.e., the third memory address) by querying the page mapping table, converts the virtual address in the access request into the third memory address, and then sends an access request including the third memory address to the manager. At this time, the memory physical page associated with the third memory address is also the first target physical page.
另外,该访问请求可能是数据读取请求,也可能是数据写入请求,其中,数据读取请求用于指示读取该内存地址中存储的数据,数据写入请求用于指示向该内存地址写入目标数据,此时,数据写入请求还包括待写入的目标数据。In addition, the access request may be a data read request or a data write request, wherein the data read request is used to indicate reading the data stored in the memory address, and the data write request is used to indicate writing target data to the memory address. At this time, the data write request also includes the target data to be written.
步骤602、管理器获取对该混合内存系统中第一目标物理页的访问请求。 Step 602: The manager obtains an access request to a first target physical page in the hybrid memory system.
如图6所示,管理器在获取到该访问请求后,根据该访问请求中的第三内存地址,在页面映射表中查询包括该第三内存地址的第三映射表项,从查询到的该第三映射表项中获取第一目标物理页的介质地址,将访问请求中的物理地址转换为该介质地址。若第三映射表项中记录有第一目标物理页的被访问次数,则管理器将被访问次数1。As shown in FIG6 , after obtaining the access request, the manager searches the page mapping table for a third mapping table entry including the third memory address in the access request, obtains the media address of the first target physical page from the queried third mapping table entry, and converts the physical address in the access request into the media address. If the third mapping table entry records the number of times the first target physical page has been accessed, the manager will be accessed 1.
步骤603、若第一目标物理页属于第一存储介质,管理器基于访问请求,对第一目标物理页进行访问。Step 603: If the first target physical page belongs to the first storage medium, the manager accesses the first target physical page based on the access request.
如图6所示,若该第三映射表项中的介质属性标识为第一存储介质的介质属性标识,说明该第一目标物理页为第一存储介质中的内存物理页,则该访问请求命中第一存储介质。之后,管理器基于访问请求,对第一存储介质中的第一目标物理页进行访问。例如,管理器将包括第一目标物理页的介质地址的访问请求发送给第一存储介质的控制器(称为第一控制器),由第一控制器根据接收到的访问请求,对第一目标物理页进行访问,向管理器返回对第三内存地址的访问结果。之后由管理器向处理器返回访问结果。As shown in FIG6 , if the media attribute identifier in the third mapping table entry is the media attribute identifier of the first storage medium, indicating that the first target physical page is a memory physical page in the first storage medium, then the access request hits the first storage medium. Afterwards, the manager accesses the first target physical page in the first storage medium based on the access request. For example, the manager sends an access request including the media address of the first target physical page to the controller of the first storage medium (referred to as the first controller), and the first controller accesses the first target physical page based on the received access request, and returns the access result of the third memory address to the manager. The manager then returns the access result to the processor.
其中,若访问请求为数据读取请求,对目标物理页进行访问是指从第一目标物理页中读取的数据,访问结果包括从基于该数据读取请求从第一目标物理页中读取的数据。若访问请求为数据写入请求,对第一目标物理页进行访问是指向第一目标物理页写入目标数据,则访问结果用于指示向第一目标物理页写入完成。Wherein, if the access request is a data read request, accessing the target physical page refers to data read from the first target physical page, and the access result includes data read from the first target physical page based on the data read request. If the access request is a data write request, accessing the first target physical page refers to writing target data to the first target physical page, and the access result is used to indicate that writing to the first target physical page is completed.
步骤604、若第一目标物理页属于第二存储介质,管理器基于访问请求,对第一存储介质中与第一目标物理页关联的第二目标物理页进行访问,该第二目标物理页为该第一目标物理页的缓存。Step 604: If the first target physical page belongs to the second storage medium, the manager accesses a second target physical page associated with the first target physical page in the first storage medium based on the access request, where the second target physical page is a cache of the first target physical page.
如图6所示,若该第三映射表项中的介质属性标识为第二存储介质的介质属性标识,说明该第一目标物理页为第二存储介质中的内存物理页,不是第一存储介质中的内存物理页,则该访问请求命中第二存储介质,而没有命中第一存储介质。As shown in Figure 6, if the media attribute identifier in the third mapping table entry is the media attribute identifier of the second storage medium, it means that the first target physical page is a memory physical page in the second storage medium, not a memory physical page in the first storage medium, then the access request hits the second storage medium but not the first storage medium.
下面以访问请求为数据写入请求,且命中第二存储介质的情况下,对本步骤604作如下介绍。In the following, assuming that the access request is a data write request and hits the second storage medium, step 604 is described as follows.
在访问请求为数据写入请求的情况下,管理器访问第一存储介质中的缓存物理页,以确定数据写入请求是否命中第一存储介质中的缓存物理页。例如,管理器基于该第一目标物理的第三内存地址或者介质地址,在缓存映射表的有效缓存表项中查询第三内存地址或者介质地址,若查询到包括第三内存地址或者介质地址的第三缓存页表项,则此时数据写入请求命中第一存储介质中的缓存物理页。例如,第三缓存页表项中的第一存储介质地址所指示的缓存物理页为该数据写请求命中的缓存物理页,该缓存物理页也即该第二目标物理页。若查询不到第三缓存页表项,则数据写入请求没有命中第一存储介质中的缓存物理页。In the case where the access request is a data write request, the manager accesses the cache physical page in the first storage medium to determine whether the data write request hits the cache physical page in the first storage medium. For example, based on the third memory address or media address of the first target physical, the manager queries the third memory address or media address in the valid cache table entry of the cache mapping table. If the third cache page table entry including the third memory address or media address is queried, then the data write request hits the cache physical page in the first storage medium. For example, the cache physical page indicated by the first storage medium address in the third cache page table entry is the cache physical page hit by the data write request, and the cache physical page is also the second target physical page. If the third cache page table entry cannot be queried, the data write request does not hit the cache physical page in the first storage medium.
在数据写入请求命中第二目标物理页的情况下,管理器从第三缓存页表项中获取该第二目标物理页的介质地址,将数据写入请求中的第一目标物理页的介质地址修改为第二目标物理页的介质地址,管理器向第一控制器发送修改后的数据写入请求,由第一控制器根据接收到的数据写入请求,向第一存储介质中的第二目标物理页写入目标数据,向管理器返回访问结果,由管理器将该访问结果返回给处理器。对于这种情况,若目标数据被写入到该第二目标物理页的至少一个缓存行,对于该至少一个缓存行中的任一缓存行,若该任一缓存行的第一缓存行状态用于指示该缓存行没有数据,则管理器更新该任一缓存行的第一缓存行状态,使得更新后的该第一缓存行状态指示该缓存行中有数据,还更新该任一缓存行的第二缓存行状态,使得更新后的该第二缓存行状态指示该缓存行中的数据和第一目标物理页中对应存储空间中的数据不同。若该任一缓存行的第一缓存行状态用于指示该缓存行存储有数据,则管理器不再更新该第一缓存行状态,而由于向该第一缓存行写入了新的数据,则管理器还要更新该任一缓存行的第二缓存行状态,使得更新后的该第二缓存行状态指示该缓存行中的数据和第一目标物理页中对应存储空间中的数据不同。In the case where the data write request hits the second target physical page, the manager obtains the media address of the second target physical page from the third cache page table entry, modifies the media address of the first target physical page in the data write request to the media address of the second target physical page, and sends the modified data write request to the first controller. The first controller writes the target data to the second target physical page in the first storage medium according to the received data write request, and returns the access result to the manager, which returns the access result to the processor. In this case, if the target data is written to at least one cache line of the second target physical page, for any cache line in the at least one cache line, if the first cache line state of any cache line is used to indicate that there is no data in the cache line, the manager updates the first cache line state of any cache line so that the updated first cache line state indicates that there is data in the cache line, and also updates the second cache line state of any cache line so that the updated second cache line state indicates that the data in the cache line is different from the data in the corresponding storage space in the first target physical page. If the first cache line state of any cache line is used to indicate that the cache line stores data, the manager will no longer update the first cache line state. However, since new data is written to the first cache line, the manager will also update the second cache line state of any cache line, so that the updated second cache line state indicates that the data in the cache line is different from the data in the corresponding storage space in the first target physical page.
在数据写入请求没有命中缓存物理页的情况下,管理器为该第一目标物理页分配缓存物理页,例如,管理器获取缓存列表中的一个介质地址,在缓存映射表中建立该介质地址与该第一目标物理页之间的映射关系,以指示该介质地址所指示的第三目标物理页为该第一目标物理页的缓存。在分配完成后,管理器将数据写入请求中的第一目标物理页的介质地址修改为第三目标物理页的介质地址,管理器向第一控制器发送修改后的数据写入请求,由第一控制器根据接收到的数据写入请求,向第一存储介质中的第三目标物理页写入目标数据,向管理器返回访问结果,由管理器将该访问结果返回给处理器。对于这种情况,由于目标数据为新数据,若目标数据被写入到该第三目标物理页的至少一个缓存行,对于该至少一个缓存行中的任一缓存行,管理器将该任一缓存行的第一缓存行状态设置为指示该缓存行存储有数据,将该任一缓存行的第二缓存行状态设置为指示该缓存行中的数据和第一目标物理页中对应存储空间中的数据不同。In the case where the data write request does not hit the cache physical page, the manager allocates a cache physical page for the first target physical page. For example, the manager obtains a media address in the cache list and establishes a mapping relationship between the media address and the first target physical page in the cache mapping table to indicate that the third target physical page indicated by the media address is the cache of the first target physical page. After the allocation is completed, the manager modifies the media address of the first target physical page in the data write request to the media address of the third target physical page, and the manager sends the modified data write request to the first controller. The first controller writes the target data to the third target physical page in the first storage medium according to the received data write request, and returns the access result to the manager, and the manager returns the access result to the processor. In this case, since the target data is new data, if the target data is written to at least one cache line of the third target physical page, for any cache line in the at least one cache line, the manager sets the first cache line state of any cache line to indicate that the cache line stores data, and sets the second cache line state of any cache line to indicate that the data in the cache line is different from the data in the corresponding storage space in the first target physical page.
下面再以访问请求不是数据写入请求而是数据读取请求,且命中第二存储介质的情况下,对本步骤604 作如下介绍。Next, in the case where the access request is not a data write request but a data read request and hits the second storage medium, the step 604 is repeated. The following is introduced.
在访问请求为数据读取请求的情况下,管理器访问第一存储介质中的缓存物理页,以确定该数据读取请求是否命中第一存储介质中的缓存物理页,该过程可参考上文中确定数据写入请求是否命中缓存物理页的过程。When the access request is a data read request, the manager accesses the cached physical page in the first storage medium to determine whether the data read request hits the cached physical page in the first storage medium. This process can refer to the process of determining whether the data write request hits the cached physical page above.
在数据读取请求命中第二目标物理页的情况下,管理器将数据读取请求中的第一目标物理页的介质地址修改为第二目标物理页的介质地址,管理器向第一控制器发送修改后的数据读取请求,由第一控制器根据接收到的数据读取请求,从第一存储介质中的第二目标物理页读取数据,向管理器返回访问结果,由管理器将该访问结果返回给处理器。When the data read request hits the second target physical page, the manager modifies the media address of the first target physical page in the data read request to the media address of the second target physical page, and sends the modified data read request to the first controller. The first controller reads data from the second target physical page in the first storage medium based on the received data read request, and returns the access result to the manager, which returns the access result to the processor.
在数据读取请求没有命中缓存物理页的情况下,管理器向第二存储介质的控制器(称为第二控制器)发送修改后的数据读取请求,由第二控制器根据接收到的数据读取请求,从第二存储介质中的第一目标物理页读取数据,向管理器返回访问结果,由管理器将该访问结果返回给处理器。另外,管理器还为该第一目标物理页分配缓存物理页,假设将第一存储介质中的第三目标物理页分配给第一目标物理页,作为第一目标物理页的缓存,管理器从访问结果中获取从第一目标物理页读取到的数据,将读取到的数据写入第三目标物理页。假设读取到的数据被写入到第三目标物理页的至少一个缓存行,对于该至少一个缓存行中的任一缓存行,管理器将该任一缓存行的第一缓存行状态设置为指示该缓存行存储有数据,将该任一缓存行的第二缓存行状态设置为指示该缓存行中的数据和第一目标物理页中对应存储空间中的数据相同。In the case where the data read request does not hit the cache physical page, the manager sends a modified data read request to the controller of the second storage medium (referred to as the second controller), and the second controller reads data from the first target physical page in the second storage medium according to the received data read request, and returns the access result to the manager, and the manager returns the access result to the processor. In addition, the manager also allocates a cache physical page to the first target physical page. Assuming that the third target physical page in the first storage medium is allocated to the first target physical page as the cache of the first target physical page, the manager obtains the data read from the first target physical page from the access result, and writes the read data to the third target physical page. Assuming that the read data is written to at least one cache line of the third target physical page, for any cache line in the at least one cache line, the manager sets the first cache line state of any cache line to indicate that the cache line stores data, and sets the second cache line state of any cache line to indicate that the data in the cache line is the same as the data in the corresponding storage space in the first target physical page.
图6所示的方法,通过在获取对混合内存系统中第一目标物理页的访问请求后,若待访问的第一目标物理页属于第一存储介质,则基于访问请求,对第一目标物理页进行访问,由于第一存储介质访问性能高于第二存储介质,从而在访问第一存储介质中的第一目标物理页时能够快速访问。若第一目标物理页属于第二存储介质,基于访问请求,对第一存储介质中与第一目标物理页关联的第二目标物理页进行访问,由于第一存储介质访问性能高于第二存储介质,从而在访问第一存储介质中的第二目标物理页时能够快速访问。The method shown in FIG6 is that after obtaining an access request to a first target physical page in a hybrid memory system, if the first target physical page to be accessed belongs to the first storage medium, the first target physical page is accessed based on the access request, and since the access performance of the first storage medium is higher than that of the second storage medium, the first target physical page in the first storage medium can be quickly accessed. If the first target physical page belongs to the second storage medium, based on the access request, the second target physical page associated with the first target physical page in the first storage medium is accessed, and since the access performance of the first storage medium is higher than that of the second storage medium, the second target physical page in the first storage medium can be quickly accessed.
以上介绍了本申请提供的数据处理方法,接下来,结合附图进一步介绍下本申请提供的装置、芯片和电子设备。应理解,以下介绍的装置、芯片和电子设备可以实现上述任一方法中混合内存系统的管理器或管理器一部分的任意功能。The above describes the data processing method provided by the present application. Next, the device, chip and electronic device provided by the present application are further described in conjunction with the accompanying drawings. It should be understood that the device, chip and electronic device described below can implement any function of the manager or part of the manager of the hybrid memory system in any of the above methods.
图7是本申请提供的一种数据处理装置结构示意图,如图7所示,装置700包括映射模块701、迁移模块702、缓存管理模块703以及介质管理模块704。FIG. 7 is a schematic diagram of the structure of a data processing device provided by the present application. As shown in FIG. 7 , the device 700 includes a mapping module 701 , a migration module 702 , a cache management module 703 and a media management module 704 .
其中,映射模块701,用于维护页面映射表,将处理器下发的访问请求中的内存地址转换为介质地址,该介质地址用于指示待访问的内存物理页,若待访问的内存物理页是第一存储介质中的内存物理页,则将访问请求发送给第一存储介质,若待访问的内存物理页是第二存储介质中的内存物理页,则将访问请求发送给缓存管理模块703。Among them, the mapping module 701 is used to maintain the page mapping table, convert the memory address in the access request sent by the processor into a media address, and the media address is used to indicate the memory physical page to be accessed. If the memory physical page to be accessed is a memory physical page in the first storage medium, the access request is sent to the first storage medium; if the memory physical page to be accessed is a memory physical page in the second storage medium, the access request is sent to the cache management module 703.
映射模块701,还用于对混合内存系统中的内存物理页进行数据迁移检测,若检测到存在满足数据迁移条件的内存物理页,则通知迁移模块702对该内存物理页进行数据迁移,迁移模块702对该内存物理页进行数据迁移的过程可参考图4所示的数据处理方法。The mapping module 701 is also used to perform data migration detection on the memory physical pages in the hybrid memory system. If a memory physical page that meets the data migration conditions is detected, the migration module 702 is notified to perform data migration on the memory physical page. The process of the migration module 702 performing data migration on the memory physical page can refer to the data processing method shown in Figure 4.
缓存管理模块703,用于维护缓存映射表,接收到访问请求后,查询该访问请求是否命中第一存储介质中的缓存物理页(即缓存),若命中缓存物理页,将访问请求中的介质地址修改为命中的缓存物理页的介质地址,向第一存储介质发送修改后的访问请求,若没有命中缓存物理页,为第二存储介质中待访问的内存物理页分配新的缓存物理页,若访问请求为数据写入请求,则向新分配的缓存物理页写入数据,若访问请求为数据读取请求,则从第二存储介质中待访问的内存物理页读取数据,将读取的数据写入到新分配的缓存物理页,将读取的数据原路返回给处理器。The cache management module 703 is used to maintain the cache mapping table. After receiving an access request, it queries whether the access request hits the cache physical page (i.e., cache) in the first storage medium. If the cache physical page is hit, the medium address in the access request is modified to the medium address of the cache physical page that is hit, and the modified access request is sent to the first storage medium. If the cache physical page is not hit, a new cache physical page is allocated to the memory physical page to be accessed in the second storage medium. If the access request is a data write request, the data is written to the newly allocated cache physical page. If the access request is a data read request, the data is read from the memory physical page to be accessed in the second storage medium, the read data is written to the newly allocated cache physical page, and the read data is returned to the processor by the original path.
介质管理模块704,用于对装置700中的其他模块进行初始化和管理,例如初始化迁移周期、迁移阈值等。在一些实施例中,介质管理模块704还用于维护第二存储介质的候选列表。The media management module 704 is used to initialize and manage other modules in the device 700, such as initializing the migration period, migration threshold, etc. In some embodiments, the media management module 704 is also used to maintain a candidate list of the second storage medium.
在一些实施例中,若第二存储介质或者第二存储介质的控制器所要求的访问请求的数据格式和装置700中生成的访问请求的数据格式不一致,装置700还包括访问控制模块705,访问控制模块705用于转换接收到的访问请求的数据格式,使得转换后的访问请求的数据格式能够满足第二存储介质或者第二存储介质的控制器的要求,向第二存储介质或者第二存储介质的控制器发送转换后的访问请求,原路返回访问结果。 In some embodiments, if the data format of the access request required by the second storage medium or the controller of the second storage medium is inconsistent with the data format of the access request generated in the device 700, the device 700 also includes an access control module 705, and the access control module 705 is used to convert the data format of the received access request so that the data format of the converted access request can meet the requirements of the second storage medium or the controller of the second storage medium, send the converted access request to the second storage medium or the controller of the second storage medium, and return the access result via the original route.
以第二存储介质为非易失性内存主机控制器接口规范(non-volatile memory express,NVME)SSD为例,介质管理模块704还用于维护NVME SSD的NVME队列,该NVME队列用于存储块输入输出(blocking IO,BIO)请求。当接收到接收访问请求后,访问控制模块705将访问请求转换为BIO请求,将BIO请求加入到NVME队列,通知NVME SSD执行NVME队列中的BIO请求,然后,由NVME SSD从NVME队列中获取BIO请求,并基于BIO请求向访问控制模块705返回访问结果。Taking the second storage medium as a non-volatile memory express (NVME) SSD as an example, the media management module 704 is also used to maintain the NVME queue of the NVME SSD, which is used to store blocking IO (BIO) requests. After receiving the access request, the access control module 705 converts the access request into a BIO request, adds the BIO request to the NVME queue, notifies the NVME SSD to execute the BIO request in the NVME queue, and then the NVME SSD obtains the BIO request from the NVME queue and returns the access result to the access control module 705 based on the BIO request.
以第二存储介质为DDR接口的PCM为例,当接收到接收访问请求后,访问控制模块705将访问请求转换为DDR接口可识别的访问命令,向PCM发送访问命令,以对PCM进行数据的读取或写入。Taking the second storage medium as a PCM with a DDR interface as an example, after receiving an access request, the access control module 705 converts the access request into an access command recognizable by the DDR interface and sends the access command to the PCM to read or write data to the PCM.
应当理解,访问控制模块705接收到的访问请求可能是迁移模块702在进行数据迁移时,向第二存储介质下发的访问请求,也可能是缓存管理模块703下发的访问请求。It should be understood that the access request received by the access control module 705 may be an access request sent by the migration module 702 to the second storage medium when performing data migration, or may be an access request sent by the cache management module 703 .
图8是本申请提供的一种数据处理装置的结构示意图,如图8所示的装置800可以为前面各个实施例混合内存系统的管理器或管理器的部分,用于执行管理器所执行的数据处理方法,所述装置800应用于混合内存系统,所述混合内存系统包括第一存储介质和第二存储介质,所述第一存储介质的访问性能优于所述第二存储介质的访问性能,所述装置800包括:FIG8 is a schematic diagram of the structure of a data processing device provided by the present application. The device 800 shown in FIG8 may be a manager or a part of a manager of the hybrid memory system of the previous embodiments, and is used to execute the data processing method executed by the manager. The device 800 is applied to the hybrid memory system, and the hybrid memory system includes a first storage medium and a second storage medium. The access performance of the first storage medium is better than the access performance of the second storage medium. The device 800 includes:
获取模块801,用于获取所述第一存储介质中第一物理页的第一迁移检测结果,所述第一物理页是所述第一存储介质中作为内存使用的物理页;An acquisition module 801 is configured to acquire a first migration detection result of a first physical page in the first storage medium, where the first physical page is a physical page used as a memory in the first storage medium;
选择模块802,用于若所述第一迁移检测结果满足第一数据迁移条件,从所述第二存储介质中选择第二物理页,所述第二物理页为所述第二存储介质中作为内存使用的候选物理页;A selection module 802 is configured to select a second physical page from the second storage medium if the first migration detection result satisfies a first data migration condition, where the second physical page is a candidate physical page used as a memory in the second storage medium;
第一处理模块803,用于将所述第二物理页作为所述内存使用;A first processing module 803, configured to use the second physical page as the memory;
第二处理模块804,用于将所述第一物理页作为所述第二物理页的缓存。The second processing module 804 is configured to use the first physical page as a cache for the second physical page.
应理解的是,本申请实施例的装置800可以通过CPU实现,也可以通过专用集成电路(application-specific integrated circuit,ASIC)实现,也可以通过可编程逻辑器件(programmable logic device,PLD)实现,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD),现场可编程门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)、数据处理单元(data processing unit,DPU)、片上系统(system on chip,SoC)或其任意组合。装置800也可以通过软件实现图4至图6所示的方法,在通过软件实现时,装置800及其各个模块也可以为软件模块。It should be understood that the device 800 of the embodiment of the present application can be implemented by a CPU, an application-specific integrated circuit (ASIC), or a programmable logic device (PLD), and the above-mentioned PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), a data processing unit (DPU), a system on chip (SoC) or any combination thereof. The device 800 can also implement the method shown in Figures 4 to 6 by software. When implemented by software, the device 800 and its various modules can also be software modules.
在一种可能的实现方式中,所述第一处理模块803用于:将所述第二物理页所处的候选状态转换为内存状态,所述候选状态用于指示对应物理页作为所述候选物理页,所述内存状态用于指示对应物理页作为所述内存使用。In a possible implementation, the first processing module 803 is used to: convert the candidate state of the second physical page into a memory state, the candidate state is used to indicate that the corresponding physical page is the candidate physical page, and the memory state is used to indicate that the corresponding physical page is used as the memory.
在另一种可能的实现方式中,所述第一物理页的介质地址与所述混合内存系统中的第一内存地址之间具有第一映射关系,所述第一映射关系用于指示所述第一物理页处于所述内存状态,所述介质地址用于指示对应物理页在所属存储介质中的位置,所述第一内存地址用于指示第一物理页作为内存使用时在所述内存的位置;In another possible implementation, a first mapping relationship exists between the medium address of the first physical page and the first memory address in the hybrid memory system, the first mapping relationship is used to indicate that the first physical page is in the memory state, the medium address is used to indicate the position of the corresponding physical page in the storage medium, and the first memory address is used to indicate the position of the first physical page in the memory when the first physical page is used as a memory;
所述第一处理模块803用于:删除候选列表中所述第二物理页的介质地址,所述候选列表用于存储所述第二存储介质中作为所述内存使用的候选物理页的介质地址;将所述第一映射关系中的介质地址修改为所述第二物理页的介质地址。The first processing module 803 is used to: delete the media address of the second physical page in the candidate list, where the candidate list is used to store the media addresses of the candidate physical pages in the second storage medium used as the memory; and modify the media address in the first mapping relationship to the media address of the second physical page.
在另一种可能的实现方式中,所述第二处理模块804用于:将所述第一物理页所处的内存状态转换为缓存状态,将所述第二物理页与所述第一物理页关联,所述内存状态用于指示对应物理页作为所述内存使用,所述缓存状态用于指示对应物理页是关联的物理页的缓存。In another possible implementation, the second processing module 804 is used to: convert the memory state of the first physical page into a cache state, associate the second physical page with the first physical page, the memory state is used to indicate that the corresponding physical page is used as the memory, and the cache state is used to indicate that the corresponding physical page is the cache of the associated physical page.
在另一种可能的实现方式中,所述第二处理模块804用于:无效所述第一物理页的介质地址与所述混合内存系统中的第一内存地址之间的第一映射关系,所述第一映射关系用于指示所述第一物理页处于所述内存状态,所述介质地址用于指示对应物理页在所属存储介质中的位置,所述内存地址用于指示对应物理作为内存使用时在所述内存的位置;建立所述第一物理页的介质地址与所述第二物理页的介质地址之间的第二映射关系,所述第二映射关系用于指示所述第一物理页为关联的所述第二物理页的缓存。In another possible implementation, the second processing module 804 is used to: invalidate a first mapping relationship between a media address of the first physical page and a first memory address in the hybrid memory system, the first mapping relationship being used to indicate that the first physical page is in the memory state, the media address being used to indicate a location of the corresponding physical page in a corresponding storage medium, and the memory address being used to indicate a location of the corresponding physical page in the memory when the corresponding physical page is used as memory; establish a second mapping relationship between the media address of the first physical page and the media address of the second physical page, the second mapping relationship being used to indicate that the first physical page is a cache of the associated second physical page.
在另一种可能的实现方式中,所述获取模块801,还用于获取所述第二存储介质中第三物理页的第二迁移检测结果,所述第三物理页是所述第二存储介质中作为所述内存使用的物理页;In another possible implementation, the acquisition module 801 is further configured to acquire a second migration detection result of a third physical page in the second storage medium, where the third physical page is a physical page in the second storage medium used as the memory;
所述选择模块802,还用于若所述第二迁移检测结果满足第二数据迁移条件,从所述第一存储介质中选择第四物理页,所述第四物理页是所述第一存储介质中所述第三物理页的缓存; The selection module 802 is further configured to select a fourth physical page from the first storage medium if the second migration detection result satisfies a second data migration condition, wherein the fourth physical page is a cache of the third physical page in the first storage medium;
所述第一处理模块803,还用于将所述第四物理页作为所述内存使用;The first processing module 803 is further configured to use the fourth physical page as the memory;
所述第二处理模块804,还用于将所述第三物理页作为所述候选物理页。The second processing module 804 is further configured to use the third physical page as the candidate physical page.
在另一种可能的实现方式中,所述第一存储介质包括至少一个缓存物理页,每个缓存物理页与所述第二存储介质中作为所述内存使用的一个物理页关联,每个缓存物理页用于作为关联的物理页的缓存;In another possible implementation, the first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as the memory in the second storage medium, and each cache physical page is used as a cache of the associated physical page;
所述选择模块802,还用于将所述至少一个缓存物理页中与所述第三物理页关联的缓存物理页,确定为第四物理页。The selection module 802 is further configured to determine a cache physical page associated with the third physical page in the at least one cache physical page as a fourth physical page.
在另一种可能的实现方式中,所述第一处理模块803还用于:解除所述第三物理页与所述第四物理页之间的关联;将所述第四物理页所处的缓存状态转换为内存状态,所述缓存状态用于指示对应物理页是关联的物理页的缓存,所述内存状态用于指示对应物理页作为所述内存使用。In another possible implementation, the first processing module 803 is further used to: disassociate the third physical page from the fourth physical page; convert the cache state of the fourth physical page into a memory state, wherein the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page, and the memory state is used to indicate that the corresponding physical page is used as the memory.
在另一种可能的实现方式中,所述第三物理页的介质地址与所述混合内存系统中的第二内存地址之间具有第三映射关系,所述第三映射关系用于指示所述第三物理页处于所述内存状态,所述介质地址用于指示对应物理页在所属存储介质中的位置,所述内存地址用于指示对应物理作为内存使用时在所述内存的位置;In another possible implementation, a third mapping relationship is provided between the medium address of the third physical page and the second memory address in the hybrid memory system, the third mapping relationship is used to indicate that the third physical page is in the memory state, the medium address is used to indicate the position of the corresponding physical page in the storage medium to which it belongs, and the memory address is used to indicate the position of the corresponding physical page in the memory when the corresponding physical page is used as a memory;
所述第一处理模块803,还用于将所述第三映射关系中的介质地址修改为所述第四物理页的介质地址。The first processing module 803 is further configured to modify the medium address in the third mapping relationship to the medium address of the fourth physical page.
在另一种可能的实现方式中,所述装置800还包括:In another possible implementation, the device 800 further includes:
数据搬迁模块,用于查询所述第三物理页中还未缓存到所述第四物理页的数据,将查询到的数据迁移至所述第四物理页。The data migration module is used to query the data in the third physical page that has not been cached to the fourth physical page, and migrate the queried data to the fourth physical page.
在另一种可能的实现方式中,所述数据搬迁模块用于:获取所述第四物理页的缓存行的缓存行状态,所述缓存行状态用于指示所述缓存行是否存储数据;若所述缓存行状态指示所述缓存行没有存储数据,将所述第三物理页中与所述缓存行对应的存储空间的数据迁移至所述缓存行。In another possible implementation, the data relocation module is used to: obtain a cache line status of the cache line of the fourth physical page, the cache line status being used to indicate whether the cache line stores data; if the cache line status indicates that the cache line does not store data, migrate data in the storage space corresponding to the cache line in the third physical page to the cache line.
在另一种可能的实现方式中,所述装置800还包括:In another possible implementation, the device 800 further includes:
写入模块,用于若所述第二迁移检测结果满足第三数据迁移条件,将所述第四物理页所存储的数据写入所述第三物理页;a writing module, configured to write the data stored in the fourth physical page into the third physical page if the second migration detection result satisfies a third data migration condition;
解除模块,用于解除所述第三物理页与所述第四物理页之间的关联。The releasing module is used to release the association between the third physical page and the fourth physical page.
在另一种可能的实现方式中,所述解除模块用于:无效所述第三物理页的介质地址与所述第四物理页的介质地址之间的第四映射关系,所述介质地址用于指示对应物理页在所属存储介质中的位置。In another possible implementation, the release module is used to: invalidate a fourth mapping relationship between the media address of the third physical page and the media address of the fourth physical page, where the media address is used to indicate a location of a corresponding physical page in a corresponding storage medium.
在另一种可能的实现方式中,所述装置800还包括访问模块;In another possible implementation, the apparatus 800 further includes an access module;
所述获取模块801,还用于获取对所述混合内存系统中第一目标物理页的访问请求;The acquisition module 801 is further used to acquire an access request to a first target physical page in the hybrid memory system;
所述访问模块用于:若所述第一目标物理页属于所述第一存储介质,基于访问请求,对所述第一目标物理页进行访问;若所述第一目标物理页属于所述第二存储介质,基于所述访问请求,对所述第一存储介质中与所述第一目标物理页关联的第二目标物理页进行访问,所述第二目标物理页为所述第一目标物理页的缓存。The access module is used to: if the first target physical page belongs to the first storage medium, access the first target physical page based on an access request; if the first target physical page belongs to the second storage medium, access the second target physical page associated with the first target physical page in the first storage medium based on the access request, and the second target physical page is a cache of the first target physical page.
上述所有可能的实现方案,可以采用任意结合形成本申请的可选实施例,在此不再一一赘述。All possible implementation schemes described above may be arbitrarily combined to form optional embodiments of the present application, and will not be described in detail here.
应理解,对于装置700和装置800中的任一装置,该装置对应于上述方法实施例中的管理器,该装置中的各模块和上述其他操作和/或功能分别为了实现方法实施例中的管理器所实施的各种步骤和方法,具体细节可参见上述方法实施例,为了简洁,在此不再赘述。It should be understood that for any device in device 700 and device 800, the device corresponds to the manager in the above-mentioned method embodiment, and the modules in the device and the above-mentioned other operations and/or functions are respectively various steps and methods implemented by the manager in the method embodiment. The specific details can be found in the above-mentioned method embodiment, and for the sake of brevity, they will not be repeated here.
应理解,对于装置700和装置800中的任一装置,该任一装置在进行数据处理时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将该装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的装置与上述方法实施例属于同一构思,其具体实现过程详见上述方法实施例,这里不再赘述。It should be understood that for any device in the device 700 and the device 800, when the device performs data processing, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the above method embodiment belong to the same concept, and the specific implementation process is detailed in the above method embodiment, which will not be repeated here.
应理解,对于装置700和装置800中的任一装置可以相当于图1至图3中的管理器13、13a以及13b,或者相当于管理器13、13a以及13b中的执行部件。It should be understood that any one of the apparatuses 700 and 800 may be equivalent to the managers 13, 13a and 13b in FIG. 1 to FIG. 3, or equivalent to the execution components in the managers 13, 13a and 13b.
图9是本申请提供的一种芯片的结构示意图,如图9所示,芯片900包括处理器901和接口电路902,其中,接口电路902,用于接收指令并传输至处理器901。处理器901,例如可以是装置700或装置800的一种具体实现形式,可以用于执行上述应用于数据处理方法。处理器901与存储器903耦合,存储器903用于存储程序代码,当该程序代码被处理器901执行时,使得处理器901、接口电路902以及存储器903所组成的芯片系统实现上述图4至图6中任一方法实施例中的方法的操作步骤。 FIG9 is a schematic diagram of the structure of a chip provided by the present application. As shown in FIG9 , the chip 900 includes a processor 901 and an interface circuit 902, wherein the interface circuit 902 is used to receive instructions and transmit them to the processor 901. The processor 901, for example, can be a specific implementation form of the device 700 or the device 800, and can be used to execute the above-mentioned data processing method. The processor 901 is coupled to the memory 903, and the memory 903 is used to store program code. When the program code is executed by the processor 901, the chip system composed of the processor 901, the interface circuit 902 and the memory 903 implements the operation steps of the method in any of the method embodiments in FIG4 to FIG6.
可选地,该芯片系统中的处理器901有至少一个,应理解,在本申请实施例中,处理器901可以是CPU或其他通用处理器,处理器901还可以是一个或多个用于实现本申请方案的集成电路,例如,数字信号处理器(digital signal processing,DSP)、ASIC、PLD、FPGA或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者是任何常规的处理器等。Optionally, there is at least one processor 901 in the chip system. It should be understood that in the embodiment of the present application, the processor 901 may be a CPU or other general-purpose processor. The processor 901 may also be one or more integrated circuits for implementing the solution of the present application, such as a digital signal processor (DSP), ASIC, PLD, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.
可选地,该芯片系统中的存储器903也可以为一个或多个。存储器903可以与处理器901集成在一起,也可以和处理器901分离设置,本申请并不限定。示例性的,存储器903可以与处理器901集成在同一块芯片上,如图9所示,存储器903也可以和处理器901分别设置在不同的芯片上,本申请对存储器903的类型以及存储器903与处理器901的设置方式不作具体限定。Optionally, the memory 903 in the chip system may be one or more. The memory 903 may be integrated with the processor 901, or may be separately arranged with the processor 901, which is not limited in this application. Exemplarily, the memory 903 may be integrated with the processor 901 on the same chip, as shown in FIG9 , or the memory 903 may be arranged on different chips from the processor 901, and this application does not specifically limit the type of the memory 903 and the arrangement of the memory 903 and the processor 901.
其中,存储器903可以包括只读存储器和随机存取存储器,并向处理器901提供指令和数据。存储器903还可以包括非易失性随机存取存储器。例如,存储器903还可以存储设备类型的信息。存储器903还可以是易失性存储器,或可包括易失性和非易失性存储器两者。The memory 903 may include a read-only memory and a random access memory, and provide instructions and data to the processor 901. The memory 903 may also include a non-volatile random access memory. For example, the memory 903 may also store information about the device type. The memory 903 may also be a volatile memory, or may include both volatile and non-volatile memories.
其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data date SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous connection dynamic random access memory (SLDRAM) and direct memory bus random access memory (DR RAM).
示例性的,该芯片系统可以是FPGA,可以是ASIC,还可以是SoC,还可以是CPU,还可以是网络处理器(network processor,NP),还可以是数字信号处理电路(digital signal processor,DSP),还可以是微控制器(micro controller unit,MCU),还可以是PLD)或其他集成芯片。Exemplarily, the chip system can be FPGA, ASIC, SoC, CPU, network processor (NP), digital signal processor (DSP), microcontroller unit (MCU), PLD) or other integrated chips.
本申请还提供了一种计算机可读存储介质,例如包括程序代码的存储器,上述程序代码可由电子设备(或芯片)中的处理器执行以完成上述实施例中的数据处理方法。该计算机可读存储介质的实现方式可参考与图9中的存储器903。The present application also provides a computer-readable storage medium, such as a memory including a program code, which can be executed by a processor in an electronic device (or chip) to complete the data processing method in the above embodiment. The implementation of the computer-readable storage medium can refer to the memory 903 in Figure 9.
本申请还提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括程序代码,该程序代码存储在计算机可读存储介质中,处理器从计算机可读存储介质读取该程序代码,处理器执行该程序代码,使得处理器所在芯片或电子设备执行上述数据处理方法。The present application also provides a computer program product or a computer program, which includes a program code, and the program code is stored in a computer-readable storage medium. A processor reads the program code from the computer-readable storage medium, and the processor executes the program code, so that the chip or electronic device where the processor is located executes the above-mentioned data processing method.
另外,本申请还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中数据处理方法。In addition, the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory so that the chip executes the data processing method in the above-mentioned method embodiments.
其中,本申请提供的装置、设备、计算机可读存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。Among them, the devices, equipment, computer-readable storage media, computer program products or chips provided in this application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
上述实施例,可以全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载或执行所述计算机程序指令时,全部或部分地产生按照本发明本申请实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)或者半导体介质。半导体介质可以是固态硬盘(solid state disk,SSD)。The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiment of the present application of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD) or a semiconductor medium. The semiconductor medium can be a solid state disk (SSD).
以上所述,仅为本申请的具体实施方式。熟悉本技术领域的技术人员根据本申请提供的具体实施方式,可想到变化或替换,都应涵盖在本申请的保护范围之内。 The above is only a specific implementation of the present application. Those skilled in the art may conceive of changes or substitutions based on the specific implementation provided by the present application, which should all be included in the protection scope of the present application.

Claims (13)

  1. 一种数据处理方法,其特征在于,所述方法应用于混合内存系统,所述混合内存系统包括第一存储介质和第二存储介质,所述第一存储介质的访问性能优于所述第二存储介质的访问性能,所述方法包括:A data processing method, characterized in that the method is applied to a hybrid memory system, the hybrid memory system includes a first storage medium and a second storage medium, the access performance of the first storage medium is better than the access performance of the second storage medium, the method includes:
    获取所述第一存储介质中第一物理页的第一迁移检测结果,所述第一物理页是所述第一存储介质中作为内存使用的物理页;Acquire a first migration detection result of a first physical page in the first storage medium, where the first physical page is a physical page used as a memory in the first storage medium;
    若所述第一迁移检测结果满足第一数据迁移条件,从所述第二存储介质中选择第二物理页,所述第二物理页为所述第二存储介质中作为内存使用的候选物理页;If the first migration detection result satisfies a first data migration condition, selecting a second physical page from the second storage medium, the second physical page being a candidate physical page used as a memory in the second storage medium;
    将所述第二物理页作为所述内存使用;using the second physical page as the memory;
    将所述第一物理页作为所述第二物理页的缓存。The first physical page is used as a cache for the second physical page.
  2. 根据权利要求1所述的方法,其特征在于,所述将所述第二物理页作为所述内存使用包括:The method according to claim 1, wherein using the second physical page as the memory comprises:
    将所述第二物理页所处的候选状态转换为内存状态,所述候选状态用于指示对应物理页作为所述候选物理页,所述内存状态用于指示对应物理页作为所述内存使用。The candidate state of the second physical page is converted into a memory state, wherein the candidate state is used to indicate that the corresponding physical page is used as the candidate physical page, and the memory state is used to indicate that the corresponding physical page is used as the memory.
  3. 根据权利要求1所述的方法,其特征在于,所述将所述第一物理页作为所述第二物理页的缓存包括:The method according to claim 1, wherein using the first physical page as a cache of the second physical page comprises:
    将所述第一物理页所处的内存状态转换为缓存状态,将所述第二物理页与所述第一物理页关联,所述内存状态用于指示对应物理页作为所述内存使用,所述缓存状态用于指示对应物理页是关联的物理页的缓存。The memory state of the first physical page is converted into a cache state, and the second physical page is associated with the first physical page, wherein the memory state is used to indicate that the corresponding physical page is used as the memory, and the cache state is used to indicate that the corresponding physical page is a cache of the associated physical page.
  4. 根据权利要求1-3中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1 to 3, characterized in that the method further comprises:
    获取所述第二存储介质中第三物理页的第二迁移检测结果,所述第三物理页是所述第二存储介质中作为所述内存使用的物理页;Acquire a second migration detection result of a third physical page in the second storage medium, where the third physical page is a physical page in the second storage medium used as the memory;
    若所述第二迁移检测结果满足第二数据迁移条件,从所述第一存储介质中选择第四物理页,所述第四物理页是所述第一存储介质中所述第三物理页的缓存;If the second migration detection result satisfies a second data migration condition, selecting a fourth physical page from the first storage medium, the fourth physical page being a cache of the third physical page in the first storage medium;
    将所述第四物理页作为所述内存使用;Using the fourth physical page as the memory;
    将所述第三物理页作为所述候选物理页。The third physical page is used as the candidate physical page.
  5. 根据权利要求4所述的方法,其特征在于,所述第一存储介质包括至少一个缓存物理页,每个缓存物理页与所述第二存储介质中作为所述内存使用的一个物理页关联,每个缓存物理页用于作为关联的物理页的缓存;The method according to claim 4, characterized in that the first storage medium includes at least one cache physical page, each cache physical page is associated with a physical page used as the memory in the second storage medium, and each cache physical page is used as a cache of the associated physical page;
    所述从所述第一存储介质中选择第四物理页包括:The selecting a fourth physical page from the first storage medium comprises:
    将所述至少一个缓存物理页中与所述第三物理页关联的缓存物理页,确定为第四物理页。A cache physical page associated with the third physical page in the at least one cache physical page is determined as a fourth physical page.
  6. 根据权利要求4所述的方法,其特征在于,所述将所述第四物理页作为所述内存使用包括:The method according to claim 4, wherein using the fourth physical page as the memory comprises:
    解除所述第三物理页与所述第四物理页之间的关联;disassociating the third physical page from the fourth physical page;
    将所述第四物理页所处的缓存状态转换为内存状态,所述缓存状态用于指示对应物理页是关联的物理页的缓存,所述内存状态用于指示对应物理页作为所述内存使用。The cache state of the fourth physical page is converted into a memory state, wherein the cache state is used to indicate that the corresponding physical page is a cache of an associated physical page, and the memory state is used to indicate that the corresponding physical page is used as the memory.
  7. 根据权利要求4所述的方法,其特征在于,所述将所述第四物理页作为所述内存使用之前,所述方法还包括:The method according to claim 4, characterized in that before using the fourth physical page as the memory, the method further comprises:
    查询所述第三物理页中还未缓存到所述第四物理页的数据,将查询到的数据迁移至所述第四物理页。The third physical page is queried for data that has not been cached to the fourth physical page, and the queried data is migrated to the fourth physical page.
  8. 根据权利要求7所述的方法,其特征在于,所述查询所述第三物理页中还未缓存到所述第四物理页的数据,将查询到的数据迁移至所述第四物理页包括:The method according to claim 7, wherein querying the data in the third physical page that has not been cached to the fourth physical page and migrating the queried data to the fourth physical page comprises:
    获取所述第四物理页的缓存行的缓存行状态,所述缓存行状态用于指示所述缓存行是否存储数据; Acquire a cache line state of a cache line of the fourth physical page, wherein the cache line state is used to indicate whether the cache line stores data;
    若所述缓存行状态指示所述缓存行没有存储数据,将所述第三物理页中与所述缓存行对应的存储空间的数据迁移至所述缓存行。If the cache line status indicates that the cache line does not store data, data in the storage space corresponding to the cache line in the third physical page is migrated to the cache line.
  9. 根据权利要求4所述的方法,其特征在于,所述获取所述第二存储介质中第三物理页的第二迁移检测结果之后,所述方法还包括:The method according to claim 4, characterized in that after obtaining the second migration detection result of the third physical page in the second storage medium, the method further comprises:
    若所述第二迁移检测结果满足第三数据迁移条件,将所述第四物理页所存储的数据写入所述第三物理页;If the second migration detection result satisfies a third data migration condition, writing the data stored in the fourth physical page into the third physical page;
    解除所述第三物理页与所述第四物理页之间的关联。The association between the third physical page and the fourth physical page is released.
  10. 根据权利要求1-3以及5-9中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 1-3 and 5-9, characterized in that the method further comprises:
    获取对所述混合内存系统中第一目标物理页的访问请求;Obtaining an access request to a first target physical page in the hybrid memory system;
    若所述第一目标物理页属于所述第一存储介质,基于访问请求,对所述第一目标物理页进行访问;If the first target physical page belongs to the first storage medium, accessing the first target physical page based on the access request;
    若所述第一目标物理页属于所述第二存储介质,基于所述访问请求,对所述第一存储介质中与所述第一目标物理页关联的第二目标物理页进行访问,所述第二目标物理页为所述第一目标物理页的缓存。If the first target physical page belongs to the second storage medium, based on the access request, a second target physical page associated with the first target physical page in the first storage medium is accessed, and the second target physical page is a cache of the first target physical page.
  11. 一种数据处理装置,其特征在于,所述装置应用于混合内存系统,所述混合内存系统包括第一存储介质和第二存储介质,所述第一存储介质的访问性能优于所述第二存储介质的访问性能,所述装置包括:A data processing device, characterized in that the device is applied to a hybrid memory system, the hybrid memory system includes a first storage medium and a second storage medium, the access performance of the first storage medium is better than the access performance of the second storage medium, and the device includes:
    获取模块,用于获取所述第一存储介质中第一物理页的第一迁移检测结果,所述第一物理页是所述第一存储介质中作为内存使用的物理页;an acquisition module, configured to acquire a first migration detection result of a first physical page in the first storage medium, where the first physical page is a physical page used as a memory in the first storage medium;
    选择模块,用于若所述第一迁移检测结果满足第一数据迁移条件,从所述第二存储介质中选择第二物理页,所述第二物理页为所述第二存储介质中作为内存使用的候选物理页;A selection module, configured to select a second physical page from the second storage medium if the first migration detection result satisfies a first data migration condition, the second physical page being a candidate physical page used as a memory in the second storage medium;
    第一处理模块,用于将所述第二物理页作为所述内存使用;A first processing module, configured to use the second physical page as the memory;
    第二处理模块,用于将所述第一物理页作为所述第二物理页的缓存。The second processing module is configured to use the first physical page as a cache for the second physical page.
  12. 一种芯片,其特征在于,所述芯片包括处理器,所述处理器用于执行至少一条程序代码,使得所述芯片执行如权利要求1至权利要求10中任一项所述的方法。A chip, characterized in that the chip comprises a processor, and the processor is used to execute at least one program code, so that the chip executes the method as described in any one of claims 1 to claim 10.
  13. 一种计算机可读存储介质,其特征在于,所述存储介质中存储有至少一条程序代码,所述至少一条程序代码由处理器读取以使芯片执行如权利要求1至权利要求10中任一项所述的方法。 A computer-readable storage medium, characterized in that at least one program code is stored in the storage medium, and the at least one program code is read by a processor to enable a chip to execute the method as described in any one of claims 1 to claim 10.
PCT/CN2023/103852 2022-10-20 2023-06-29 Data processing method and apparatus, and chip and computer-readable storage medium WO2024082702A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211289255.5A CN117917649A (en) 2022-10-20 2022-10-20 Data processing method, device, chip and computer readable storage medium
CN202211289255.5 2022-10-20

Publications (1)

Publication Number Publication Date
WO2024082702A1 true WO2024082702A1 (en) 2024-04-25

Family

ID=90729557

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103852 WO2024082702A1 (en) 2022-10-20 2023-06-29 Data processing method and apparatus, and chip and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN117917649A (en)
WO (1) WO2024082702A1 (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092534A (en) * 2013-02-04 2013-05-08 中国科学院微电子研究所 Scheduling method and device of memory structure
CN107193646A (en) * 2017-05-24 2017-09-22 中国人民解放军理工大学 A kind of high-efficiency dynamic paging method that framework is hosted based on mixing
CN108804350A (en) * 2017-04-27 2018-11-13 华为技术有限公司 A kind of memory pool access method and computer system
CN110347510A (en) * 2019-07-09 2019-10-18 中国科学院微电子研究所 A kind of management method, system, equipment and medium mixing memory

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103092534A (en) * 2013-02-04 2013-05-08 中国科学院微电子研究所 Scheduling method and device of memory structure
CN108804350A (en) * 2017-04-27 2018-11-13 华为技术有限公司 A kind of memory pool access method and computer system
CN107193646A (en) * 2017-05-24 2017-09-22 中国人民解放军理工大学 A kind of high-efficiency dynamic paging method that framework is hosted based on mixing
CN110347510A (en) * 2019-07-09 2019-10-18 中国科学院微电子研究所 A kind of management method, system, equipment and medium mixing memory

Also Published As

Publication number Publication date
CN117917649A (en) 2024-04-23

Similar Documents

Publication Publication Date Title
US11954043B2 (en) Memory system and method for controlling nonvolatile memory
US11797436B2 (en) Memory system and method for controlling nonvolatile memory
CN110555001B (en) Data processing method, device, terminal and medium
WO2023125524A1 (en) Data storage method and system, storage access configuration method and related device
EP3115904A1 (en) Method for managing a distributed cache
CN115794669A (en) Method, device and related equipment for expanding memory
JP6343722B2 (en) Method and device for accessing a data visitor directory in a multi-core system
US20220107752A1 (en) Data access method and apparatus
WO2024060710A1 (en) Page swap-in method and apparatus
US20230088344A1 (en) Storage medium management method and apparatus, device, and computer-readable storage medium
WO2024082702A1 (en) Data processing method and apparatus, and chip and computer-readable storage medium
WO2024061344A1 (en) Data migration method and apparatus, and chip and computer-readable storage medium
CN116644006B (en) Memory page management method, system, device, equipment and computer medium
WO2024066575A1 (en) Method and device for distinguishing cold and hot physical pages, and chip and storage medium
JP7524443B2 (en) MEMORY SYSTEM AND CONTROL METHOD - Patent application
CN116880754A (en) Data access heat statistics method and device
CN115858422A (en) Page table processing method, electronic device and storage medium
CN116339611A (en) Cache management method, device, system and storage medium
CN115827688A (en) Data access method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23878699

Country of ref document: EP

Kind code of ref document: A1