Method, system and terminal for optimizing service life of nonvolatile flash memory

By using a dynamic backup pool and a multi-level wear leveling mechanism, the wear leveling of NAND Flash is optimized, solving the problem of uneven wear, extending equipment life, and improving waste recycling efficiency.

CN121635818AActive Publication Date: 2026-03-10HANGZHOU JUQI INFORMATION TECH CO LTD +3
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-05
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, NAND Flash has a limited number of erase/write cycles, resulting in uneven wear. Static wear leveling algorithms cannot effectively distribute write pressure and ignore wear accumulation during garbage collection, leading to uneven wear on Flash chips.

Method used

A dynamic backup pool and a multi-level wear leveling mechanism are adopted. By collecting the basic write and erase cycles and block wear parameters, the ratio of the backup pool is dynamically adjusted. Combined with the write level, garbage collection level and active maintenance level balancing mechanism, the wear leveling is optimized.

Benefits of technology

It improves the wear uniformity of Flash chips, reduces heat loss, extends equipment life, improves wear uniformity during garbage collection, and ensures effective write pressure distribution under high load.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121635818A_ABST
    Figure CN121635818A_ABST
Patent Text Reader

Abstract

The invention relates to a nonvolatile flash memory service life optimization method and system and a terminal, and relates to the technical field of flash memory optimization, and the method comprises the following steps: collecting a basic erasing frequency of a preset physical block; calculating a real-time wear standard deviation according to the basic erasing times; substituting the real-time wear standard deviation into a preset capacity decision model for analysis and calculation to generate a spare pool proportion; constructing a dynamic standby pool according to the proportion of the standby pool; collecting a standby pool activation trigger signal; and activating the dynamic standby pool based on the standby pool activation trigger signal to support execution of a preset multi-stage wear leveling mechanism. The method and the device have the effect of improving the wear balance of the Flash chip.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of flash memory optimization, and in particular to a method, system and terminal for optimizing the lifetime of non-volatile flash memory. Background Technology

[0002] As the mainstream non-volatile memory, NAND Flash's limited number of erase / write cycles has become a key bottleneck restricting device lifespan.

[0003] In related technologies, static wear leveling algorithms are typically used to solve the problem of uneven wear in Flash chips. By periodically scanning, low-frequency access data, i.e., cold data, is identified and migrated from low-wear blocks to high-wear blocks, thus freeing up the low-wear blocks and evenly distributing erase and write operations across all memory blocks, thereby extending the overall lifespan.

[0004] Regarding the aforementioned technologies, the static wear leveling algorithm is limited by the fixed spare block mechanism, which makes it unable to effectively distribute write pressure under high load. It can only use high wear blocks, which leads to uneven wear. Furthermore, it only selects low wear blocks on the write path and ignores the wear accumulation during the garbage collection process, resulting in uneven wear of the Flash chip. There is still room for improvement. Summary of the Invention

[0005] To improve the uniformity of Flash chip wear, this application provides a method, system, and terminal for optimizing the lifetime of non-volatile flash memory.

[0006] In a first aspect, this application provides a method for optimizing the lifetime of non-volatile flash memory, employing the following technical solution: A method for optimizing the lifetime of non-volatile flash memory includes: Collect the base number of erase / write cycles for the preset physical block; Calculate the real-time wear standard deviation based on the base number of erase / write cycles; The real-time wear standard deviation is substituted into the preset capacity decision model for analysis and calculation to generate the standby pool ratio; Construct a dynamic backup pool based on the backup pool ratio; Collect the activation trigger signal of the backup pool; The dynamic backup pool is activated based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism.

[0007] Optionally, the multi-level wear leveling mechanism includes a write-level leveling mechanism, and the step of activating the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism includes: Pre-allocate spare blocks in the dynamic spare pool based on the spare pool activation trigger signal; Traverse the free blocks in the physical block and collect the block wear parameters of the free blocks; the block wear parameters include the number of block erase / write operations, the block wear gradient, and the block error rate; Determine whether the block wear parameters meet the preset requirements of the current admission conditions; If it does not meet the requirements, the spare block will be determined as the current write block; If the conditions are met, the free block is identified as a block that meets the criteria. Blocks that meet the criteria are sorted and filtered based on the number of times they have been erased or written in order to determine the current block to be written. The write-level load balancing mechanism is supported based on the current write block.

[0008] Optionally, the step of pre-allocating spare blocks in the dynamic spare pool based on the spare pool activation trigger signal includes: Based on the backup pool activation trigger signal, the hot blocks in the physical block are traversed, and the current erase / write count of the hot blocks is collected. Calculate the average number of erase / write cycles based on the current number of erase / write cycles; The current number of erase / write cycles and the average number of erase / write cycles are substituted into the preset hot block probability model for calculation to generate the current hot block probability; Determine whether the current hot block probability meets the preset baseline probability threshold. If it does not meet the requirements, continue to collect the current number of erase / write operations of the hot block and perform a loop judgment. If the conditions are met, then reserve blocks in the dynamic reserve pool are pre-allocated.

[0009] Optionally, the multi-level wear leveling mechanism includes a garbage collection-level leveling mechanism, and the step of activating the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism includes: Based on the standby pool activation trigger signal, the occupied blocks in the physical block are traversed, and the occupied and reclaimable parameters of the occupied blocks are collected; the occupied and reclaimable parameters include the effective page ratio, the occupied wear value, and the occupied block status; Traverse the migration blocks in the physical blocks and the dynamic standby pool, and collect the number of migration blocks; The preset basic filtering conditions are modified based on the number of migration blocks to generate recycling filtering conditions; Determine whether the recyclable parameters meet the requirements for recycling and filtration. If not, remove the occupying block; If so, the occupied blocks are filtered based on the occupied wear value and the real-time wear standard deviation to identify garbage blocks; The garbage collection level balance mechanism is supported based on garbage blocks and migration blocks.

[0010] Optionally, the step of modifying the preset basic filtering conditions according to the number of migration blocks to generate recycling filtering conditions includes: The corrected effective page ratio threshold is determined by finding the preset effective page relationship in the storage space based on the number of migration blocks. The basic filtering conditions are modified based on the modified effective page ratio threshold to generate recycling filtering conditions.

[0011] Optionally, the multi-level wear leveling mechanism includes an active maintenance-level leveling mechanism. The step of activating the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism includes: Based on the backup pool activation trigger signal, the replacement blocks in the physical blocks are traversed, and the data heat score of the replacement blocks is collected; The current migration strategy is determined by searching the preset popularity migration relationships based on the data popularity score. The receiving block is determined from the physical block and the dynamic spare pool based on the current migration strategy; The effective data volume of the acquisition replacement block, as well as the reception preparation time and write bandwidth of the receiving block; The migration time is determined by analyzing the effective data volume, reception preparation time, and write bandwidth. The active maintenance-level load balancing mechanism is supported based on replacement blocks, receiving blocks, and migration time.

[0012] Optionally, the step of traversing the replacement blocks in the physical blocks based on the spare pool activation trigger signal includes: The real-time erase / write count of physical blocks is collected based on the backup pool activation trigger signal. Determine whether the number of real-time erase / write operations meets the preset warning threshold requirements; If it does not meet the requirements, the real-time erase and write count of the physical block will continue to be collected for repeated judgment. If the conditions are met, the preset early warning mechanism will be activated, and it will be determined whether the number of real-time erase / write operations meets the preset replacement state threshold requirements. If the conditions are met, the physical block is determined as the replacement block; If it does not meet the requirements, an analysis will be performed based on the number of real-time erase / write cycles to determine the remaining lifetime; When the remaining lifetime is less than the preset migration lifetime threshold, the physical block is determined as the replacement block.

[0013] Optionally, the steps for collecting the data heat score of the replacement block include: Collect the first access frequency, second access frequency, and third access frequency of the replacement block; The first access frequency, the second access frequency, and the third access frequency are weighted and summed according to the preset access frequency weights to generate a data popularity score.

[0014] Secondly, this application provides a non-volatile flash memory lifetime optimization system, which adopts the following technical solution: A non-volatile flash memory lifetime optimization system, comprising: The acquisition module is used to collect the basic erase / write count and the backup pool activation trigger signal; A memory for storing a program of a non-volatile flash memory lifetime optimization method as described in any of the preceding claims; The processor and the program in the memory can be loaded and executed by the processor to implement a non-volatile flash memory lifetime optimization method as described in any of the above.

[0015] Thirdly, this application provides a smart terminal, which adopts the following technical solution: A smart terminal includes a memory and a processor, wherein the memory stores a computer program that can be loaded by the processor and executed as described in any of the preceding claims, a non-volatile flash memory lifetime optimization method.

[0016] In summary, this application includes at least one of the following beneficial technical effects: 1. By constructing a dynamic backup pool and combining it with a multi-level wear leveling mechanism, the proportion of the backup pool is dynamically adjusted according to the wear of the physical blocks, distributing the erase and write operations to more physical blocks, ensuring that the write pressure can be effectively distributed under high load, and taking into account the wear impact of the garbage collection process on the physical blocks, reducing heat block loss, thereby improving the wear leveling of the Flash chip. 2. By comparing the recyclable parameters and recycling filtration conditions, the occupying blocks are screened to identify those with higher recycling benefits. Then, the screened occupying blocks are screened again based on their wear to remove those with high wear, thus avoiding secondary damage to them and improving the wear uniformity during waste recycling. 3. By collecting the data heat score of the replacement block, the current migration strategy is found in the heat migration relationship based on the data heat score. Based on the current migration strategy, the corresponding receiving block is found in the physical block and dynamic spare pool. Thus, a hot and cold data separation strategy is adopted to migrate low-frequency access data to low-wear blocks, reduce hot block loss, and improve wear leveling during active maintenance. Attached Figure Description

[0017] Figure 1 This is a flowchart of a non-volatile flash memory lifetime optimization method according to an embodiment of this application.

[0018] Figure 2 This is a flowchart of the steps in this application embodiment to activate the dynamic backup pool based on the backup pool activation trigger signal to support the execution of a preset multi-level wear leveling mechanism.

[0019] Figure 3 This is a flowchart of the steps for pre-allocating spare blocks in the dynamic spare pool based on the spare pool activation trigger signal in the embodiments of this application.

[0020] Figure 4 This is a flowchart of the steps in this application embodiment to activate the dynamic backup pool based on the backup pool activation trigger signal to support the execution of a preset multi-level wear leveling mechanism.

[0021] Figure 5 This is a flowchart of the steps in this application embodiment to modify the preset basic filtering conditions according to the number of migration blocks in order to generate recycling filtering conditions.

[0022] Figure 6 This is a flowchart of the steps in this application embodiment to activate the dynamic backup pool based on the backup pool activation trigger signal to support the execution of a preset multi-level wear leveling mechanism.

[0023] Figure 7 This is a flowchart of the steps for traversing replacement blocks in physical blocks based on the backup pool activation trigger signal in an embodiment of this application.

[0024] Figure 8 This is a flowchart of the steps for collecting the data heat score of the replacement block in the embodiments of this application. Detailed Implementation

[0025] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figures 1 to 8 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.

[0026] Reference Figure 1 This application discloses a method for optimizing the lifetime of non-volatile flash memory, comprising the following steps: Step S100: Collect the basic erase / write count of the preset physical block.

[0027] The base erase / write count refers to the cumulative number of erase / write operations performed on all physical blocks of the non-volatile flash memory. This includes the total number of erase / write operations performed on the physical blocks during data writing, data migration, and garbage collection. The base erase / write count is read from the fast status register of the non-volatile flash memory controller, and the unique identifier of each physical block is associated with its erase / write count. By determining the base erase / write count of each physical block, data support can be provided for analyzing wear leveling among different physical blocks.

[0028] Step S101: Calculate the real-time wear standard deviation based on the basic number of erase / write cycles.

[0029] The real-time wear standard deviation refers to the standard deviation of the number of erase / write cycles across all physical blocks. It reflects the uniformity of wear among different physical blocks. The larger the standard deviation, the more uneven the wear. First, the mean number of erase / write cycles is calculated based on the base number of erase / write cycles and the number of physical blocks. Then, the real-time wear standard deviation is calculated based on the base number of erase / write cycles, the mean number of erase / write cycles, and the number of physical blocks. The specific formula is as follows: .

[0030] in, For real-time wear standard deviation, The number of physical blocks. For the first The base number of erase / write cycles per physical block This represents the average number of erase / write cycles.

[0031] Step S102: Substitute the real-time wear standard deviation into the preset capacity decision model for analysis and calculation to generate the standby pool ratio.

[0032] The capacity decision model refers to a model that allocates capacity pools based on the current physical block balance. The specific formula is as follows: .

[0033] in, This is the proportion of the backup pool. This represents the real-time wear standard deviation.

[0034] The reserve pool ratio refers to the proportion of the dynamic reserve pool to the total capacity of non-volatile flash memory. It is calculated by substituting the real-time wear standard deviation into the capacity decision model. The reserve pool ratio is dynamically adjusted according to the real-time wear standard deviation. When the real-time wear standard deviation is no greater than 0.1 (low imbalance), 10% of the capacity is allocated; when the real-time wear standard deviation is greater than 0.1 but not greater than 0.2 (medium imbalance), it is allocated linearly according to the capacity decision model; when the real-time wear standard deviation is greater than 0.2 (high imbalance), 20% of the capacity is allocated.

[0035] Step S103: Construct a dynamic standby pool based on the standby pool ratio.

[0036] After determining the spare pool ratio, spare blocks of non-volatile flash memory are called according to the spare pool ratio, and a low-stress voltage configuration is applied to the spare blocks. The erase voltage is reduced to 16V (standard 18V), the programming verification current is set to 2μA (standard 4μA), the SPARE_RESERVED flag is marked in the block status register (can only be called by the equalizer), and a dynamic spare pool management mapping table is established to record the physical address, erase / write count and status of the spare blocks in the dynamic spare pool, waiting for subsequent equalizer activation and call.

[0037] Step S104: Collect the standby pool activation trigger signal.

[0038] The standby pool activation trigger signal refers to the signal that the dynamic standby pool transitions from a standby state to an active state. In this embodiment, the global wear leveling and local hotspot risk of the physical blocks are monitored to determine whether to output the standby pool activation trigger signal. Global wear leveling is determined by comparing the real-time wear standard deviation with the standard deviation threshold. Local hotspot risk is determined by comparing the maximum number of erase / write cycles with 70% of the flash memory's maximum endurance. The standby pool activation trigger signal is only output when the real-time wear standard deviation is greater than the standard deviation threshold (global wear imbalance) and the maximum number of erase / write cycles is greater than 70% of the flash memory's maximum endurance (local overheating). After receiving the standby pool activation trigger signal, the equalizer adjusts the dynamic standby pool state, and the standby block enters the allocatable state.

[0039] Step S105: Activate the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism.

[0040] Specifically, after the equalizer receives and activates the dynamic backup pool in response to the backup pool activation trigger signal, it utilizes the dynamic backup pool to support a multi-level wear leveling mechanism to ensure global wear leveling of the non-volatile flash memory. The specific method is described in [reference needed]. Figure 2 , Figure 4 and Figure 6 The steps.

[0041] Multi-level wear leveling refers to a multi-level mechanism to ensure the wear leveling of non-volatile flash memory. This embodiment employs a three-level leveling mechanism, including a write-level leveling mechanism to prioritize writing to low-wear blocks during data writing, avoiding excessive wear on high-wear blocks; a garbage collection-level leveling mechanism to avoid high-wear blocks by filtering garbage blocks, preventing secondary wear on high-wear blocks during garbage collection; and an active maintenance-level leveling mechanism to periodically detect critical wear blocks, perform data migration and block replacement, and prevent physical blocks from failing due to excessive wear. To ensure the orderly execution of the multi-level wear leveling mechanism, this embodiment defines four physical block status codes and status transition rules, as follows: The first is the DATA state, representing normal read / write or garbage collection. The write-level leveling mechanism can select the corresponding state block as a write block, the garbage collection-level leveling mechanism can select the corresponding state block as an occupied block, and the active maintenance-level leveling mechanism can convert the corresponding state block to the PRE_ALERT state. The second state is SPARE_RESERVED, a reserved state for the dynamic spare pool, which can only be accessed by the balancer. After the balancer activates the dynamic spare pool, the spare block's state changes to DATA (receiving block) or COOLING (cooling block). The third state is COOLING, where the physical block is inaccessible and physically isolated for cooling. After cooling, three checks are performed. If the checks pass, it changes to SPARE_AVAILABLE; if the checks fail, it changes to BAD. The fourth state is BAD, where the physical block is permanently disabled and no longer participates in data storage.

[0042] This application defines a collaborative operation mechanism for a multi-level wear leveling system, including: a write priority principle, where write requests are prioritized when writes and recycling contend for free blocks, and recycling tasks are placed in a waiting queue (maximum delay 50μs). During idle periods, migration is performed at full speed (≤20 blocks / cycle), while during busy periods, only emergency migrations (>0.95 threshold) are processed. During overload periods, maintenance is paused to release computing resources. When the spare pool is below 5%, an emergency recycling protocol is triggered, temporarily relaxing recycling conditions (effective page threshold increased to 50%) and enabling a fast erase mode (voltage increased by 20%).

