Movatterモバイル変換


[0]ホーム

URL:


CN119847772B - Memory management method, electronic device, storage medium, and computer program product - Google Patents

Memory management method, electronic device, storage medium, and computer program product

Info

Publication number
CN119847772B
CN119847772BCN202510331481.2ACN202510331481ACN119847772BCN 119847772 BCN119847772 BCN 119847772BCN 202510331481 ACN202510331481 ACN 202510331481ACN 119847772 BCN119847772 BCN 119847772B
Authority
CN
China
Prior art keywords
memory
storage medium
data
target storage
operation mode
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202510331481.2A
Other languages
Chinese (zh)
Other versions
CN119847772A (en
Inventor
张顺顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
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 Suzhou Metabrain Intelligent Technology Co LtdfiledCriticalSuzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202510331481.2ApriorityCriticalpatent/CN119847772B/en
Publication of CN119847772ApublicationCriticalpatent/CN119847772A/en
Application grantedgrantedCritical
Publication of CN119847772BpublicationCriticalpatent/CN119847772B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Classifications

Landscapes

Abstract

The application discloses a memory management method, electronic equipment, a storage medium and a computer program product, and relates to the technical field of computers. According to the application, the memory page is provided with the cold and hot marks according to the cold and hot scores, so that memory data with different cold and hot grades can be distinguished, the type of the memory medium where the memory page is located is compared with that of the memory medium to judge whether to transfer the memory data of the memory page, the energy consumption can be reduced by transferring the data to the memory medium matched with the cold and hot marks, the energy waste is avoided, the current operation mode of the target memory medium is judged whether to support the data transfer before the data transfer, the target memory medium is adjusted to be the operation mode supporting the data transfer, all the memory media are not required to be kept to be the operation mode supporting the data transfer all the time, the energy consumption of the operation mode of the memory medium can be kept to be the lowest, and the energy consumption can be reduced by combining the dynamic adjustment of the data position according to the load with the static power consumption management.

Description

Memory management method, electronic device, storage medium, and computer program product
Technical Field
The present application relates to the field of computer technology, and in particular, to a memory management method, an electronic device, a storage medium, and a computer program product.
Background
CXL (Computer Express Link) is an open interconnect new standard for data centers, high performance computers, and AI, etc. areas, which is introduced by Intel corporation. The current low-power heterogeneous memory management technology under CXL protocol mainly depends on static allocation strategy and single medium optimization, and has obvious limitation. The DRAM and the SCM/NVM are divided into static capacity pools by adopting a fixed memory partition, and the data position cannot be dynamically adjusted according to the load, so that the low-frequency access data occupies the high-power-consumption DRAM for a long time, and more than 30% of energy consumption is wasted. The technical scheme of the current CXL protocol in the heterogeneous memory management field has obvious defects, and is mainly characterized in three aspects of static power consumption management, single medium access strategy and insufficient support of a protocol layer.
Disclosure of Invention
The application provides a memory management method, electronic equipment, a storage medium and a computer program product, which at least solve the technical problem that the energy consumption can not be reduced by combining dynamic data position adjustment according to load and static power consumption management in the related art.
The application provides a memory management method, which comprises the following steps:
Acquiring memory data of a memory page in a memory module, acquiring a cold and hot score of the memory data of the memory page, and setting a cold and hot mark for the memory page according to the cold and hot score;
Acquiring the type of a storage medium where the memory page is located, and determining whether to transfer the memory data of the memory page according to the type of the storage medium and the cold and hot marks set by the memory page;
Responding to the data transfer of the memory data of the memory page, acquiring the address of the storage medium where the memory page is located and the address of the target storage medium, and judging whether the current running mode of the target storage medium supports the data transfer;
And in response to the current running mode of the target storage medium supporting data transfer, transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium, otherwise, converting the current running mode of the target storage medium into supporting data transfer.
The application also provides an electronic device, which comprises a memory for storing a computer program, and a processor for implementing any of the memory management methods when executing the computer program:
Acquiring memory data of a memory page in a memory module, acquiring a cold and hot score of the memory data of the memory page, and setting a cold and hot mark for the memory page according to the cold and hot score;
Acquiring the type of a storage medium where the memory page is located, and determining whether to transfer the memory data of the memory page according to the type of the storage medium and the cold and hot marks set by the memory page;
Responding to the data transfer of the memory data of the memory page, acquiring the address of the storage medium where the memory page is located and the address of the target storage medium, and judging whether the current running mode of the target storage medium supports the data transfer;
And in response to the current running mode of the target storage medium supporting data transfer, transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium, otherwise, converting the current running mode of the target storage medium into supporting data transfer.
The present application also provides a computer readable storage medium having a computer program stored therein, wherein the computer program when executed by a processor implements the steps of any one of the memory management methods described above:
Acquiring memory data of a memory page in a memory module, acquiring a cold and hot score of the memory data of the memory page, and setting a cold and hot mark for the memory page according to the cold and hot score;
Acquiring the type of a storage medium where the memory page is located, and determining whether to transfer the memory data of the memory page according to the type of the storage medium and the cold and hot marks set by the memory page;
Responding to the data transfer of the memory data of the memory page, acquiring the address of the storage medium where the memory page is located and the address of the target storage medium, and judging whether the current running mode of the target storage medium supports the data transfer;
And in response to the current running mode of the target storage medium supporting data transfer, transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium, otherwise, converting the current running mode of the target storage medium into supporting data transfer.
The application also provides a computer program product comprising a computer program which when executed by a processor implements the steps of any of the memory management methods described above:
Acquiring memory data of a memory page in a memory module, acquiring a cold and hot score of the memory data of the memory page, and setting a cold and hot mark for the memory page according to the cold and hot score;
Acquiring the type of a storage medium where the memory page is located, and determining whether to transfer the memory data of the memory page according to the type of the storage medium and the cold and hot marks set by the memory page;
Responding to the data transfer of the memory data of the memory page, acquiring the address of the storage medium where the memory page is located and the address of the target storage medium, and judging whether the current running mode of the target storage medium supports the data transfer;
And in response to the current running mode of the target storage medium supporting data transfer, transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium, otherwise, converting the current running mode of the target storage medium into supporting data transfer.
According to the application, the memory page is provided with the cold and hot marks according to the cold and hot scores, so that memory data with different cold and hot grades can be distinguished, the type of the memory page is compared with that of a storage medium, whether the memory data of the memory page is subjected to data transfer is judged, the energy consumption can be reduced by transferring the data to the storage medium matched with the cold and hot marks, the energy waste is avoided, the current operation mode of a target storage medium is judged whether to support data transfer or not before the data transfer, the target storage medium is adjusted to be the operation mode supporting data transfer, all the storage media are not required to be kept to be the operation mode supporting data transfer at any time, the energy consumption of the operation mode of the storage medium can be kept to be the lowest, and the energy consumption can be reduced by combining dynamic adjustment of the data position according to the load with static power consumption management.
Drawings
For a clearer description of embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described, it being apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
FIG. 1 is a diagram of an application environment of a memory management method according to an embodiment of the present application;
FIG. 2 is a flow chart of a memory management method according to an embodiment of the application;
FIG. 3 is a flowchart illustrating a step of acquiring memory data of a memory page in a memory module, acquiring a hot score of the memory data of the memory page, and setting a hot flag for the memory page according to the hot score according to an embodiment of the present application;
FIG. 4 is a flow chart of a data transfer step for determining whether to transfer memory data of a memory page according to a type of a storage medium in which the memory page is located and a cold/hot flag set in the memory page according to an embodiment of the present application;
FIG. 5 is a flow chart of a step of determining whether a current operation mode of a target storage medium supports data transfer in response to data transfer of memory data of the memory page in an embodiment of the present application, by acquiring an address of the storage medium where the memory page is located and an address of the target storage medium;
FIG. 6 is a flowchart illustrating a step of transferring memory data of the memory page to the target storage medium according to an address of the target storage medium in response to the current operation mode supporting data transfer in an embodiment of the present application;
FIG. 7 is a block diagram illustrating a memory management device according to an embodiment of the present application;
FIG. 8 is a block diagram of a data migration engine in accordance with one embodiment of the present application;
Fig. 9 is an internal structural diagram of an electronic device in one embodiment of the application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. Based on the embodiments of the present application, all other embodiments obtained by a person of ordinary skill in the art without making any inventive effort are within the scope of the present application.
It should be noted that in the description of the present application, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. The terms "first," "second," and the like in this specification are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The present application will be further described in detail below with reference to the drawings and detailed description for the purpose of enabling those skilled in the art to better understand the aspects of the present application.
The current CXL protocol lacks dynamic analysis of multidimensional features such as access frequency, time locality and the like, has high error mobility, and increases system delay instead. On the protocol support level, the existing CXL 3.0 standard lacks a native energy consumption management field, and a manufacturer needs to indirectly control the medium state through a private protocol, so that cross-platform compatibility is poor. And the DRAM mode switching is realized through the read-write of MMIO registers for many times, extra delay is introduced, and the energy consumption state cannot be fed back in real time. In addition, the traditional scheme has insufficient support for novel media (such as ReRAM and MRAM), needs to customize a drive and hardware interface, and has long development period and poor expansibility.
Under a dynamic load scene, the prior art is particularly insufficient in performance, and sudden data access in an AI training task causes a DRAM to frequently switch power consumption modes, so that a static strategy is difficult to quickly respond, and performance fluctuation is caused. In general, the existing scheme cannot meet the green calculation requirement in energy efficiency, instantaneity and expansibility, and innovative breakthrough of software and hardware cooperation is needed.
In particular, the current CXL protocol has significant defects in the technical scheme in the heterogeneous memory management field, and is mainly characterized in three aspects of static power consumption management, single medium access strategy and insufficient support of a protocol layer.
(1) Limitations of static power consumption management policies
At present, a fixed power consumption mode is adopted, and the power consumption state of a memory medium cannot be dynamically adjusted according to a load. The specific problems include energy waste, low frequency access data occupies high power consumption DRAM for a long time, resulting in low energy efficiency ratio (TOPS/W). For example, in the AI reasoning task, the model parameters may be accessed frequently only in the initialization stage after loading, and 80% of data is in idle state in the subsequent reasoning process, but the conventional scheme still remains in the DRAM, which causes waste of power consumption.
Also lack of dynamic response, inability to perceive real-time load changes, such as bursty access requests (e.g., real-time data analysis) may cause the DRAM to frequently enter/exit low power modes, creating additional energy consumption overhead.
(2) Medium access policy singulation
In the prior art, a single medium optimization strategy is generally adopted, the differential characteristics of heterogeneous mediums are ignored, and resources are contended due to excessive dependence on DRAM. While the low power consumption characteristics of SCM/NVM are underutilized. The traditional scheme does not classify the cold and hot attributes of the data, resulting in the hybrid storage of high frequency accessed "hot data" and low frequency "cold data". There is a lack of cooperative access mechanisms to DRAM, SCM, NVM. Failure to effectively match the random access characteristics of DRAM results in increased overhead for cross-media data handling.
(3) Inadequate support of protocol layers
The original support of the CXL protocol in the aspect of energy consumption management is weak, and firstly, the energy consumption state feedback is lost, namely the CXL 3.0 protocol undefined standard field is used for reporting the real-time power consumption state. And the control instruction is difficult to expand, the existing CXL.io protocol lacks a special command for power consumption management, and the medium state is required to be indirectly controlled through multiple read-write operations.
As shown in FIG. 1, in order to avoid serious energy consumption waste caused by low energy efficiency ratio (TOPS/W) of a memory module due to long-term occupation of high-power-consumption DRAM by low-frequency access data, the application reduces medium switching delay and memory energy consumption. The CXL controller is arranged between a HOST (HOST CPU) and a memory module, the CXL controller comprises a cold and hot score calculator, an energy consumption management module and a data migration engine, the memory module comprises a DRAM (dynamic random access memory), an SCM (storage class memory) and an NVM (nonvolatile memory), the storage medium type of the DRAM is a high-broadband memory, the storage medium type of the SCM (storage class memory) is a low-power-consumption medium, and the storage medium type of the NVM (nonvolatile memory) is a high-capacity memory. The application is based on Compute Express Link (CXL) protocol low-power consumption heterogeneous memory management technology, optimizes the energy consumption efficiency of heterogeneous media such as DRAM, SCM (storage class memory), NVM (nonvolatile memory) and the like by integrating an energy consumption sensing module and a dynamic data migration strategy in the CXL controller, and is suitable for high-density computing scenes such as a data center, an edge server and the like.
According to the application, the software and hardware cooperation is realized through hardware architecture optimization and protocol layer expansion, the low-power consumption heterogeneous memory management is realized, and the system architecture is divided into two layers of a hardware layer and a protocol layer.
The hardware layer comprises a host computer which is interconnected with the CXL controller through a PCIE protocol, a data migration engine and an energy consumption management module which are integrated in the CXL controller and are respectively responsible for Cold and Hot classification and energy consumption management of data, and the CXL controller is externally extended and linked to be connected with different types of storage media, wherein the storage media comprise three heterogeneous memory modules of DRAM/SCM/NVM and are respectively used for storing different data types of Hot data (Hot), warm data (Warm) and Cold data (Cold) and realizing different energy consumption management strategies.
The CXL.io protocol provides the functions of bottom layer equipment connection and equipment management, newly-increased energy consumption state, data migration and other information control, the CXL.cache protocol mainly solves the problem of multi-equipment cache consistency, and the CXL.memory protocol realizes memory resource flexible expansion, newly-increased energy consumption management detailed fields, and the CXL.io protocol transmits energy consumption information to a memory module for the power consumption management of the memory module while finishing data migration. The CXL.memory protocol is expanded, the new energy consumption management TLP field is not influenced by the existing CXL.io/CXL.cache function, energy consumption management information is added in the process of completing dynamic expansion of memory resources, the resource utilization rate and the energy efficiency ratio are improved, and an CXL.io control interface is used for transmitting control information such as energy consumption states, data migration and the like and is used for synchronizing basic information with a host and equipment.
As shown in fig. 2, an embodiment of the present application provides a memory management method, which includes the following steps:
s1, acquiring memory data of a memory page in a memory module, acquiring a cold and hot score of the memory data of the memory page, and setting a cold and hot mark for the memory page according to the cold and hot score;
s2, acquiring the type of a storage medium where the memory page is located, and determining whether to transfer data of memory data of the memory page according to the type of the storage medium and a cold and hot mark set by the memory page;
s3, responding to data transfer of the memory data of the memory page, acquiring an address of a storage medium where the memory page is located and an address of a target storage medium, and judging whether the current running mode of the target storage medium supports data transfer or not;
and S4, responding to the current operation mode of the target storage medium to support data transfer, and transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium, otherwise, converting the current operation mode of the target storage medium into support data transfer.
According to the embodiment, the memory page is provided with the cold and hot marks according to the cold and hot scores, so that memory data with different cold and hot grades can be distinguished, the type of the memory medium where the memory page is located is compared with that of the memory medium to judge whether the memory data of the memory page is subjected to data transfer, energy consumption can be reduced by transferring the data to the memory medium matched with the cold and hot marks, energy waste is avoided, the current operation mode of the target memory medium is judged whether to support data transfer or not before data transfer, the target memory medium is adjusted to be the operation mode supporting data transfer, all the memory media are not required to be kept to be the operation mode supporting data transfer at any time, the energy consumption of the operation mode of the memory medium can be kept to be the lowest, and the energy consumption can be reduced by combining dynamic adjustment of the data position according to loads with static power consumption management.
The memory management method is applied to the GPU server cluster, and can be used for serving various application scenes with high concurrency and high computing power requirements such as AI/HPC/cloud service and the like.
As shown in fig. 3, in this embodiment, obtaining memory data of a memory page in a memory module, obtaining a hot score of the memory data of the memory page, and setting a hot flag for the memory page according to the hot score includes:
S11, acquiring access frequency, time locality and task priority of memory data of a memory page;
S12, obtaining the cold and hot scores of the memory data of the memory pages according to the access frequency, the time locality and the task priority of the memory data of the memory pages;
S13, acquiring the types of cold and hot marks, wherein the cold and hot marks comprise hot data, warm data and cold data, and marking the cold and hot marks for the memory pages according to the cold and hot scores of the memory data of the memory pages.
In this embodiment, obtaining the hot and cold scores of the memory data of the memory page according to the access frequency, the time locality and the task priority of the memory data of the memory page includes:
Setting time locality as a weight value which decreases with time based on an exponential decay model;
setting the access frequency, time locality and the weight coefficient of task priority;
Multiplying the access frequency, the time locality and the task priority with the corresponding weight coefficients respectively, and summing to obtain the cold and hot scores of the memory data of the memory pages.
Specifically, the formula of the hot and cold scores of the memory data of the memory page is score=0.6×freq+0.3×return+0.1×priority.
Wherein Freq is the access frequency, the access frequency (Freq) is the number of accesses within a statistical time window (t=1s) and is a value of 0-1, recency is the time locality, the time locality (Recency) is based on an exponential decay model in which the weight decreases with time, λ=0.1 (decay coefficient), T is in milliseconds, priority is the task Priority, the task Priority (Priority) is marked (0-1 range) by the operating system or application program, such as real task=1.0, batch task=0.3.
The present embodiment improves the LRU-K algorithm by expanding the conventional LRU, recording the last 3 accesses history (k=3), and computing the obsolete candidate pages in combination with the weighted heat. The weight coefficients of the access frequency, the time locality and the task priority are respectively 0.6, 0.3 and 0.1, and the weight coefficients can be adjusted according to actual situations.
As shown in fig. 4, in this embodiment, obtaining the type of the storage medium where the memory page is located, and determining whether to transfer the data of the memory page according to the type of the storage medium and the cold/hot flag set in the memory page includes:
s21, obtaining a storage medium type in a memory module, wherein the storage medium type comprises a high-broadband memory, a low-power-consumption medium and a large-capacity storage;
S22, obtaining the type of a preset cold and hot mark of memory data stored correspondingly by the type of the storage medium, correspondingly storing the memory data marked as hot data in the high-bandwidth memory, correspondingly storing the memory data marked as warm data in the low-power-consumption medium, and correspondingly storing the memory data marked as cold data in the high-capacity memory;
S23, acquiring the type of a preset cold and hot mark corresponding to the type of the storage medium where the memory page is located, judging whether the type of the cold and hot mark marked by the memory data of the memory page is the same as the type of the preset cold and hot mark corresponding to the type of the storage medium where the memory page is located, if so, judging that the memory data of the memory page is subjected to data transfer, otherwise, judging that the memory data of the memory page is not subjected to data transfer.
It can be understood that the CXL controller is externally extended and linked to connect different types of storage media, the types of the storage media in the memory module can be obtained, the CXL controller is provided with a dual-port DMA controller as a connection port, the concurrent transmission of the DRAM and the SCM/NVM is supported, and the bandwidth is 64GB/s. Among the types of storage media in the memory module, the storage media of the high-bandwidth memory are DRAM, the storage media of the low-power consumption media are SCM (storage class memory), and the storage media of the mass storage are NVM (nonvolatile memory). Memory data marked as hot data is correspondingly stored in the DRAM, memory data marked as warm data is correspondingly stored in the SCM, and memory data marked as cold data is correspondingly stored in the NVM. By classifying and storing the memory data according to the cold and hot marks, the occupation of high-bandwidth memory space by the temperature data and the cold data can be avoided, and the occupation of low-power-consumption medium space by the cold data can be avoided.
Wherein the hot data is characterized by high frequency access (> 100 times/second), recent usage (last access time <10 ms), high priority task association. The hot data is stored in a policy that the cache line is preferentially allocated while remaining in the DRAM.
The warm data is characterized by medium access frequency (10-100 times/second), weak temporal locality (last access time 10ms-1 s), and normal priority. The temperature data is temporarily stored in SCM and dynamically promoted and degraded according to load pressure.
Cold data is characterized by low frequency access (< 10 times/second), long-term non-use (last access time >1 s), low priority or background tasks. The storage strategy of the cold data is to migrate to the NVM and free up DRAM resources.
Wherein, setting cold and hot marks for the memory pages according to the cold and hot scores comprises:
comparing the cold and hot score to a first threshold;
When the cold and hot scores are smaller than a first threshold value and the utilization rate of the storage medium of the high-bandwidth memory is larger than a preset utilization rate threshold value, setting cold and hot marks as cold data for the memory pages, and forcedly migrating the memory data of the memory pages;
and when the cold and hot score is larger than or equal to the first threshold value and smaller than or equal to the second threshold value, setting a cold and hot mark as warm data for the memory page, and asynchronously migrating the memory data of the memory page.
In the embodiment, an adaptive migration strategy is adopted, namely a hardware migration circuit is designed in the CXL controller, cold data is automatically migrated to a low-power-consumption medium (such as SCM/NVM), and hot data is reserved in the DRAM.
Forced migration-when Score <0.4 and DRAM utilization >80%, cold data is migrated immediately;
migration is suggested, namely asynchronous migration of data of Score E [0.4, 0.6] to avoid blocking a critical path.
As shown in fig. 5, in this embodiment, in response to performing data transfer on memory data of a memory page, acquiring an address of a storage medium where the memory page is located and an address of a target storage medium, and determining whether a current operation mode of the target storage medium supports data transfer includes:
s31, after the memory data type of the memory page and the target storage medium are confirmed, address conversion is carried out, and the address of the target storage medium is obtained by inquiring an address conversion table;
S32, acquiring a current operation mode of the target storage medium according to the address of the target storage medium, and acquiring a transfer operation mode of the target storage medium preset for data transfer;
s33, judging whether the current operation mode of the target storage medium is a transfer operation mode, if so, judging that the current operation mode of the target storage medium supports data transfer, otherwise, judging that the current operation mode of the target storage medium does not support data transfer.
The address conversion table stores 16K item mapping relation for the SRAM, and the hash index is combined with the bloom filter to realize 5ns query delay.
As shown in fig. 6, in this embodiment, in response to the current operation mode of the target storage medium supporting data transfer, transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium includes:
s41, migrating the memory data of the memory page into the target storage medium according to the address of the target storage medium, and judging whether the memory data of the memory page is completely transferred or not;
S42, after the transfer of the memory data of the memory page is completed, updating the address conversion table, and releasing the space of the storage medium where the memory page is located.
The application can reduce the energy consumption and avoid maintaining the energy consumption of a larger storage space by releasing the space of the storage medium where the memory page is located in time.
In this embodiment, before migrating the memory data of the memory page into the target storage medium according to the address of the target storage medium, the method further includes:
Locking the address of the storage medium where the memory page is located, and reading the memory data of the memory page from the address of the storage medium where the memory page is located.
The concurrent access conflict can be prevented by locking the address of the storage medium where the memory page is located.
In this embodiment, before migrating the memory data of the memory page into the target storage medium according to the address of the target storage medium, the method further includes:
judging the validity of the data migration authority and the parameters, if so, checking whether the data migration authority and the parameters meet the switching limiting conditions, and if not, sending out alarm information;
and in response to the switching limiting condition, judging that the data migration is legal, and executing the memory data migration of the memory page to the target storage medium.
And if the information is legal, the information is issued to a target medium, the GPIO signal is driven to switch the medium state, and the internal state machine is updated.
In this embodiment, converting the current operation mode of the target storage medium to support data transfer includes:
Acquiring whether an intermediate transition mode exists when the current operation mode of the target storage medium is converted into a transfer operation mode preset for data transfer;
In response to the presence of the intermediate transition mode, converting the current operating mode of the target storage medium to the intermediate transition mode, and then converting the intermediate transition mode to a transfer operating mode;
The current operating mode of the target storage medium is converted to a transition operating mode in response to the presence of the intermediate transition mode.
The data migration engine drives the storage medium to perform operation mode switching through the GPIO signals, so that the DRAM switching delay is less than 100ns.
Specifically, multi-level power consumption modes P1-P6 are defined, and the switching is dynamically performed according to the type of the storage medium:
DRAM, full speed mode (P1: 5W/GB), self refresh mode (P2: 1W/GB);
SCM full speed mode (P3:2W/GB), low power consumption mode (P4:0.5W/GB);
NVM full speed mode (P5: 1W/GB), deep sleep mode (P6: 0.1W/GB).
Wherein, the state transition mechanism of each storage medium is as follows:
First, the full speed mode of DRAM state transition is converted to self-refresh mode:
The condition is that the DRAM is not accessed for 5 consecutive cycles (5 ms).
And (3) sending PRECHARGE ALL a command to enter a low-power consumption state.
Second, the self-refresh mode of DRAM state transition is converted to full speed mode:
conditional-access request detected.
The operation is that a REFRESH EXIT command is sent to resume the full speed mode.
Third, the full speed mode of SCM state transition transitions to a low power consumption mode:
the condition is that the SCM is not accessed for 20 consecutive periods (20 ms).
And (3) closing the redundant power domain and reserving a key state register.
Fourth, the low power mode of SCM state transition is converted to full speed mode:
conditional-access request detected.
And (3) recovering power supply and initializing the I/O interface.
Fifth, full-speed mode of NVM state migration transitions to deep sleep mode:
the condition is that the NVM is not accessed for 100 consecutive cycles (100 ms).
The operation is to disconnect the main power supply and only keep the standby circuit.
Sixth, the deep sleep mode of NVM state migration transitions to full speed mode:
conditional: the controller sends an activate command or a direct access request.
And (3) the operation of powering up again and loading metadata.
In this embodiment, converting the current operation mode of the target storage medium to support data transfer includes:
acquiring the limiting condition of a target storage medium of the target storage medium, analyzing the limiting condition of the target storage medium, and judging the pre-condition of the conversion from the current operation mode to the target operation mode supporting data transfer;
and controlling the target storage medium to meet the precondition, and converting the current operation mode into the target operation mode after the target storage medium meets the precondition.
Wherein, the switching limiting conditions are as follows:
DRAM can not be directly switched from full-speed mode to deep sleep mode, and needs to be transited through self-refresh mode;
SCM, forbid writing in low power consumption mode, only support reading;
The NVM deep sleep mode requires reservation of at least 1ms wake-up time during which access requests are queued.
When the current operation mode of the target storage medium is converted into the support data transfer, the conversion limiting conditions are acquired first, and then the operation mode conversion is realized after the pre-condition is met, so that the smooth completion of the operation mode conversion can be ensured.
In this embodiment, converting the current operation mode of the target storage medium to support data transfer includes:
Configuring a target storage medium into a demand state according to the energy consumption management information, and sending a pre-wake-up signal to the target storage medium;
and performing operation mode conversion after the target storage medium receives the pre-wake signal.
When data enter the memory module through the CXL controller, the CXL controller obtains data information through CXL.io protocol, and marks a certain memory page as Hot data (Hot), warm data (Warm) and Cold data (Cold) through the Cold and Hot score calculator. After confirming the data type and the target storage medium, the data migration engine performs address translation, and obtains the target DRAM/SCM/NVM physical address by querying the address translation table. At this time, the DMA controller is informed to read data from the source DRAM through CXL.memory protocol, the memory data is migrated into the target storage medium according to the target address of DRAM/SCM/NVM, and the address conversion table is updated after the data migration is completed, so that the space of the source DRAM is released.
And meanwhile, the information such as the power consumption mode, the medium information, the mode switching and the like is issued to a target storage medium through a CXL.memory protocol, the target storage medium is configured into a required state according to the energy consumption management information, and at the moment, if the target DRAM/SCM/NVM is in a low power consumption or self-refresh mode, a pre-wake-up signal is sent, the dynamic operation mode switching of DRAM, SCM, NVM is supported, and the real-time energy consumption state can be reported to a host end through expanding a CXL.io protocol field.
In this embodiment, after performing data transfer on the memory data of the memory page, the method further includes:
the method comprises the steps of obtaining real-time energy consumption state data of a target storage medium, setting preset time length for reporting the real-time energy consumption state data at intervals, and reporting the real-time energy consumption state data of the target storage medium to a host end according to the preset time length or after the operation mode of the target storage medium is converted.
A16-byte extension field is added in the CXL.memory TLP of the CXL protocol layer, which contains the medium type (DRAM/SCM/NVM), the current power consumption mode (full speed mode/low power consumption mode/deep sleep mode) and the accumulated power consumption value (μJ). The newly added 16-byte field is located in the expansion area of the head of the TLP, does not affect the original data transmission and control logic, and is compatible with the existing CXL equipment (such as a memory module and an accelerator). And the ASIC/FPGA controller can support new field analysis through microcode upgrade without reconstructing physical layer and link layer designs.
The CXL protocol layer also comprises a mode switching instruction, and a special operation code (opcode=0x2F) is defined for issuing a switching command, supporting execution, authority verification and the like. An example of switching SCM to low power mode is media type=0x2, target mode=0x1.
And CXL.io is a new control information byte for increasing energy consumption state, data migration and the like.
In this embodiment, the memory management method further includes:
a request packet is sent to the memory module, and the request packet is used for issuing an operation mode switching command or an energy consumption query request;
And after the request packet is sent, acquiring a completion packet, wherein the completion packet is used for returning the energy consumption state data or the operation mode switching operation result.
The CXL protocol is highly scalable in design, and the transaction layer (Transaction Layer) reserves flexible header expansion space to support newly added custom fields. And registering new fields through CXL.memory and CXL.io management interfaces, ensuring the cooperative operation between a Host and equipment, realizing the flexible expansion of memory pooled resources, and avoiding the conflict with CXL.cache protocol. The CXL.memory defines a transmission mechanism through TLP expansion, and mainly completes equipment state energy consumption inquiry and energy consumption mode switching (a state management unit), wherein a Request packet (Request TLP) is used for issuing a mode switching command or inquiry Request, and a Completion packet (Completion TLP) is used for returning an energy consumption state or confirming an operation result.
The user can integrate command tools in firmware to perform active inquiry, and the Host can forcedly acquire the real-time state through the Request TLP.
The energy consumption mode switching can be issued to the target medium by the CXL controller or the user can issue a switching instruction at the host end by himself, and the implementation steps are as follows:
1. software initiates a request:
host driven constructs Request TLPs (opcode=0x2f), specifying target medium and mode;
example switching SCM to low power mode is medium type=0x2, target mode=0x1.
2. The controller responds to:
The CXL controller analyzes the request, verifies the validity of the authority and the parameters, and also needs to verify whether the switching limiting conditions (described below) are met, if the information is legal, the information is issued to the target medium, the GPIO signal is driven to switch the medium state, and the internal state machine is updated.
3. And (3) completion confirmation:
The CXL controller returns a Completion TLP containing the result of the operation (success/failure code);
Additional error details (e.g., invalid mode or media failure) are added upon failure.
The handover constraint is as follows:
DRAM can not be directly switched from full speed mode to deep sleep mode, and needs to be transited through self-refresh mode;
the SCM prohibits writing in a low power consumption mode and only supports reading;
The deep sleep mode of the NVM requires reservation of at least 1ms wake-up time during which access requests are queued.
The specific field extension definitions in the cxl.mem TLP are shown in table 1.
Table 1 field extension definition
Through the medium power consumption definition and the state migration mechanism, dynamic load adaptation can be realized, and the utilization rate of each medium is monitored in real time by dynamically distributing data positions in combination with cold and hot scoring (Score). And in the protocol layer cooperative operation, the current power consumption mode is reported and issued through CXL.mem and CXL.io protocol extension fields (ESF), the energy consumption duty ratio of each medium is counted in real time, the task scheduling is optimized, the effect of hot and cold data distribution as required and the energy consumption dynamic management is achieved, and the resource cost is distributed according to the energy consumption in a cloud computing scene.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment.
As shown in fig. 7 and 8, the embodiment of the present application further provides a memory management device 10, which includes a cold and hot score calculator 1, an energy consumption management module 2 and a data migration engine 3;
The cold and hot score calculator 1 is used for acquiring memory data of a memory page in the memory module, acquiring cold and hot scores of the memory data of the memory page, and setting cold and hot marks for the memory page according to the cold and hot scores;
the data migration engine 3 is used for acquiring the type of the storage medium where the memory page is located, and determining whether to perform data transfer on the memory data of the memory page according to the type of the storage medium and the cold and hot marks set by the memory page;
The energy consumption management module 2 is used for responding to data transfer of the memory data of the memory page, acquiring the address of the storage medium where the memory page is located and the address of the target storage medium, and judging whether the current running mode of the target storage medium supports data transfer or not;
the data migration engine 3 is configured to support data migration in response to a current operation mode of the target storage medium, migrate the memory data of the memory page to the target storage medium according to the address of the target storage medium, and otherwise, the energy consumption management module 2 is configured to convert the current operation mode of the target storage medium into support data migration.
In this embodiment, obtaining memory data of a memory page in a memory module, obtaining a hot score of the memory data of the memory page, and setting a hot flag for the memory page according to the hot score includes:
acquiring access frequency, time locality and task priority of memory data of a memory page;
Acquiring the cold and hot scores of the memory data of the memory pages according to the access frequency, the time locality and the task priority of the memory data of the memory pages;
and obtaining the types of cold and hot marks, wherein the cold and hot marks comprise hot data, warm data and cold data, and marking the cold and hot marks for the memory pages according to the cold and hot scores of the memory data of the memory pages.
In this embodiment, obtaining the hot and cold scores of the memory data of the memory page according to the access frequency, the time locality and the task priority of the memory data of the memory page includes:
Setting time locality as a weight value which decreases with time based on an exponential decay model;
setting the access frequency, time locality and the weight coefficient of task priority;
Multiplying the access frequency, the time locality and the task priority with the corresponding weight coefficients respectively, and summing to obtain the cold and hot scores of the memory data of the memory pages.
In this embodiment, obtaining the type of the storage medium where the memory page is located, and determining whether to transfer the data of the memory page according to the type of the storage medium and the cold/hot flag set in the memory page includes:
Acquiring a storage medium type in a memory module, wherein the storage medium type comprises a high-broadband memory, a low-power-consumption medium and a large-capacity storage;
obtaining the type of a preset cold and hot mark of memory data stored correspondingly by the type of a storage medium, correspondingly storing memory data marked as hot data in a high-bandwidth memory, correspondingly storing memory data marked as warm data in a low-power consumption medium, and correspondingly storing memory data marked as cold data in a large-capacity memory;
The method comprises the steps of obtaining the type of a preset cold and hot mark corresponding to the type of a storage medium where a memory page is located, judging whether the type of the cold and hot mark marked by memory data of the memory page is the same as the type of the preset cold and hot mark corresponding to the type of the storage medium where the memory page is located, if so, judging that data transfer is carried out on the memory data of the memory page, otherwise, judging that data transfer is not carried out on the memory data of the memory page.
In this embodiment, in response to performing data transfer on memory data of a memory page, acquiring an address of a storage medium where the memory page is located and an address of a target storage medium, and determining whether a current operation mode of the target storage medium supports data transfer includes:
after confirming the memory data type of the memory page and the target storage medium, performing address conversion, and obtaining the address of the target storage medium by inquiring an address conversion table;
Acquiring a current operation mode of a target storage medium according to an address of the target storage medium, and acquiring a transfer operation mode of the target storage medium preset for data transfer;
Judging whether the current operation mode of the target storage medium is a transfer operation mode, if so, judging that the current operation mode of the target storage medium supports data transfer, otherwise, judging that the current operation mode of the target storage medium does not support data transfer.
In this embodiment, in response to the current operation mode of the target storage medium supporting data transfer, transferring the memory data of the memory page into the target storage medium according to the address of the target storage medium includes:
Migrating the memory data of the memory page into the target storage medium according to the address of the target storage medium, and judging whether the memory data of the memory page is completely transferred or not;
and after the transfer of the memory data of the memory page is completed, updating the address conversion table, and releasing the space of the storage medium where the memory page is located.
In this embodiment, before migrating the memory data of the memory page into the target storage medium according to the address of the target storage medium, the method further includes:
Locking the address of the storage medium where the memory page is located, and reading the memory data of the memory page from the address of the storage medium where the memory page is located.
In this embodiment, before migrating the memory data of the memory page into the target storage medium according to the address of the target storage medium, the method further includes:
judging the validity of the data migration authority and the parameters, if so, checking whether the data migration authority and the parameters meet the switching limiting conditions, and if not, sending out alarm information;
and in response to the switching limiting condition, judging that the data migration is legal, and executing the memory data migration of the memory page to the target storage medium.
In this embodiment, converting the current operation mode of the target storage medium to support data transfer includes:
Acquiring whether an intermediate transition mode exists when the current operation mode of the target storage medium is converted into a transfer operation mode preset for data transfer;
In response to the presence of the intermediate transition mode, converting the current operating mode of the target storage medium to the intermediate transition mode, and then converting the intermediate transition mode to a transfer operating mode;
The current operating mode of the target storage medium is converted to a transition operating mode in response to the presence of the intermediate transition mode.
In this embodiment, converting the current operation mode of the target storage medium to support data transfer includes:
Configuring a target storage medium into a demand state according to the energy consumption management information, and sending a pre-wake-up signal to the target storage medium;
and performing operation mode conversion after the target storage medium receives the pre-wake signal.
In this embodiment, after performing data transfer on the memory data of the memory page, the method further includes:
the method comprises the steps of obtaining real-time energy consumption state data of a target storage medium, setting preset time length for reporting the real-time energy consumption state data at intervals, and reporting the real-time energy consumption state data of the target storage medium to a host end according to the preset time length or after the operation mode of the target storage medium is converted.
As shown in fig. 7, in the present embodiment, the memory management device 10 further includes an instruction query module 4.
The instruction query module 4 is used for sending a request packet to the memory module, wherein the request packet is used for sending an operation mode switching command or an energy consumption query request, and acquiring a completion packet after sending the request packet, wherein the completion packet is used for returning energy consumption state data or operation mode switching operation results.
The description of the features in the embodiment corresponding to the memory management device may be referred to the related description of the embodiment corresponding to the memory management method, which is not described herein in detail.
The embodiment of the application also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the memory management method embodiments described above.
The electronic device may be a server, and its internal structure may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing memory management data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a memory management method.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is configured to perform the steps of any of the memory management method embodiments described above when run.
In an exemplary embodiment, the computer readable storage medium may include, but is not limited to, a U disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, etc. various media in which a computer program may be stored.
Embodiments of the present application also provide a computer program product comprising a computer program which, when executed by a processor, implements the steps of any of the memory management method embodiments described above.
Embodiments of the present application also provide another computer program product comprising a non-volatile computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of any of the memory management method embodiments described above.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The memory management method, the electronic device, the storage medium and the computer program product provided by the application are described in detail above. The principles and embodiments of the present application have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present application and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the application can be made without departing from the principles of the application and these modifications and adaptations are intended to be within the scope of the application as defined in the following claims.

Claims (14)

The method comprises the steps of responding to the current operation mode of a target storage medium to support data transfer, transferring memory data of a memory page into the target storage medium according to an address of the target storage medium, otherwise, converting the current operation mode of the target storage medium into a mode for supporting data transfer, wherein the step of converting the current operation mode of the target storage medium into the mode for supporting data transfer comprises the steps of obtaining a limiting condition of the target storage medium, analyzing the limiting condition of the target storage medium, judging a pre-condition for converting the current operation mode into the mode for supporting data transfer, controlling the target storage medium to meet the pre-condition, and converting the current operation mode into the target operation mode after the target storage medium meets the pre-condition;
CN202510331481.2A2025-03-202025-03-20Memory management method, electronic device, storage medium, and computer program productActiveCN119847772B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202510331481.2ACN119847772B (en)2025-03-202025-03-20Memory management method, electronic device, storage medium, and computer program product

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202510331481.2ACN119847772B (en)2025-03-202025-03-20Memory management method, electronic device, storage medium, and computer program product

Publications (2)

Publication NumberPublication Date
CN119847772A CN119847772A (en)2025-04-18
CN119847772Btrue CN119847772B (en)2025-07-25

Family

ID=95360075

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202510331481.2AActiveCN119847772B (en)2025-03-202025-03-20Memory management method, electronic device, storage medium, and computer program product

Country Status (1)

CountryLink
CN (1)CN119847772B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN120561153B (en)*2025-07-312025-09-26苏州元脑智能科技有限公司Heterogeneous acceleration method of database, electronic device, storage medium and program product

Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20230086149A1 (en)*2021-09-232023-03-23Intel CorporationReducing memory power usage in far memory
CN117234432A (en)*2023-11-142023-12-15苏州元脑智能科技有限公司Management method, management device, equipment and medium of hybrid memory system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN114063894A (en)*2020-08-072022-02-18华为技术有限公司 A coroutine execution method and device
CN115904212A (en)*2021-09-302023-04-04华为技术有限公司 Data processing method, device, processor and hybrid memory system
CN116486868A (en)*2022-01-222023-07-25美光科技公司 High-speed non-volatile memory (NVMe) over Compute Express Link (CXL)
CN119201452A (en)*2024-09-112024-12-27武汉大学 Hierarchical memory page management method and system based on random dynamic access memory and heterogeneous memory

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US20230086149A1 (en)*2021-09-232023-03-23Intel CorporationReducing memory power usage in far memory
CN117234432A (en)*2023-11-142023-12-15苏州元脑智能科技有限公司Management method, management device, equipment and medium of hybrid memory system

Also Published As

Publication numberPublication date
CN119847772A (en)2025-04-18

Similar Documents

PublicationPublication DateTitle
CN119847772B (en)Memory management method, electronic device, storage medium, and computer program product
US20210373951A1 (en)Systems and methods for composable coherent devices
US11341059B2 (en)Using multiple memory elements in an input-output memory management unit for performing virtual address to physical address translations
US6820143B2 (en)On-chip data transfer in multi-processor system
US7174471B2 (en)System and method for adjusting I/O processor frequency in response to determining that a power set point for a storage device has not been reached
CN109992210B (en)Data storage method and device and electronic equipment
KR20210124082A (en)Systems and methods for composable coherent devices
CN104462432B (en)Adaptive distributed computing method
US20130110308A1 (en)Information Handling System Storage Device Management Information Access
EP4528431A1 (en)Energy-saving management method and apparatus, and computing device and computer-readable storage medium
CN119225985B (en)Memory device and control method based on calculation fast link protocol
CN120144326B (en) Data processing system, method, device, medium and program product
CN116665727B (en)Write I/O aggregation method, apparatus, storage device and storage medium
CN118279126B (en) Graphics processing unit video memory processing method, server, product, device and medium
CN118363914A (en)Data processing method, solid state disk device and host
WO2025026114A1 (en)Storage processing method, electronic device, and readable storage medium
CN112486870B (en) Computer system and computer system control method
EP4492236A1 (en)Data processing method and apparatus for fusion system, device and system
US20250103390A1 (en)Data Processing Method, Apparatus, Device, and System
CN102043731A (en)Cache system of storage system
EP3602309B1 (en)A memory allocation manager and method performed thereby for managing memory allocation
CN119226191A (en) A solid-state memory and memory management method
CN109521949A (en)It is a kind of that frequency data distribution method is write based on the perception for mixing scratch ROM
US7984150B2 (en)Cell compatibilty in multiprocessor systems
CN117806570A (en)Online memory expansion method, device, equipment and storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp