NAND flash memory garbage collection method based on page serial number and update time

By combining page number and update time to calculate data popularity, and adopting an adaptive recycling strategy, the problem of low garbage collection efficiency of NAND flash memory is solved, and more efficient garbage collection and memory management are achieved.

CN119311200AInactive Publication Date: 2025-01-14SICHUAN UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310856775.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-13
Publication Date
2025-01-14
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing NAND flash garbage collection methods rely on inaccurate update times to calculate data popularity, resulting in high garbage collection efficiency and overhead.

Method used

The method based on page number and update time is used to calculate the data heat, and combined with conventional recycling strategies and enhanced balance strategies, through adaptive switching strategies, the appropriate recycling blocks are selected for hot and cold data separation and garbage collection.

Benefits of technology

Improves garbage collection efficiency, reduces garbage collection overhead and additional memory consumption, and is better than existing methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0004336211160000021
    Figure BDA0004336211160000021
  • Figure BDA0004336211160000031
    Figure BDA0004336211160000031
  • Figure BDA0004336211160000032
    Figure BDA0004336211160000032
Patent Text Reader

Abstract

The invention discloses an NAND flash memory garbage collection method based on page serial numbers and update time, and belongs to the field of computer storage. The method mainly comprises the following three processing steps: firstly, screening recovery blocks needing to be cleaned according to a conventional recovery strategy and an enhanced balance strategy; then, on the basis of the page serial number and the updating time, the average heat degree of all blocks is calculated according to the updating age to prepare for cold and hot separation of data, and meanwhile the heat degree of a logic interval containing an effective page needs to be calculated; and finally, according to the comparison of the hot degree of the logic interval and the average hot degree of the blocks, the valid page data in the logic interval is redistributed to other idle or erased blocks. And finally, the space in the recycling block is cleaned, and garbage recycling is completed. Experimental results show that the method disclosed by the invention can optimize the garbage collection process required by the NAND flash memory and improve the garbage collection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of computer storage, and in particular relates to a NAND flash memory garbage collection method based on page sequence number and update time. Background Art

[0002] NAND flash memory has many significant advantages, such as low power consumption and small size. Compared with traditional disks, it does not require seek, so NAND flash memory has higher read and write performance and reliability. Therefore, it is often used as a storage medium for consumer electronic products, such as smart watches and smartphones. The basic storage unit of NAND flash memory is a double-layer floating gate MOS tube. Due to this physical structure, NAND flash memory cannot directly overwrite when writing data, but can only write in free blocks or erase blocks. Therefore, in the data update process, NAND flash memory mainly adopts an off-site update strategy. In other words, NAND flash memory writes the updated data directly to the new location, and the old location containing invalid pages will be left as garbage. The result of adopting this update strategy is that a large amount of invalid page garbage will be generated. If the garbage is not cleaned and recycled in time, the system's storage space will be exhausted. Therefore, NAND flash memory will perform garbage collection at a certain time.

[0003] However, garbage collection incurs additional read, write, and erase overheads. These overheads can be reduced by optimizing garbage collection methods. Pan Y. et al. proposed a cache-aware garbage collection method that can achieve fewer page migrations by perceiving the cache. Shafaei M. et al. identified hot data or frequently written data through application-wide clustering techniques, and allowed these data to be separated to improve garbage collection performance. Hsieh JW et al. proposed multiple independent hash functions to reduce the probability of hot data identification errors to improve the efficiency of garbage collection.

[0004] In general, the separation of hot and cold data is helpful to improve the efficiency of garbage collection. Lee J. and Kim JS evaluated three hot and cold data separation strategies: 2-level LRU, multi-bloom filter, and dynamic data clustering to confirm the benefits of hot and cold separation. These strategies perform hot and cold separation of data by utilizing the frequency and recency of data pages or according to the write access frequency of data before writing data to NAND flash memory. Therefore, existing garbage collection methods mainly adopt hot and cold data separation strategies to achieve better results.

[0005] However, the separation of hot and cold data depends heavily on accurate heat calculation. Existing methods usually use update time to calculate the heat of data, which is not accurate enough and there is room for improvement. This chapter proposes a NAND flash memory garbage collection method based on page number and update time. This method considers both update time and page number to accurately calculate data heat, and gives a corresponding garbage collection strategy based on this. Experimental results show that our proposed method is superior to existing methods in terms of garbage collection overhead and additional memory consumption. Summary of the invention

