# Patent

## Title
System and method for performing data retention in solid-state memory using an LRU list

## Abstract

Systems and methods for retaining data are disclosed in which refresh copy operations are performed on data stored in non-volatile solid-state memory. A controller may be configured to maintain a list of physical memory locations, the list sorted by a least recently used criterion. The controller may select a first entry from a top of the list and perform a refresh operation to copy data stored in a current physical memory location associated with the first entry to a new physical memory location, and may remove the first entry from the top of the list and add a new entry associated with the new physical memory location to a bottom of the list. The controller may repeat the select, perform, remove and add steps for a plurality of entries in the list, and the steps may be timed such that all refresh operations are performed for all of the plurality of entries within a set period of time.

## Background
RELATED APPLICATION
The present application is a continuation of U.S. patent application Ser. No. 14/087,549 entitled “SYSTEM AND METHOD FOR PERFORMING DATA RETENTION IN SOLID-STATE MEMORY,” filed on Nov. 22, 2013, now U.S. Pat. No. 9,135,166, which is a continuation of U.S. patent application Ser. No. 12/824,434, entitled “SYSTEM AND METHOD FOR PERFORMING DATA RETENTION IN SOLID-STATE MEMORY,” filed on Jun. 28, 2010, now U.S. Pat. No. 8,612,669, the contents which are hereby incorporated by reference in their entirety for all purposes.


BACKGROUND
Non-volatile solid-state memory stores data, at the hardware level, by retaining electrons at individual floating gates within memory cells. The electrons are placed into the floating gates by a current applied during a program cycle. If a floating gate in the programmed state is left un-programmed for a long time, some of the electrons may leak out of the floating gate and cause bit errors.
SUMMARY
In certain aspects, the subject technology relates to a non-volatile solid-state memory array and a controller. The controller may be configured to maintain a list of physical memory locations storing data in non-volatile solid-state memory array, where the list is sorted by a least recently used criterion. The controller may be further configured to execute one or more refresh cycles comprising selecting a first entry from a top of the list for processing, performing a refresh operation comprising copying data stored in a current physical memory location associated with the first entry to a new physical memory location, removing the first entry from the top of the list, adding a new entry associated with the new physical memory location to a bottom of the list, and repeating the selecting, repeating the selecting, performing, removing and adding steps for a plurality of entries in the list, where the selecting, performing, removing and adding steps are timed such that all refresh operations are performed for all of the plurality of entries in the list within a set period of time.
In certain aspects, the subject technology relates to performing data retention in solid-state memory. The method includes maintaining a list of physical memory locations storing data in the non-volatile solid-state memory array, where the list is sorted by a least recently used criterion, and executing one or more refresh cycles comprising selecting a first entry from a top of the list for processing, performing a refresh operation comprising copying data stored in a current physical memory location associated with the first entry to a new physical memory location, removing the first entry from the top of the list, adding a new entry associated with the new physical memory location to a bottom of the list, and repeating the selecting, performing, removing and adding steps for a plurality of entries in the list, where the selecting, performing, removing and adding steps are timed such that all refresh operations are performed for all of the plurality of entries in the list within a set period of time.
In yet another aspect, the subject technology relates to a non-transitory readable medium storing instructions executable by a processor to perform operations. In certain implementations, the operations include maintaining a list of physical memory locations storing data in the non-volatile solid-state memory array, where the list is sorted by a least recently used criterion, and executing one or more refresh cycles comprising selecting a first entry from a top of the list for processing, performing a refresh operation comprising copying data stored in a current physical memory location associated with the first entry to a new physical memory location, removing the first entry from the top of the list adding a new entry associated with the new physical memory location to a bottom of the list, and repeating the selecting, performing, removing and adding steps for a plurality of entries in the list, where the selecting, performing, removing and adding steps are timed such that all refresh operations are performed for all of the plurality of entries in the list within a set period of time.
It is understood that other configurations of the subject technology will become readily apparent to those skilled in the art from the following detailed description, wherein various configurations of the subject technology are shown and described by way of illustration. As will be realized, the subject technology is capable of other and different configurations and its several details are capable of modification in various other respects, all without departing from the scope of the subject technology. Accordingly, the drawings and detailed description are to be regarded as illustrative in nature and not as restrictive.



