Memory data migration method, related apparatus, and computer device
By using a periodic sampling method based on sampling rules to count the memory page access frequency in the hybrid memory system, the problem of long memory access hotness statistics period in the existing technology is solved, fast and accurate data migration is achieved, and the system's data processing is improved. Speed and performance.
Patent Information
- Application Number
- PCT/CN2024/083897
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-31
- Filing Date
- 2024-03-26
- Publication Date
- 2024-10-03
AI Technical Summary
In the existing technology, the memory access hotness is determined by counting the access frequency of the memory page. The cycle of data migration is relatively long, resulting in the processor being unable to obtain the page access frequency in time, affecting the input/output performance of the system, and possibly causing fast access speeds. The memory stores infrequently accessed data or the memory with slow access speed stores frequently accessed data, which affects the data processing speed and latency.
A periodic sampling method based on sampling rules is used to sample access requests and count the access frequency of the page, so as to trigger data migration between different types of memory media according to access popularity, ensuring the statistical accuracy of access frequency and reducing the amount of data, making processing more convenient. The server can quickly obtain the page access frequency, thereby migrating hot data to local memory and cold data to remote memory, improving data processing speed and reducing latency.
Through periodic sampling, the statistical accuracy of page access frequency and the timeliness of data migration are improved, the system's data processing speed is improved, the data processing delay is reduced, and the system's access performance is significantly improved.
Smart Images