[0006] The technical problem to be solved by the present invention is to provide a NAND flash memory garbage collection method based on page sequence number and update time to improve the garbage collection efficiency.

[0007] The following technical measures are adopted to solve the above technical problems: A NAND flash memory garbage collection method based on page sequence number and update time mainly includes:

[0008] Adaptively select the conventional recycling strategy and enhanced balancing strategy to filter out the recycling blocks that need to be cleaned up;

[0009] Separate the data in the selected recovery block from hot and cold. Prepare for the separation of hot and cold data by calculating the average heat of all blocks based on the update age. At the same time, calculate the heat of the logical interval containing valid pages. Finally, based on the comparison between the heat of the logical interval and the average heat of the block, reallocate the valid page data in the logical interval to other free or erased blocks.

[0010] Clean up the space in the reclaim block and complete the garbage collection.

[0011] Further, the conventional recycling strategy and the enhanced balance strategy, and the adaptive method for switching between the two strategies. The enhanced balance strategy usually gives priority to selecting the block with the smallest erase count as the recycling block. The conventional recycling strategy takes into account the number of erases and the number of invalid pages of the block, and selects the block with the largest garbage revenue value (GB) as the recycling block, and the calculation formula of the garbage revenue value GB of the block is:

[0012]

[0013] where F victim It is the calculation result based on update time and page number when triggering the recovery block selection strategy, and n is the number of invalid pages in the block. i is the calculation result based on the update time and page number when the i-th page fails, F victim -F i The update age of the page. victim -F iThe larger the value of , the longer page i exists in the block. u is the percentage of valid pages in the block, which is initialized to zero after the block is recycled. Therefore, 1-u / 1+u represents the benefit of recycling the block. e is the number of erases of the block. e max is the maximum number of block erase times among all blocks, e min is the minimum number of block erase times among all blocks, e max -e / e max -e min is the wear degree of the block. N invalid The number of invalid pages in the block, initialized to zero after the block is reclaimed.

[0014] Furthermore, the calculation formula based on the calculation result of the update time and the page number is:

[0015] F=w*T+(1-w)*P

[0016] Where F represents the calculation result; T is the update time, which is defined as the time between two consecutive updates of the page; P is the page number, which is defined as a unique, continuous and increasing count assigned by the NAND flash memory to the allocated free page. w is the threshold for balancing the influence of T and P, and its value range is 0 to 1.

[0017] Furthermore, an adaptive method for switching between the conventional recovery strategy and the enhanced balance strategy is provided. The control strategy of the adaptive method is as follows:

[0018] G=(F victim -F banlance ) / T init T e =(1-v)*T init -(e max -e min )

[0019] Among them, F victim It is the calculation result based on update time and page number when executing the recovery block selection strategy. balance This is the calculation result based on update time and page sequence number recorded when the enhanced balancing strategy was last started. balance The value of will be updated when the enhanced balancing strategy is executed. init is the initial threshold, which indicates the required wear leveling level, T init = 100. G is the update age since the last triggering of the enhanced balancing policy. v is the percentage of valid blocks, where a valid block is a block without any invalid pages. v is updated after the regular reclamation policy starts. e max and e min are the maximum and minimum number of block erase times in all blocks. erepresents the dynamic threshold for switching from the conventional recycling strategy to the enhanced balancing strategy. e Under the definition of , the proposed adaptive method follows the following rules. e When the balance is increased, the enhanced balance strategy is adopted. In addition, the conventional recycling strategy is adopted.

[0020] Furthermore, the average heat of all blocks is calculated as:

[0021]

[0022] Where n is the number of blocks with no free pages and u is the percentage of valid pages in the block. victim is the calculation result based on update time and page number after the recovery block is selected, F j The calculation result based on update time and page number used when allocating block j, F victim -F j is the update age of block j. The average heat value H avr It is calculated immediately after the recycling block selection strategy selects the recycling block. The heat calculation formula for the logical interval of the valid page is:

[0023]

