What is Wear Leveling? What are Its Techniques?

Rufaida kassem
5 min readMar 6, 2023

--

Each memory cell has a maximum number of P/E cycles that is close to 100,000. In most cases, some blocks got accessed more than others. Which leads these blocks to wear early. An important feature of a memory controller is Wear Leveling. This means to distribute P/E cycles evenly on all block. Consider a case without wear leveling. If we have a NAND Flash with 4,096 total blocks and 2.5% allowable bad blocks in a system that updates 3 files comprised of 50 blocks each at a rate of 1 file every 10 minutes (or 6 files per hour), where a NAND host reuses the same 200 physical blocks for these updates, the NAND Flash device will wear out in under 1 year, leaving over 95% of the memory array unused.

For example:

In contrast, in a situation where all blocks are used equally by programming and erasing 4,096 of them at a rate of 50 blocks every 10 minutes (or 6 files per hour), even distribution of wear across all blocks dramatically increases the useful life of the device.

For example:

Wear leveling not only extends the life of a Flash device, it also enables the memory capacity to be used more efficiently. Reusing only 200 blocks results in programming and erasing about 2 million effective blocks over the life of the device, while evenly using all 4,096 blocks results in programming and erasing more than 40 million effective blocks.

In order to perform wear leveling, the controller needs to maintain the mapping of the LBA (logical block address) to the corresponding PBA (physical block address), number of erases, and the valid page pointers. It stores them into Embedded Block RAM (EBR) or User Flash Memory (UFM) to keep track of the Flash memory usage.

There are two methods to do wear leveling:

  • Static method
  • Dynamic method

The static algorithm is suitable for read-only blocks or blocks are rarely changed (i.e. static data). Where the dynamic algorithm is for the frequently-used blocks (i.e. dynamic data).

Dynamic Wear Leveling:

All you have to do is to choose the block with the least erase cycles for the next programming cycle. But the choice is done from the set of free blocks only. Which means if you have static data, this wouldn’t be a good solution.

For instance, in a device with a 25%/75% split of dynamic data versus static data, respectively, dynamic wear leveling targets the 25% of the blocks of dynamic memory area, while the other 75% of the blocks remain idle with static data. In this case, 25% of the available blocks are used to their maximum cycle count

Static Wear Leveling:

Here, the choice is based on the block with the least erase cycles, from all good blocks. Including non-free blocks. It keeps the erase cycle count within a certain threshold for all blocks. It makes use of all blocks and extends the life of your flash device. For more illustration, it evenly distribute wear. Blocks that contain static data with erase counts that begin to lag behind other blocks will be included in the wear-leveling block pool, with the static data being moved to blocks with higher erase counts.

Using the same example of a 4,096-block MLC device with a 10,000-cycle count, 75% static data, and a program and erase rate of 50 blocks every 10 minutes (or 6 files per hour), static wear leveling provides the best chance of extending the device life span beyond 15 years.

For example:

Static vs. Dynamic Block Utilization

Which Method is Better?

It all depends on the application. As both have disadvantages in addition to the advantages.

Static method is the most robust, provides the most efficient use of memory, and maximizes the device life. On the other hand, it is more complicated to implement, requires more controller overhead, may slow writing operations, and causes higher power consumption.

Dynamic method is easier to implement, and has no impact on device performance. But it may not optimize the life of your device.

Multiple Zones vs Single Zone Data Distribution

Even though static wear leveling helps ensure equal block use within each zone if the controller treats each zone separately, different zones might receive different levels of use. As such, one zone is likely to wear out before another, which would cause the die to wear out prematurely.

The most effective approach is to encompass all good blocks in the memory array into a single zone to help ensure equal wear leveling.

--

--