Figure CN2024083897_03102024_PF_FP_ABST
Abstract
Description
Memory data migration method, related device and computer equipment
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on March 31, 2023, with application number 202310379809.9 and application name “Memory data migration method, related devices and computer equipment”, all of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computers, and in particular to a memory data migration method, related devices, and computer equipment. Background Art
[0003] Currently, memory access popularity is determined by counting the access frequency of memory pages, and data migration is performed based on memory access popularity. Specifically, it is hoped that memories with fast access speeds will store frequently accessed data, while memories with slow access speeds will store less frequently accessed data. However, the statistical cycle for page access frequency is long, and the processor may not be able to obtain page access frequency in a timely manner, affecting the system's input / output (I / O) performance. This may cause memories with fast access speeds to store less frequently accessed data, or memories with slow access speeds to store frequently accessed data, affecting the system's data processing speed and latency.
[0004] Summary of the Invention
[0005] The present application provides a memory data migration method, related devices and computer equipment, thereby improving the data processing speed of the system and reducing the data processing delay.
[0006] In a first aspect, a method for memory data migration is provided. The method is applied to a hybrid memory system, wherein the hybrid memory system includes multiple processors and multiple different types of memory media, wherein the processors are associated with at least two different types of memory media. The method includes: sampling access requests obtained according to a periodic sampling method indicated by a sampling rule, counting the access frequency of pages indicated by the sampling results to determine the access popularity of the pages based on the access frequency of the pages, and triggering data migration between at least two different types of memory media based on the access popularity. The access request is used to indicate the operation of the memory media by an application running on a processor in a computer device. The access frequency intuitively indicates the frequency with which a data block is accessed by an application. The more times a data block is accessed by an application, the more frequently the data block is accessed by the application, and the higher the access popularity of the data block; the fewer times a data block is accessed by an application, the less frequently the data block is accessed by the application, and the lower the access popularity of the data block.
[0007] If a page is frequently accessed, the number of access requests for the access page is large. In this way, the memory data migration method provided by the present application samples the access requests in multiple ways based on the periodic sampling method indicated by the sampling rule, so the probability of the access requests of the frequently accessed pages being sampled is relatively high, and the trend of the page being frequently accessed is determined based on the changing trend of the page access frequency, thereby ensuring the statistical accuracy of the page access frequency and reducing the amount of statistical data of the page access frequency, so that the processor can obtain the page access frequency as quickly as possible. When triggering data migration based on the page access heat, hot data can be migrated to the near-end memory and cold data can be migrated to the far-end memory, so that the processor can obtain frequently accessed data from the near-end memory as quickly as possible, thereby improving the data processing speed of the system and reducing the data processing delay.
[0008] The access speed of the near-end memory is greater than the access speed of the far-end memory. For example, the near-end memory may be dynamic random access memory (DRAM) or double data rate synchronous dynamic random access memory (DDR SDRAM). The far-end memory may be storage-class memory (SCM).
[0009] The multiple different types of memory media include a first memory medium and a second memory medium. The memory media associated with the processor include the first memory medium and the second memory medium. If the access speed of the first memory medium is greater than the access speed of the second memory medium, the access latency of the first memory medium is less than the access latency of the second memory medium. For example, the first memory medium may be local memory, and the second memory medium may be remote memory.
[0010] In a possible implementation, sampling the obtained access request according to the sampling rule to obtain the sampling result includes: sampling the obtained access request according to the time interval-based sampling mode indicated by the sampling rule to obtain the sampling result.
[0011] Therefore, the memory access request is sampled at intervals, which reduces the reliance on storage of statistical data on page access frequency within the sampling interval. Moreover, the page access frequency only needs to be transmitted within the sampling interval, which reduces the demand for instantaneous bandwidth.
[0012] In another possible implementation, sampling the obtained access requests according to the time interval sampling pattern indicated by the sampling rule to obtain the sampling result includes: sampling the obtained access requests according to the sampling frequency indicated by the sampling rule to obtain the sampling result. The sampling frequency is used to indicate the number of access requests between which the sampling is performed.
[0013] The sampling frequency is determined by the memory bandwidth. This balances the bandwidth with the amount of statistical data on page access frequencies, allowing the processor to obtain page access frequencies as quickly as possible. This avoids situations where the processor is unable to obtain page access frequencies in a timely manner due to excessive amounts of data due to bandwidth limitations.
[0014] Optionally, the sampling frequency is determined based on the number of pages in the memory. When there are many pages, the sampling frequency can indicate a smaller number of access requests per sampling interval. When there are fewer pages, the sampling frequency can indicate a larger number of access requests per sampling interval, so as to capture the access frequency of each page as closely as possible.
[0015] In another possible implementation, sampling the obtained access requests according to the time interval sampling pattern indicated by the sampling rule to obtain a sampling result includes sampling the obtained access requests according to a quantity characteristic of the access requests within a sampling period indicated by the sampling rule to obtain a sampling result. The sampling period indicates the length of time between sampling intervals.
[0016] In another possible implementation, sampling the obtained access requests according to the sampling rules to obtain the sampling results includes: sampling the obtained access requests at least once according to the sampling number of times indicated by the sampling rules to obtain the sampling results. Thus, by sampling multiple access requests multiple times, the statistical accuracy of the page access frequency can be improved.
[0017] In another possible implementation, sampling the obtained access request according to the sampling rule to obtain the sampling result includes: sampling the sampling sample in the obtained access request according to the sampling rule to obtain the sampling result.
[0018] In another possible implementation, counting the access frequency of the page indicated by the sampling result includes determining an address index based on the address indicated by the access request, and counting the access frequency associated with the address index, wherein the address indicated by the access request is used to indicate the page. Thus, the address indicated by the access request is trimmed, thereby reducing the storage space occupied by storing the access frequency of the page.
[0019] In another possible implementation, the access request is used to instruct an application program running on a processor in a computer device to operate on a memory in an interleaved manner.
[0020] In a second aspect, a memory data migration device is provided, which includes modules for executing the memory data migration method in the first aspect or any possible design of the first aspect.
[0021] In a third aspect, a memory is provided, which includes a storage medium and a controller, the storage medium being used to store a set of computer instructions; when the controller executes the set of computer instructions, the operating steps of the method in the first aspect or any possible implementation of the first aspect are executed to identify the access frequency of data blocks in the memory by applications.
[0022] In a fourth aspect, a chip is provided, comprising: a processor and a power supply circuit; wherein the power supply circuit is used to supply power to the processor; and the processor is used to execute the operating steps of the method in the first aspect or any possible implementation of the first aspect to identify the access frequency of a data block in a memory by an application.
[0023] In a fifth aspect, a processor is provided, which includes at least two different types of associated memory media, and the processor is used to execute the operating steps of the method in the first aspect or any possible implementation of the first aspect to identify the access frequency of data blocks in the memory medium by applications.
[0024] In a sixth aspect, a computer device is provided, which includes a memory, multiple different types of memory media and a processor, wherein the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the processor is used to execute the operating steps of the method in the first aspect or any possible implementation of the first aspect to identify the access frequency of data blocks in the memory by applications.
[0025] In the seventh aspect, a computer-readable storage medium is provided, comprising: computer software instructions; when the computer software instructions are executed in a processor, the processor executes the operating steps of the method described in the first aspect or any possible implementation of the first aspect.
[0026] In an eighth aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to execute the operating steps of the method described in the first aspect or any possible implementation of the first aspect.
[0027] The technical effects brought about by any design method in the second to eighth aspects can be referred to the technical effects brought about by the first aspect or different design methods in the first aspect, and will not be repeated here.
[0028] Based on the implementation methods provided in the above aspects, this application can also be further combined to provide more implementation methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] FIG1 is a schematic diagram of the composition of a computer device provided by the present application;
[0030] FIG2 is a schematic diagram of a memory access heat statistics scenario provided by this application;
[0031] FIG3 is a flow chart of a memory data migration method provided by the present application;
[0032] FIG4 is a schematic diagram of a sampling access request based on a sampling frequency provided by the present application;
[0033] FIG5 is a schematic diagram of a sampling access request based on a sampling period provided by the present application;
[0034] FIG6 is a schematic diagram of a method for obtaining a sampling sample provided by the present application;
[0035] FIG7 is a schematic diagram of an address clipping method provided by the present application;
[0036] FIG8 is a flow chart of a memory access heat statistics method provided by the present application;
[0037] FIG9 is a flow chart of a method for obtaining access frequency provided by the present application;
[0038] FIG10 is a schematic structural diagram of a memory data migration device provided in this application. DETAILED DESCRIPTION
[0039] For the convenience of description, the terms involved in this application are first briefly introduced.
[0040] In the computer memory system hierarchy, the closer the memory is to the processor, the faster it is to access and the smaller its storage capacity. In descending order of distance from the processor, memory is divided into registers, cache memory, main memory, and external memory.
[0041] Main memory, also known as internal memory, is a crucial component of a computer system, serving as the bridge between external memory and the processor. It temporarily stores computational data within the processor and data exchanged between the processor and external memory, such as a hard drive. For example, when a computer starts running, data to be computed is loaded from main memory into the processor for computation. Once the computation is complete, the processor stores the result in main memory. Examples of main memory include dynamic random access memory (DRAM) and double data rate synchronous DRAM (DDR SDRAM).
[0042] External storage, also known as auxiliary storage or simply external memory, has a larger storage capacity than main memory but slower access speeds. Examples of external storage include network storage, solid-state drives (SSDs), and hard disk drives (HDDs).
[0043] Cache memory is a high-speed, small-capacity memory located between the processor and main memory. Cache memory is often referred to as cache. Compared to main memory, cache has a smaller storage capacity and faster access speeds. Cache includes Level 1 (L1 cache), Level 2 (L2 cache), and Level 3 (L3 cache). Level 1 cache is located inside the processor core. Level 2 cache can be located inside or outside the processor core. Level 1 and Level 2 caches are typically exclusive to the processor core they are located in. Level 3 cache is typically located outside the processor core and is shared by multiple processor cores.
[0044] A register is a small memory inside a processor that temporarily stores data and results involved in a calculation. A register can be a commonly used sequential logic circuit.
[0045] Hierarchical Storage Technology (HST) stores data in different storage devices with different performance based on data importance, access frequency, retention time, storage capacity, performance, and other indicators. Hierarchical storage management enables automatic migration of data between storage devices.
[0046] Hot data refers to data that is frequently accessed by the processor. Storing hot data in near memory allows the processor to access the data as quickly as possible, increasing the system's data processing speed and reducing data processing latency, significantly improving system access performance.
[0047] Cold data refers to data that is infrequently accessed by the processor. Storing cold data in far memory allows for more data storage, allowing near memory to store more hot data, improving near memory resource utilization and reducing system costs. For example, cache memory is considered near memory, while main memory is considered far memory. Another example is the relationship between main memory and external memory: main memory is considered near memory, while external memory is considered far memory.
[0048] A cache line is a unit of memory that a computer device uses to read or write data. A cache line can be 64 bytes in size.
[0049] A page is a unit used by a computer to manage memory storage space. For example, a page size can be 4KB, 2 megabytes (MB), or other byte sizes. A 4KB page is called a small page. A 2MB page is called a large page. The smaller the page, the more resources the computer requires to manage memory; the larger the page, the fewer resources the computer requires to manage memory. A page can include multiple cache lines, meaning the page size is a multiple of the cache line size.
[0050] Interleaving distributes memory access data evenly across multiple memory channels, based on unit storage space (for example, cache lines). Interleaving is configurable by the system administrator and can be applied across multiple memory channels connected to a single processor or across multiple memory channels of multiple processors.
[0051] Memory channels refer to multiple memory channels connected to a processor in a computer device. Processors can use interleaving techniques to operate on memory. For example, the processor evenly distributes data to be written to memory across multiple memory channels based on cache line sizes. Furthermore, the processor reads data from multiple memory channels based on cache line sizes. Data processing across multiple memory channels improves memory bandwidth utilization and processing performance.
[0052] The sampling frequency (frequency of sample), also known as sampling speed or sampling rate, indicates the number of samples extracted from a continuous signal to form a discrete signal per unit time, expressed in Hertz (Hz). The reciprocal of the sampling frequency is the sampling period or sampling time, and the sampling frequency is the time interval between samples. In layman's terms, the sampling frequency refers to the number of signal samples a computer can collect per unit time.
[0053] In order to improve the data processing speed of the system and reduce the data processing latency, the present application provides a memory data migration method, which is applied to a hybrid memory system, wherein the hybrid memory system includes multiple processors and multiple different types of memory media, and the processors are associated with at least two different types of memory media. The method includes: sampling the obtained access requests according to a periodic sampling method indicated by a sampling rule, counting the access frequency of the page indicated by the sampling result, so as to determine the access popularity of the page based on the access frequency of the page, and triggering data migration between at least two different types of memory media based on the access popularity.
[0054] Due to the periodic sampling method indicated by the sampling rules, access requests are sampled in multiple ways, ensuring the statistical accuracy of the page access frequency and reducing the statistical data volume of the page access frequency, so that the processor can obtain the page access frequency as quickly as possible. When data migration is triggered based on the page access popularity, hot data can be migrated to the near-end memory and cold data can be migrated to the far-end memory, so that the processor can obtain frequently accessed data from the near-end memory as quickly as possible, thereby improving the system's data processing speed and reducing data processing latency, significantly improving the system's access performance.
[0055] The memory data migration method provided in this application can be applied to fields such as artificial intelligence, big data, cloud computing, as well as scenarios such as high-performance, large-capacity storage systems that contain multiple types of storage media.
[0056] The embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0057] FIG1 is a schematic diagram of the composition of a computer device provided by the present application. As shown in FIG1 , the computer device 100 includes a processor 110 .
[0058] The processor 110 is the control center of the computer device 100. The processor 110 can be a computing unit with computing power, such as a central processing unit (CPU), a graphics processing unit (GPU), a data processing unit (DPU), a neural processing unit (NPU), and an embedded neural network processing unit (NPU). The processor 110 can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), system on chip (SoC) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc. For ease of description, the following embodiments are described by taking the processor 110 as a CPU as an example.
[0059] Computer device 100 in FIG1 may include one or more processors (e.g., processor 110 and processor 130). The processor may be a multi-core processor, i.e., a processor including one or more processor cores. For example, processor 110 shown in FIG1 includes N processor cores. A processor herein may refer to one or more devices, circuits, and / or computing units for processing data (e.g., computer program instructions).
[0060] As the number of cores in a single processor increases and processor computing speeds continue to improve, the processors' demands for memory access speed and capacity are also increasing. In one possible implementation, multiple different types of storage media are used together as the main memory (abbreviated as "RAM" or "main memory") of a computer device to increase memory capacity. Each processor core is allocated as much memory resources and memory bandwidth as possible from the memory to meet the processor's memory access speed and capacity requirements. A system that uses multiple different types of storage media as memory can be called a hybrid memory system. The storage media used as memory in a hybrid memory system can be called memory media. A processor can be associated with at least one type of memory media, meaning some processors are associated with one type of memory media, while others are associated with two or more types of memory media.
[0061] For example, a computer device includes multiple different types of memory media. The multiple different types of memory media include a first memory medium and a second memory medium. The storage capacity of the first memory medium is lower than the storage capacity of the second memory medium. The access speed of the first memory medium is higher than the access speed of the second memory medium. The access latency of the first memory medium is lower than the access latency of the second memory medium. The cost of the first memory medium is higher than the cost of the second memory medium.
[0062] The first memory medium may include dynamic random access memory (DRAM). The second memory medium is storage-class memory (SCM), which includes at least one of phase-change memory (PCM), magnetic random access memory (MRAM), resistive random access memory (RRAM / ReRAM), ferroelectric random access memory (FRAM), fast NAND, or nano-RAM (NRAM).
[0063] For example, the various types of memory media used as the main memory 120 in the computer device 100 include DRAM 121 and SCM 122. The processor 110 is connected to the DRAM 121 and SCM 122 via an interface supporting memory semantics.
[0064] The processor 110 is configured to run an application program to perform a read operation or a write operation on a memory medium (eg, DRAM 121 or SCM 122), and to trigger data migration based on the access hotness or coldness of the memory medium.
[0065] Triggering data migration based on the access hotness of the memory medium can be replaced by triggering data migration based on the access hotness of the data stored in the memory medium. Data migration includes migrating cold data to the next-level memory medium and migrating hot data to the previous-level memory medium.
[0066] For example, when the cache line is cold data and the memory medium where the cache line is located is DRAM, the cache line is migrated to the SCM.
[0067] For another example, when the cache line is hot data and the memory medium where the cache line is located is SCM, the cache line is migrated to DRAM.
[0068] Understandably, data migration can be triggered for any level of memory media in a computer device based on the level of data access. Each memory medium migrates data based on the level of data access. The next level of memory media has a larger storage capacity than the current one, while the previous level of memory media has a faster access speed.
[0069] In some embodiments, the computer device counts the access frequency of the page at the granularity of the page (such as 4KB page, 2MB page), which is compatible with the page management method of the computer device for the memory, making the memory data migration method easy to use. For example, the processor operates the memory medium at the granularity of the cache line, and the cache line belongs to a certain page under management. Then, the cache line in the memory medium is operated once, and the page to which the cache line belongs is also read and written once. The controller counts the access frequency of the page to which the cache line being operated belongs, effectively improving the accuracy of identifying the access popularity of the page.
[0070] In the present application, the processor 110 is used to sample the obtained access requests according to the periodic sampling method indicated by the sampling rules, and to count the access frequency of the page indicated by the sampling results, so as to determine the access popularity of the page according to the access frequency of the page, and trigger data migration according to the access popularity.
[0071] In addition, the present application does not limit the execution subject of the memory access heat statistics. The execution subject includes a media module in a computer device, a hardware module with computing function, or a processor.
[0072] For example, as shown in FIG2(a), a sampling access request is implemented in a media module. The media module can be any of a variety of different types of memory media, such as DRAM or SCM.
[0073] The processor in a computer device sends an access request to a media module, instructing it to perform a write or read operation on the media module. A controller in the media module, such as a register clock driver (RCD), collects the access requests, samples multiple access requests according to a sampling rule, and calculates the access frequency of the pages indicated by the sampling results. This frequency is then stored and fed back to the processor via in-band or out-of-band communication.
[0074] As shown in Figure 2(b), the difference from Figure 2(a) is that another hardware module within the computer implements the sampling access request and reports the page access frequency to the processor in-band or out-of-band. The hardware module can be a memory controller or a peripheral (such as a complex programmable logical device (CPLD) or FPGA).
[0075] As shown in (c) of FIG. 2 , the difference from (a) of FIG. 2 is that the sampling access request is implemented by the processor in the computer device, and the processor core can obtain the access frequency of the page by reading the register in the processor.
[0076] Computer device 100 may also include cache memory and registers.
[0077] The cache memory is used to store instructions or data that may be accessed multiple times by the processor core in the processor 110 , thereby increasing the speed at which the processor processes data and preventing the processor from frequently accessing the main memory 120 .
[0078] In physical form, a cache memory can be a random access memory (RAM), static random-access memory (SRAM), dynamic RAM (DRAM), or other types of storage devices that can store information and instructions.
[0079] In terms of logical form, a cache memory can be a level 1 cache (L1 cache), a level 2 cache (L2 cache), a level 3 cache (L3 cache), or any other level of cache. For example, a cache memory located inside a processor core can be a level 1 cache (L1 cache) or a level 2 cache (L2 cache). A cache memory located outside a processor core can be a level 3 cache (L3 cache).
[0080] Registers are used to store instructions or data that may be accessed multiple times by the processor core of processor 110. Since register access speed is higher than cache memory access speed, instructions or data that may be accessed multiple times by the processor core can be stored in registers first, which can further increase the speed at which the processor processes data.
[0081] The processor core is connected to other components in the processor (e.g., the processor core, cache memory, and main memory 120) via bus 111, and accesses these components via bus 111. For example, bus 111 transmits access frequencies between the processor core, cache memory, and main memory 120. For another example, bus 111 transmits write instructions or read instructions to main memory 120, causing main memory 120 to write to a cache line according to the write instruction or read from a cache line according to the read instruction. Bus 111 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect Express (PCIe) bus, an Extended Industry Standard Architecture (EISA) bus, a Unified Bus (UBus or UB), a Compute Express Link (CXL), a Cache Coherent Interconnect for Accelerators (CCIX), or a proprietary bus standard of a non-standard system. This bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in FIG1 , but this does not mean that there is only one bus or one type of bus.
[0082] The connection between the processor core and other components in the processor in Figure 1 is merely illustrative. In one possible implementation, the processor core connects to the other components in the processor via a ring bus, accessing the other components via the ring bus. In another possible implementation, the processor core connects to the other components in the processor via a mesh bus, accessing the other components via the mesh bus.
[0083] The processor 110 is connected to the main memory 120 through a memory controller (MC) 112. The processor 110 can perform various functions of the computer device 100 by running or executing software programs stored in the main memory 120 and accessing data stored in the main memory 120. For example, the processor 110 implements a sampling access request through the memory controller 112.
[0084] The main memory 120 may be a read-only memory (ROM) or other static storage device capable of storing static information and instructions, a random access memory (RAM) or other dynamic storage device capable of storing information and instructions, or an electrically erasable programmable read-only memory (EEPROM). The main memory 120 is also used to store programs related to this embodiment.
[0085] The processor 110 may further include an external device 140 and a peripheral management module 113. The peripheral device 140 is connected to the peripheral management module 113 via the bus 111. The peripheral device 140 may be an application specific integrated circuit (ASIC). For example, a microprocessor (digital signal processor, DSP), or one or more field programmable gate arrays (field programmable gate array, FPGA), or a graphics processing unit (graphics processing unit, GPU), or a neural network processing unit (neural-network processing unit, NPU). The peripheral device 140 may also implement sampling access requests and feedback the access frequency to the processor core via the bus 111, so that the processor core triggers data migration based on the access hotness or coldness of the data.
[0086] The device structure shown in FIG1 does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0087] Next, the memory data migration method provided in this application is described in detail with reference to the accompanying drawings.
[0088] For ease of explanation, the media module statistics scenario shown in (a) of Figure 2, that is, implementing a sampling access request in a memory medium, is used as an example for explanation, and Figure 3 is a flow chart of a memory data migration method provided by this application. As shown in Figure 3, the method includes the following steps.
[0089] Step 310: The processor sends an access request to the memory medium.
[0090] When an application program running on a processor in a computer device needs to perform a read operation or a write operation on a memory medium, an access request is sent to the memory medium. Optionally, when the processor accesses the memory medium in an interleaved manner, the data accessing the memory medium is evenly distributed to multiple memory channels according to a unit storage space (e.g., a cache line). It should be understood that evenly distributing the data accessing the memory medium to multiple memory channels according to a unit storage space means evenly distributing the data accessing the memory medium to multiple memory media according to a unit storage space. The access request sent to multiple memory media when the processor accesses the memory medium in an interleaved manner. The access request indicates a read operation or a write operation on the memory medium according to a unit storage space (e.g., a cache line). The size of the unit storage space may be the size of a cache line when the processor accesses the memory medium.
[0091] Step 320: The memory medium samples the obtained access request according to the sampling rule to obtain a sampling result.
[0092] The memory medium samples received access requests according to a periodic sampling pattern specified by a sampling rule. Specifically, the memory medium periodically samples received access requests at time intervals to obtain sampling results. It is understood that the memory medium samples received access requests at intervals while continuously receiving access requests. The sampling results include multiple sampled access requests. In some embodiments, the memory medium samples multiple access requests according to a time interval sampling pattern to obtain sampling results.
[0093] The following describes how the memory medium samples the obtained access requests.
[0094] Method 1: Sample the acquired access requests according to the sampling frequency indicated by the sampling rule to obtain a sampling result. The sampling frequency is used to indicate the number of access requests between which the sampling is performed.
[0095] In some embodiments, after receiving an access request, the memory medium numbers the access request based on the time of receipt to obtain multiple access requests. Furthermore, the memory medium samples the multiple access requests based on a sampling frequency. Each sampling may sample at least one access request from the sampled sample, and the sampled sample may include at least one access request. The sampled sample may include access requests separated by sampling intervals indicated by the sampling frequency.
[0096] Furthermore, this application does not limit which access request is sampled from the sample. For example, at least one access request may be randomly sampled from the sample. In another example, the sample may be divided into multiple sections, and one access request may be sampled from each section. In another example, the first access request, the last access request, or the middle access request may be sampled from the sample. In another example, at least one access request may be sampled from the sample based on odd or even numbering.
[0097] For example, as shown in FIG4 , assuming a sampling frequency of 100, sampling is performed once for every 100 access requests. Each 100 access requests constitutes a sampling sample. The memory medium receives access requests 0 through 100 and samples access requests 0 and 100. From access requests 101 through 200, access request 200 is sampled. In some embodiments, a counter may be set that increments each time the memory medium receives an access request. When the counter reaches 0, 100, or 200, a sampling operation is performed, and the addresses indicated by access requests 0, 100, and 200, respectively, are saved.
[0098] Optionally, the sampling frequency is determined based on the bandwidth of the memory medium. A larger bandwidth means a greater amount of data can be transferred, so a smaller sampling frequency can be set to increase the number of access requests sampled, thereby improving the statistical accuracy of page access frequency. Conversely, a smaller bandwidth means a smaller amount of data can be transferred, so a larger sampling frequency can be set to reduce the number of access requests sampled, thereby reducing the statistical volume of page access frequency statistics, achieving a balance between statistical accuracy and statistical volume of page access frequency statistics.
[0099] Optionally, the sampling frequency is determined based on the number of pages in the memory medium. When there are many pages, a lower sampling frequency is set; when there are fewer pages, a higher sampling frequency can be set to collect the access frequency of each page as much as possible, thereby improving the statistical accuracy of the page access frequency.
[0100] Method 2: Sample the access requests received based on the number characteristics of the access requests within the sampling period indicated by the sampling rule to obtain a sampling result. The sampling period is used to indicate the length of time between samplings.
[0101] In some embodiments, the memory medium samples access requests received during a sampling period. Each sampling may sample at least one access request from the sampled sample, and the sampling result includes at least one access request. The sampled sample includes multiple access requests received during the sampling period.
[0102] In addition, this application does not limit which access request is sampled from the sampled sample. For specific explanations, please refer to the description of the above method one.
[0103] For example, as shown in FIG5 , assuming a sampling period of 1 microsecond, access requests received within each microsecond are sampled once. Each access request received within a microsecond constitutes a sample. During the first sampling period, the memory medium receives access requests 0 through 100, and access request 50 is sampled. During the second sampling period, the memory medium receives access requests 101 through 200, and access request 150 is sampled. In some embodiments, a timer can be set. When the timer reaches 0 microseconds, 1 microsecond, 2 microseconds, and so on, a sampling operation is performed, and the address indicated by the sampled access request is saved.
[0104] Method three: sampling the obtained access request at least once according to the sampling times indicated by the sampling rule to obtain a sampling result.
[0105] The solutions described in the above-mentioned methods 1 and 2 are to sample the received access request once to obtain the sampling result. In some embodiments, the memory medium may sample the received access request twice or more to obtain the sampling result.
[0106] For example, the two samplings may use the same sampling rule. For example, the memory medium first samples the acquired access request according to the sampling frequency to obtain a first sampling set, and then samples the first sampling set according to the sampling frequency to obtain a sampling result.
[0107] For another example, the two sampling operations can use different sampling rules. For example, the memory medium first samples the acquired access requests according to a sampling frequency to obtain a first sampling set, and then samples the first sampling set according to a sampling period to obtain a sampling result. The specific sampling method based on the sampling frequency and sampling period is described above and is not further elaborated here.
[0108] Therefore, the memory medium performs at least two samplings on the received access request according to at least one periodic sampling method, thereby ensuring the statistical accuracy of the page access frequency and reducing the amount of statistical data on the page access frequency.
[0109] Method 4: sampling the sample in the received access request according to the sampling rule to obtain a sampling result.
[0110] The memory medium may first extract sampling samples from the received access requests, and then sample the sampling samples according to the sampling rules to obtain a sampling result. The method for extracting sampling samples from the received access requests is not limited and may be based on the sampling rules provided in this application or other methods. For example, the received access requests may be numbered according to the time of receipt, and sampling samples may be extracted from the received access requests according to odd or even numbers. The sampling samples may then be sampled according to the sampling rules to obtain a sampling result.
[0111] For example, as shown in Figure 6, assuming a sampling frequency of 50, a sample is taken for every 50 access requests. The memory medium receives access requests 0 through 200 and first extracts the odd-numbered access requests to obtain a sample. The sample includes access request 1, access request 3, access request 5, and so on. Then, based on the sampling frequency, at least one access request is sampled from the sample. For example, the sampling results include access request 47 and access request 133.
[0112] It should be noted that the above-mentioned method of sampling access requests provided in this application can be used alone or in combination according to factors such as storage space requirements and statistical accuracy of page access frequency, and this application is not limited thereto.
[0113] Step 330: The processor counts the access frequency of the page indicated by the sampling result.
[0114] The processor obtains a sampling result from the memory medium, and the sampling result includes information such as the address indicated by at least one access request. After obtaining the sampled at least one access request, the page to which the accessed data block belongs can be determined based on the physical address indicated by the access request, and the access frequency of the page can be counted. In some embodiments, the storage location for storing the physical address indicated by the access request and the storage location for storing the access frequency of the page can be the same or different. For example, a portion of the storage space in the memory medium is used to store the access frequency of the page. The physical address indicated by the access request can be stored in other memories outside the memory medium. The memory medium reads the access frequency of the page and updates the access frequency. For example, each time the page is accessed, the access frequency of the page is increased by one, and the updated access frequency is written to the memory.
[0115] In other embodiments, the memory medium clips the address indicated by the sampled access request to obtain an address index, reads the access frequency corresponding to the address index from the RAM based on the address index, updates the access frequency corresponding to the address index, and uses the address indicated by the access request to indicate the page. This reduces the storage space occupied by the access frequency of the stored page. Under different system architectures, the supported page size may be 4KB, 64KB, or 2MB. Software clipping can be performed based on different page sizes, and the clipped address is used as the address index for counting operations to obtain the access frequency of all pages.
[0116] For example, as shown in Figure 7, assuming that the address indicated by the sampled access request is 64B, that is, the sampled address is 64B, the address index obtained after clipping the sampled address can be 4KB, 64KB, or 2MB.
[0117] Optionally, the RAM stores an address index corresponding to each page, and after the memory medium obtains the address index by clipping according to the address indicated by the access request, the access frequency corresponding to the address index in the RAM is updated.
[0118] Optionally, when the RAM does not store the address index determined by the memory medium, a new address index and a corresponding access frequency are written into the RAM.
[0119] Step 340: The processor determines the page's access popularity based on the page's access frequency, and triggers data migration.
[0120] The processor determines page popularity based on page access frequency and triggers data migration. For example, if the access frequency is greater than or equal to a threshold, the data block is considered hot; if the cold access frequency is less than the threshold, the data block is considered cold. When triggering data migration based on page popularity, hot data can be migrated to local memory and cold data to remote memory.
[0121] The memory data migration method provided in the present application samples access requests in multiple ways based on a periodic sampling method indicated by sampling rules, thereby ensuring the statistical accuracy of the page access frequency and reducing the statistical data volume of the page access frequency, so that the processor can obtain the page access frequency as quickly as possible. When data migration is triggered based on the access popularity of the page, hot data can be migrated to the near-end memory and cold data can be migrated to the far-end memory, so that the processor can obtain frequently accessed data from the near-end memory as quickly as possible, thereby improving the system's data processing speed and reducing data processing latency, significantly improving the system's access performance.
[0122] Figure 8 is a flow chart of a memory access heat statistics method provided by the present application. When the access request sampling function is implemented by the processor, the processor core can configure the sampling rules of the corresponding sampling module (step 810); the processor core enables the access request sampling function (step 820), if the enabling is successful, execute step 830, if the enabling fails, execute step 820; sample the collected access requests according to the sampling rules, count and store the access frequency of the page corresponding to the address indicated by the sampled access request (step 830); if the access request sampling function is not turned off, continue to execute the access request sampling function on the access request, count and store the access frequency of the page corresponding to the address indicated by the sampled access request, when the RAM storage space is full, the processor core reads the page access frequency from the RAM, determines the page access heat to trigger data migration. If the access request sampling function is turned off, the sampling is ended and the process ends (step 840). The specific sampling process can refer to the description of the above embodiment and will not be repeated here.
[0123] Optionally, if the access request sampling function is implemented by other hardware modules or memory outside the processor in the computer device, the sampling rules can be transmitted by out-of-band communication or in-band communication to configure, enable the access request sampling function and the access frequency of the page.
[0124] For a detailed explanation of the access request sampling function, please refer to the description of the above embodiment and will not be elaborated here.
[0125] Figure 9 is a flow chart of an access frequency acquisition method provided by the present application. The access request sampling function is turned on and the processor polls to check the status of the RAM (step 910). If the RAM is empty, the RAM status is continued to be detected; if there is an access request in the RAM, the access request can be read from the RAM (step 920). The address indicated by the read access request is subjected to address bit clipping (step 930). The number of bits after clipping can be determined according to the operating status of the system, for example, the number of bits after clipping is 4KB, 64KB or 2MB. The clipped address is used as an address index, and the address index is used for counting processing (step 940). The initial value of each address index should be 0. Each time a corresponding address index is identified, the access frequency corresponding to the address index is increased by 1. Check whether the access request sampling function is turned off. If not, continue to return to step 910 for judgment until the access request sampling function is turned off, and the process ends (step 950).
[0126] It is worth noting that for the memory access heat statistics scenarios within the hardware module shown in Figure 2 (b) and Figure 2 (c), as well as the memory access heat statistics scenario within the processor, the data processing process is similar to the processing process in Figure 2 (a). For the sake of brevity, only the scenario shown in Figure 2 (a) is used as an example. The data processing process for other scenarios is similar to the data processing process shown in Figure 3 and will not be repeated here.
[0127] It is understood that in order to implement the functions in the above embodiments, the processor includes hardware structures and / or software modules corresponding to the execution of each function. It should be readily apparent to those skilled in the art that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0128] The memory data migration method provided in accordance with the present embodiment is described in detail above with reference to FIG. 1 to FIG. 9 . The memory data migration device provided in accordance with the present embodiment will be described below with reference to FIG. 10 .
[0129] Figure 10 is a schematic diagram of the structure of a possible memory data migration device provided in this embodiment. These memory data migration devices can be used to implement the memory functions of the above-mentioned method embodiments, thereby also achieving the beneficial effects of the above-mentioned method embodiments. In this embodiment, the memory data migration device can be the first memory medium shown in Figure 3, or it can be a module (such as a chip) applied to a processor.
[0130] As shown in Figure 10, memory data migration apparatus 1000 includes a communication module 1010, a sampling module 1020, a statistics module 1030, a migration module 1040, and a storage module 1050. Memory data migration apparatus 1000 is used to implement the functions of the memory and processor in the method embodiment shown in Figure 3 above.
[0131] The communication module 1010 is used to obtain an access request, where the access request is used to instruct an application program running on a processor in a computer device to operate on a memory medium. For example, the communication module 1010 is used to execute step 310 in FIG3 .
[0132] The sampling module 1020 is used to sample the acquired access requests according to a sampling rule to obtain a sampling result. The sampling rule is used to indicate a periodic sampling method. For example, the sampling module 1020 is used to execute step 320 in FIG3 .
[0133] The statistics module 1030 is used to count the access frequency of the page indicated by the sampling result, and the access frequency of the page is used to determine the access popularity of the page. For example, the statistics module 1030 is used to execute step 330 in Figure 3.
[0134] Optionally, the sampling module 1020 is specifically configured to sample the acquired access requests according to a sampling frequency indicated by the sampling rule to obtain a sampling result, where the sampling frequency is used to indicate the number of access requests at intervals between samplings.
[0135] Optionally, the sampling module 1020 is specifically configured to sample the acquired access requests according to a quantity feature of the access requests within a sampling period indicated by the sampling rule to obtain a sampling result, where the sampling period indicates the length of time between samplings.
[0136] The migration module 1040 is configured to trigger memory data migration between the at least two different types of memory media according to the access frequency. For example, the migration module 1040 is configured to execute step 340 in FIG3 .
[0137] The storage module 1050 is used to store sampling rules and access frequencies, so that the sampling module 1020 can sample the access requests obtained according to the sampling rules when the processor in the computer device accesses the memory medium to obtain sampling results.
[0138] It should be understood that the memory data migration device 1000 of the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD), wherein the PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. Alternatively, when the memory data migration shown in FIG. 3 is implemented by software, the memory data migration device 1000 and its modules can also be software modules.
[0139] According to the embodiment of the present application, the memory data migration device 1000 can correspond to executing the method described in the embodiment of the present application, and the above-mentioned and other operations and / or functions of each unit in the memory data migration device 1000 are respectively for implementing the corresponding processes of each method in Figure 3. For the sake of brevity, they will not be repeated here.
[0140] The present application also provides a processor, which includes a memory and at least two processor cores. The processor is associated with at least two different types of memory media, and the memory is used to store a set of computer instructions; when the processor core executes the set of computer instructions, the operating steps of the methods described in the above embodiments are executed to identify the access frequency of data blocks in the memory medium by applications.
[0141] The present application also provides a chip comprising: a processor and a power supply circuit; wherein the power supply circuit is used to supply power to the processor; and the processor is used to execute the operation steps of the methods described in the above embodiments, thereby realizing the identification of the access frequency of data blocks in memory by applications.
[0142] The present application also provides a computer system, which includes multiple computer devices, and the computer devices are used to execute the operating steps of the methods described in the above embodiments.
[0143] The method steps in this embodiment can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and storage medium can be located in an ASIC. In addition, the ASIC can be located in a computer device. Of course, the processor and storage medium can also exist in a computer device as discrete components.
[0144] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is performed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer program or instruction 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 program or instruction can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired or wireless means. 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 integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, a hard disk, or a tape; it can also be an optical medium, such as a digital video disc (DVD); it can also be a semiconductor medium, such as a solid state drive (SSD). The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present application, and such modifications or substitutions should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. A memory data migration method, characterized in that: The hybrid memory system includes a plurality of processors and a plurality of different types of memory media, wherein the processors are associated with at least two different types of memory media, and the method includes: Sampling the acquired access requests according to a sampling rule to obtain a sampling result, wherein the access request is used to indicate an operation of an application program running on a processor in a computer device on a memory medium, and the sampling rule is used to indicate a periodic sampling method; Counting the access frequency of the page indicated by the sampling result, wherein the access frequency of the page is used to determine the access popularity of the page; Memory data migration is triggered between the at least two different types of memory media according to the access frequency.
2. The method according to claim 1, characterized in that The obtained access requests are sampled according to the sampling rules to obtain sampling results, including: The acquired access request is sampled according to the time interval-based sampling mode indicated by the sampling rule to obtain the sampling result.
3. The method according to claim 2, characterized in that Sampling the acquired access request according to the time interval based sampling mode indicated by the sampling rule to obtain a sampling result, including: The acquired access requests are sampled according to a sampling frequency indicated by the sampling rule to obtain the sampling result, wherein the sampling frequency is used to indicate the number of access requests at intervals of sampling.
4. The method according to claim 3, characterized in that The sampling frequency is determined according to the bandwidth of the memory medium.
5. The method according to claim 2, characterized in that: Sampling the acquired access request according to the time interval based sampling mode indicated by the sampling rule to obtain a sampling result, including: The acquired access requests are sampled according to the quantity characteristics of the access requests within a sampling period indicated by the sampling rule to obtain the sampling result, wherein the sampling period is used to indicate the length of time between samplings.
6. The method according to any one of claims 1 to 5, characterized in that The obtained access requests are sampled according to the sampling rules to obtain sampling results, including: The acquired access request is sampled at least once according to the sampling times indicated by the sampling rule to obtain the sampling result.
7. The method according to any one of claims 1 to 6, characterized in that The obtained access requests are sampled according to the sampling rules to obtain sampling results, including: The sampling samples in the obtained access request are sampled according to the sampling rule to obtain the sampling result.
8. The method according to any one of claims 1 to 7, characterized in that Counting the access frequency of the page indicated by the sampling result includes: An address index is determined according to the address indicated by the access request, and an access frequency associated with the address index is counted, wherein the address indicated by the access request is used to indicate the page.
9. The method according to any one of claims 1 to 8, characterized in that The multiple different types of memory media include a first memory medium and a second memory medium, the memory medium associated with the processor includes the first memory medium and the second memory medium, the access speed of the first memory medium is greater than the access speed of the second memory medium, and the access delay of the first memory medium is less than the access delay of the second memory medium.
10. A memory data migration device, characterized in that: include: A communication module, used to obtain an access request, wherein the access request is used to instruct an application program running on a processor in a computer device to operate a memory medium; A sampling module, used to sample the obtained access request according to a sampling rule to obtain a sampling result, wherein the sampling rule is used to indicate a periodic sampling method; A statistics module, used to count the access frequency of the page indicated by the sampling result, and the access frequency of the page is used to determine the access popularity of the page; A migration module is used to trigger memory data migration between the at least two different types of memory media according to the access frequency.
11. The device according to claim 10, characterized in that The obtained access requests are sampled according to the sampling rules to obtain sampling results, including: The acquired access request is sampled according to the time interval-based sampling mode indicated by the sampling rule to obtain the sampling result.
12. The device according to claim 11, characterized in that Sampling the acquired access request according to the time interval based sampling mode indicated by the sampling rule to obtain a sampling result, including: The acquired access requests are sampled according to a sampling frequency indicated by the sampling rule to obtain the sampling result, wherein the sampling frequency is used to indicate the number of access requests at intervals of sampling.
13. The device according to claim 12, characterized in that The sampling frequency is determined according to the bandwidth of the memory medium.
14. The device according to claim 11, characterized in that Sampling the acquired access request according to the time interval based sampling mode indicated by the sampling rule to obtain a sampling result, including: The acquired access requests are sampled according to the quantity characteristics of the access requests within a sampling period indicated by the sampling rule to obtain the sampling result, wherein the sampling period is used to indicate the length of time between samplings.
15. The device according to any one of claims 10 to 14, characterized in that The obtained access requests are sampled according to the sampling rules to obtain sampling results, including: The acquired access request is sampled at least once according to the sampling times indicated by the sampling rule to obtain the sampling result.
16. The device according to any one of claims 10 to 15, characterized in that The obtained access requests are sampled according to the sampling rules to obtain sampling results, including: The sampling samples in the obtained access request are sampled according to the sampling rule to obtain the sampling result.
17. The device according to any one of claims 10 to 16, characterized in that Counting the access frequency of the page indicated by the sampling result includes: An address index is determined according to the address indicated by the access request, and an access frequency associated with the address index is counted, wherein the address indicated by the access request is used to indicate the page.
18. The device according to any one of claims 10 to 17, characterized in that The multiple different types of memory media include a first memory medium and a second memory medium, the memory medium associated with the processor includes the first memory medium and the second memory medium, the access speed of the first memory medium is greater than the access speed of the second memory medium, and the access delay of the first memory medium is less than the access delay of the second memory medium.
19. A memory, characterized in that: The memory includes a storage medium and a controller, the storage medium is used to store a set of computer instructions; when the controller executes the set of computer instructions, the operating steps of the method described in any one of claims 1 to 9 are executed to realize the identification of the access frequency of the data block in the memory by the application program.
20. A chip, characterized in that: include: A processor and a power supply circuit; wherein the power supply circuit is used to supply power to the processor; The processor is used to execute the operating steps of the method described in any one of claims 1-9 to realize the identification of the access frequency of the data block in the memory by the application program.
21. A processor, characterized in that: The processor is associated with at least two different types of memory media, and is used to execute the operation steps of the method described in any one of claims 1 to 9 to identify the access frequency of data blocks in the memory medium by the application program.
22. A computer device, characterized in that: The computer device includes a memory, a processor and multiple different types of memory media, the processor is associated with at least two different types of memory media, and the memory is used to store a set of computer instructions; when the processor executes the set of computer instructions, the operating steps of the method described in any one of claims 1 to 9 are executed to identify the access frequency of data blocks in the memory medium by the application program.
Citation Information
Patent Citations
Memory data migration method, related device and computer equipment
CN118732934A
Memory system, memory access request processing method and computer system
CN104216837A
Memory system based on hybrid memory architecture
CN110532200A
Sampling rate-based video data processing
CN115699778A
Memory-sampling based migrating page cache
US20180081541A1
Cited By
Data processing method and device for solid state disk
CN119883140A