[0024] Among them, F separ is the calculation result based on update time and page number when the cold and hot data separation strategy starts to execute, F i is the calculation result based on the update time and page number of the logical interval, F separ -F i is the update age of the logical interval, C i is the number of updates of the logic interval, H i is the heat of the logical interval. i >H avr , the valid pages of the logical interval are classified as cold data and copied to the free block with the maximum erase count. i >H avr / 2, the valid pages of the logical interval are classified as the second coldest data and copied to the free block with the second largest erase count. i >H avr / 4, the valid pages of the logical interval are classified as second hot data and copied to the free block with the second smallest erase count. i <H avr / 4, the valid pages of the logical interval are classified as hot data and copied to the free block with the minimum erase count.

[0025] Furthermore, the logic interval L i The representation of the logical interval L iThe calculation formula is:

[0026] L i =[p / m]

[0027] Where p is the count of pages in the block, m is the length of the logical interval, and the value of m is usually a power of 2. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 Schematic diagram of the relationship between blocks, pages and logical intervals.

[0029] Figure 2 This is a schematic diagram of the updating process of page numbers during data updating.

[0030] Figure 3 It is a garbage collection process diagram of the present invention.

[0031] Figure 4 It is a diagram of the data hot and cold separation process of the present invention.

[0032] Figure 5 The erasure performance of the present invention is compared with that of GR, CB, CAT, FaGC, FeGC, MCSGC, and FaGC+ algorithms.

[0033] Figure 6 The write performance of the present invention is compared with that of GR, CB, CAT, FaGC, FeGC, MCSGC, and FaGC+ algorithms. DETAILED DESCRIPTION

[0034] The present invention is further described below in conjunction with the accompanying drawings. It is necessary to point out here that the following embodiments are only used to further illustrate the present invention and cannot be understood as limiting the scope of protection of the present invention. Persons skilled in the art in this field may make some non-essential improvements and adjustments to the present invention based on the above content of the present invention, which still fall within the scope of protection of the present invention.

[0035] Before explaining the technical solution of the present invention in detail, the following explanation is given to the logical interval and the update age in conjunction with the accompanying drawings.

[0036] Figure 1 The relationship between blocks, pages, and logical intervals is shown. Assume that there are n pages in this block and the length of each logical interval is m. For a page p, the logical interval L of this page p is i It can be calculated as follows.

[0037] L i =[p / m]

[0038] The update age of data is introduced to measure the popularity of data. It can be calculated by the difference between the calculation results based on the update time and the page number of the block or page. The younger the update age of data, the hotter the data. The basis of the calculation results based on the update time and the page number is the update time and the page number. The allocation process of the page number is as follows: Figure 2 As shown, in Figure 2 In step 1, it is assumed that 9 pages have been allocated to write data, and each page is assigned a unique page number from 1 to 9, so the next page number will be assigned 10. In step 2, due to the out-of-place update strategy, the NAND flash memory allocates a free page in block 4 to write the data in page i with page number 2 that is updated. As a result, page i is remapped to this free page with page number 10, and the old page with page number 2 is marked as an invalid page. Similarly, in step 3, the free page with page number 11 in block 2 is allocated for data update of logical page j with page number 8. Therefore, the heat of the associated logical page can be determined by the difference in page numbers between two consecutive updates. For the calculation results based on update time and page number, the definition is as follows.

[0039] F=w*T+(1-w)*P

[0040] Where F represents the calculation result, T is the update time, and P is the page number. w is the threshold for balancing the influence of T and P, and its value range is 0 to 1. The value of w is 0.5.

[0041] exist Figure 3 Specifically, a NAND flash memory garbage collection method based on page sequence number and update time is involved, which can be divided into the following steps:

[0042] (1) Select the conventional recycling strategy and enhanced balancing strategy through an adaptive method to screen out the recycling blocks that need to be cleaned up;

[0043] (2) Separate the data in the selected recovery block into cold and hot blocks. The average heat of all blocks is calculated based on the update age to prepare for the separation of cold and hot data. At the same time, the heat of the logical interval containing valid pages needs to be calculated. Finally, based on the comparison between the heat of the logical interval and the average heat of the block, the valid page data in the logical interval is reallocated to other free or erased blocks.

[0044] (3) Clean up the space in the recovery block and complete garbage collection.

