Memory management method, memory storage device and memory controller
By dynamically adjusting the erase count threshold and selecting an appropriate source physical erase unit, the wear balancing mechanism is optimized, solving the problems of low data consolidation operation efficiency and increased write amplification factor in the existing technology, and extending the service life of the memory. and improve work efficiency.
Patent Information
- Application Number
- CN202410632573.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-08-27
AI Technical Summary
The existing wear leveling mechanism has the problems of low data consolidation operation efficiency and increased write amplification factor during the service life of the memory storage device. This is mainly due to the erasure threshold setting being too strict or loose, resulting in unnecessary movement operations and data. The consolidation operation is not efficient.
Adopt the method of dynamically adjusting the erase count threshold, by setting multiple average erase count levels and their corresponding erase count thresholds, select the source entity erase unit based on the current average erase count and valid data count value, and optimize data consolidation. operation, reducing unnecessary moving operations and reducing the write amplification factor.
The efficiency of the data merging operation is improved, the service life of the memory storage device is extended, the write amplification factor is reduced, unnecessary data merging operations are avoided, and the working efficiency of the memory is improved.
Smart Images

Figure CN118550464A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of storage technology, and in particular to a memory management method, a memory storage device and a memory controller. Background Art
[0002] The existing wear leveling (WL) mechanism starts a data consolidation operation based on the wear leveling mechanism when the erase count of the memory storage device is greater than the preset erase count threshold. However, this method only considers the erase count of the physical erase unit as the only criterion for whether to start the data consolidation operation. If the erase count threshold is too strict, the execution efficiency of the data consolidation operation will be too low, resulting in an increase in the write amplification factor (WAF), which will affect the service life of the memory storage device. Summary of the invention
[0003] Embodiments of the present invention provide a memory management method, a memory storage device, and a memory controller, which can optimize data consolidation operations based on a wear leveling mechanism, dynamically adjust the erasure count threshold during the service life of the memory module, reduce the occurrence of unnecessary move operations in the early stage of the service life, improve the efficiency of data consolidation operations, thereby reducing the write amplification factor and increasing the service life of the memory storage device.
[0004] An embodiment of the present invention provides a memory management method, which is used for a memory module. The memory module is divided into a storage area and an idle area. The memory management method includes: determining multiple average erase count levels; determining multiple different erase count thresholds corresponding to the multiple average erase count levels; obtaining the current average erase count of the memory module; judging the average erase count level corresponding to the current average erase count, and judging whether the current average erase count is greater than the erase count threshold corresponding to the average erase count level; and in response to the current average erase count being greater than the erase count threshold, selecting a source physical erase unit from the storage area, and releasing the source physical erase unit to the idle area. In an exemplary embodiment of the present invention, the multiple average erase count levels are negatively correlated with the multiple erase count thresholds.
[0005] In an exemplary embodiment of the present invention, the step of selecting a source physical erase unit from a storage area includes: in an exemplary embodiment of the present invention, when the data to be stored is written in the order in which the corresponding write instructions are received from the host system, selecting the remaining physical erase units arranged in the storage area except the last X physical erase units as a plurality of selected physical erase units, where X is a positive integer greater than 1, and the last X physical erase units have valid data; obtaining a plurality of erase times and a plurality of valid data count values of the plurality of selected physical erase units; and selecting a source physical erase unit according to the plurality of erase times and the plurality of valid data count values.
[0006] In an exemplary embodiment of the present invention, the step of selecting a source physical erase unit according to a plurality of erase counts and a plurality of valid data count values includes: determining a plurality of erase count levels; determining an erase count level corresponding to each erase count; and in response to at least one erase count corresponding to the same erase count level, selecting a valid physical erase unit having a minimum valid data count value among at least one valid physical erase unit corresponding to at least one erase count as a source physical erase unit.
[0007] In an exemplary embodiment of the present invention, the memory management method further includes: in response to at least one erase count corresponding to different erase count levels, calculating at least one wear balance factor comprehensive value according to at least one erase count and its corresponding at least one valid data count value, and selecting a source physical erase unit according to the at least one wear balance factor comprehensive value.
[0008] In an exemplary embodiment of the present invention, the memory management method further includes: obtaining a curve comparison table, wherein the curve comparison table records a mapping relationship between average erase times and erase times thresholds, wherein an average erase times corresponds to an erase times threshold; according to the current average erase times, obtaining a dynamic erase times threshold according to the mapping relationship from the curve comparison table; wherein the curve comparison table includes the following acquisition steps: determining the model identification information of the current memory module; creating a corresponding curve comparison original table according to the model identification information; according to a preset time interval, obtaining the average erase times of the current test and the original default average erase times at different test times, and comparing the sizes; if the average erase times of the current test are less than the original default average erase times, The number of erasure times to be tested is generated by taking the original erasure times threshold value corresponding to the original default average erasure times as the minimum value, and when the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erasure times threshold value; if the average erasure times of the current test is not less than the original default average erasure times, the number of erasure times to be tested is generated by taking the original erasure times threshold value corresponding to the original default average erasure times as the maximum value, and when the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erasure times threshold value; the mapping relationship between the dynamic erasure times threshold value and the corresponding average erasure times of the current test is stored in the curve comparison original table to obtain the curve comparison table.
[0009] In an exemplary embodiment of the present invention, the memory management method also includes: obtaining address conversion information, wherein the address conversion information includes a data logical address; obtaining the number of updates of the corresponding data within a preset time period according to the data logical address; when the number of updates is greater than an update number threshold, obtaining a data physical address currently corresponding to the data; determining the effective value ratio of the physical erase unit corresponding to the data physical address currently corresponding to the data; if the effective value ratio of the physical erase unit corresponding to the data physical address corresponding to the current data is greater than the ratio threshold, determining that the physical erase unit corresponding to the data physical address corresponding to the current data is a source physical erase unit to be excluded; receiving a source physical erase unit acquisition instruction, removing the source physical erase unit to be excluded, and acquiring the source physical erase unit from the remaining source physical erase units.
[0010] An embodiment of the present invention further provides a memory storage device, which includes a connection interface, a memory module and a memory controller. The memory module is divided into a storage area and an idle area. The memory controller connects the connection interface and the memory module. The memory controller is used to determine multiple average erase times. The memory controller is also used to determine multiple different erase times thresholds corresponding to the multiple average erase times levels. The memory controller is also used to obtain the current average erase times of the memory module. The memory controller is also used to determine the average erase times level corresponding to the current average erase times, and to determine whether the current average erase times is greater than the erase times threshold corresponding to the average erase times level. In response to the current average erase times being greater than the erase times threshold, the memory controller is also used to select a source physical erase unit from the storage area and release the source physical erase unit to the idle area.
[0011] In an exemplary embodiment of the present invention, when the data to be stored is written in the order in which the corresponding write commands are received from the host system, the memory controller is further used to select the remaining physical erase units arranged in the storage area other than the last X physical erase units as multiple physical erase units to be selected, where X is a positive integer greater than 1, and the last X physical erase units have valid data. The memory controller is also used to obtain multiple erase times and multiple valid data count values of the multiple physical erase units to be selected. The memory controller is also used to select the source physical erase unit according to the multiple erase times and the multiple valid data count values.
[0012] In an exemplary embodiment of the present invention, the memory controller is further used to determine a plurality of erase count levels. The memory controller is further used to determine the erase count level corresponding to each erase count. In response to at least one erase count corresponding to the same erase count level, the memory controller is further used to select a valid physical erase unit having a minimum valid data count value among at least one valid physical erase unit corresponding to at least one erase count as a source physical erase unit.
[0013] In an exemplary embodiment of the present invention, in response to at least one erase count corresponding to different erase count levels, the memory controller is further configured to calculate at least one wear balance factor comprehensive value based on the at least one erase count and its corresponding at least one valid data count value, and select a source physical erase unit based on the at least one wear balance factor comprehensive value.
[0014] In an exemplary embodiment of the present invention, the memory controller is further used to obtain a curve comparison table, wherein the curve comparison table records a mapping relationship between average erase times and erase times thresholds, wherein an average erase times corresponds to an erase times threshold. The memory controller is also used to obtain a dynamic erase times threshold from the curve comparison table according to the mapping relationship based on the current average erase times. The memory controller is used to obtain the curve comparison table, including the following operations: determining the model identification information of the current memory module, and creating a corresponding curve comparison original table according to the model identification information; obtaining the average erase times of the current test and the original default average erase times at different test times according to a preset time interval, and comparing the sizes; if the average erase times of the current test is less than the original default average erase times, the original erase times threshold value corresponding to the original default average erase times is used as the minimum value to generate the erase times threshold value to be tested, and when the efficiency of the data consolidation operation changes from low to high and then from high to low during the test process, the inflection point of the change is used as the dynamic erase times threshold value; if the average erase times of the current test is not less than the original default average erase times, the original erase times threshold value corresponding to the original default average erase times is used as the maximum value to generate the erase times threshold value to be tested, and when the efficiency of the data consolidation operation changes from low to high and then from high to low during the test process, the inflection point of the change is used as the dynamic erase times threshold value; the mapping relationship between the dynamic erase times threshold value and the corresponding average erase times of the current test is stored in the curve comparison original table to obtain the curve comparison table.
[0015] In an exemplary embodiment of the present invention, the memory controller is also used to obtain address conversion information, wherein the address conversion information includes a data logical address. The memory controller is also used to obtain the number of updates of the corresponding data within a preset time period according to the data logical address. When the number of updates is greater than the update number threshold, the memory controller is also used to obtain the data physical address currently corresponding to the data. The memory controller is also used to determine the effective value ratio of the physical erase unit corresponding to the data physical address currently corresponding to the data. If the effective value ratio of the physical erase unit corresponding to the data physical address corresponding to the current data is greater than the ratio threshold, the memory controller is also used to determine that the physical erase unit corresponding to the data physical address corresponding to the current data is a source physical erase unit to be excluded. The memory controller is also used to receive a source physical erase unit acquisition instruction, remove the source physical erase unit to be excluded, and acquire the source physical erase unit from the remaining source physical erase units.
[0016] The embodiment of the present invention further provides a memory controller, which is used to control a memory module. The memory module is divided into a storage area and an idle area. The memory controller includes a host interface, a memory interface, and a memory control circuit. The host interface is used to connect to a host system. The memory interface is used to connect to the memory module. The memory control circuit is connected to the host interface and the memory interface. The memory control circuit is used to determine a plurality of average erase times levels. The memory control circuit is also used to determine a plurality of different erase times thresholds corresponding to the plurality of average erase times levels. The memory control circuit is also used to obtain the current average erase times of the memory module. The memory control circuit is also used to determine the average erase times level corresponding to the current average erase times, and to determine whether the current average erase times is greater than the erase times threshold corresponding to the average erase times level. In response to the current average erase times being greater than the erase times threshold, the memory control circuit is also used to select a source physical erase unit from the storage area, and release the source physical erase unit to the idle area.
[0017] Based on the above, the present invention provides a memory management method, a memory storage device and a memory controller, which can set multiple average erase times and their corresponding multiple erase times thresholds to dynamically provide the erase times threshold that best suits the current average erase times. Accordingly, unnecessary move operations can be avoided to improve the efficiency of data consolidation operations and reduce write amplification factors.
[0018] In order to make the above features and advantages of the present invention more clearly understood, embodiments are given below with reference to the accompanying drawings for detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a schematic diagram of a memory storage device according to an embodiment of the present invention;
[0020] Figure 2 is a schematic diagram of a memory controller according to an embodiment of the present invention;
[0021] Figure 3 is a schematic diagram of a management memory module according to an embodiment of the present invention;
[0022] Figure 4 is a graph showing a relationship between an average erasure count level and an erasure count threshold according to an embodiment of the present invention;
[0023] Figure 5 is a flowchart of a memory management method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0024] Reference will now be made in detail to exemplary embodiments of the present invention, examples of which are illustrated in the accompanying drawings. Whenever possible, the same reference numerals are used in the drawings and the description to refer to the same or like parts.
[0025] Figure 1 is a schematic diagram of a memory storage device according to an embodiment of the present invention. Figure 1 , the memory storage system 10 includes a host system 11 and a memory storage device 12. The host system 11 can be any type of computer system. For example. The host system 11 can be a notebook computer, a desktop computer, a smart phone, a tablet computer, an industrial computer, etc. The memory storage device 12 is used to store data from the host system 11. For example, the memory storage device 12 may include a solid state drive, a USB flash drive, or other types of non-volatile storage devices. The host system 11 can be electrically connected to the memory storage device 12 via a Serial Advanced Technology Attachment (SATA) interface, a Peripheral Component Interconnect Express (PCI Express), a Universal Serial Bus (USB), or other types of connection interfaces. Therefore, the host system 11 can store data to the memory storage device 12 and / or read data from the memory storage device 12.
[0026] The memory storage device 12 may include a connection interface 121, a memory module 122, and a memory controller 123. The connection interface 121 is used to connect the memory storage device 12 to the host system 11. For example, the connection interface 121 may support connection interface standards such as SATA, PCI Express, or USB. The memory storage device 12 may communicate with the host system 11 via the connection interface 121.
[0027] The memory module 122 is used to store data. The memory module 122 may include a rewritable non-volatile memory module. The memory module 122 includes a memory cell array. The memory cells in the memory module 122 store data in the form of voltage. For example, the memory module 122 may include a single-level cell (SLC) NAND flash memory module, a multi-level cell (MLC) NAND flash memory module, a triple-level cell (TLC) NAND flash memory module, a quad-level cell (QLC) NAND flash memory module, or other memory modules with similar characteristics.
[0028] The memory controller 123 is connected to the connection interface 121 and the memory module 122. The memory controller 123 can be used to control the memory storage device 12. For example, the memory controller 123 can control the connection interface 121 and the memory module 122 to perform data access and data management. For example, the memory controller 123 may include a central processing unit (CPU), a graphics processing unit (GPU), or other programmable general-purpose or special-purpose microprocessors, digital signal processors (DSP), programmable controllers, application specific integrated circuits (ASIC), programmable logic devices (PLD) or other similar devices or combinations of these devices.
[0029] In one embodiment, the memory controller 123 is also called a flash memory controller. In one embodiment, the memory module 122 is also called a flash memory module. The memory module 122 can receive a command sequence from the memory controller 123 and access data stored in the storage unit according to the command sequence.
[0030] Figure 2 FIG. 1 is a schematic diagram of a memory controller according to an embodiment of the present invention. Figure 1 and Figure 2 The memory controller 123 includes a host interface 21, a memory interface 22 and a memory control circuit 23. The host interface 21 is used to connect to the host system 11 via the connection interface 121 to communicate with the host system 11. The memory interface 22 is used to connect to the memory module 122 to communicate with the memory module 122.
[0031] The memory control circuit 23 is connected to the host interface 21 and the memory interface 22. The memory control circuit 23 can communicate with the host system 11 via the host interface 21 and access the memory module 122 via the memory interface 22. For example, the memory control circuit 23 can receive various operation instructions (such as read instructions, write instructions, or erase instructions) from the host system 11 via the host interface 21 and issue corresponding instruction sequences (such as read instruction sequences, write instruction sequences, or erase instruction sequences) to the memory module 122 via the memory interface 22. In addition, the memory control circuit 23 can transmit data to the host system 11 via the host interface 21.
[0032] In one embodiment, the memory control circuit 23 may also be regarded as the control core of the memory controller 123. In the following embodiments, the description of the memory control circuit 23 is equivalent to the description of the memory controller 123.
[0033] Figure 3 FIG. 1 is a schematic diagram of a management memory module according to an embodiment of the present invention. Figures 1 to 3 , the memory module 122 includes a plurality of physical units 301(1)-301(B). Each physical unit includes a plurality of storage cells and is used to store data in a non-volatile manner. For example, a physical unit may include one or more physical erase units (e.g., physical blocks). Each physical unit may include a plurality of physical programming units (e.g., physical pages). A plurality of storage cells in a physical page may be programmed simultaneously to store data. All storage cells in a physical unit (or physical block) may be erased simultaneously.
[0034] In one embodiment, the physical units 301(1)-301(A) and 301(A+1)-301(B) in the memory module 122 can be respectively divided into a storage area 310 and an idle area 320. The physical units 301(1)-301(A) in the storage area 310 store data (also called user data) from the host system 11. The physical units 301(A+1)-301(B) in the idle area 320 do not store data.
[0035] In one embodiment, when new data from the host system 11 needs to be stored, one or more physical units in the idle area 320 will be selected and used to store the new data. The physical units in the idle area 320 used to store data can be divided into the storage area 310. As more and more physical units in the idle area 320 are used to store data, the total number of physical units in the idle area 320 will gradually decrease.
[0036] In one embodiment, the memory control circuit 23 may configure a plurality of logical units 302 (1) to 302 (C) to map physical units in the storage area 310. For example, a logical unit may be composed of one or more logical addresses. For example, a logical address may include one or more logical block addresses (Logical Block Address, LBA). The mapping relationship between the logical unit and the physical unit may be recorded in a logical to physical mapping table. When receiving an access instruction from the host system 11, the memory control circuit 23 may access the physical units in the storage area 310 and / or the idle area 320 according to the logical to physical mapping table.
[0037] In one embodiment, if a physical unit is currently mapped by a logical unit, it means that valid data is stored in the physical unit. However, if a physical unit is currently not mapped by any logical unit, it means that no valid data is stored in the physical unit.
[0038] Generally speaking, in the existing wear leveling (WL) mechanism, when the erase count of the memory module 122 is greater than a preset erase count threshold, a data consolidation operation based on the wear leveling mechanism is immediately started. However, the existing mechanism mostly only considers the average erase count of the memory module 122 (that is, the average of multiple erase counts of multiple physical erase units in the memory module 122) as the only criterion for whether to start the data consolidation operation.
[0039] If the erase count threshold is set too strictly, the efficiency of data consolidation operation will be too low, resulting in an increase in the write amplification factor (WAF), thereby affecting the service life of the memory storage device 12. On the contrary, if the erase count threshold is set too loosely, it will lead to too many unnecessary data consolidation operations, affecting the working performance of the memory storage device 12.
[0040] To improve the above problems, the present invention provides a memory management method that can dynamically adjust the erase count threshold during the life time of the memory storage device 12 to reduce unnecessary data consolidation operations in the early life time and provide the most suitable erase count threshold.
[0041] Specifically, the present invention starts from the entire service life of the memory storage device 12, comprehensively considers the changes in the service life of the memory storage device 12 at different periods, and provides a suitable erasure number threshold, so that at different periods, the memory storage device 12 can efficiently implement data consolidation operations, so that the service life of the memory storage device 12 can be further extended. In the present invention, the change in time, the different periods of the service life of the memory storage device 12, and the change in the ratio of valid data to invalid data in the physical erasure unit can be reflected by the average erasure number of the memory module 122. It is understandable that the average number of erase times of the memory module 122 increases with time. In the process of increasing the average number of erase times of the memory module 122, the remaining storage resources of the memory module 122 are actually changing. In fact, different remaining storage resources have different tolerances for data consolidation operations. When there are more remaining storage resources, given that the ratio of valid data to invalid data in the physical erase unit is not very close, the efficiency of the data consolidation operation is actually relatively high at this time. The erase times threshold can be set higher to maximize the efficiency of the data consolidation operation and reduce the write amplification factor while striving to achieve wear balance.
[0042] In view of this, the present invention also specifically includes a method for dynamically adjusting the erasure count threshold value according to the storage consumption of the memory module 122 that changes over time:
[0043] Obtain a curve comparison table, wherein the curve comparison table records a mapping relationship between an average number of erasures and an erasure threshold, wherein one average number of erasures corresponds to one erasure threshold;
[0044] According to the current average erasure times, a dynamic erasure times threshold is obtained from the curve comparison table according to a mapping relationship, wherein the curve comparison table includes the following acquisition steps:
[0045] Determine model identification information of the current memory module;
[0046] Create corresponding curves and compare them to the original table according to the model identification information;
[0047] According to the preset time interval, obtain the average erasure times of the current test and the original default average erasure times at different test times, and compare them;
[0048] If the average erase times of the current test is less than the original default average erase times, the erase times threshold to be tested is generated with the original erase times threshold corresponding to the original default average erase times as the minimum value, and when the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erase times threshold;
[0049] If the average erase times of the current test is not less than the original default average erase times, the erase times threshold to be tested is generated with the original erase times threshold corresponding to the original default average erase times as the maximum value, and when the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erase times threshold;
[0050] The mapping relationship between the dynamic erasure times threshold and the corresponding average erasure times of the current test is stored in the curve comparison original table to obtain a curve comparison table.
[0051] Specifically, the memory module obtains a curve comparison table corresponding to the count change curve, wherein the curve comparison table includes a mapping relationship between the average number of erasures and the threshold number of erasures. It should be noted that the mapping relationship recorded in the curve comparison table can be a data relationship recorded for a specific model of memory module during the test phase.
[0052] Furthermore, the curve comparison table corresponding to the count change curve can be a test setting of different erasure number thresholds by the user according to a preset time interval and at different average erasure times. Specifically, first determine the size relationship between the average erasure times during the current test and the average erasure times in the (existing) original default setting. If the average erasure times during the current test is smaller, the value range of the erasure number threshold will be set above the original erasure number threshold corresponding to the average erasure times in the original default setting. For example, the average erasure times in the original default device is A, and its corresponding original erasure number threshold is Ya. When testing and setting different erasure number thresholds, Ya will be taken as the minimum value and upward. Afterwards, when the test setting is performed under the value range of the determined erasure number threshold, when the efficiency of the data consolidation operation changes from low to high and then from high to low, the threshold corresponding to the inflection point is used as the erasure number threshold corresponding to the average erasure times of the current test, and the two values are recorded in the relationship mapping and stored in the curve comparison table. Similarly, if the average number of erase times in the current test is large, the value range of the erase times threshold will be set below the original erase times threshold corresponding to the average number of erase times in the original default setting. For example, the average number of erase times in the original default device is B, and its corresponding original erase times threshold is Yb. When different erase times thresholds are tested and set, Yb will be taken as the maximum value and then taken downward. After that, when the test is set under the value range of the determined erase times threshold, when the efficiency of the data consolidation operation changes from low to high and then from high to low, the threshold corresponding to the inflection point is used as the erase times threshold corresponding to the average number of erase times of the current test, and the relationship mapping record of the two values is stored in the curve comparison table. In this way, the mapping relationship between the average number of erase times and the erase times threshold of multiple groups can be stored in the curve comparison table corresponding to the counting change curve.
[0053] It is understandable that in actual applications, if the frequency of dynamic changes in the erase count threshold is too fast, it will also occupy a lot of computing power and memory resources of the memory module. Therefore, from the perspective of comprehensive and full utilization of resources, in actual application scenarios, the frequency of dynamic changes in the erase count threshold can be specifically set to take several key nodes on the average erase count axis of storage, and the average erase count and the corresponding erase count threshold are expressed in a segmented and hierarchical manner. Specifically, Figure 4 This feasible implementation method is adopted in .
[0054] Figure 4 is a graph showing the relationship between the average erase count level and the erase count threshold according to an embodiment of the present invention. Figures 1 to 4 First, the memory control circuit 23 can determine a plurality of average erase times levels Level 0 to Level 3. Figure 4As shown, when the average erase count EC of the memory module 122 avg When the average erase times of the memory module 122 is 0 to K times, it is determined to be the lowest average erase times level Level 0; when the average erase times of the memory module 122 EC avg When the average erase times of the memory module 122 is K+1 to M times, it is determined to be the second lowest average erase times level Level 1 1; when the average erase times of the memory module 122 EC avg When the average erase times of the memory module 122 is M+1 to N times, it is determined to be the second highest average erase times level Level 1 2; when the average erase times of the memory module 122 is EC avg When it is greater than N times, it is determined as the highest average erasure times level Leve1 3.
[0055] Next, the memory control circuit 23 may determine a plurality of different erasure count thresholds EC corresponding to a plurality of average erasure count levels. th Specifically, at the beginning of the service life of the memory storage device 12, the wear level of the memory module 122 (ie, the average number of erasures) is very low. At this time, if the memory control circuit 23 appropriately increases the erasure threshold EC th Since the ratio of valid data to invalid data in the erased physical unit is not very close, it will not have a negative impact on the service life of the memory storage device 12.
[0056] Therefore, the memory control circuit 23 can set the highest erasure count threshold T0 for the lowest average erasure count level Level 0, and increase the average erasure count level (ie, the average erasure count EC of the memory module 122). avg The erase count threshold EC is dynamically lowered. th To ensure that the memory control circuit 23 can quickly converge the erase count threshold EC at the end of its service life th Finally, the memory control circuit 23 may set a maximum erasure count threshold T for the highest average erasure count level Level 3. n Thereafter, until the end of the service life of the memory storage device 12, the memory control circuit 23 may set the erasure count threshold EC th Keep at T n .
[0057] In one embodiment, the average erase count level 0 to Level 3 and the erase count threshold EC th That is, when the average erasure times level is higher, the erasure times threshold EC th The lower.
[0058] In one embodiment, the memory control circuit 23 may obtain the current average erase count of the memory module 122. Then, the memory control circuit 23 may determine the average erase count level corresponding to the current average erase count. For example, if the current average erase count of the memory module 122 is K+5 times, the memory control circuit 23 may determine that the current average erase count (K+5 times) corresponds to the average erase count level Leve1 1. Accordingly, the memory control circuit 23 may determine whether the current average erase count (K+5 times) is greater than the erase count threshold T corresponding to the average erase count level Leve1 1. k .
[0059] If the current average number of erasures (K+5 times) is equal to or less than the erasure threshold T k , the memory control circuit 23 does not perform the data consolidation operation based on the wear leveling mechanism for the time being.
[0060] On the other hand, if the current average number of erasures (K+5 times) is greater than the erasure threshold T k , the memory control circuit 23 can select a source physical erase unit from the storage area 310 and release the source physical erase unit to the idle area 320. Specifically, if the current average erase count (K+5 times) is greater than the erase count threshold T k , the memory control circuit 23 needs to perform data consolidation operations based on the wear leveling mechanism.
[0061] According to the above, the memory management method of the present invention sets a plurality of average erase times levels Level 0 to Level 3 and a plurality of corresponding erase times thresholds EC. th , dynamically provide the erase count threshold EC that best suits the current average erase count th In this way, unnecessary migration operations can be avoided, thereby improving the efficiency of data consolidation operations and reducing write amplification factors.
[0062] Furthermore, before performing the data consolidation operation based on the wear leveling mechanism, the present invention also includes an improved method step of acquiring the source physical erase unit:
[0063] Acquire address conversion information, wherein the address conversion information includes a data logical address;
[0064] Acquire the update times of the corresponding data within a preset time period according to the data logical address;
[0065] When the number of updates is greater than the update number threshold, the physical address of the data currently corresponding to the data is obtained;
[0066] Determine the effective value ratio of the physical erase unit corresponding to the data physical address currently corresponding to the data;
[0067] If the valid value ratio of the physical erase unit corresponding to the data physical address corresponding to the current data is greater than the ratio threshold, determining that the physical erase unit corresponding to the data physical address corresponding to the current data is a source physical erase unit to be excluded;
[0068] A source physical erase unit acquisition instruction is received, the source physical erase unit to be excluded is removed, and a source physical erase unit is acquired from the remaining source physical erase units.
[0069] It should be understood that the memory module 122 can obtain the address conversion information related to the recent data writing behavior. After that, the data logical address included in the address conversion information is actually the address at the user operation level, and the data physical address of the data during the operation process can be changed. For the user operation level, the user is facing the same data object. Then, from the data logical address level, the update frequency of the data logical address in a short period of time reflects the demand for data update frequency, that is, the hot data in the memory module 122 can be judged from this level. When the update number meets the threshold requirement, the latest data physical address corresponding to the data can be obtained, so as to determine the latest physical erase unit where the hot data is located according to the data physical address. If the valid data on the physical erase unit also meets the corresponding threshold requirement, it means that the physical erase unit is likely to be copied by the host system 11 and the data is gradually converted into invalid data. If the physical erase unit that is about to convert the data from high valid data to low valid data is used as the source physical erase unit, the write amplification factor will be increased.
[0070] Specifically, the following embodiments can be used for explanation. First, the memory control circuit 23 can select the remaining physical erase units other than the X physical erase units arranged in the storage area 310 as multiple physical erase units to be selected. In one embodiment, X is a positive integer greater than 1, and the value of X is related to the proportion of valid data and hot data in the physical erase unit. When the proportion of valid data and hot data in the physical erase unit is higher than the corresponding threshold value, these X physical blocks will not be used as source physical erase units.
[0071] Among them, when performing data consolidation operation, if the proportion of hot data on the physical erase unit is high, since a large amount of hot data itself will gradually become invalid data as the host system 11 is copied, if these physical erase units containing a large amount of hot data are directly used as source physical erase units without being copied by the host system 11, the copy of the host system 11 will not be fully utilized to reduce the proportion of hot data during the wear leveling mechanism, which will increase the write amplification factor. Therefore, when selecting the source physical erase unit in the data consolidation operation, the memory control circuit 23 can ignore X physical erase units storing valid data in the storage area 310, and use the remaining physical erase units as the physical erase units to be selected, so as to reduce the proportion of hot data during the data consolidation operation, thereby reducing the write amplification factor.
[0072] In particular, in one embodiment, generally speaking, in the storage resource list of the used physical erase units, the last X physical erase units have more valid data. To further illustrate, when the memory control circuit 23 manages the multiple physical erase units in the storage area 310, they are mostly arranged according to the data writing order of the host system 11. Generally, a large amount of valid data is stored in the several physical erase storage units at the end of the storage area 310 (that is, the last several physical erase units in the storage area 310), and these large amounts of valid data are mostly hot data, that is, data that is often repeatedly written by the host system 11, so these large amounts of valid data will gradually become invalid data; when the data is arranged according to the writing order of the host system 11, it can be determined that the last X physical erase units arranged in the storage area 310 generally have more hot data and valid data. In this way, if it is determined that the host system 11 arranges according to the writing order, the storage units that are not suitable for being the source physical erase units can be quickly identified in the memory 310, which can effectively reduce the write amplification factor.
[0073] Next, the memory control circuit 23 may obtain a plurality of erasure times and a plurality of valid data count values of the physical erasure unit to be selected, and select a source physical erasure unit according to the plurality of erasure times and the plurality of valid data count values.
[0074] Further explanation, when the memory control circuit 23 selects the source physical erase unit, if only the number of erases is considered, a physical erase unit with a small number of erases but a high valid data count value may be selected, thereby reducing the efficiency of the data consolidation operation based on the wear leveling mechanism and increasing the write amplification factor. Accordingly, when the memory control circuit 23 selects the source physical erase unit, the memory control circuit 23 can comprehensively consider multiple erase times and multiple valid data count values of the selected physical erase unit to avoid the problem of low efficiency of the data consolidation operation.
[0075] In one embodiment, the memory control circuit 23 can determine a plurality of erasure levels. The erasure levels in the present invention are specifically described according to five levels, namely, erasure level 0, 1, 2, 3, and 4. The erasure levels are shown in Table 1.
[0076] Table 1
[0077] Erasure level <![CDATA[EC s -EC min range<!-- 9 --> ]]> 0 <![CDATA[[0,EC gap )]]> 1 <![CDATA[[EC gap ,2EC gap )]]> 2 <h2 style=";text-align:left;direction:ltr"><![CDATA[[2EC <h2 style=";text-align:left;direction:ltr"> gap <h2 style=";text-align:left;direction:ltr"> ,3EC<h2 style=";text-align:left;direction:ltr"> gap <h2 style=";text-align:left;direction:ltr"> )]]><h2 style=";text-align:left;direction:ltr"> 3 <![CDATA[[3EC gap ,4EC gap )]]> 4 <![CDATA[[4EC gap ,5EC gap )]]>
[0078] Among them, EC s is the number of erasures of the physical erasure unit to be selected; EC min is the minimum value of the number of erasures among multiple physical erasure units to be selected; when there are 5 erasure levels, EC gap Specific setting is EC th / 5, when there are N erasure levels, EC gap For EC th / N. It can be understood that the EC gap The level of erasure is adjusted accordingly. The higher the level of erasure, the higher the EC gap The smaller the source physical erase unit, the more accurate it will be. As shown in Table 1, EC s -EC min The value range is divided according to the erasure level. For example, the value range of erasure level 0 is [0,EC gap ), the corresponding value range of erasure level 4 is [4EC gap ,5EC gap ) etc., you can see that 5EC gap Actually equal to EC th , that is, EC s -EC min The value range can be set between 0 and EC th Among them, theoretically, EC s -EC min The value range will not exceed EC th Because when the present invention performs multi-weighted wear balancing, there will be no situation where the number of erase times of the physical erase unit to be selected is greater than EC th If this happens, it also reflects that there are problems with the multi-weighted wear balance mechanism of the present invention. When the number of erasures of the selected physical erase unit is not greater than EC th In this case, it just shows that the multi-weighted wear balance mechanism is controlled within a reasonable range.
[0079] Among them, EC s -EC min The value range is based on the degree of erasure, with EC gapBy dividing the increment amount, the erasure conditions of different candidate physical erasure units can be further subdivided, so as to further subdivide according to the erasure conditions of different candidate physical erasure units, thereby improving the accuracy of selecting the source physical erasure unit.
[0080] The memory control circuit 23 can determine the erasure level corresponding to each erasure number.
[0081] In one embodiment, if at least one erase count corresponds to the same erase level, the memory control circuit 23 may select the candidate physical erase unit with the smallest valid data count value among at least one valid physical erase unit corresponding to the at least one erase count as the source physical erase unit. Specifically, if the values of multiple erase counts belonging to the same erase level are close, the memory control circuit 23 may select the source physical erase unit according to the valid data count value.
[0082] In addition, if at least one erase count corresponds to different erase levels, the memory control circuit 23 can calculate at least one wear balance factor comprehensive value according to the at least one erase count and its corresponding at least one valid data count value, and select a source physical erase unit according to the at least one wear balance factor comprehensive value.
[0083] The calculation formula for the comprehensive value of balanced wear factors is as follows:
[0084] WL f =α*VC max *[(EC s -EC min ) / EC gap ]+β*VC s
[0085] Among them, WL f is the comprehensive value of balanced wear factors; among them, VC max The maximum valid data count value among multiple physical erase units to be selected; EC s is the number of erasures of the physical erasure unit to be selected; VC s EC is the valid data count value of the physical erase unit to be selected; min The minimum number of erasure times among multiple physical erasure units to be selected; EC gap For EC th / N, where N is the number of erasure levels, α is the first coefficient, and β is the second coefficient. α is set to be equal to VC max The moderating factor related to the factor, β is set to be equal to VC sRelated adjustment factors. Among them, under initial conditions, the values of α and β can both be set to 0.5. As time goes by or the environment changes, for example, the storage capacity occupancy of the memory module, or the ambient temperature, voltage, etc. may cause changes in data storage, under different specific conditions and environments, the values of α and β can be adaptively adjusted according to the pre-set parameter comparison table, so that a better source physical erase unit can still be selected and determined under specific environments.
[0086] In the calculation formula of the above balanced wear factor comprehensive value, the influence of the erase times difference between the erase times of the candidate physical erase unit and the minimum erase times among multiple candidate physical erase units is fully considered, and the EC is set gap The influence of the difference is further subdivided to distinguish the influence of different erase times under different levels of erase times; secondly, the influence of the largest valid data count value on wear balance is considered from multiple candidate physical erase units; and finally, the valid data count value of the candidate physical erase unit is considered in combination with the actual environment and condition factors of the largest valid data count value and the valid data count value of the candidate physical erase unit, and the corresponding adjustment factors are set to achieve more accurate balance adjustment calculation. Finally, based on the above multiple factors, the influence on wear balance can be visualized from multiple core dimensions using WL f The mathematical expression of WL f It actually reflects the processing efficiency of data integration and cooperation. The processor erases the WL of different candidate physical units. f After comparing the values, you can use the comparison results, such as WL f The unit with the larger value is given priority as the source entity to be erased.
[0087] As described above, after comprehensively considering multiple factors such as the maximum valid data count value among multiple physical erase units to be selected, the number of erase times of the physical erase unit to be selected, the valid data count value of the physical erase unit to be selected, the minimum number of erase times and the erase degree level among multiple physical erase units to be selected, the most suitable multiple source physical erase units can be quickly determined, which can improve the processing efficiency of data consolidation operations, effectively reduce the write amplification factor, and thus increase the service life of the storage device.
[0088] In one embodiment, the memory control circuit 23 may select a candidate physical erase unit with a smaller comprehensive value of the balance wear factor as the source physical erase unit.
[0089] Finally, the memory control circuit 23 may release the source physical erase unit to the idle area 320 to complete the data consolidation operation based on the wear leveling mechanism. Specifically, the memory control circuit 23 may move the valid data in the source physical erase unit to another physical erase unit and perform an erase operation on the source physical erase unit to release the source physical erase unit to the idle area 320.
[0090] In this way, the memory control circuit 23 can comprehensively consider the erasure times and the valid data count value of the selected physical erasing unit to select the source physical erasing unit, so as to improve the efficiency of the data consolidation operation and reduce the write amplification factor.
[0091] Figure 5 is a flow chart of a memory control method according to an embodiment of the present invention. Figure 5 . In step S501, multiple average erase count levels are determined. In step S502, multiple different erase count thresholds corresponding to the multiple average erase count levels are determined. In step S503, the current average erase count of the memory module is obtained. In step S504, the average erase count level corresponding to the current average erase count is determined, and it is determined whether the current average erase count is greater than the erase count threshold corresponding to the average erase count level. In step S505, in response to the current average erase count being greater than the erase count threshold, a source physical erase unit is selected from the storage area, and the source physical erase unit is released to the idle area.
[0092] However, Figure 5 The steps in the above are described in detail, so I will not repeat them here. It is worth noting that Figure 5 Each step in the above process can be implemented as multiple program codes or circuits, and the present invention is not limited thereto. Figure 5 The method can be used in combination with the above embodiments or can be used alone, and the present invention is not limited thereto.
[0093] In summary, the present invention provides a memory management method, a memory storage device, and a memory controller, which can dynamically adjust the erasure count threshold to reduce unnecessary data consolidation operations in the early stage of service life and provide the most suitable erasure count threshold. In addition, the memory management method, the memory storage device, and the memory controller of the present invention can also reduce the proportion of hot data during the data consolidation operation, and comprehensively consider the erasure count and the valid data count value to select the source physical erase unit, so as to improve the efficiency of the data consolidation operation and reduce the write amplification factor.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A memory management method, characterized in that: Used for a memory module, the memory module is divided into a storage area and an idle area, including: determining a plurality of average erasure count levels; determining a plurality of different erasure count thresholds corresponding to a plurality of the average erasure count levels; Obtaining a current average number of erase times of the memory module; Determining the average erase count level corresponding to the current average erase count, and determining whether the current average erase count is greater than the erase count threshold corresponding to the average erase count level; and In response to the current average erase count being greater than the erase count threshold, a source physical erase unit is selected from the storage area, and the source physical erase unit is released to the idle area. 2 . The memory management method according to claim 1 , wherein a plurality of the average erase count levels are negatively correlated with a plurality of the erase count thresholds.
3. The memory management method according to claim 1 , wherein the step of selecting the source physical erase unit from the storage area comprises: When data to be stored is written in an order in which corresponding write commands are received from a host system, selecting remaining physical erasing units other than the last X physical erasing units arranged in the storage area as a plurality of physical erasing units to be selected, where X is a positive integer greater than 1, and the last X physical erasing units have valid data; Acquire multiple erasure times and multiple valid data count values of multiple physical erasure units to be selected; and The source physical erasing unit is selected according to a plurality of the erasing times and a plurality of the valid data count values.
4. The memory management method according to claim 3 , wherein the step of selecting the source physical erase unit according to the plurality of erase times and the plurality of valid data count values comprises: Determine multiple levels of erasure; Determining the erasure level corresponding to each erasure count; as well as In response to at least one erase count corresponding to the same erase level, a valid physical erase unit having a minimum valid data count value among at least one valid physical erase unit corresponding to the at least one erase count is selected as the source physical erase unit.
5. The memory management method according to claim 4, further comprising: In response to at least one erase count corresponding to different erase levels, at least one wear balance factor comprehensive value is calculated according to the at least one erase count and its corresponding at least one valid data count value, and the source physical erase unit is selected according to the at least one wear balance factor comprehensive value.
6. The memory management method according to claim 1 , further comprising: Obtaining a curve comparison table, wherein the curve comparison table records a mapping relationship between an average number of erasures and the threshold number of erasures, wherein one average number of erasures corresponds to one threshold number of erasures; According to the current average number of erasures, a dynamic erasure number threshold is obtained from the curve comparison table according to the mapping relationship; The curve comparison table includes the following acquisition steps: Determining model identification information of the current memory module; Creating a corresponding curve comparison original table according to the model identification information; According to a preset time interval, obtaining the average number of erasures of the current test and the original default average number of erasures at different test times, and comparing the numbers; If the average erase count of the current test is less than the original default average erase count, the erase count threshold to be tested is generated with the original erase count threshold corresponding to the original default average erase count as the minimum value, and if the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erase count threshold; If the average erase count of the current test is not less than the original default average erase count, the erase count threshold to be tested is generated with the original erase count threshold corresponding to the original default average erase count as the maximum value, and if the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erase count threshold; The mapping relationship between the dynamic erasure count threshold and the corresponding average erasure count of the current test is stored in the curve comparison original table to obtain the curve comparison table.
7. The memory management method according to any one of claims 1 to 6, further comprising: Acquiring address translation information, wherein the address translation information includes a data logical address; Obtaining the number of updates of the corresponding data within a preset time period according to the data logical address; When the update number is greater than the update number threshold, obtaining the data physical address currently corresponding to the data; Determine the effective value ratio of the physical erase unit corresponding to the data physical address currently corresponding to the data; If the proportion of the valid values of the physical erase unit corresponding to the data physical address corresponding to the current data is greater than a proportion threshold, determining that the physical erase unit corresponding to the data physical address corresponding to the current data is the source physical erase unit to be excluded; A source physical erase unit acquisition instruction is received, the source physical erase unit to be excluded is removed, and the source physical erase unit is acquired from the remaining source physical erase units.
8. A memory storage device, characterized in that: include: A connection interface for connecting to a host system; The memory module is divided into a storage area and an idle area; as well as a memory controller, connecting the connection interface and the memory module, The memory controller is used to determine a plurality of average erase times levels. The memory controller is further configured to determine a plurality of different erasure count thresholds corresponding to the plurality of average erasure count levels. The memory controller is further configured to obtain a current average erase count of the memory module. The memory controller is further configured to determine the average erase count level corresponding to the current average erase count, and determine whether the current average erase count is greater than the erase count threshold corresponding to the average erase count level, and The memory controller is further configured to select a source physical erase unit from the storage area in response to the current average erase count being greater than the erase count threshold, and release the source physical erase unit to the idle area. 9 . The memory storage device of claim 8 , wherein the plurality of average erase count levels are negatively correlated with the plurality of erase count thresholds.
10. The memory storage device of claim 8, wherein When data to be stored is written in the order of corresponding write commands received from the host system, the memory controller is further configured to select remaining physical erase units other than the last X physical erase units arranged in the storage area as a plurality of selected physical erase units, where X is a positive integer greater than 1, and the last X physical erase units have valid data. The memory controller is further configured to obtain a plurality of erasure times and a plurality of valid data count values of a plurality of the physical erasure units to be selected, and The memory controller is further configured to select the source physical erase unit according to a plurality of the erase times and a plurality of the valid data count values.
11. The memory storage device of claim 10, wherein The memory controller is further configured to determine a plurality of erase count levels. The memory controller is further configured to determine the erase times level corresponding to each erase times, and In response to at least one erase count corresponding to the same erase count level, the memory controller is further configured to select a valid physical erase unit having a minimum valid data count value among at least one valid physical erase unit corresponding to the at least one erase count as the source physical erase unit.
12. The memory storage device of claim 11, wherein In response to at least one erase count corresponding to different erase count levels, the memory controller is further configured to calculate at least one wear balance factor comprehensive value based on the at least one erase count and its corresponding at least one valid data count value, and select the source physical erase unit based on the at least one wear balance factor comprehensive value.
13. The memory storage device of claim 8, wherein The memory controller is further configured to obtain a curve comparison table, wherein the curve comparison table records a mapping relationship between an average number of erase times and the threshold number of erase times, wherein: The average number of erasures corresponds to an erasure threshold. The memory controller is further configured to obtain a dynamic erasure count threshold value from the curve comparison table according to the mapping relationship based on the current average erasure count. The memory controller is used to obtain the curve comparison table, including the following operations: Determine the model identification information of the current memory module, Creating a corresponding curve comparison original table according to the model identification information; According to a preset time interval, obtaining the average number of erasures of the current test and the original default average number of erasures at different test times, and comparing the numbers; If the average erase count of the current test is less than the original default average erase count, the erase count threshold to be tested is generated with the original erase count threshold corresponding to the original default average erase count as the minimum value, and if the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erase count threshold; If the average erase count of the current test is not less than the original default average erase count, the erase count threshold to be tested is generated with the original erase count threshold corresponding to the original default average erase count as the maximum value, and if the efficiency of the data consolidation operation changes from low to high and then from high to low during the test, the inflection point of the change is used as the dynamic erase count threshold; The mapping relationship between the dynamic erasure count threshold and the corresponding average erasure count of the current test is stored in the curve comparison original table to obtain the curve comparison table.
14. The memory storage device according to any one of claims 8 to 13, wherein The memory controller is further configured to obtain address conversion information, wherein: The address conversion information includes a data logical address, The memory controller is further configured to obtain the number of updates of the corresponding data within a preset time period according to the data logical address. When the update number is greater than the update number threshold, the memory controller is further configured to obtain the data physical address currently corresponding to the data. The memory controller is further configured to determine a valid value ratio of the physical erase unit corresponding to the data physical address currently corresponding to the data. If the valid value ratio of the physical erase unit corresponding to the data physical address corresponding to the current data is greater than a ratio threshold, the memory controller is further configured to determine that the physical erase unit corresponding to the data physical address corresponding to the current data is the source physical erase unit to be excluded, The memory controller is further configured to receive a source physical erase unit acquisition instruction, remove the source physical erase unit to be excluded, and acquire the source physical erase unit from the remaining source physical erase units.
Citation Information
Cited By
Counting method of memory device and memory device
CN119626300A
Memory management method and storage device
CN120848804A
