Wear Leveling, abbreviated as WL, is a technique used to ensure that each flash memory block in SSD/UFS maintains a similar number of erase and write cycles.Each flash memory block has a limited lifespan, with a maximum number of erase cycles. When the erase count of a block exceeds a certain threshold, that block becomes unreliable, leading to potential data loss or inability to read/write data, thus becoming a bad block.As the number of bad blocks increases, the lifespan of the SSD/UFS decreases. Therefore, by distributing the erase and write operations across all blocks, the device can endure more data read/write cycles, thereby ensuring its longevity.Typically, a block can endure up to hundreds of thousands of erase cycles if it is SLC; however, for TLC, it may only last a few hundred cycles. Yet, in terms of storage capacity, TLC offers three times the capacity of SLC, meaning its cost is only one-third of that of SLC.There are two methods of wear leveling: Dynamic Wear Leveling (DWL) and Static Wear Leveling (SWL).Before introducing these two concepts, let’s clarify a few terms:
- The concept of Cold Data and Hot Data. Cold data refers to data that users do not frequently update, such as operating system files and movies; hot data refers to data that users update frequently. For SSD/UFS, they do not recognize the file format of the data, only the raw data itself, so the classification into cold and hot data is based on average read/write activity.
- Another term is Old Block and Young Block. An old block is one that has undergone many erase/write cycles, while a young block has undergone fewer cycles.
- Another concept is Erase Count (EC), where the firmware (FW) keeps track of the EC value for each block. Naturally, blocks with a high EC value are considered old, while those with a low EC value are considered young.
The basic idea of DWL is to write hot data to young blocks, selecting blocks with fewer erase cycles when writing to a new flash memory block; SWL involves writing cold data to old blocks, effectively moving cold data to blocks that have undergone more erase cycles.When the firmware performs SWL, it typically uses garbage collection (GC) to accomplish this. When selecting the source block, it does not choose the block with the least valid data but rather the block containing cold data. The other processes are similar to GC.Stay tuned for more updates.