BRIEF DESCRIPTION OF THE DRAWINGS
Systems and methods which embody the various features of the invention will now be described with reference to the following drawings, in which:
FIG. 1A is a block diagram illustrating a solid-state storage subsystem according to one embodiment.
FIG. 1B illustrates data retention methods according to various embodiments.
FIG. 2A illustrates an example of using validity bit arrays in a data retention operation in accordance with one embodiment.
FIG. 2B is a flow diagram showing the process of updating the validity bit arrays in accordance with one embodiment.
FIG. 2C is a flow diagram showing the process of using the validity bit arrays in the data retention operation in accordance with one embodiment.
FIG. 3A illustrates another example of using validity bit arrays in a data retention operation in accordance with one embodiment.
FIG. 39 is a flow diagram showing the process of updating the validity bit arrays in accordance with another embodiment.
FIG. 3C is a flow diagram showing the process of using the validity bit arrays in the data retention operation in accordance with another embodiment.
FIG. 4 is a flow diagram illustrating a process of updating a least recently used list of blocks in accordance with one embodiment.
FIG. 5 is a flow diagram illustrating a process of performing data retention with a least recently used list of blocks in accordance with one embodiment.



DETAILED DESCRIPTION
While certain embodiments of the invention have been described, these embodiments have been presented by way of example only, and are not intended to limit the scope of the invention. Indeed, the novel methods and systems described herein may be embodied in a variety of other forms. Furthermore, various omissions, substitutions and changes in the form of the methods and systems described herein may be made without departing from the spirit of the invention. The accompanying claims and their equivalents are intended to cover such forms or modifications as would fall within the scope and spirit of the inventions.
Overview
Embodiments of the invention are directed to systems and methods for retaining data in solid-state memory in which refresh copy operations are performed on data stored in solid-state memory. A refresh copy operation helps ensure that data written to memory retain integrity by causing data to be programmed again onto the memory, which minimizes the aforementioned risk of data error caused by electron leak. One or more data structures may be used to determine memory blocks that require refresh copy operations. For example, in one embodiment, a validity bit array is used to track blocks that contain valid data. In another embodiment, a least recently used list is used to track blocks that have been least recently written.
System Overview
FIG. 1A is a block diagram illustrating a storage subsystem embodiment with a data retention capability. As shown, a storage subsystem 140 includes a controller 150, which in turn includes a command queue 142 and a data retention module 148, which is configured to execute the data retention operations as further described below. In one embodiment, the host command queue 142 receives memory commands from a driver 132 residing within a host system 130, and the memory commands may include write and read commands issued by the host system 130. As further shown in FIG. 1A, in one embodiment, the controller 150 executes the commands in the host command queue 142 as well as commands issued by the data retention module 148 in one or more non-volatile solid-state memory arrays 160. The commands from the data retention module 148 may be stored in the queue 142 or in a separate queue. In the description below, for the sake of brevity, the data retention module 148 may be described as directly performing a memory operation on data in the array (e.g. copying) instead of providing a command for doing so.
Data Retention Operations
FIG. 1B illustrates data retention methods according to various embodiments. Block diagram 202 shows a time-based embodiment in which blocks 210 within the non-volatile memory are sequentially refreshed on a periodic basis (i.e. by refreshing one or more blocks per refresh cycle) until all blocks are refreshed. The refresh cycle in one embodiment can be determined by dividing a refresh period by the number of blocks to be refreshed. In one embodiment, the refresh period can be set at three months, six months, one year, etc., as based on the manufacturer's specification and/or warranty of the memory. In one embodiment, the refresh copy commands are executed when the memory is idle (e.g. no host and/or garbage collection commands are executed). In one embodiment, the execution of refresh copy commands may be delayed as host commands and/or other internal commands (e.g. wear leveling commands) are prioritized by the controller over the refresh copy commands. In one embodiment, the pace of executing the refresh copy commands is adjusted in accordance with the progress of executing the refresh copy commands within the refresh period. For example, if the refresh period is three months and the refresh copy commands are not on track to finish within three months, the remaining refresh copy commands may be prioritized for execution.
Block diagram 204 shows a data retention embodiment that uses one or more validity bit arrays to track blocks that have valid data stored therein. In one embodiment, the data retention module 148 consults a validity bit array as it performs the data retention operation. As shown, each block has a validity bit entry in each array, with the bit set to “1” if the corresponding block contains valid data and “0” if it does not. In other embodiments, a “1” bit indicates invalid data and a “0” bit indicates valid data. In one or more embodiments, validity bit arrays 212 and 214 are used. The two-array embodiments allow the data retention module 148 to perform data retention operations based on the validity indications in one array while the other array is used to track new validity changes. The various data retention embodiments based on validity bit arrays will be further described below in conjunction with FIGS. 2A-2C and 3A-3C. In other embodiments, one validity bit array is used in the data retention operation.
Block diagram 206 shows a data retention embodiment that uses a table 216 that keeps track of the least recently used (written) blocks in the solid-state memory. In one embodiment, the table 216 lists blocks sorted by a least recently used (LRU) criterion. In one embodiment, each time a block is written, the entry corresponding to the written block is moved from its current position in the table 216 to the bottom of the table. In this manner, entries for blocks that are least recently used rise to the top, and other entries become sorted by a LRU criterion. In one embodiment, the data retention module 148 performs data retention on blocks referenced by entries between a head pointer 218 and a tail pointer 220. In one embodiment, the entry of the block that undergoes data retention is moved to the bottom of the table 216. In one embodiment, once data retention module 148 processes all the blocks between the head and the tail pointers, the head pointer is moved to the entry after the previous location of the tail pointer, and the tail pointer is moved to the end of the table. In other embodiments, other data structures such as a linked list can be used to keep track of the blocks sorted by the LRU criterion. The LRU-based data retention embodiment will be further described below in conjunction with FIGS. 4-5.
Validity Bit Array Embodiments
FIG. 2A is a block diagram that illustrates an example of using validity bit arrays in a data retention operation in accordance with one embodiment. Scenario 230 illustrates an initialization phase with the array 212 (marked as the “current” array) and the array 214 ((marked as the “next” array). Scenario 232 shows that during a first refresh period, the “current” array 212 records indications of changes in the validity of the data in the blocks. In the example shown, each block has a validity bit entry in the array, with the bit set to “1” if the corresponding block contains valid data and “0” if it does not. In other embodiments, a “1” bit indicates invalid data and a “0” bit indicates valid data. The “next” array 214 in scenario 232 remains unchanged while the “current” array 212 is updated. Scenario 234 shows the arrays just before the start of the data retention operation. At the start of the operation, the data retention module 148 copies the contents of the “current” array 212 to the “next” array 214. The data retention module 148 then executes the data retention operation by consulting the “current” array 212. While the data retention operation is ongoing, the arrays record indications of changes in the validity of the data in accordance with the process shown in FIG. 2B. Scenario 236 shows the end of the data retention operation, and the arrays are switched, with the “current” array becoming the new “next” array and the “next” array becoming the new “current” array. Scenario 238 shows that new validity changes are recorded in the new “current” array until the next data retention operation. Scenario 240 shows the start of the next data retention operation, with the contents of the “current” array being copied to the “next” array and the data retention operation proceeding in accordance with the validity indications within the “current” array.
FIG. 2B is a flow diagram showing a process 300 performed by the data retention module 148 to update the validity bit arrays in accordance with one embodiment. In block 302, the process 300 is triggered by a new memory operation (e.g. a new host write or a garbage collection operation). Then in block 304, the process determines if the data retention operation is currently being executed. If not, the update process records the validity change caused by the new memory operation in the “current” bit array in block 306. If so, the process determines in block 308 if the new memory operation is a write operation or an erase operation. If it is a write operation, the update process records the validity change caused by the new operation in the “next” bit array in block 310. If it is an erase operation, the process further determines in block 312 if the location of the block to be erased is ahead of the location currently being processed by the data retention operation. If not, the update process records the validity change caused by the new memory operation in the “next” bit array in block 314. If so, the update process records the validity change caused by the new memory operation in the “current” and “next” bit arrays in block 316. As stated above, since a new erase operation makes the data in the block invalid, recording the validity change in the “current” array prevents the pending data retention operation from needlessly refreshing invalid data.
FIG. 2C is a flow diagram showing a process 400 performed by the data retention module 148 that uses the validity bit arrays in the data retention operation in accordance with one embodiment. In block 402, the process begins by copying contents of the “current” bit array to the “next” bit array. In block 404, the data retention operation begins, and the “current” bit array entries are consulted to determine if refresh operations (copy operations) are needed for the individual blocks. In block 406, the process determines if the current bit in the array indicates valid data in the referenced memory block and a need for a refresh copy. If so, data in the referenced memory block are copied to a new physical block in block 408. If not, the process moves to block 410. In block 410, the process checks if there are additional bits remaining in the array. If so, it moves to consult the next bit in block 406. Optionally, a timer is used in block 412 to trigger the next iteration of operation to ensure that the refresh copy operation is performed on a periodic basis. In one embodiment, each refresh cycle is timed to ensure all refresh operations for the blocks complete within a time period set in accordance with a manufacturer warranty and/or specification. The time period can be for example, three months, six months, one year, etc. After all the bits are consulted in the “current” array and it is determined that there are no more bits remaining at block 410, the bit arrays are switched so the “current” array becomes the “next” array and vice versa at block 414. The data retention operation ends in block 416.
FIG. 3A is a block diagram that illustrates another example of using validity bit arrays in a data retention operation in accordance with one embodiment. Scenario 430 illustrates an initialization phase with the array 212 (marked as the “current” array) and the array 214 (marked as the “next” array). Scenario 432 shows that during a first refresh period, the “next” array 214 records indications of changes in the validity of the data in the blocks. The “current” array 212 in scenario 432 remains unchanged while the “next” array 214 is updated. Scenario 434 shows the arrays just before the start of the data retention operation. At the start of the operation, the data retention module 148 copies the contents of the “next” array 214 to the “current” array 212, and then switches the two arrays by making array 212 the “next” array and array 214 the “current” array. The data retention module 148 then executes the data retention operation by consulting the “current” array 212. While the operation is ongoing, the arrays record indications of changes in the validity of the data in accordance with the process shown in FIG. 3B. Scenario 436 shows the arrays at the end of the data retention operation. Scenario 438 shows that new validity changes are recorded in the “next” array 212 until the next data retention operation. Scenario 440 shows the start of the next data retention operation, in which the data retention module 148 again performs the copying and switching of arrays as previously shown in scenario 434 prior to executing the data retention operation.
FIG. 3B is a flow diagram showing a process 500 performed by the data retention module 148 to update the validity bit arrays in accordance with one embodiment. In block 502, the process 500 is triggered by a new memory operation (e.g. a new host write or a garbage collection operation). Then in block 504, the process determines if the data retention operation is currently being executed. If not, the update process records the validity change caused by the new memory operation in the “next” bit array in block 506. If so, the process determines in block 508 if the new memory operation is a write operation or an erase operation. If it is a write operation, the update process records the validity change caused by the new operation in the “next” bit array in block 510. If it is an erase operation, the process further determines in block 512 if the location of the block to be erased is ahead of the location currently being processed by the data retention operation. If not, the update process records the validity change caused by the new memory operation in the “next” bit array in block 514. If so, the update process records the validity change caused by the new memory operation in the “current” and “next” bit arrays in block 516.
FIG. 3C is a flow diagram showing a process 600 performed by the data retention module 148 that uses the validity bit arrays in the data retention operation in accordance with one embodiment. In block 602, the process begins by copying contents of the “next” bit array to the “current” bit array. In block 604, the arrays are switched so the “next” array becomes the “current” array and vice versa. In block 606, the data retention operation begins, and the “current” bit array entries are consulted to determine if refresh operations (copy operations) are needed for the individual blocks. In block 608, the process determines if the current bit in the array indicates a need for a refresh copy in the referenced memory block. If so, data in the referenced memory block are copied to a new physical block in block 610. If not the process moves to block 612. In block 612, the process checks if there are additional bits remaining in the array. If so, it moves to consult the next bit in block 608. As with the process shown in HG. 2C, optionally, a timer is used in block 614 to trigger the next iteration to ensure that the refresh copy operation is performed on a periodic basis. After all the bits are consulted in the “current” array, the data retention operation ends in block 616.
Least Recently Used Based Embodiment
FIG. 4 is a flow diagram illustrating a process 700 performed by the data retention module 148 for updating a LRU list used in a data retention operation in accordance with one embodiment. In block 702, the process 700 is triggered by a new memory operation (e.g. a new host write or a garbage collection operation). Then in block 704, the process determines if the new memory operation is a write operation or an erase operation. If it is a write operation, the update process 700 records the validity change caused by the new memory operation by moving an entry referencing the written block to the bottom of the LRU list in block 706. If it is an erase operation, the process records the validity change caused by the new memory operation by removing the entry referencing the erased block from the LRU list in block. 708, if the same block is written to in the future, it will be added back into the LRU list (at the bottom of the list). In another embodiment, no change to the list is made in block 708.
FIG. 5 is a flow diagram illustrating a process 800 performed by the data retention module 148 for performing data retention with a least recently used list (or table) of blocks in accordance with one embodiment. The process 800 begins at block 802. Then in block 804, the top entry on the LRU list within range of the head and tail pointers is processed. The head and tail pointers (218 and 220) were previously shown in FIG. 1B, and as discussed above, mark the range of blocks that will undergo the data retention operation. In block 806, the process 800 copies data in the corresponding block referenced by the particular entry in the LRU list to a new physical location. Then in block 808, the entry is moved to the bottom of the LRU list, which may be outside of the range of the head and tail pointers. The process 800 then determines if there are additional entries remaining between the head and tail pointers, and if so, proceeds to the next entry at block 804. Optionally, a timer may be used to trigger the next iteration in block 812. In one embodiment, each refresh cycle is timed to ensure all refresh operations for the blocks complete with a time period set in accordance with a manufacturer warranty and/or specification. The time period can be, for example, three months, six months, one year, etc. Once the entries between the head and tail pointers are processed, the process in block 814 moves or sets the locations of the head and tail pointers for the next data retention operation. In one embodiment, the head pointer is moved to the entry after the previous location of the tail pointer and the tail pointer is moved to the end of the table. The operation ends in block 816.
In various embodiments, the different data retention operations described above may be modified. For example, the data retention module may switch among the different types of data retention operations or perform operations that use more than one data structure described above (e.g. using both the LRU list and the validity data bit arrays).
Conclusion
The features and attributes of the specific embodiments disclosed above may be combined in different ways to form additional embodiments, all of which fall within the scope of the present disclosure. Although the present disclosure provides certain embodiments and applications, other embodiments that will be apparent to those of ordinary skill in the art, including embodiments which do not provide all of the features and advantages set forth herein, are also within the scope of this disclosure. Accordingly, the scope of the present disclosure is intended to be defined only by reference to the appended claims.

## Claims

1. A storage subsystem, comprising:
a non-volatile solid-state memory array; and
a controller configured to maintain a list of physical memory locations storing data in the non-volatile solid-state memory array, wherein the list is sorted by a least recently used criterion, and wherein the controller is further configured to execute one or more refresh cycles to:
select a first entry from a top of the list for processing;
perform a refresh operation comprising copying data stored in a current physical memory location associated with the first entry to a new physical memory location;
remove the first entry from the top of the list;
add a new entry associated with the new physical memory location to a bottom of the list; and
repeat the select, perform, remove and add steps for a plurality of entries in the list, wherein the select, perform, remove and add steps are timed such that all refresh operations are performed for all of the plurality of entries in the list within a set period of time.

2. The storage subsystem according to claim 1, wherein the controller is further configured to:
maintain a head pointer to reference the top of the list, wherein the head pointer is updated to reference a next entry in the list when the first entry is removed from the top of the list; and
maintain a tail pointer to reference a bottom entry of the list, wherein the plurality of entries is bounded in the list by a head entry referenced by the head pointer and the bottom entry referenced by the tail pointer.

3. The storage subsystem according to claim 2, wherein the controller is further configured to add the new entry associated with the new physical memory location to the list below the bottom entry of the list.

4. The storage subsystem according to claim 3, wherein the controller is further configured to:
reset the head pointer to reference an entry on the list below a current bottom entry of the list; and
reset the tail pointer to reference an entry at the bottom of the list,
wherein the head and tail pointers are reset upon completing the select, perform, remove and add steps for the plurality of entries in the list.

5. The storage subsystem according to claim 1, wherein the controller is further configured to:
add an entry associated with a physical memory location corresponding to a write command to the bottom of the list; and
remove an entry associated with a physical memory location corresponding to an erase command from the list.

6. The storage subsystem according to claim 1, wherein the controller is further configured to:
receive a timer trigger; and
initiate a next iteration of the select, perform, remove and add steps in response to the received timer trigger,
wherein the timer is set according to a refresh cycle based on the set period of time and the number of entries in the plurality of entries.

7. A method, comprising:
maintaining a list of physical memory locations storing data in a non-volatile solid-state memory array, wherein the list is sorted by a least recently used criterion; and
executing one or more refresh cycles comprising:
selecting a first entry from a top of the list for processing;
performing a refresh operation comprising copying data stored in a current physical memory location associated with the first entry to a new physical memory location;
removing the first entry from the top of the list;
adding a new entry associated with the new physical memory location to a bottom of the list; and
repeating the selecting, performing, removing and adding steps for a plurality of entries in the list, wherein the selecting, performing, removing and adding steps are timed such that all refresh operations are performed for all of the plurality of entries in the list within a set period of time.

8. The method of claim 7, further comprising:
maintaining a head pointer to reference the top of the list, wherein the head pointer is updated to reference a next entry in the list when the first entry is removed from the top of the list; and
maintaining a tail pointer to reference a bottom entry of the list, wherein the plurality of entries is bounded in the list by a head entry referenced by the head pointer and the bottom entry referenced by the tail pointer.

9. The method of claim 8, further comprising adding the new entry associated with the new physical memory location to the list below the bottom entry of the list.

10. The method of claim 9, further comprising:
resetting the head pointer to reference an entry on the list below a current bottom entry of the list; and
resetting the tail pointer to reference an entry at the bottom of the list,
wherein the head and tail pointers are reset upon completing the selecting, performing, removing and adding steps for the plurality of entries in the list.

11. The method of claim 7, further comprising:
adding an entry associated with a physical memory location corresponding to a write command to the bottom of the list; and
removing an entry associated with a physical memory location corresponding to an erase command from the list.

12. The method of claim 7, further comprising:
receiving a timer trigger; and
initiating a next iteration of the selecting, performing, removing and adding steps in response to the received timer trigger,
wherein the timer is set according to a refresh cycle based on the set period of time and the number of entries in the plurality of entries.

13. A non-transitory machine readable storage medium storing instructions executable by a processor to perform operations comprising:
maintaining a list of physical memory locations storing data in a non-volatile solid-state memory array, wherein the list is sorted by a least recently used criterion; and
executing one or more refresh cycles comprising:
selecting a first entry from a top of the list for processing;
performing a refresh operation comprising copying data stored in a current physical memory location associated with the first entry to a new physical memory location;
removing the first entry from the top of the list;
adding a new entry associated with the new physical memory location to a bottom of the list; and
repeating the selecting, performing, removing and adding steps for a plurality of entries in the list, wherein the selecting, performing, removing and adding steps are timed such that all refresh operations are performed for all of the plurality of entries in the list within a set period of time.

14. The non-transitory machine readable storage medium of claim 13, wherein the operations further comprise:
maintaining a head pointer to reference the top of the list, wherein the head pointer is updated to reference a next entry in the list when the first entry is removed from the top of the list; and
maintaining a tail pointer to reference a bottom entry of the list, wherein the plurality of entries is bounded in the list by a head entry referenced by the head pointer and the bottom entry referenced by the tail pointer.

15. The non-transitory machine readable storage medium of claim 14, wherein the operations further comprise adding the new entry associated with the new physical memory location to the list below the bottom entry of the list.

16. The non-transitory machine readable storage medium of claim 15, wherein the operations further comprise:
resetting the head pointer to reference an entry on the list below a current bottom entry of the list; and
resetting the tail pointer to reference an entry at the bottom of the list,
wherein the head and tail pointers are reset upon completing the selecting, performing, removing and adding steps for the plurality of entries in the list.

17. The non-transitory machine readable storage medium of claim 13, wherein the operations further comprise:
adding an entry associated with a physical memory location corresponding to a write command to the bottom of the list; and
removing an entry associated with a physical memory location corresponding to an erase command from the list.

18. The non-transitory machine readable storage medium of claim 13, wherein the operations further comprise:
receiving a timer trigger; and
initiating a next iteration of the selecting, performing, removing and adding steps in response to the received timer trigger,
wherein the timer is set according to a refresh cycle based on the set period of time and the number of entries in the plurality of entries.