[0043] Reference Figure 2 The multi-level wear leveling mechanism includes a write-level leveling mechanism. The steps for activating the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism include: Step S200: Pre-allocate spare blocks in the dynamic spare pool based on the spare pool activation trigger signal.

[0044] Specifically, after the equalizer receives and responds to the standby pool activation trigger signal, the equalizer activates and pre-allocates standby blocks in the dynamic standby pool. The specific method is described in [reference needed]. Figure 3This process ensures that the response time is reduced to 15μs.

[0045] Step S201: Traverse the free blocks in the physical blocks and collect the block wear parameters of the free blocks.

[0046] Specifically, when the equalizer activates the dynamic standby pool, it synchronously traverses the status of physical blocks in the physical block management mapping table, defines all physical blocks with the status of DATA as free blocks, and then calls the block wear parameters of the free blocks to provide data support for determining whether the free blocks can be used as data writing blocks.

[0047] Block wear parameters refer to wear-related parameters of the free block, including block erase / write count, block wear gradient, and block error rate. Block erase / write count refers to the cumulative number of erase / write operations on the free block, which is read from the block status register. Block wear gradient refers to the wear gradient of the free block within a fixed time period, which is calculated by the absolute value of the difference between the block erase / write count and the average erase / write count. Block error rate refers to the average bit error rate of the free block in the last 10 reads.

[0048] Step S202: Determine whether the block wear parameters meet the requirements of the preset current access conditions.

[0049] The current admission criteria refer to the wear parameter requirements for a free block to be used as a write block. In this embodiment, the free block must have at least one free page (to ensure immediate write capability), the number of block erases must be less than 70% of the maximum durability (to prevent write-to-failure), high-risk blocks that have already suffered 70% of their lifespan loss must be excluded, the block wear gradient must not exceed twice the real-time wear standard deviation, new blocks with abnormally low wear must be prevented from being selected (to avoid concentrated wear), and the block error rate must be less than [specified value]. .

[0050] By determining whether the block erase / write count, block wear gradient, and block error rate in the block wear parameters meet the parameter requirements in the current admission conditions, it can be determined whether there are any blocks in the free blocks that can be written to.

[0051] Step S2021: If it does not meet the requirements, then the spare block is determined as the current write block.

[0052] If any of the block erase / write count, block wear gradient, or block error rate parameters in the block wear parameters do not meet the parameter requirements in the current admission conditions, it indicates that there is no block in the free block that can be written to, and therefore the spare block is determined as the current write block.

[0053] The currently written block refers to the block where data is currently being written. In this step, the currently written block is a spare block in the dynamic spare pool.

[0054] Step S2022: If the condition is met, the free block is determined as a block that meets the condition.

[0055] If the block erase / write count, block wear gradient, and block error rate among the block wear parameters all meet the parameter requirements in the current admission criteria, it indicates that the free block can be used as a block for writing data. Therefore, the free block is identified as a block that meets the conditions, which facilitates further screening of the blocks to be written.

[0056] A qualified block is an idle block that meets the current admission criteria. When the number of erase / write cycles, the block wear gradient, and the block error rate all meet the parameter requirements in the current admission criteria, the corresponding idle block is defined as a qualified block.

[0057] Step S20221: Sort and filter the blocks that meet the conditions according to the number of times the blocks have been erased and written, so as to determine the current block to be written.

[0058] In this step, the current write block is the same as the current write block in step S2021. The difference is that in this step, the current write block is selected as the current write block by sorting the number of block erases and writes of the blocks that meet the conditions.

[0059] Step S203: Execute the write-level load balancing mechanism according to the current write block.

[0060] Specifically, after determining the current write block, the data to be written is written into the current write block, and the erase / write count of the current write block is updated in the physical block management mapping table, thereby completing the execution of the write-level load balancing mechanism.

[0061] Reference Figure 3 The steps for pre-allocating spare blocks in the dynamic spare pool based on the spare pool activation trigger signal include: Step S300: Based on the backup pool activation trigger signal, traverse the hot blocks in the physical block and collect the current erase / write count of the hot blocks.

[0062] Specifically, after the equalizer receives and responds to the backup pool activation trigger signal, it filters physical blocks in the physical block mapping management table that have been erased and written no less than 5 times in the past hour, and identifies such physical blocks as hot blocks. The current erase and write count of the hot blocks is read through the block status register to provide data support for subsequent analysis of whether hot blocks need backup blocks.

[0063] Step S301: Calculate the average number of erase / write cycles based on the current number of erase / write cycles.

[0064] The average number of erase / write cycles refers to the average number of erase / write cycles for all hot blocks, which is obtained by averaging the current number of erase / write cycles.

[0065] Step S302: Substitute the current number of erase / write cycles and the average number of erase / write cycles into the preset hot block probability model for calculation to generate the current hot block probability.

[0066] The hot block probability model refers to the model that calculates the probability that a hot block needs a spare block. The specific formula is as follows: .

[0067] in, The probability of the current hot block. This represents the current number of erase / write cycles. This represents the average number of erase / write cycles. This represents the absolute value of the difference between the current number of erase / write cycles and the average number of erase / write cycles. This represents the real-time wear standard deviation.

[0068] The current hot block probability refers to the probability that a hot block needs a spare block. It is calculated by the processing terminal by substituting the current number of erase / write operations and the average number of erase / write operations into the hot block probability model.

[0069] Step S303: Determine whether the current hot block probability meets the requirements of the preset baseline probability threshold.

[0070] The baseline probability threshold refers to the lowest probability that a hot block needs a spare block. In this embodiment, 0.7 is used as an example. The requirement for the baseline probability threshold is that it is not lower than the baseline probability threshold.

[0071] By determining whether the current hot block probability is not lower than the baseline probability threshold, it can be determined whether a spare block needs to be pre-allocated.

