BACKGROUND OF THE INVENTION
Solid-state memory devices encompass rewritable non-volatile memory devices which may use electronic circuitry for storing data. Currently, solid-state memory devices start replacing conventional storage devices such as hard disk drives and optical disk drives in some arenas, such as in mass storage applications for laptops or desktops. Solid state memory devices are also investigated for replacing conventional storage devices in other areas such as in enterprise storage systems. This is because solid state memory devices offer exceptional bandwidth as well as excellent random I/O (input/output) performance along with an appreciated robustness due to lack of moveable parts.
However, writing data to a solid-state memory device such as a flash memory device requires paying attention to specifics in the flash technology: NAND Flash memory is organized in units of pages and blocks. Multiple pages form a block. While read and write operations can be applied to individual pages, erase operations can only be applied to entire blocks. And while in other storage technologies outdated data can simply be overwritten by new data, Flash technology requires an erase operation before new data can be written to an erased block.
Another specific in Flash technology is that today's Flash memory devices are limited to a finite number of Program Erase (PE) cycles. A Flash memory device typically has an endurance specification that defines its maximum number of PE cycles. Therefore, a writing technique is applied called “write out of place” in which new or updated data is written to some free page offered by a free page allocator instead of writing it to the same page where the out-dated data resides. The page containing the out-dated data is marked as invalid page. By such means, the life expectancy of Flash-based solid-state drives (SSD) and also log-structured file systems may be extended, since erase cycles needed for directly overwriting data in a block are avoided.
However, available free pages may be exhausted over time. Instead, the blocks of the Flash memory device may be occupied by a mix of valid and invalid pages. New free space needs to be created by a block reclaiming process, also denoted as garbage-collection process, which reclaims space occupied by out-dated, i.e. invalid, data. A block reclaiming process first identifies blocks for erasing based on a given policy. Then, valid data residing in such blocks is copied (relocated) to other blocks containing free pages, and finally the subject blocks are erased so that they become available for rewriting.
The block reclaiming mechanism introduces additional read and write operations the extent of which depends on the specific policy deployed as well as on the system parameters. Such additional writes are also referred to as “write amplification” phenomenon. The write amplification negatively affects the lifetime and endurance of SSDs since it produces data elsewhere which need to be erased sooner or later again, and it slows down the overall performance of the Flash memory device.
A Flash memory device may even stop operating when only a small fraction of its blocks are worn out. In this case, there may still be blocks that are either unused or underused. Wear-leveling algorithms ensure that erasures are distributed more evenly across the Flash memory blocks.
DETAILED DESCRIPTION OF THE INVENTION
According to one aspect of the present invention, a method is provided for operating a computer memory wherein the memory is organized to store data in a set of units of the memory. For each of the units of the set a wear level is determined and a maximum wear level among the determined wear levels is identified. A suggestion of a subset of one or more units for being selected for data erasure is received. At least one unit in the subset is identified, which has a wear level less than the maximum wear level, for subsequent data erasure. In the step of identifying, it is preferable that a unit of the subset is dropped from being selected for data erasure if the wear level of the unit is equal to the maximum wear level, unless the wear level of each of the other units of the set is equal to the maximum wear level.
According to a further aspect of the present invention, a storage device is provided. The storage device includes a memory made up of a set of units. A controller is adapted to determine a wear level of each of the units of the set and to identify a maximum wear level among the determined wear levels. The controller is further adapted to receive suggestion of a subset of one or more units for being selected for data erasure. The controller is further adapted to identify at least one unit in the subset, a wear level of which is less than the maximum wear level, for subsequent data erasure. It is preferable that, for each unit of the subset, the unit will be dropped from being selected for data erasure if the wear level of that unit is equal to the maximum wear level, unless the wear level of each of the other units of the set is equal to the maximum wear level.
As an introduction to the following description, it is first pointed at a general aspect of the present invention concerning wear leveling in memory devices suffering from wear. Such memory device preferably may be solid state memory devices, such as Flash memories, phase change memories, magnetic RAM memories, etc. In the following description references are made to Flash technology terminology, for example, when it is referred to blocks instead of units and to pages instead of subunits. Nevertheless, it is understood that for the entire application neither the content nor the scope of protection shall be restricted to the Flash memory technology. Any other solid state storage technology shall be encompassed, as is any log structured file system making use of a storage device in a log-structured way.
In such memory devices, the wear of a set of memory units is monitored, so that an instantaneous maximum wear is observed. The set of memory units may preferably include all units available in the memory device, or may include all units available for storing user data in the memory device, or generally may include a number of units less than the number of units available in the memory device. Wear in the present context may rather be a matter of usage than of pure age. There may be various ways for determining a wear, however, in a preferred embodiment, the number of erase cycles a unit was exposed to in the past may serve as a representation of the level of wear. In this example, the wear level is not a relative measure with respect to a maximum wear level allowed or achievable but is an absolute measure that is comparable to the wear levels of other units.
It is preferred, that the instantaneous wear level is determined, monitored and stored for each unit. Hence, the present wear status of a unit may be available at every time needed. Out of all variables representing the instantaneous wear levels of the associated units in the set of units, it is searched for the variable indicating the maximum wear level. There may be different ways for determining the maximum wear level representing the one or more most worn out units in the set of units. Given that a variable shows a higher level the higher the wear is, a search for the maximum wear level may result in a max search among the variables. Preferably, an identifier identifies the instantaneous maximum wear level per unit of the set. For the present idea it may be sufficient that a value representing the maximum wear is identified among all the wear levels determined for the units of the set such that it may not be critical to learn which one of these units is the most worn out.
Subject to the overall processing, at some point in time there may be a request to verify if one or more units may be suitable for being erased and make the unit available for new writes. Such request received may in the following also be denoted as suggestion of a subset of one or more units for data erasure. The subset typically represents a number of units from the set of units which number is smaller than the number of units belonging to the set. However, in a different embodiment, the subset of units may be identical to the set of units. In one embodiment, there may be a process such as a unit reclaiming process for preselecting units for a possible future data erasure. In one embodiment, such preselecting may involve a characteristic which units may be better suited for erasure than others wherein such characteristic may be different than wear, and specifically be different than the wearlevels assigned to the respective units. Such characteristic may, for example, be the amount of valid data residing in a unit for the reason that in write-out-of-place concepts any still valid data needs to be relocated to another location. In such way, a preselection may include an evaluation with respect to a validity characteristic of a unit. If a unit includes a set of subunits for storing data, such validity characteristic may depend on validity characteristics assigned to the individual subunits of the respective unit. For example, a flag may be assigned to each subunit indicating that the subunit includes valid or invalid data. Such flag may be interpreted as characteristic to the subunit. The characteristic of the unit may result from an accumulation of the characteristics of the associated subunits, and may result in an integer number representing the number of its subunits containing valid data.
The subset of units suggested for data erasure may preferably include one of the following: a single unit; multiple units; all units of the set of units. Whenever the subset contains more than one unit, the units may be received as a list, or one by one in consecutive manner.
Any suggested unit is evaluated in that its wear level may be compared to the maximum wear level. In case the wear level is below the maximum wearlevel, the subject unit may generally be suitable for being erased; however, additional criteria may be applied for determining if the subject unit finally will be selected for erasure, or if another unit also producing a wear level less than the maximum wear level may better be suited along such other criteria. In this context, it is attempted to identify at least one unit in the subset for subsequent data erasure, a wear level of which at least one unit is less than the maximum wear level.
On the other hand, it may be preferred that each unit of the subset the wear level of which unit is equal to the maximum wear level is dropped from being selected for data erasure. However, in case all units of the subset suggested for being selected for data erasure show a wear level equal to the maximum wear level, it is preferred to identify a unit with a wear level less than the maximum wear level out the units outside the subset. In case such unit is identified it may be the preferred unit for a subsequent data erasure. In such scenario, all units of the set of units may need to be investigated as to their wear level. It is preferred, that only if the wear level of each of the other units of the set is equal to the maximum wear level, the presently considered unit out of the subset of suggested units may be identified for data erasure although its associated wear level is equal to the maximum wearlevel either for the reason that no other unit could be identified within the set of units with a wear level less than the maximum wear level. In such scenario, it may be preferred that either at least one of the units out of the subset of units is identified for erasure according to a criterion different thanwear since from a wear point of view there is no preference among the units suggested in the subset, or one of the units out of the set of units is identified for erasure according to a criterion different than wear since from a wear point of view there is no preference among the units suggested in the set.
Hence, in case all the units suggested in the subset show a wear level equal to the maximum wear level, it is preferred that none of the blocks suggested in the subset will be erased and instead one or more blocks not suggested in the subset but showing a wear level less than the maximumwear level will be selected for erasure, since such units may still be existing in the set of units. In terms of processing, this may be implemented by either the wear leveling process taking over from the block reclaiming scheme and searching for such blocks, or the wear levelling process returning to the block reclaiming scheme and requesting for a suggestion of one or more additional blocks.
In block/page terminology, the wear leveling process selects one or more blocks out of the set of blocks to erase that exhibit a wear level that is less than the instantaneous maximum wear level among the blocks in the set. This approach results in the following advantages over previous approaches: The present approach can be combined with any block reclaiming scheme that may focus on criteria different than wear, and as such may be combined with any garbage collection scheme and still assign sufficient weight to the problem of wear in the overall process. For this reason, a process for reclaiming blocks focusing on the avoidance of write amplification may be implemented and the present wear leveling approach may correct any decisions taken by the block reclaiming scheme that inappropriately favor a block selection at the cost of wear.
In addition, the present approach provides an excellent degree of wear leveling in that the wear imbalance among all the blocks is minimized throughout the operation of the memory device. It avoids additional costly operations to maintain a sufficient degree of wear leveling among the blocks. It prolongs the lifetime of the memory device since when the memory device is declared as unusable for the reason that one or more blocks basically exceed awear level threshold, the degree of usage of all blocks is essentially the same.
Hence, a new approach for performing efficient wear leveling in SSD devices is proposed. By means of monitoring the wear level of each block in the set of blocks, by identifying an instantaneous maximum wear level and by selecting one or more blocks for erasure that exhibit a wear level that is less than the instantaneous maximum wear level, an efficient wear leveling approach is proposed suitable for solid state storage devices, whereby all blocks in the set monitored undergo essentially the same degree of usage to prolong the lifetime of the device. The same mechanism may be applied to any memory structure in which new or updated data are written out-of-place, i.e. where data updates to out-dated data are not written to the subunit containing the out-dated data but to a log which provides a series of free subunits where data is to be written to. Such subunits typically may not be subunits subsequent to each other in the organization of the storage device but may be scattered around the storage device and be offered by an allocation engine. Such systems may be referred to as log-structured file systems.
Typically, the present wear leveling process is triggered together with or from a block reclaiming process which in turn is started when there is a need recognized for freeing blocks for writing new data to, which requires a previous erasure of all data on such blocks. The more data is written over time to the device, the less free pages may be available and new blocks may need to be reclaimed for a free block queue, i.e. a queue for providing free, erased blocks for writing new or updated data to. New free blocks need to be reclaimed from blocks filled with valid and/or invalid data. The block reclaiming process first identifies blocks for cleaning based on a given policy. Then valid data still residing in these blocks is copied/relocated to other blocks, and finally the blocks that now are free from valid data are erased and become available again for rewriting. While this procedure requires some additional write operations in excess, it is apparent that by such approach immediate erase operations are avoided which would contribute to a much higher overall processing time than an overhead of some additional write operations do.
The proposed real-time wear leveling scheme can be combined with any block reclaiming scheme and, in an embodiment, may work as follows: The wear level of each block is registered in an individual counter. An additional counter referred to as max_counter is provided for keeping track of the instantaneous maximum value over all counters. When a block is erased, the content of the corresponding counter is increased by one. Furthermore, if this new value exceeds the value of the max_counter, then also the max_counter is increased by one. To identify a block for recycling, the block reclaiming process may consider blocks according to a specific sequence and may examine, for example, their number of valid pages. This process terminates when a block is found that contains a number of valid pages that satisfies a given criterion. According to the proposed scheme, the process preferably terminates when the wear of the block found is less than the instantaneous maximum wear monitored up to this point in time, which is registered in the max_counter.
FIG. 1 shows a flow diagram of a method according to an embodiment of the present invention.
In an initialization step 50 an erase counter <c(i)> representing a variable for the wear level for the block i is set to zero for each block of a set of blocks. The erase counter <c(i)> represents a variable of the erase cycles applied to the block i in the past, and as such represents the wear level of the block i, which wear level in some instances is also referred to as age of the block. A counter <c_max> is also set to zero. The counter <c_max> delivers a level representing the maximum wear level that is assigned to any of the counters <c(i)>.
In step 51 a block reclaiming process is started, for example, in view of limited resources to write new data to. The initialization step 50 may of course be integrated into the starting step 51, too. In step 52, a <last> identifier, i.e. a first identifier, is set to minus one. The <last> identifier is an identifier for the block that currently would have been selected by the block reclaiming process, i.e. which would be recycled by the garbage collection process in the absence of the proposed wear-leveling feature. In the same step 52, a <last_WL> identifier, i.e. a second identifier, is set to minus one. The <last_WL> identifier is an identifier for the block that is selected for recycling by the block reclaiming process in the presence of the proposed wear-levelingfeature.
In the following, it is considered that the block reclaiming process will examine a set of blocks of the memory device according to a given sequence. The sequence can be fixed, such as in the case, for example, of the so-called greedy garbage collection process where all blocks are examined, or it can be dynamic where the search is stopped when a set of criteria are fulfilled. An end of the search is verified in step 59. In the present example, the block reclaiming process considers one block after the other in a given sequence. Any block out of the set of blocks is considered in the block reclaiming scheme and is suggested to the wear leveling feature, such that a subset of blocks suggested for data erasure represents the entire set of blocks investigated in the block reclaiming scheme. The wear leveling feature is denoted by the brace including steps 54 to 56 which are explained later.
If the wear-leveling feature would not be implemented, the block reclaiming process would compare a sample block j in the sequence of blocks with the best block identified so far according to the given criteria. This is accomplished in step 57. The best block so far is registered in the <last> identifier. If the sample block j is better in terms of the criteria than the <last> block, then block j would become the new <last> block, i.e. last=j, see step 58. If the sample block j proves not to be better than <last> block in terms of the criteria, then the best block remains to be the one pointed at by the <last> identifier, and in step 59 it would be verified if there is another block in the sequence waiting to be suggested.
The proposed method, however, introduces a wear-leveling feature, which is implemented by steps 54 to 56. Thus, wherever a new block j is suggested, it is determined in step 54 if such block j is preferred over the <last_WL> block in view of the criteria according to which the <last> block is identified. In other words, it is determined if the present block j under consideration is better in terms of the criteria than the best block identified so far in terms of wear. If this is not the case (no), it is jumped to step 57 where it is determined if the new block j is better than the best block so far in this category in terms of the criteria. This reflects a situation where the presently favored block in view of wear is also better than the new block j in view the other criteria. However, if the new block j is better in terms of these criteria than the presently best block in view of wear, then step 55 applies and thewear level represented by the variable c(j) for block j is compared to the maximum wear level represented by the level assigned to the counter <c_max>. If the wear level of block j is not equal to the maximum level stored in <c_max>, block j becomes the new <last_WL> block.
When the sequence is exhausted, i.e. there are no more blocks suggested, see step 59 (no), then the <last_WL> identifier contains the block to be recycled, see step 62, except if the <last_WL> identifier is equal to minus one or any other value representing an invalid term of wear. When all blocks produce equal wear which is equivalent to a confirmation in step 60 that <last_WL>=-1 no new block could be identified that satisfies the wear criterion in step 55 since all such blocks produce the maximum wear indicated by <c_max>. In this case, the block to be recycled is the one that the block reclaiming process would have recycled when the wear leveling feature were not considered, i.e. <last_WL> =<last>, see step 61. Finally, after recycling the block indicated by the <last_WL> identifier in step 62, its wear counter <c(last_WL)> is incremented by one, also in step 62, and if thewear counter <c(last_WL)> then exceeds the instantaneous maximum wear level <c_max>, the <c_max> variable is also updated in step 62. Then, the process may be stopped in step 63, until a new request for block reclaiming activities is received and triggers initialization in step 50 and a start of the process in step 51.
Clearly, other implementations may be envisaged, such as an embodiment without using the <last> identifier.
The above criteria according to which a block is identified to be the one to be reclaimed without consideration of wear may involve one or more of the following:
- the number of valid pages of a block;
- the number of invalid pages of a block;
- the number of free pages of a block;
- the age of the block;
- the time of the most recent write activity to such block;
- the time of the earliest write activity to such block; and
- the frequency of write activities to such block (i.e. the wear of such block).
The criteria may involve any combination of two or more of the above parameters. The criteria may involve a comparison of any one of the above parameters with a threshold and the criteria may be fulfilled when the parameter is above or below a threshold. The criteria may alternatively be fulfilled if a parameter 10 is found to be below a threshold. The criteria may include a comparison of multiple of the above parameters with individually assigned thresholds, or the criteria may be fulfilled when all the parameters are above or below their respective thresholds. A sample criterion may include “the number of valid pages in the block is less than 12 and an age of the block is less than 100”.
A threshold may be a predefined threshold and may not change during operation. A threshold may be predefined and depend on the memory system characteristics. Advantageously, the threshold may be determined in view of the number of pages per block the memory system provides; and/or in view of a ratio between an average number of valid subunits in all blocks and the total number of subunits in the memory. The threshold may be a variable threshold which during operation may take different values. E.g. the threshold may depend on a ratio between an absolute or a floating (average) number of valid subunits in all blocks and the total number of subunits in the memory. The threshold may be an adaptive threshold which may depend on other parameters. The threshold may be adaptive also with respect to previous threshold values, or it may be adaptive with respect to the actual number of valid subunits of previously identified blocks, specifically, if the number of valid subunits in the previously identified block is taken as a new value for the threshold. Or, a moving average of the numbers of valid subunits in the previously identified blocks is taken as a new value for the threshold.
FIG. 2 shows a block diagram of a storage device according to an embodiment of the present invention. The storage device 1 includes a Flash based solid state memory 2 with a block/page memory space structure. Few of the blocks are indicated as 21. A memory controller 3 is controlling the activities of the flash memory 2—as such the memory can be described as a computer memory. The memory controller 3 specifically is adapted for writing data to and reading data from the memory 2, and for executing all administrative tasks in connection with the reading and writing of data. Specifically, the memory controller 3 writes updates to a page of a block to one or more blocks different to the block the out-dated data is contained in (“write out-of-place”). When doing so, the memory controller 3 flags the one or more subunits containing the out-dated data as invalid. From time to time, the memory controller 3 may execute a search among the blocks—whereas such search may be limited to blocks containing at least one page of invalid data and/or limited according to other criteria—in order to identify one or more blocks matching predetermined criteria. In a preferred embodiment, the search may be stopped when one or a given number of blocks are identified matching the given criteria. Such blocks then build a subset of blocks suggested to a wear leveling routing for being erased. The memory controller 3 may then implement the wear leveling routine for identifying one or more blocks among the suggested blocks in view of the wear level of each block being compared to the maximum wear level. Only when one or more of the suggested blocks show a wear level less than the maximum wear level exhibited by any of the blocks considered in view ofwear, such one or more blocks may be erased.
Prior to erasing, the memory controller 3 initiates a relocation of data of valid pages of this identified block to pages of another block, and possibly even to multiple other blocks. In this context, the memory controller 3 is responsible for running a method according to any of the embodiments descried above. The memory controller 3 further is connected to a host 4 which makes use of the storage device 1 for storing data. Hence, the host 4 issues read and/or write commands to the storage device 1.
In order to implement the method according to any one of the embodiments as described above, the memory controller 3 preferably provides a computer program code preferably stored in a non-volatile, non-rewritable storage medium such as a ROM 31 see FIG. 3. The storage controller further provides a RAM 32 for loading the program code into, and a processing unit 33 for executing the program code in the RAM 32. Internal communication systems34 are provided for communicating between the components of the memory controller 3, and an interface 35 is provided for communicating with the flash memory, while another interface 36 may be provided for any communication with the host.
In the diagram of FIG. 4a) the wear equivalent to the number of erased cycles applied to a block is depicted of multiple blocks with block ids 0 to 1000, i.e. for thousand blocks. It turns out that the proposed wear leveling method ensures that all blocks in the system have essentially the same wearthroughout the operation of the device. In the present example, a memory device is considered with 16 pages per block, 1000 blocks, and occupancy of 0.8, operating under random small writes. FIG. 4a) depicts in small dots the wear of blocks after 30 million user write operations under the assumption that a windowed greedy garbage-collection scheme is applied with a window size equal to 10. This implies that the block selected for erasing is the block among the first 10 most aged blocks that has the least number of valid pages. From the diagram in FIG. 4a) it can be observed that the wear of blocks has a variation between 4998 and 5017 erases per block. In contrast, by applying the proposed wear leveling scheme a nearly uniform wear of all blocks is achieved of 5011 or 5012 erases per block, as illustrated in FIG. 4a) by the two horizontal lines. In effect, the proposed method leads to a nearly uniform utilization of all blocks when the memory device reaches the end of its lifetime, whereas if the proposed method were not applied, a significant number of blocks would have been underutilized.
With respect to the diagram in FIG. 4b), it is considered the case of hot and cold traffic and is assumed that 9% of the blocks, i.e. 90 blocks, contain static (cold) addresses. A static address contains data which is not changed too much over the lifetime of the memory device. FIG. 4b) depicts in small dots the wear of the blocks after 60 million user write operations when the windowed greedy garbage-collection scheme is applied, with a window size equal to 100. It can be observed that 9% of blocks have a wear of 1 (not shown), whereas the wear of the remaining blocks has a variation between 9878 and 9938 erases per block (small dots). Applying the proposed method yields a uniform wear of all blocks of 9607 or 9608 erases per block, as illustrated in FIG. 4b) by the horizontal line. In effect, the proposed method leads to a nearly uniform utilization of all blocks when the memory device reaches the end of its lifetime, whereas if the proposed method were not applied, a significant number of blocks would have been underutilized.
In the present example, it may illustratively be assumed that the endurance of blocks is equal to 9918 cycles and that the device is declared as unusable if 15% of the blocks are no longer operational. Then, in the case of absence of the present wear-leveling method the device would have been declared as unusable after 60 million user writes. By contrast, applying the proposed wear leveling method allows for a significant number of additional writes, given that none of the blocks has reached its endurance after 60 million user writes. For the considered example, this allows for an additional (9918−9607)*1000*16=5 million user writes before declaring the device unusable, which corresponds to an 8% increase of the device lifetime. This increase in lifetime is obtained without introducing additional procedures and complexity to ensure that the wear is maintained within limits to prevent the device to be declared unusable.