[0045] Specifically, in the step (1) shown, the present invention designs a conventional recycling strategy, an enhanced balancing strategy, and an adaptive method for controlling the switching between the conventional recycling strategy and the enhanced balancing strategy. When selecting a recycling block object, the NAND flash memory will select the conventional recycling strategy or the enhanced balancing strategy according to the adaptive method to perform the search. When the wear leveling level of the NAND flash memory is not good, the enhanced balancing strategy is adopted. In addition, the wear leveling level of the NAND flash memory is good, and the conventional recycling strategy is adopted. The conventional recycling strategy will traverse all blocks in the NAND flash memory to calculate the garbage yield value of each block, and use the block with the largest garbage yield value as the recycling block. The enhanced balancing strategy will traverse the array storing the number of erase times of each block, and find the block with the least number of erase times as the recycling block.

[0046] In the process of selecting the reclaimed block, the present invention uses the conventional reclaim strategy, takes into account the number of invalid pages in the block and the update age, and weighs the cost and benefit of block erasure, which can effectively improve the efficiency of garbage collection. In addition, the present invention uses the adaptive method and enhanced balance strategy to further optimize the wear leveling level and increase the service life of NAND flash memory.

[0047] In step (2), the valid data in the recovered block needs to be migrated to the free block. Before migrating the valid data, the average heat of all blocks H needs to be calculated. avr , and then through the logical interval heat H corresponding to each valid page i , migrate the data of the valid page to the corresponding free block, such as Figure 4 As shown, if H i >H avr , the valid pages of the logical interval are classified as cold data and copied to the free block with the maximum erase count. i >H avr / 2, the valid pages of the logical interval are classified as the second coldest data and copied to the free block with the second largest erase count. i >H avr / 4, the valid pages of the logical interval are classified as second hot data and copied to the free block with the second smallest erase count. i <H avr / 4, the valid pages of the logical interval are classified as hot data and copied to the free block with the minimum erase count. After the data in the reclaimed block is separated and redistributed, valid pages with similar heat are gathered in free blocks with similar erase counts, and valid pages in the same block are very likely to become invalid at the same time.

[0048] To better illustrate the effectiveness of the present invention, the present invention is used to implement the garbage collection algorithm, and the Linux system with the Yaffs2 file system modified is used to build the QEMU embedded simulation development board, and the NAND flash memory simulator (NANDsim) is used to simulate the NAND flash memory. Then it is compared with GR, CB, CAT, FaGC, FeGC, MCSGC, FaGC+ and other methods. The results are as follows Figure 5 and Figure 6 As shown. The garbage collection overhead of the algorithm of the present invention in NAND flash memory is now superior to other algorithms. In the algorithm of the present invention, a combination of update time and page number is introduced to more accurately calculate data heat. Based on the accurate calculation of data heat, the present invention can achieve accurate separation of hot and cold data. In this way, pages with similar heat are more likely to be clustered in one block, so pages with similar heat in the same block are more likely to fail at the same time. Since the possibility of valid pages in a block becoming invalid at the same time is greater, the more invalid pages there are in the block, and the fewer valid pages there are in the block. Therefore, the number of required copy and erase operations is reduced, thereby reducing the required garbage collection overhead. In other words, the present invention can effectively reduce the migration of valid data in garbage collection and improve the performance of NAND flash memory.

Claims

1. A NAND flash memory garbage collection method based on page sequence number and update time, characterized in that The following steps are involved: (1) Adaptively select the conventional recycling strategy and enhanced balancing strategy to screen out the recycling blocks that need to be cleaned up; (2) Based on the page number and update time, the data in the reclaimed block selected in (1) is separated into hot and cold blocks. Therefore, the average heat of all blocks is calculated according to the update age to prepare for the separation of hot and cold data. At the same time, the heat of the logical interval containing valid pages needs to be calculated. Finally, based on the comparison between the heat of the logical interval and the average heat of the block, the valid page data in the logical interval is reallocated to other free or erased blocks. (3) Clean up the space in the recovery block and complete garbage collection.

2. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 1, characterized in that The conventional recycling strategy and enhanced balancing strategy described in step (1), as well as the adaptive method for switching between the two strategies, wherein the conventional recycling strategy takes into account the number of erasures and the number of invalid pages of the block, and selects the block with the maximum garbage yield value (GB) as the recycling block, and the enhanced balancing strategy usually gives priority to blocks with more invalid pages as recycling blocks.

3. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 2, characterized in that The conventional recycling strategy selects a block with a garbage revenue value as a recycling block, and the calculation formula of the garbage revenue value GB of the block is: where F victim is the calculation result based on update time and page number when triggering the recovery block selection strategy, n is the number of invalid pages in the block, and F i is the calculation result based on the update time and page number when the i-th page fails, F victim -F i is the update age of the page, F victim -F i The larger the value of , the longer page i exists in the block. u is the percentage of valid pages in the block and is initialized to zero after the block is recycled. Therefore, 1-u / 1+u represents the benefit that can be obtained by recycling the block. e is the number of erases of the block. e max is the maximum number of block erase times among all blocks, e min is the minimum number of block erase times among all blocks, e max -e / e max -e min is the wear degree of the block, N invalid The number of invalid pages in the block, initialized to zero after the block is reclaimed.

4. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 3, characterized in that The calculation formula based on the update time and page number is: F=w*T+(1-w)*P Where F represents the calculation result; T is the update time, which is defined as the time between two consecutive updates of the page; P is the page number. The definition of the page number is that the NAND flash memory assigns a unique, continuous and increasing count to the allocated free page. w is the threshold for balancing the influence of T and P, and its value range is 0 to 1.

5. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 3, characterized in that w=0.5。 6. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 1 or 2, characterized in that The adaptive method switches between the conventional recovery strategy and the enhanced balance strategy. The control strategy of the adaptive method is as follows: G=(F victim -F banlance ) / T init T e =(1-v)*T init -(e max -e min ) where F victim It is the calculation result based on update time and page number when executing the recovery block selection strategy F balance The calculation result based on update time and page number recorded when the enhanced balance strategy was last started. balance The value of will be updated when the enhanced balancing strategy is executed. init is the initial threshold, which indicates the required wear leveling level, T init = 100, G is the update age since the last triggering of the enhanced balancing strategy, v is the percentage of valid blocks, a valid block is a block without any invalid pages, v is updated after the regular reclamation strategy starts, e max and e min are the maximum and minimum number of block erase times in all blocks, T e represents the dynamic threshold of the strategy switching from the conventional recycling strategy to the enhanced balancing strategy, between G and T e Under the definition of , the proposed adaptive method follows the following rule: when G ≥ T e When, the enhanced balance strategy is adopted, and in addition, the conventional recovery strategy is adopted.

7. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 1, characterized in that In step (2), the cold and hot separation method of the data is used to calculate the average heat of all blocks: Where n is the number of blocks with no free pages, u is the percentage of valid pages in the block, and F victim is the calculation result based on update time and page number after the recovery block is selected, F j The calculation result based on update time and page number used when allocating block j, F victim -F j is the update age of block j, and the average heat value H avr After the recycling block selection strategy selects a recycling block, it will be calculated immediately. The heat calculation formula of the logical interval of the valid page is: where F separ is the calculation result based on update time and page number when the cold and hot data separation strategy starts to execute, F i is the calculation result based on the update time and page number of the logical interval, F separ -F i is the update age of the logical interval, C i is the number of updates of the logic interval, H i is the heat of the logical interval. If H i >H avr , the valid pages of the logical interval are classified as cold data and copied to the free block with the maximum erase count. If H i >H avr / 2, the valid pages of the logical interval are classified as the second coldest data and copied to the free block with the second largest erase count. i >H avr / 4, then the valid pages of the logical interval are classified as the second hot data and copied to the free block with the second smallest erase count. i <H avr / 4, the valid pages of the logical interval are classified as hot data and copied to the free block with the minimum erase count.

8. A NAND flash memory garbage collection method based on page sequence number and update time according to claim 1 or 7, characterized in that: Logical interval L i The representation of the logical interval L i The calculation formula is: L i =[p / m] Where p is the count of pages in the block, m is the length of the logical interval, and the value of m is usually a power of 2.

Citation Information

Patent Citations

  • NAND Flash memory garbage collection method

    CN105528301A

  • Selection method for damaged blocks in solid state disk garbage collection

    CN112631523A

  • Method for accelerating erasure of sub-blocks in 3D NAND flash memory

    CN114138189A

  • Adaptive garbage collection

    US20160179386A1

  • Method and System for Optimizing Deterministic Garbage Collection in Nand Flash Storage Systems

    US20170300410A1