Garbage collection optimization method based on solid-state disk address remapping
By building a flash page life cycle model and dividing remapping storage areas, the garbage collection algorithm is optimized, and the remapping page and ordinary page partition storage is solved, which solves the problem of garbage collection write amplification caused by solid-state disk address remapping, and extends the use of solid-state disk Lifespan and performance improvements.
Patent Information
- Application Number
- CN202411408519.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-01-14
AI Technical Summary
The existing solid-state disk address remapping technology leads to garbage collection and write amplification, and the long life of remapping flash pages is mixed with ordinary flash pages, resulting in a shorter service life of the solid-state disk.
By building a flash page life cycle model, dividing remapping storage areas, optimizing garbage collection algorithms, storing remapping pages and ordinary pages partitions, avoiding unnecessary write amplification, reducing the number of garbage collections, and extending the service life of the solid-state disk.
It effectively reduces the write amplification brought by garbage collection, improves the performance and service life of the solid-state disk. By isolating the garbage collection strategy of remapping pages, unnecessary write amplification is avoided and system performance is improved.
Smart Images

Figure CN119311604A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer storage, and in particular to a garbage collection optimization method based on solid state disk address remapping. Background Art
[0002] Solid-state drives have gradually replaced mechanical hard disks and become the mainstream device for data storage due to their low power consumption and high performance. Among them, flash-based solid-state drives have the advantages of data protection not being controlled by power, being removable, and having a long life, so they are widely used in notebook hard disks, USB flash drives and other storage devices.
[0003] Flash memory particles are composed of pages, blocks, planes, and chips (dies) from small to large. Due to the feature of off-site update of SSDs, the physical flash memory pages can only be written again after being erased. In order to better manage the written pages, the SSD maintains a logical to physical (L2P) table in the controller. The logical page requested by the host is mapped to the physical flash memory page of the SSD through the L2P table, so that the SSD itself can better manage the flash memory pages that have been written and achieve more efficient erasure.
[0004] The existence of the L2P mapping table also brings opportunities for SSD address remapping. Figure 1 As shown in the figure, the original method of migrating data is to copy the old physical pages and then use the new pages to store the data. However, the emergence of the remapping strategy makes these old physical pages available. It takes into account the existence of the L2P table in the SSD, so the migration operation only needs to change the physical-logical page correspondence of the L2P table without rewriting the old physical pages. The address remapping technology can be used for copy and paste, cut and paste, and some specific repeated write application scenarios. It can effectively reduce the internal write amplification of the SSD and increase the service life of the SSD.
[0005] Existing SSD address remapping technology is dedicated to solving the problem of duplicate writes. However, the phenomenon of SSD garbage collection write amplification caused by remapping flash memory pages also occurs. Remapped flash memory pages store data that is not frequently updated and have a longer lifespan than ordinary flash memory pages. SSDs want the flash memory pages in a block to have the same lifespan, which can reduce the burden of moving valid flash memory page data before erasing the block. Summary of the invention
[0006] The purpose of the present invention is to provide a garbage collection optimization method based on solid state disk address remapping, which allocates the general flash memory pages and remapped flash memory pages that need to be moved in the valid flash memory pages to different free blocks as much as possible during garbage collection. Through the garbage collection strategy of remapped page isolation, the repeated movement of remapped pages in subsequent garbage collection is reduced, the performance of the solid state disk is improved, and the service life of the solid state disk is also extended.
[0007] To achieve the above object, the present invention provides a garbage collection optimization method based on solid state disk address remapping, comprising the following steps: Step 1: Build a flash page life cycle model, analyze the life cycle log data through the flash page life cycle model, verify whether the life of the remapped flash page is longer than that of the ordinary flash page, and obtain the remapped page ratio represented in the remap mark bitmap; Step 2: divide the solid state disk remapping storage area according to the remapping page ratio represented in the remapping mark bitmap obtained in step 1, in preparation for garbage collection migration page partitioning; Step 3: Optimize the garbage collection algorithm to sense the normal flash memory pages and remapped pages during garbage collection, and store them in partitions to avoid unnecessary write amplification caused by remapped flash memory pages during garbage collection of the solid-state drive.
[0008] Preferably, the flash page life cycle model is used to evaluate and compare the life cycle differences between ordinary flash pages and remapped flash pages under different workloads, specifically including: Remapping mark bitmap: A bitmap is used to distinguish between normal flash pages and remapped flash pages with low overhead. The bits corresponding to normal flash pages are marked as 0, indicating that they are not remapped pages; the bits corresponding to remapped flash pages are marked as 1, which is used to mark the pages that have been migrated during the remapping operation. Erase counter: Each flash page corresponds to an erase counter, which is used to count the number of times the flash page is erased and migrated during the garbage collection process. When the flash page is garbage collected and migrated, the counter is incremented by 1; when the flash page data is invalid or deleted, the counter is cleared; Lifecycle log: responsible for recording the lifecycle data of each flash memory page. When a flash memory page fails, the log records the value of its erase counter to form a complete lifecycle record.
[0009] Preferably, a designated area Sremap is divided in the solid state disk to store the flash memory pages moved after garbage collection. The area division principle is: The Sremap size is dynamically adjusted according to different workloads, and this adjustment is optimized by the remap page ratio represented in the remap mark bitmap provided by the flash page lifecycle model.
[0010] Preferably, the optimized garbage collection algorithm migrates the remapped flash memory pages that need to be migrated for garbage collection to the remapped storage area, thereby avoiding the mixing of flash memory pages with different lifespans, reducing the number of solid-state drive garbage collection times, reducing solid-state drive write amplification, and ultimately improving system performance.
[0011] Preferably, during garbage collection, the block containing the most invalid pages is first selected for erasure, and each page in the recovered block is traversed in turn. There are three situations for the flash memory pages in the block: (1) The flash page is an invalid page, which means that the page does not need to be migrated and can be skipped directly; (2) If the flash memory page is a normal page, it needs to be migrated to a free block in the normal storage area; (3) If the flash memory page is a remapped page, the page needs to be migrated to a free block in the Sremap remap storage area; When all pages of the recycling block are traversed, this garbage collection ends.
[0012] Therefore, the present invention adopts the above-mentioned garbage collection optimization method based on solid-state disk address remapping, and migrates the remapped flash memory pages and ordinary flash memory pages to different storage areas during garbage collection, thereby reducing the possibility of flash memory pages with different life cycles appearing in the same block, thereby reducing the write amplification caused by garbage collection, improving the overall performance of the solid-state disk, and extending the service life of the solid-state disk. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 Comparison of whether the address remapping method is used to migrate data inside the SSD; Figure 2 Isolate normal and remapped flash pages for garbage collection; Figure 3 This is a flow chart of the garbage collection strategy based on SSD address remapping in step three. DETAILED DESCRIPTION
[0014] The technical solution of the present invention is further described below through the accompanying drawings and embodiments.
[0015] Unless otherwise defined, technical or scientific terms used in the present invention shall have the common meanings understood by one having ordinary skills in the field to which the present invention belongs.
[0016] Embodiment 1
[0017] A garbage collection optimization method based on solid state disk address remapping includes the following steps: Step 1: Build a flash page lifecycle model to reflect the difference in lifespan between remapped data and normal data under different workloads; The flash page lifecycle model is used to evaluate and compare the lifecycle differences between normal flash pages and remapped flash pages under different workloads. By tracking the number of times a flash page is erased during garbage collection before failure, a flash page lifecycle model is constructed, which provides a reference for the division of remapped storage areas in the SSD. The model aims to verify the assumption that remapped pages have a longer lifespan than normal pages, thereby optimizing the overall management of flash storage.
[0018] The flash page lifecycle model includes three core modules: remapping mark bitmap, erase counter and lifecycle log.
[0019] Remapping mark bitmap: A bitmap is used to distinguish between normal flash pages and remapped flash pages with low overhead. The bits corresponding to normal flash pages are marked as 0, indicating that they are not remapped pages; the bits corresponding to remapped flash pages are marked as 1, which is used to mark pages that have been migrated during the remapping operation.
[0020] Erase counter: Each flash page has an erase counter, which is used to count the number of times the flash page is erased and migrated during the garbage collection process. When a flash page is migrated due to garbage collection, the counter is incremented by 1; when the flash page data is invalid or deleted, the counter is cleared. This counter can be used to intuitively record the service life of each flash page.
[0021] Lifecycle log: Responsible for recording the lifecycle data of each flash memory page. When a flash memory page fails, the log records the value of its erase counter to form a complete lifecycle record. These log data provide a basis for subsequent flash memory page life analysis and verification.
[0022] The workflow of the flash page life cycle model is as follows: The system tracks the life cycle of each flash page, including normal flash pages and remapped flash pages.
[0023] When a flash page is migrated during garbage collection, the corresponding erase counter is incremented by 1.
[0024] When a flash memory page fails (for example, it is deleted by an upper-layer application), the lifecycle log records the value of its erase counter, completing the lifecycle record of the page.
[0025] Verify that the remapped flash pages have a longer lifespan than normal flash pages by analyzing the lifecycle log data.
[0026] The flash memory page lifecycle model of the present invention can accurately evaluate the lifespan difference between remapped pages and ordinary pages under different workloads by tracking the number of erasures of valid data blocks. Compared with existing flash memory management technologies, the model provides a more detailed lifespan tracking mechanism and provides a basis for the remapped storage area division of solid-state drives.
[0027] The flash page lifecycle model can be widely used in solid-state drives and other flash storage-based devices, especially in database and big data storage scenarios. It can optimize the life management of storage devices by dynamically adjusting the capacity ratio of the remapped storage area.
[0028] The flash page lifecycle model is constructed by tracking the number of times each flash page data is erased by garbage collection before it becomes invalid (the upper layer application deletes the page data). For example, if a flash page is migrated 3 times due to garbage collection before it becomes invalid, then its lifecycle is 3.
[0029] Step 2: Divide the SSD remapping storage area to prepare for the garbage collection migration page partition; The present invention needs to divide a designated area Sremap in the solid state disk to store the flash memory pages moved after garbage collection. The setting of the size of this area is crucial. If Sremap is too large, it will affect the storage of normal pages, and the actual usable solid state disk space will become smaller. If Sremap is too small, the remapped flash memory pages will still be mixed with ordinary flash memory pages in the same block.
[0030] Area division principle: The Sremap size is dynamically adjusted according to different workloads, and this adjustment can be optimized through the analysis data provided by the flash page lifecycle model. For example, according to research, the average proportion of repeated write data in real application scenarios is 33%, so we set the Sremap size to 30% of the total capacity of the SSD.
[0031] Step 3: Optimize the garbage collection algorithm. During garbage collection, the normal flash memory pages and remapped pages are sensed and stored in partitions to avoid unnecessary write amplification caused by remapped flash memory pages during garbage collection of the solid-state drive. Figure 2 and Figure 3 shown.
[0032] The difference between the optimized garbage collection algorithm and the traditional garbage collection algorithm is that the traditional garbage collection algorithm will migrate both valid ordinary flash memory pages and remapped flash memory pages to the same area, while the garbage collection strategy of isolating remapped flash memory pages will migrate the remapped flash memory pages that need to be migrated for garbage collection to the remapped storage area, thereby avoiding the mixing of flash memory pages with different lifespans, reducing the number of garbage collection times of the SSD, reducing the write amplification of the SSD, and ultimately improving system performance.
[0033] When garbage collection is performed, the block with the most invalid pages is first selected for erasure, and each page in the recovered block is traversed in turn. There are three situations for flash memory pages in a block: (1) The flash page is an invalid page, which means that the page does not need to be migrated and can be skipped directly; (2) If the flash memory page is a normal page, it is necessary to migrate the page to a free block in the normal storage area; (3) If the flash memory page is a remapped page, the page needs to be migrated to a free block in the Sremap remap storage area.
[0034] When all pages of the recovery block are traversed, the garbage collection ends. After garbage collection, the normal flash memory pages and the remapped flash memory pages are stored in different blocks, which also avoids the write amplification effect of the remapped data on the SSD garbage collection.
[0035] Therefore, the present invention adopts the above-mentioned garbage collection optimization method based on solid-state disk address remapping, and migrates the remapped flash memory pages and ordinary flash memory pages to different storage areas during garbage collection, thereby reducing the possibility of flash memory pages with different life cycles appearing in the same block, thereby reducing the write amplification caused by garbage collection, improving the overall performance of the solid-state disk, and extending the service life of the solid-state disk.
[0036] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that they can still modify or replace the technical solution of the present invention with equivalents, and these modifications or equivalent replacements cannot cause the modified technical solution to deviate from the spirit and scope of the technical solution of the present invention.
Claims
1. A garbage collection optimization method based on solid state disk address remapping, characterized in that: The following steps are involved: Step 1: Build a flash page life cycle model, analyze the life cycle log data through the flash page life cycle model, verify whether the life of the remapped flash page is longer than that of the ordinary flash page, and obtain the remapped page ratio represented in the remap mark bitmap; Step 2: divide the solid state disk remapping storage area according to the remapping page ratio represented in the remapping mark bitmap obtained in step 1, in preparation for garbage collection migration page partitioning; Step 3: Optimize the garbage collection algorithm to sense the normal flash memory pages and remapped pages during garbage collection, and store them in partitions to avoid unnecessary write amplification caused by remapped flash memory pages during garbage collection of the solid-state drive.
2. The garbage collection optimization method based on solid state disk address remapping according to claim 1, characterized in that: The flash page lifecycle model is used to evaluate and compare the lifecycle differences between normal flash pages and remapped flash pages under different workloads, including: Remapping mark bitmap: A bitmap is used to distinguish between normal flash pages and remapped flash pages with low overhead. The bits corresponding to normal flash pages are marked as 0, indicating that they are not remapped pages; the bits corresponding to remapped flash pages are marked as 1, which is used to mark the pages that have been migrated during the remapping operation. Erase counter: Each flash page corresponds to an erase counter, which is used to count the number of times the flash page is erased and migrated during the garbage collection process; when the flash page is garbage collected and migrated, the counter is incremented by 1; when the flash page data is invalid or deleted, the counter is cleared; Lifecycle log: responsible for recording the lifecycle data of each flash memory page. When a flash memory page fails, the log records the value of its erase counter to form a complete lifecycle record.
3. The garbage collection optimization method based on solid state disk address remapping according to claim 1, characterized in that: A designated area Sremap is allocated in the SSD to store flash memory pages moved after garbage collection. The area division principles are as follows: The Sremap size is dynamically adjusted according to different workloads, and this adjustment is optimized by the remap page ratio represented in the remap mark bitmap provided by the flash page lifecycle model.
4. The garbage collection optimization method based on solid state disk address remapping according to claim 1, characterized in that: The optimized garbage collection algorithm migrates the remapped flash memory pages that need to be migrated for garbage collection to the remapped storage area, thereby avoiding the mixing of flash memory pages with different lifespans, reducing the number of solid-state drive garbage collections, reducing solid-state drive write amplification, and ultimately improving system performance.
5. The garbage collection optimization method based on solid state disk address remapping according to claim 1, characterized in that: During garbage collection, the block with the most invalid pages is first selected for erasure, and each page in the recovery block is traversed in turn. There are three situations for the flash memory pages in the block: (1) The flash page is an invalid page, which means that the page does not need to be migrated and can be skipped directly; (2) If the flash memory page is a normal page, it needs to be migrated to a free block in the normal storage area; (3) If the flash memory page is a remapped page, the page needs to be migrated to a free block in the Sremap remap storage area; When all pages of the recycling block are traversed, this garbage collection ends.