[0072] Step S3031: If it does not meet the requirements, continue to collect the current number of erase / write operations of the hot block for cyclic judgment.

[0073] If the current hot block probability is determined to be lower than the baseline probability threshold, it indicates that the hot block has a low probability of needing a spare block. Therefore, the current number of erase / write operations of the hot block is collected to continuously monitor the probability that the hot block needs a spare block.

[0074] Step S3032: If the conditions are met, then pre-allocate the spare blocks in the dynamic spare pool.

[0075] If the current hot block probability is determined to be no less than the baseline probability threshold, it indicates that the hot block has a high probability of needing a spare block. Therefore, the spare blocks in the dynamic spare pool are configured specifically, including setting the erase voltage to 16V, the programming step to 0.3V / step, the verification current to 2μA, and the state of the spare blocks is converted to the pre-allocated state in the spare block management mapping table.

[0076] Reference Figure 4 The multi-level wear leveling mechanism includes a garbage collection-level leveling mechanism. The steps for activating the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism include: Step S400: Based on the standby pool activation trigger signal, traverse the occupied blocks in the physical blocks and collect the occupied and reclaimable parameters of the occupied blocks.

[0077] Specifically, after the equalizer receives and responds to the backup pool activation trigger signal, it defines all physical blocks marked as DATA in the physical block management mapping table as occupied blocks and collects the occupied and reclaimable parameters of the occupied blocks to provide data support for subsequent analysis on whether the occupied blocks can be garbage collected.

[0078] Occupied and reclaimable parameters refer to parameters related to garbage collection of occupied blocks, including the effective page ratio, occupied wear value, and occupied block status. The effective page ratio refers to the proportion of effective pages in the occupied block to the total number of pages. Effective pages refer to physical pages storing currently valid data, whose logical addresses are recorded in the mapping table. Invalid pages refer to pages whose data has been updated or deleted but not yet erased; these belong to the reclaimable space. A bitmap tracking system is used to create a 256-bit status bitmap (corresponding to 256 pages) for each physical block. Each bit in the bitmap records the status of the corresponding page: 0 indicates an invalid page (reclaimable), and 1 indicates a valid page. When data is updated, the original page is marked as 0, and the newly written page is marked as 1. When data is deleted, the corresponding page is directly marked as 0. The ratio calculation mechanism counts the number of 1s in the bitmap (the number of effective pages), and divides the number of effective pages by the total number of pages (256) to obtain the ratio value. The occupied wear value refers to the number of times the occupied block has been erased and rewritten, obtained by reading from the block status register. The occupied block status refers to the status of the occupied block, determined by the status code marked in the physical block mapping management table.

[0079] Step S401: Traverse the migration blocks in the physical blocks and the dynamic standby pool, and collect the number of migration blocks.

[0080] In this process, while traversing the occupied blocks, physical blocks and blocks in the dynamic spare pool with fewer than the minimum number of erase / write operations are defined as migration blocks. These migration blocks serve as storage space for valid data during subsequent garbage collection. The number of migration blocks is also monitored to provide data support for determining the conditions for adjusting garbage blocks.

[0081] The number of migration blocks refers to the number of migration blocks, which is counted when traversing the migration blocks in the physical blocks and the dynamic spare pool.

[0082] Step S402: Modify the preset basic filtering conditions according to the number of migration blocks to generate recycling filtering conditions.

[0083] Among them, the basic filtering conditions refer to the conditions for determining that the occupied block can be recycled. In the embodiments of this application, these include: the effective page ratio is not less than 30% (to ensure recycling efficiency). The 30% threshold setting means that when the effective page ratio is lower than this value, migrating a small amount of effective data can release a large amount of space, and the recycling efficiency ratio is greater than 2.3 (that is, migrating 1 page of data can release 2.3 pages of space); the physical state is a non-cooled block (to avoid interfering with the recovery process).

[0084] The recycling filter conditions refer to the optimized conditions for determining whether an occupied block can be recycled. These conditions are obtained by modifying the basic filter conditions based on the number of migrated blocks. For specific methods, refer to [link to relevant documentation]. Figure 5 The steps.

[0085] Step S403: Determine whether the occupied recyclable parameters meet the requirements of the recycling filtration conditions.

[0086] Specifically, by determining whether the occupied recyclable parameters meet the requirements of the recycling filter conditions, it can be determined whether the occupied block is recyclable and whether the recycling efficiency is high.

[0087] Step S4031: If not, remove the occupying block.

[0088] If it is determined that the occupied block does not meet the requirements of the recycling filter conditions, it indicates that the occupied block is not recyclable or the recycling efficiency of the occupied block is low, and therefore the occupied block is removed.

[0089] Step S4032: If so, the occupied blocks are filtered according to the occupied wear value and the real-time wear standard deviation to determine the garbage blocks.

[0090] If the recyclable parameters of the occupied block meet the requirements of the recycling filter conditions, it indicates that the occupied block is recyclable and the recycling efficiency of the occupied block is high. Therefore, the occupied blocks are screened according to the occupied wear value and the real-time wear standard deviation to identify the waste blocks, thereby avoiding high wear blocks and preventing secondary wear.

[0091] A garbage block refers to the block actually used for garbage recycling. When the real-time wear standard deviation is less than 0.1, the occupation wear values ​​of the occupied blocks are sorted from smallest to largest, and only the top 70% of the occupied blocks with the highest occupation wear values ​​are selected as garbage blocks (to protect the top 30% of high-wear blocks). When the real-time wear standard deviation is greater than 0.2, the top 80% of the occupied blocks with the highest occupation wear values ​​are selected as garbage blocks (to prevent recycling blockage).

[0092] Step S404: Support the execution of garbage collection-level load balancing mechanism based on garbage blocks and migration blocks.

[0093] After identifying garbage blocks and migration blocks, zero-copy DMA transfer technology is used to extract valid data from the garbage blocks and migrate the valid data to the migration blocks. During the migration process, new block erasure and data transfer operations are performed concurrently to shorten the migration time, thereby completing the garbage collection-level load balancing mechanism.

[0094] Reference Figure 5 The steps for modifying the preset basic filtering conditions based on the number of migration blocks to generate recycling filtering conditions include: Step S500: Based on the number of migration blocks, find the corrected effective page ratio threshold in the preset storage space effective page relationship.

[0095] Among them, the effective page relationship of storage space refers to the correspondence between the number of migrated blocks and the effective page ratio threshold. The basic threshold is 30%. When the number of migrated blocks accounts for more than 20% of the total number, the effective page ratio threshold drops to 25% for stricter screening. When the number of migrated block data accounts for less than 10% of the total number, the threshold rises to 35% to accelerate space reclamation.

[0096] The corrected effective page ratio threshold refers to the corrected effective page ratio threshold, which is obtained by calculating the proportion of migrated blocks and then searching for it in the effective page relationship of the storage space based on the proportion of migrated blocks.

[0097] Step S501: Modify the basic filtering conditions according to the modified effective page ratio threshold to generate recycling filtering conditions.

[0098] The recycling filtering conditions in this step are the same as those in step S402. The recycling filtering conditions are obtained by replacing the effective page ratio threshold in the basic filtering conditions with the modified effective page ratio threshold.

[0099] Reference Figure 6 The multi-level wear leveling mechanism includes an active maintenance-level leveling mechanism. The steps for activating the dynamic backup pool based on the backup pool activation trigger signal to support the execution of the preset multi-level wear leveling mechanism include: Step S600: Based on the backup pool activation trigger signal, traverse the replacement blocks in the physical blocks and collect the data heat score of the replacement blocks.

[0100] After the equalizer receives and responds to the backup pool activation trigger signal, it traverses the replacement blocks in the physical blocks. The specific method is described in [reference needed]. Figure 7 The steps are as follows, and the data heat analysis of the replacement block is calculated to provide data support for determining the migration strategy of the data in the replacement block.

[0101] Replacement blocks refer to the physical blocks that require data migration. Data popularity score refers to the frequency of data access based on its access frequency; a higher score indicates a higher data access frequency. For specific collection methods, please refer to [link / reference]. Figure 8 The steps.

[0102] Step S601: Find the current migration strategy in the preset heat migration relationship based on the data heat score.

[0103] Among them, heat migration relationship refers to the migration strategy of data with different heat scores. When the heat score is greater than 50, the data is considered super hot data and the migration strategy is to prohibit migration. When the heat score is between 20 and 50, the data is considered hot data and the migration strategy is to migrate within the same channel (wear value ±10%). When the heat score is between 5 and 19, the data is considered warm data and the migration strategy is to migrate across channels (wear value less than the average value). When the heat score is less than 5, the data is considered cold data and the migration strategy is to force migration to the lowest wear block.

[0104] The current migration strategy refers to the migration strategy for replacing data in the block, which is obtained by the processing terminal from the heat migration relationship based on the data heat score.

[0105] Step S602: Determine the receiving block from the physical block and dynamic spare pool based on the current migration policy.

[0106] The receiving block refers to the physical block that receives valid data from the replacement block. It is selected from physical blocks and the dynamic spare pool according to the wear value requirements of the migration block under the current migration strategy. For example, if the migration strategy is same-channel migration, then physical blocks or spare blocks with wear values ​​around 10% of the wear value of the replacement block are selected as receiving blocks. If the migration strategy is forced migration to the lowest wear block, then the block with the lowest wear value among the physical blocks and spare blocks is selected as the receiving block.

[0107] Step S603: Collect the effective data volume of the replacement block and the reception preparation time and write bandwidth of the receiving block.

[0108] The effective data volume refers to the amount of valid data in the replacement block. It is determined by the number of valid pages in the replacement block through a bitmap tracking system, and then calculated by multiplying the number of valid pages by the page size. The receive preparation time refers to the erase time of the receive block, which is obtained by summing the voltage ramp-up time, voltage hold-up time, and threshold voltage verification time. The write bandwidth refers to the write bandwidth of the receive block, which is obtained by multiplying the number of parallel planes (typically 2-8), the flash interface frequency (e.g., 200MHz), and the page data volume.

[0109] Step S604: Analyze the effective data volume, receive preparation time, and write bandwidth to determine the migration time.

[0110] The migration time refers to the time it takes for the replacement block data to complete the migration. The data transmission time is obtained by calculating the quotient of the effective data volume and the write bandwidth, and then the migration time is obtained by calculating the sum of the data transmission time and the reception preparation time.

[0111] Step S605: Support the execution of the proactive maintenance-level load balancing mechanism based on the replacement block, the receiving block, and the migration time.

[0112] After determining the migration time, the process begins with valid data extraction. The L2P mapping table is scanned to locate valid pages, and zero-copy DMA transfer (skipping the cache) is used. Then, valid data in the replacement block is read, the receiving block is erased, and the valid data is written back to the receiving block. This overlapping erasure and transfer saves 30% of the time. After migration, the L2P mapping is atomically switched to ensure data consistency is maintained even after power loss. The replacement block performs word line isolation (cutting off word line voltage), applies a constant 3V bias for charge recovery, and initiates a 24-hour cooler countdown, marking the status as cooling. After the cooling period, electrical parameters are reset, historical wear values ​​are cleared, and verification is performed, thus completing the active maintenance-level equalization mechanism.

[0113] Reference Figure 7 The steps for traversing replacement blocks in the physical blocks based on the backup pool activation trigger signal include: Step S700: Collect the real-time erase / write count of the physical block based on the backup pool activation trigger signal.

[0114] The real-time erase / write count refers to the number of times a physical block is erased / written. The equalizer receives and responds to the backup pool activation trigger signal, thereby controlling the block status register to read the count.

[0115] Step S701: Determine whether the number of real-time erase / write operations meets the requirements of the preset warning state threshold.

[0116] The warning state threshold refers to 80% of the maximum durability value of the block, and the requirement for the warning state threshold is that it is greater than the warning state threshold.

[0117] By determining whether the number of real-time erase / write operations exceeds the warning threshold, it can be determined whether the wear of the physical block is high and whether the physical block needs to be marked and monitored.

[0118] Step S7011: If it does not meet the requirements, continue to collect the real-time erase / write count of the physical block for cyclic judgment.

[0119] If the number of real-time erase / write operations is determined to be no greater than the warning state threshold, it indicates that the wear of the physical block is low and no marking monitoring is required. Therefore, the number of real-time erase / write operations of the physical block is collected for cyclic judgment.

[0120] Step S7012: If the conditions are met, the preset early warning mechanism is activated, and it is determined whether the number of real-time erase / write operations meets the requirements of the preset replacement state threshold.

[0121] The replacement state threshold refers to the minimum wear value during data migration, which is 90% of the maximum durability value. The requirement for the replacement state threshold is that it is greater than the replacement state threshold.

[0122] If the number of real-time erase / write operations is determined to be greater than the warning state threshold, it indicates that the physical block is worn out. Therefore, the warning mechanism is activated, and it is determined whether the number of real-time erase / write operations is greater than the replacement state threshold, thereby determining whether data migration needs to be initiated.

[0123] The early warning mechanism refers to the mechanism that changes the physical block state and pre-allocates spare blocks, changes the physical block state to PRE_ALERT, starts background data prefetching (reducing migration delay), and warms up the spare block erase circuit, thereby preparing for subsequent data migration.

[0124] Step S70121: If the condition is met, the physical block is determined as the replacement block.

[0125] If the number of real-time erase / write operations is determined to be greater than the replacement state threshold, it indicates that the physical block needs to undergo data migration, and therefore the physical block is identified as a replacement block.

[0126] Step S70122: If it does not meet the requirements, an analysis is performed based on the number of real-time erase / write cycles to determine the remaining lifetime.

[0127] If the number of real-time erase / write operations is determined to be no greater than the replacement state threshold, it indicates that the physical block may not need to undergo data migration. Therefore, the number of real-time erase / write operations is analyzed to determine the remaining lifespan of the physical block and further verify whether the physical block needs to undergo data migration.

[0128] Remaining lifetime refers to the remaining usage time of a physical block. The remaining number of erase / write cycles is obtained by calculating the difference between the maximum durability value and the real-time erase / write cycles. Then, the erase / write speed over the past 7 days is statistically analyzed, and the remaining lifetime is obtained by calculating the quotient of the remaining number of erase / write cycles and the total number of erase / write cycles.

[0129] Step S702: When the remaining lifetime is less than the preset migration lifetime threshold, the physical block is determined as the replacement block.

[0130] The migration lifetime threshold refers to the maximum lifetime for which a physical block needs to undergo data migration; in this embodiment, 24 hours is used as an example.

[0131] When the remaining lifetime is determined to be less than the migration lifetime threshold, the physical block is identified as the replacement block.

[0132] Reference Figure 8 The steps for collecting the data heat score of the replacement block include: Step S800: Collect the first access frequency, second access frequency and third access frequency of the replacement block.

[0133] The first access frequency refers to the data access frequency in the replacement block over the past hour, measured using a sliding window counter. The second access frequency refers to the data access frequency in the replacement block over the past 24 hours, calculated using an exponentially decaying average. The third access frequency refers to the data access frequency in the replacement block over the past 7 days, obtained by querying the historical database.

[0134] Step S801: The first access frequency, the second access frequency, and the third access frequency are weighted and summed according to the preset access frequency weights to generate a data popularity score.

[0135] The access frequency weight refers to the weight of the data access frequency in the data popularity score at different times. In this embodiment, the weight of the first access frequency is 0.6, the weight of the second access frequency is 0.3, and the weight of the third access frequency is 0.1.

[0136] The data popularity score in this step is the same as the data popularity score in step S600. It is obtained by weighting and summing the first access frequency, the second access frequency, and the third access frequency according to the access frequency weight.

[0137] Based on the same inventive concept, embodiments of this application provide a non-volatile flash memory lifetime optimization system, including: The acquisition module is used to collect basic erase / write counts, backup pool activation trigger signal, block wear parameters, current erase / write counts, occupied reclaimable parameters, number of migrated blocks, data heat score, effective data volume, receive preparation time, write bandwidth, real-time erase / write counts, first access frequency, second access frequency, and third access frequency. Memory for storing a program of a non-volatile flash memory lifetime optimization method; The processor can load and execute programs in memory, and implement a non-volatile flash memory lifetime optimization method.

[0138] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0139] This application provides a computer-readable storage medium storing a computer program that can be loaded by a processor and executed as a method for optimizing the lifetime of non-volatile flash memory.

[0140] Computer storage media include, for example, USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, optical disks, and other media that can store program code.

[0141] Based on the same inventive concept, embodiments of this application provide a smart terminal, including a memory and a processor, wherein the memory stores a computer program that can be loaded and executed by the processor.

[0142] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional modules is used as an example. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device, and unit described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0143] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Any feature disclosed in this specification (including the abstract and drawings) may be replaced by other equivalent or similar features unless specifically stated otherwise. That is, unless specifically stated otherwise, each feature is only one example of a series of equivalent or similar features.

Claims

1. A method for non-volatile flash memory lifetime optimization, the method comprising: The method comprises the following steps: collecting the basic erase-write times of the preset physical blocks; calculating the real-time wear standard deviation according to the basic erase-write times; substituting the real-time wear standard deviation into a preset capacity decision model to analyze and calculate, so as to generate a spare pool ratio; constructing a dynamic spare pool according to the spare pool ratio; collecting a spare pool activation trigger signal; activating the dynamic spare pool based on the spare pool activation trigger signal to support the preset multi-level wear leveling mechanism to execute.

2. The method of claim 1, wherein, The multi-level wear leveling mechanism comprises a write-level leveling mechanism, and the step of activating the dynamic spare pool based on the spare pool activation trigger signal to support the preset multi-level wear leveling mechanism to execute comprises the following steps: pre-allocating the spare blocks in the dynamic spare pool based on the spare pool activation trigger signal; traversing the idle blocks in the physical blocks and collecting the block wear parameters of the idle blocks; the block wear parameters comprise block erase-write times, block wear gradients and block error rates; judging whether the block wear parameters meet the requirements of a preset current access condition; if not, determining the spare blocks as current write blocks; if yes, determining the idle blocks as qualified blocks; sorting and screening the qualified blocks according to the block erase-write times to determine the current write blocks; supporting the write-level leveling mechanism to execute according to the current write blocks.

3. The method of claim 2, wherein, The step of pre-allocating the spare blocks in the dynamic spare pool based on the spare pool activation trigger signal comprises the following steps: traversing the hot blocks in the physical blocks and collecting the current erase-write times of the hot blocks based on the spare pool activation trigger signal; calculating the average erase-write times according to the current erase-write times; substituting the current erase-write times and the average erase-write times into a preset hot block probability model to calculate, so as to generate a current hot block probability; judging whether the current hot block probability meets the requirements of a preset reference probability threshold; if not, continuing to collect the current erase-write times of the hot blocks to perform a loop judgment; if yes, pre-allocating the spare blocks in the dynamic spare pool.

4. The method of claim 1, wherein, The multi-level wear leveling mechanism comprises a garbage collection-level leveling mechanism, and the step of activating the dynamic spare pool based on the spare pool activation trigger signal to support the preset multi-level wear leveling mechanism to execute comprises the following steps: traversing the occupied blocks in the physical blocks and collecting the occupied recyclable parameters of the occupied blocks based on the spare pool activation trigger signal; the occupied recyclable parameters comprise effective page ratios, occupied wear values and occupied block states; traversing the migration blocks in the physical blocks and the dynamic spare pool and collecting the number of the migration blocks; modifying a preset basic filtering condition according to the number of the migration blocks to generate a recycling filtering condition; judging whether the occupied recyclable parameters meet the requirements of the recycling filtering condition; if not, eliminating the occupied blocks; if yes, screening the occupied blocks according to the occupied wear values and the real-time wear standard deviation to determine garbage blocks; supporting the garbage collection-level leveling mechanism to execute based on the garbage blocks and the migration blocks.

5. The method of claim 4, wherein, The step of modifying the preset basic filtering condition according to the number of the migration blocks to generate the recycling filtering condition comprises the following steps: finding out a modified effective page ratio threshold in a preset storage space effective page relationship according to the number of the migration blocks; modifying the basic filtering condition according to the modified effective page ratio threshold to generate the recycling filtering condition.

6. The method of claim 1, wherein, The multi-level wear leveling mechanism comprises an active maintenance level leveling mechanism, and the steps performed by the active maintenance level leveling mechanism based on the backup pool activation trigger signal include: The backup pool activation trigger signal is used to traverse the replacement block in the physical block and collect the data hotness score of the replacement block; The current migration strategy is found in the preset hotness migration relationship according to the data hotness score; The receiving block is determined in the physical block and the dynamic backup pool based on the current migration strategy; The effective data amount of the replacement block, the receiving preparation time and the write bandwidth of the receiving block are collected; The migration time is determined based on the analysis of the effective data amount, the receiving preparation time and the write bandwidth; The active maintenance level leveling mechanism is supported to perform according to the replacement block, the receiving block and the migration time.

7. The method for optimizing the lifetime of non-volatile flash memory according to claim 6, characterized in that, The steps of traversing the replacement block in the physical block based on the backup pool activation trigger signal include: The real-time erase-write times of the physical block are collected based on the backup pool activation trigger signal; It is judged whether the real-time erase-write times meet the requirements of the preset early warning state threshold; If not, the real-time erase-write times of the physical block are continuously collected for cyclic judgment; If yes, the preset early warning mechanism is started, and it is judged whether the real-time erase-write times meet the requirements of the preset replacement state threshold; If yes, the physical block is determined as the replacement block; If not, the real-time erase-write times are analyzed to determine the remaining life; When the remaining life is less than the preset migration life threshold, the physical block is determined as the replacement block.

8. The method of claim 6, wherein the step of optimizing the life of the nonvolatile flash memory is performed by a controller of the nonvolatile flash memory. The steps of collecting the data hotness score of the replacement block include: ​ The first access frequency, the second access frequency and the third access frequency of the replacement block are collected; The first access frequency, the second access frequency and the third access frequency are weighted and summed according to the preset access frequency weight to generate the data hotness score.

9. A non-volatile flash memory lifetime optimization system, comprising: It comprises: A collection module for collecting the basic erase-write times and the backup pool activation trigger signal; A memory for storing the program of the non-volatile flash memory life optimization method according to any one of claims 1 to 8; A processor, the program in the memory can be loaded and executed by the processor, and the non-volatile flash memory life optimization method according to any one of claims 1 to 8 is realized.

10. A smart terminal, characterized by It comprises a memory and a processor, and the memory stores the computer program which can be loaded and executed by the processor to realize the non-volatile flash memory life optimization method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method of allocating storage, electronic device, storage system and computer program product

    CN115061624A

  • Devices and methods for operating a solid state drive

    US20090300277A1

  • Determining adjustments to the spare space in a storage device unavailable to a user based on a current consumption profile of a storage device

    US20160162205A1

  • Spare memory management in data storage device

    US20240402923A1

  • Wear leveling for low-wear areas of low-latency random read memory

    US8001318B1