Method and device for block management of non-volatile memory
Through the block management method, data is written to the appropriate block according to the number of erasures and access probability, which solves the problem of performance degradation caused by the instability of multi-stage cell flash memory and achieves stable and efficient operation of the memory device.
Patent Information
- Application Number
- CN202010435761.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-04-15
- Filing Date
- 2020-05-21
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-05-21
AI Technical Summary
The instability of multi-level cellular flash memory leads to a rapid increase in the number of erases of data blocks, resulting in a decrease in memory device performance. A novel block management method is needed to avoid the formation of early bad blocks.
By judging the number of erases of blank blocks and the access probability of data, hot data is written into cold blocks, and cold data is written into hot blocks, and block management is performed dynamically to achieve balanced distribution of data and extend block life. .
It effectively extends the service life of the block, improves the overall performance of the memory device, and ensures the stable operation of the memory device under various conditions.
Smart Images

Figure CN113535074B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to memory control, and more particularly to a method for performing block management on a non-volatile memory (NV memory) and related apparatus such as a memory device, a controller thereof and an electronic device. Background Art
[0002] In recent years, due to the continuous development of memory technology, various portable or non-portable memory devices (e.g., memory cards that comply with SD / MMC, CF, MS and XD standards; and embedded memory devices that comply with UFS and eMMC standards) have been widely implemented in many applications. Therefore, access control of the memory in these memory devices has become a very hot topic.
[0003] As for the commonly used NAND flash memory, it can be mainly divided into two categories: single level cell (SLC) and multiple level cell (MLC). Each transistor used as a memory cell in a single level cell flash memory has only two charge values, which are used to represent the logical value 0 and the logical value 1 respectively. In addition, the storage capacity of each transistor used as a memory cell in a multi-level cell flash memory can be fully utilized. It uses a higher voltage to drive, so as to record at least two sets of bit information (such as 00, 01, 11, 10) in one transistor through different voltage levels; in theory, the recording density of multi-level cell flash memory can reach at least twice the recording density of single level cell flash memory, which is very good news for the related industries of NAND flash memory.
[0004] Compared to single-level cell flash memory, multi-level cell flash memory is cheaper and can provide larger capacity in a limited space, so multi-level cell flash memory quickly became the mainstream memory device on the market. However, problems caused by the instability of multi-level cell flash memory have also emerged one by one. In order to ensure that the memory device's access control to the flash memory can comply with relevant specifications, the flash memory controller usually has some management mechanism to properly manage data access.
[0005] According to the related art, memory devices with these management mechanisms still have shortcomings. For example, a data block generated during the wear leveling process may have data to be updated and may be used repeatedly, which may cause the erase count of this block to increase rapidly. As a result, this block may become a bad block early, which deteriorates the overall performance of the memory device. Therefore, a novel method and related architecture are needed to solve the problems of the related art without side effects or with less possibility of side effects. Summary of the invention
[0006] An object of the present invention is to disclose a method for performing block management on a non-volatile memory (NV memory) and related apparatus such as a memory device, its controller and an electronic device to solve the above-mentioned problem.
[0007] At least one embodiment of the present invention discloses a method for managing blocks of a non-volatile memory, wherein the method is applied to a controller of a memory device. The memory device may include the controller and the non-volatile memory, the non-volatile memory may include at least one non-volatile memory component (e.g., one or more non-volatile memory components), and the at least one non-volatile memory component may include multiple blocks. The method may include: determining whether a first blank block belongs to a cold block group or a hot block group according to an erase count of a first blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range; selecting the first blank block from a plurality of blank blocks as a target block for data writing in response to the first blank block belonging to the cold block group, wherein the plurality of blocks include the plurality of blank blocks, and the plurality of blank blocks include the first blank block; determining whether the first data to be written belongs to a cold data group or a hot data group according to at least one characteristic parameter of the first data, wherein the cold data group and the hot data group correspond to a first access probability range, respectively. probability range) and a second access probability range, and any value in the second access probability range is greater than any value in the first access probability range; and in response to the first data belonging to the hot data group, the first data is written into the first blank block to use the first blank block as a data block of the first data.
[0008] In addition to the above method, the present invention also discloses a memory device, and the memory device includes a non-volatile memory and a controller. The non-volatile memory is used to store information, wherein the non-volatile memory may include at least one non-volatile memory component (for example, one or more non-volatile memory components), and the at least one non-volatile memory component may include multiple blocks. The controller is coupled to the non-volatile memory, and the controller is used to control the operation of the memory device. In addition, the controller includes a processing circuit, wherein the processing circuit is used to control the controller according to multiple host commands (host commands) from a host device to allow the host device to access the non-volatile memory through the controller. For example, the controller determines whether a first blank block belongs to a cold block group or a hot block group according to an erase count of a first blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range; in response to the first blank block belonging to the cold block group, the controller selects the first blank block from a plurality of blank blocks as a target block for data writing, wherein the plurality of blocks include the plurality of blank blocks, and the plurality of blank blocks include the first blank block; the controller determines whether the first data to be written belongs to a cold data group or a hot data group according to at least one characteristic parameter of the first data to be written, wherein the cold data group and the hot data group correspond to a first access probability range and a second access probability range, respectively, and any value in the second access probability range is greater than any value in the first access probability range; and in response to the first data belonging to the hot data group, the controller writes the first data into the first blank block to use the first blank block as a data block of the first data.
[0009] According to some embodiments, the present invention also discloses a related electronic device. The electronic device may include the above-mentioned memory device, and may also include: the main device coupled to the memory device. The main device may include: at least one processor for controlling the operation of the main device; and a power supply circuit coupled to the at least one processor for providing power to the at least one processor and the memory device. In addition, the memory device may provide storage space for the main device.
[0010] In addition to the above method, the present invention also discloses a controller of a memory device, wherein the memory device includes the controller and a non-volatile memory. The non-volatile memory may include at least one non-volatile memory component (e.g., one or more non-volatile memory components), and the at least one non-volatile memory component includes a plurality of blocks. In addition, the controller includes a processing circuit, wherein the processing circuit is used to control the controller according to a plurality of master device instructions from a master device, so as to allow the master device to access the non-volatile memory through the controller. For example, the controller determines whether a first blank block belongs to a cold block group or a hot block group according to an erase count of a first blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range; in response to the first blank block belonging to the cold block group, the controller selects the first blank block from a plurality of blank blocks as a target block for data writing, wherein the plurality of blocks include the plurality of blank blocks, and the plurality of blank blocks include the first blank block; the controller determines whether the first data to be written belongs to a cold data group or a hot data group according to at least one characteristic parameter of the first data to be written, wherein the cold data group and the hot data group correspond to a first access probability range and a second access probability range, respectively, and any value in the second access probability range is greater than any value in the first access probability range; and in response to the first data belonging to the hot data group, the controller writes the first data into the first blank block to use the first blank block as a data block of the first data.
[0011] The method and related devices proposed in the present invention can ensure that the memory device can operate properly under various conditions, wherein the above-mentioned related devices are, for example, the controller, the memory device, the electronic device, etc. In addition, by performing statistics on data characteristics, the method and related devices proposed in the present invention can selectively write hot data to cold blocks and cold data to hot blocks to improve overall performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 FIG. 4 is a schematic diagram of an electronic device according to an embodiment of the present invention.
[0013] Figure 2 The flowchart is a method for performing block management on a non-volatile memory according to an embodiment of the present invention.
[0014] Figure 3 Draw Figure 2The method shown is a data classification and write control scheme in one embodiment of the present invention.
[0015] Figure 4 Draw Figure 3 Detailed implementation of the data classification and write control scheme in one embodiment of the present invention is shown.
[0016] Figure 5 An example of writing cold data to one or more hot blocks is shown.
[0017] Figure 6 An example of writing hot data to one or more cold blocks is shown.
[0018] Figure 7 Draw Figure 3 The data classification and writing control scheme shown is applied to an example of a garbage collection (GC) program.
[0019] The reference numerals are described as follows:
[0020] 10 Electronic devices
[0021] 50 Main device
[0022] 52 Processors
[0023] 54 Power supply circuit
[0024] 100 Memory Device
[0025] 110 Memory Controller
[0026] 112 Microprocessor
[0027] 112M ROM
[0028] 112C Program Code
[0029] 114 Control Logic Circuit
[0030] 116 Random Access Memory
[0031] 116T,122T Table
[0032] 118 Transmission interface circuit
[0033] 120 Non-volatile memory
[0034] 122-1, 122-2 to 122-N Non-volatile memory components
[0035] S10,S12,S14,S16,S18,S20 steps
[0036] 310 Target Block
[0037] 312C Cold Block
[0038] 312H Hot Block
[0039] Block 314C,314H
[0040] DATA_C Cold data
[0041] DATA_H Hot data
[0042] 400 L2P table
[0043] L_ADD Logical address
[0044] BLK# Block number
[0045] PG# Page number
[0046] AC access times
[0047] 710 Source Block DETAILED DESCRIPTION
[0048] I. Memory System
[0049] Figure 11 is a schematic diagram of an electronic device 10 according to an embodiment of the present invention, wherein the electronic device 10 may include a host device 50 and a memory device 100. The host device 50 may include at least one processor (e.g., one or more processors), which may be collectively referred to as a processor 52, and may also include a power supply circuit 54 coupled to the processor 52. The processor 52 is used to control the operation of the host device 50, and the power supply circuit 54 is used to provide power to the processor 52 and the memory device 100, and output one or more driving voltages to the memory device 100. The memory device 100 may be used to provide storage space for the host device 50, and the one or more driving voltages may be obtained from the host device 50 as a power source for the memory device 100. Examples of the host device 50 may include (but are not limited to): a multifunctional mobile phone, a wearable device, a tablet computer, and a personal computer such as a desktop computer and a laptop computer. Examples of the memory device 100 may include (but are not limited to): portable memory devices (such as memory cards that comply with SD / MMC, CF, MS or XD standards), solid state drives (SSD), and various embedded memory devices that comply with UFS and EMMC standards, respectively. According to this embodiment, the memory device 100 may include a controller such as a memory controller 110, and may also include a non-volatile (NV) memory 120, wherein the controller is used to control the operation of the memory device 100 and access the non-volatile memory 120, and the non-volatile memory 120 is used to store information. The non-volatile memory 120 may include at least one non-volatile memory component (e.g., one or more non-volatile memory components), such as multiple non-volatile memory components 122-1, 122-2, ... and 122-N, wherein the symbol "N" may represent a positive integer greater than one. For example, the nonvolatile memory 120 may be a flash memory, and the plurality of nonvolatile memory components 122-1, 122-2, ... and 122-N may be a plurality of flash memory chips or a plurality of flash memory dies, but the present invention is not limited thereto.
[0050] like Figure 1As shown, the memory controller 110 may include a processing circuit such as a microprocessor 112, a storage unit such as a read-only memory (ROM) 112M, a control logic circuit 114, a random access memory (RAM) 116, and a transmission interface circuit 118, wherein the above components may be coupled to each other via a bus. The random access memory 116 is implemented as a static random access memory (SRAM), but the present invention is not limited thereto. The random access memory 116 may be used to provide internal storage space to the memory controller 110. For example, the random access memory 116 may be used as a buffer memory to buffer data. In addition, the read-only memory 112M of the present embodiment is used to store a program code 112C, and the microprocessor 112 is used to execute the program code 112C to control access to the non-volatile memory 120. Please note that in some examples, the program code 112C may be stored in the random access memory 116 or any form of memory. In addition, a data protection circuit (not shown) in the control logic circuit 114 can protect data and / or perform error correction, and the transmission interface circuit 118 can comply with a specific communication standard (such as the Serial Advanced Technology Attachment (SATA) standard, the Universal Serial Bus (USB) standard, the Peripheral Component Interconnect Express (PCIE) standard, the embedded Multi Media Card (eMMC) standard, or the Universal Flash Storage (UFS) standard), and can communicate according to the specific communication standard.
[0051] In this embodiment, the host device 50 can access the memory device 100 by transmitting a host command and a corresponding logical address to the memory controller 110. The memory controller 110 receives the host commands and the logical addresses, and translates the host commands into memory operation commands (hereinafter referred to as operation commands), and then uses the operation commands to control the non-volatile memory 120 to read, write, or program memory units (e.g., data pages) with physical addresses in the non-volatile memory 120, wherein the physical addresses correspond to the logical addresses. When the memory controller 110 performs an erase operation on any non-volatile memory component 122-n among the plurality of non-volatile memory components 122-1, 122-2, ... and 122-N (the symbol "n" may represent any integer in the interval [1, N]), at least one block among the plurality of blocks of the non-volatile memory component 122-n will be erased, wherein each of the plurality of blocks may include a plurality of pages (such as data pages), and an access operation (such as reading or writing) may be performed on one or more pages.
[0052] II. System Management Mechanism
[0053] According to some embodiments, the processing circuit, such as the microprocessor 112, may control the memory controller 110 according to a plurality of master commands from the master device 50 to allow the master device 50 to access the non-volatile memory 120 through the memory controller 110. The memory controller 110 may store data in the non-volatile memory 120 for the master device 50, read the stored data in response to a master command (e.g., one of the plurality of master commands) from the master device 50, and provide the data read from the non-volatile memory 120 to the master device 50. In the non-volatile memory 120 such as a flash memory, the at least one non-volatile memory component (such as the plurality of non-volatile memory components 122-1, 122-2, ... and 122-N) may include a plurality of blocks, and the memory controller 110 may be designed to perform dynamic wear leveling processing to evenly use the plurality of blocks during any of a variety of programs, for example, writing different groups of data to different groups of blocks, respectively, to solve the problems of the related art without side effects or with a low probability of causing side effects.
[0054] In particular, the plurality of blocks may include a plurality of blank blocks, and the memory controller 110 may perform block classification on the plurality of blank blocks and data classification for the data to be written, so as to selectively write the data. The memory controller 110 may record, maintain, and / or update the block classification information about the block classification and the data classification information about the data classification in at least one comparison table (e.g., one or more comparison tables) such as tables 116T and 122T, so as to indicate different groups of blocks and different groups of data, respectively. For example, the memory controller 110 may back up the table 116T to the table 122T in the non-volatile memory 120 (e.g., one or more non-volatile memory components among the plurality of non-volatile memory components 122-1, 122-2, ... and 122-N, such as the non-volatile memory component 122-1). As another example, the memory controller 110 may load at least a portion (eg, a portion or all) of the table 122T into the random access memory 116 as the table 116T for quick reference.
[0055] Figure 2 FIG. 1 is a flow chart of a method for managing blocks in a non-volatile memory according to an embodiment of the present invention. The method can be applied to Figure 1 The illustrated architecture (eg, electronic device 10 , memory device 100 , memory controller 110 , etc.) may be executed by the memory controller 110 of the memory device 100 .
[0056] In step S10, for any blank block among the plurality of blank blocks, the memory controller 110 determines whether the blank block belongs to a cold block group or a hot block group according to an erase count of the blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range. For ease of understanding, it is assumed that the average erase count of these blank blocks is equal to 999, and the first erase count range and the second erase count range are equal to the intervals [0,999] and [1000,10000], respectively, but the present invention is not limited thereto. In some embodiments, the average erase count, the first erase count range, and the second erase count range may be varied. In addition, the plurality of blank blocks may include a first blank block and a second blank block. For example, when the erase count of the first blank block falls within the first erase count range, such as the interval [0,999], the memory controller 110 may determine that the first blank block belongs to the cold block group. For another example, when the erase count of the second blank block falls within the second erase count range, such as the interval [1000,10000], the memory controller 110 may determine that the second blank block belongs to the hot block group.
[0057] In step S12, the memory controller 110 determines whether the block classification of the plurality of blank blocks with respect to the cold or hot block group is completed. If yes, the process proceeds to step S14; if no, the process proceeds to step S10 to continue the block classification. Figure 3 Taking the data classification and write control scheme shown in FIG. 1 as an example, after the block classification is completed, the cold block group may include one or more cold blocks 312C such as a block 314C, and the hot block group may include one or more hot blocks 312H such as a block 314H, but the present invention is not limited thereto. In some embodiments, the one or more cold blocks 312C and the one or more hot blocks 312H may include a plurality of blocks {314C} and a plurality of blocks {314H}, respectively.
[0058] In step S14, the memory controller 110 selects one or more cold blocks 312C belonging to the cold block group and one or more hot blocks 312H belonging to the hot block group as target blocks 310 for data writing. For example, in response to the first blank block such as block 314C belonging to the cold block group, the memory controller 110 selects the first blank block from the plurality of blank blocks as a target block for data writing, wherein the first blank block can be used as an example of the cold block. For another example, in response to the second blank block such as block 314H belonging to the hot block group, the memory controller 110 selects the second blank block from the plurality of blank blocks as another target block for data writing, wherein the second blank block can be used as an example of the hot block.
[0059] In step S16, the memory controller 110 determines whether the data belongs to a cold data group such as cold data DATA_C or a hot data group such as hot data DATA_H according to at least one characteristic parameter of the data to be written, so as to generate a classification result of the data to indicate that the data belongs to the cold data group or the hot data group, wherein the cold data group and the hot data group correspond to a first access probability range and a second access probability range, respectively, and any value in the second access probability range is greater than any value in the first access probability range. According to this embodiment, a series of access probabilities for accessing a series of data at a series of logical addresses {L_ADD} can be regarded as the respective access probabilities of the series of logical addresses {L_ADD}, and the average value of these access probabilities can be referred to as the average access probability of the series of logical addresses {L_ADD}. The memory controller 110 may perform characteristic parameter statistics on the series of logical addresses {L_ADD} and / or the series of data (for example, in advance or online) to obtain the respective access probabilities of the series of logical addresses {L_ADD} for respectively determining whether the multiple sets of data to be written belong to the cold data group or the hot data group. For ease of understanding, it is assumed that the average access probability is equal to 0.5, and the first access probability range and the second access probability range are respectively equal to the intervals [0, 0.499] and [0.500, 1.000], but the present invention is not limited thereto. In some embodiments, the average access probability, the first access probability range, and the second access probability range may be varied. In addition, the multiple sets of data to be written may include a first set of data and a second set of data, such as first data and second data to be written, respectively. For example, when the data in step S16 represents the first data, when the access probability for the first data falls into the second access probability range such as the interval [0.500, 1.000], the memory controller 110 may determine that the first data belongs to the hot data group. For another example, when the data in step S16 represents the second data, when the access probability for the second data falls into the first access probability range such as the interval [0, 0.499], the memory controller 110 may determine that the second data belongs to the cold data group.
[0060] In step S18, according to the classification result of the data (the data described in step S16), the memory controller 110 writes the data into the target block corresponding to the classification result among the plurality of target blocks. For example, in response to the first data belonging to the hot data group such as Figure 3For example, in response to the second data belonging to the cold data group such as Figure 3 For cold data, the memory controller 110 writes the second data into the second blank block, such as block 314H, to use the second blank block as a data block for the second data.
[0061] In step S20, the memory controller 110 determines whether the data writing task is completed. If yes, Figure 2 The workflow shown ends; if not, enter step S16 to continue the above task. Therefore, the loop including steps S16 to S20 can store data belonging to different data groups in blocks belonging to different block groups respectively. For example, the memory controller 110 can determine whether the other data belongs to the cold data group or the hot data group based on at least one characteristic parameter for other data, and can write the other data to the first blank block in response to the other data belonging to the hot data group, so as to use the first blank block as the data block of the other data. For another example, the memory controller 110 can determine whether the other data belongs to the cold data group or the hot data group based on at least one characteristic parameter for other data, and can write the other data to the second blank block in response to the other data belonging to the cold data group, so as to use the second blank block as the data block of the other data.
[0062] For a better understanding, the method can be used Figure 2 According to some embodiments, one or more steps may be performed in Figure 2 Add, delete or modify the workflow shown.
[0063] According to some embodiments, the memory controller 110 may record, maintain, and / or update the relationship between the logical address L_ADD and the access count AC in the above-mentioned at least one comparison table to indicate the access probability of the logical address L_ADD. For example, the memory controller 110 may calculate the average value AC_avg of the respective access counts {AC} of all logical addresses {L_ADD}, and may determine that the access probability of the logical address L_ADD is equal to (AC / AC_avg), but the present invention is not limited thereto. For the data in step S16, the memory controller 110 may determine whether the access probability of the logical address L_ADD reaches an average access probability such as 0.5 based on whether the access count AC of the logical address L_ADD reaches (e.g., is greater than or equal to) the average value AC_avg, wherein the access count AC of the logical address L_ADD of the data may be used as an example of the above-mentioned at least one characteristic parameter of the data. If the number of access times AC of the logical address L_ADD reaches (for example, is greater than or equal to) the average value AC_avg, the memory controller 110 may determine that the access probability of the logical address L_ADD reaches the average access probability, which may indicate that the access probability of the data falls within the second access probability range such as the interval [0.500, 1.000], and therefore the memory controller 110 may determine that the data belongs to the hot data group; otherwise, the memory controller 110 may determine that the access probability of the logical address L_ADD does not reach the average access probability, which may indicate that the access probability of the data falls within the first access probability range such as the interval [0, 0.499], and therefore the memory controller 110 may determine that the data belongs to the cold data group.
[0064] According to some embodiments, the memory controller 110 may record, maintain, and / or update the mapping relationship between the logical address L_ADD and the physical address (BLK#, PG#) in at least one logical-to-physical address mapping table (L2P table), wherein the physical address (BLK#, PG#) may include a block number BLK# and a page number PG#. In addition, the at least one comparison table may include the at least one L2P table, and in particular, may be integrated into the at least one L2P table, and the memory controller 110 may record at least a portion (e.g., a portion or all) of the block classification information and the data classification information in the at least one L2P table, for example, record, maintain, and / or update the relationship between the logical address L_ADD and the access count AC in the at least one L2P table to indicate the access probability of the logical address L_ADD, wherein the table 122T may be implemented as a global L2P table, and the table 116T may be implemented as a local L2P table, which may be regarded as a subset of the global L2P table, but the present invention is not limited thereto.
[0065] Figure 4 Draw Figure 3Detailed implementation of the data classification and write control scheme in one embodiment of the present invention. L2P table 400 can be used as an example of at least one L2P table mentioned above, and can be used as an example of at least one comparison table mentioned above. Memory controller 110 can record, maintain, and / or update the relationship between the logical address L_ADD and the mixed information {(BLK#, PG#), AC} in L2P table 400, wherein the index of L2P table 400 is the logical address L_ADD, and the entry of L2P table 400 is the mixed information {(BLK#, PG#), AC}, which may include the physical address (BLK#, PG#) and the access count AC, but the present invention is not limited thereto. In some embodiments, L2P table 400 may be changed. For ease of understanding, it is assumed that AC_avg = 2.5. When the respective access times {AC} of certain logical addresses {L_ADD}, such as {3, 5}, reach (e.g., are greater than or equal to) an average value AC_avg, such as 2.5, the memory controller 110 may determine that the access probabilities of these logical addresses {L_ADD} reach the average access probability, and thus may determine that the two sets of data to be written to these logical addresses {L_ADD} belong to the hot data group, such as hot data DATA_H. When the respective access times {AC} of certain logical addresses {L_ADD}, such as {1, 1, 2, 1}, do not reach (e.g., are less than) an average value AC_avg, such as 2.5, the memory controller 110 may determine that the access probabilities of these logical addresses {L_ADD} do not reach the average access probability, and thus may determine that the four sets of data to be written to these logical addresses {L_ADD} belong to the cold data group, such as cold data DATA_C.
[0066] According to some embodiments, the first data and the second data may be received from the autonomous device 50, and the operation of writing the first data may be performed according to a write instruction received from the autonomous device 50, and the operation of writing the second data may be performed according to another write instruction received from the autonomous device 50. After executing step S18, the memory controller 110 may update the L2P table 400 for the data in step S18 (e.g., the first data, the second data, etc.), and in particular, update the physical address (BLK#, PG#) corresponding to the logical address L_ADD of the data to the latest storage location of the data, such as the block number BLK# of the target block used to write the data in step S18 and the page number PG# of a certain page therein, for further access to the data, and increase the access count AC of the logical address L_ADD of the data by a predetermined increment, such as 1, for reference in subsequent data classification. For example, for the first written data in the first blank block, the memory controller 110 may update the L2P table 400 for further access to the first written data, wherein the first written data includes the first data. For another example, with respect to the second written data in the second blank block, the memory controller 110 may update the L2P table 400 for further access to the second written data, wherein the second written data includes the second data.
[0067] According to some embodiments, the memory controller 110 may simplify at least a portion (e.g., a portion or all) of the block classification information and the data classification information, and in particular, manage (e.g., record, maintain, and / or update) the data classification information according to a set of predetermined intervals. For example, the set of predetermined intervals may be a set of logical address intervals {[0, L_ADD1-1], [L_ADD1, L_ADD2-1], ...} including all logical addresses {L_ADD}, such as address intervals {[0, 15], [16, 31], ...}, wherein any logical address L_ADD of these logical addresses {L_ADD} may correspond to a data length of 4KB (kilobytes), and each address interval of these address intervals {[0, 15], [16, 31], ...} may correspond to a data length of 64KB (e.g., (4*16)=64), but the present invention is not limited thereto. In some embodiments, the set of predetermined intervals and the data length corresponding to any of the above logical addresses L_ADD may be changed.
[0068] Figure 5An example of writing cold data to one or more hot blocks 312H is shown. Assume that the write address, such as the logical address L_ADD, includes a group of logical addresses {10310, ..., 13000}. The memory controller 110 determines that a group of data to be written to the group of logical addresses {10310, ..., 13000} belongs to the cold data group (or cold data) based on the data classification information (e.g., the respective access times {AC}, the average value AC_avg, etc. of the group of logical addresses {10310, ..., 13000}). This group of data can be used as an example of the second data. In response to the second data belonging to the cold data group such as Figure 3 For cold data, the memory controller 110 writes the second data into the second blank block, such as block 314H, to use the second blank block as a data block of the second data, such as data block #0.
[0069] Figure 6 An example of writing hot data to one or more cold blocks 312C is shown. Assume that the write address, such as the logical address L_ADD, includes a group of logical addresses {158, ..., 171}. The memory controller 110 determines that a group of data to be written to the group of logical addresses {158, ..., 171} belongs to the hot data group (or hot data) based on the data classification information (e.g., the respective access times {AC}, the average value AC_avg, etc. of the group of logical addresses {158, ..., 171}). This group of data can be used as an example of the first data. In response to the first data belonging to the hot data group such as Figure 3 As shown in FIG. 1 , the memory controller 110 writes the first data into the first blank block, such as block 314C, to use the first blank block as a data block of the first data, such as data block #1.
[0070] Figure 7 Draw Figure 3 The data classification and write control scheme shown is applied to an example of a garbage collection (GC) program. According to this embodiment, each of the target blocks 310 (such as the target block and the other target block) is a destination block (destination block) of the garbage collection program, and the multiple sets of data to be written (such as the first data and the second data) are derived from at least one source block (for example, one or more source blocks) of the garbage collection program, such as source block 710. Assume that the first data is originally stored in a first used block, and the second data is originally stored in a second used block. For example, the multiple blocks include multiple used blocks such as Figure 7The blocks shown in the left half, and the plurality of used blocks include the first used block and the second used block, such as Figure 7 In this case, in response to the first data in the first used block belonging to the hot data group such as hot data DATA_H, the memory controller 110 selects the first used block from the multiple used blocks as a source block for the garbage collection procedure; and in response to the second data in the second used block belonging to the cold data group such as cold data DATA_C, the memory controller 110 selects the second used block from the multiple used blocks as another source block for the garbage collection procedure; but the present invention is not limited to this. Figure 7 Taking one of the blocks in the left half as an example, the first data and the second data may be originally stored in the same used block, such as this block among these blocks. In this case, the first used block and the second used block may be replaced by the same used block mentioned above, and the source block and the other source block may be replaced by the same source block. Generally speaking, the first data and the second data may be originally stored in at least one used block (for example, stored in the same used block mentioned above, or stored in the first and second used blocks respectively). In response to the fact that the first data and the second data in the at least one used block belong to the hot data group and the cold data group respectively, the memory controller 110 may select the at least one used block from the multiple used blocks as at least one source block regarding the garbage collection procedure, wherein the multiple used blocks include the at least one used block mentioned above.
[0071] During the garbage collection process, the memory controller 110 may check whether multiple available blank pages in the destination area block have been fully written. In particular, in response to the multiple available blank pages in the destination area block being fully written, the memory controller 110 may close the destination area block and update the L2P table 400 for the written data in the destination area block for further access to the written data, wherein the written data may include one of the first data and the second data. For example, when the destination area block represents the first blank block such as block 314C, the written data may include the first data. For another example, when the destination area block represents the second blank block such as block 314H, the written data may include the second data.
[0072] According to some embodiments, after executing step S18, the memory controller 110 may update a physical-to-logical address mapping table (P2L table) for the data in step S18 for use by one or more recovery mechanisms of the memory controller 110, wherein the P2L table may be set in the target block corresponding to the classification result in step S18, but the present invention is not limited thereto. For example, the target block may represent the first blank block, and after writing the first data into the first blank block, the memory controller 110 may update the P2L table in the first blank block for the first data. For another example, the target block may represent the second blank block, and after writing the second data into the second blank block, the memory controller 110 may update the P2L table in the second blank block for the second data.
[0073] According to some embodiments, the at least one characteristic parameter in step S16 may include an access count parameter PARA_AC, which may indicate a cumulative access count of a logical address L_ADD of the data in step S16, such as access count AC, wherein the memory controller 110 may determine the access count AC of the logical address L_ADD to generate the access count parameter PARA_AC carrying the access count AC. For example, in the case where the data in step S16 represents the first data, such as DATA(1), the at least one characteristic parameter for the first data may include an access count parameter PARA_AC(1), which may indicate a cumulative access count of the logical address L_ADD(1) of the first data DATA(1), such as access count AC(1). For another example, in the case where the data in step S16 represents the second data, such as DATA(2), the at least one characteristic parameter for the second data may include an access count parameter PARA_AC(2), which may indicate a cumulative access count of the logical address L_ADD(2) of the second data DATA(2), such as access count AC(2). For the sake of brevity, similar contents in these embodiments are not repeated here.
[0074] According to some embodiments, the at least one characteristic parameter in step S16 may include a type parameter PARA_TYPE, which may indicate a data type of the data in step S16, such as type TYPE, wherein the memory controller 110 may determine the type TYPE of the data to generate a type parameter PARA_TYPE carrying the type TYPE. For example, in the case where the data in step S16 represents the first data, such as DATA(1), the at least one characteristic parameter for the first data may include a type parameter PARA_TYPE(1), which may indicate a data type of the first data DATA(1), such as file system type TYPE_FILE_SYSTEM, i.e., file system information. For another example, in the case where the data in step S16 represents the second data, such as DATA(2), the at least one characteristic parameter for the second data may include a type parameter PARA_TYPE(2), which may indicate a data type of the second data DATA(2), such as multimedia type TYPE_MULTIMEDIA, i.e., multimedia data. For the sake of simplicity, similar contents in these embodiments are not repeated here.
[0075] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for managing blocks of a non-volatile memory, It is characterized in that The method is applied to a controller of a memory device, the memory device includes the controller and the nonvolatile memory, the nonvolatile memory includes at least one nonvolatile memory component, the at least one nonvolatile memory component includes a plurality of blocks, the method includes: judging whether a first blank block belongs to a cold block group or a hot block group according to an erase count of the first blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range; in response to the first blank block belonging to the cold block group, selecting the first blank block from a plurality of blank blocks as a target block for data writing, wherein the plurality of blocks include the plurality of blank blocks, and the plurality of blank blocks include the first blank block; determining whether the first data to be written belongs to a cold data group or a hot data group according to at least one characteristic parameter of the first data to be written, wherein the cold data group and the hot data group correspond to a first access probability range and a second access probability range, respectively, and any value in the second access probability range is greater than any value in the first access probability range; and In response to the first data belonging to the hot data group, the first data is written into the first blank block, so as to use the first blank block as a data block of the first data, Among them, multiple entries of a logic-to-physical address mapping table used to manage the mapping relationship between the logical address and the physical address when accessing the non-volatile memory are respectively built-in with multiple characteristic parameters, so as to determine whether any one of the multiple groups of data belongs to the cold data group or the hot data group during the period of writing multiple groups of data into the non-volatile memory to dynamically switch between writing to the cold block group and writing to the hot block group.
2. The method according to claim 1, It is characterized in that The first data is received from a host device, and the operation of writing the first data is performed according to a write command received from the host device.
3. The method according to claim 2, It is characterized in that Also includes: The logical-to-physical address mapping table is updated for first written data in the first blank block for further access to the first written data, wherein the first written data includes the first data.
4. The method according to claim 1, It is characterized in that The target block is a destination block of a garbage collection process, and the first data is originally stored in a first used block; And the method further comprises: In response to the first data in the first used block belonging to the hot data group, the first used block is selected from a plurality of used blocks as a source block for the garbage collection procedure, wherein the plurality of blocks include the plurality of used blocks, and the plurality of used blocks include the first used block.
5. The method according to claim 4, It is characterized in that Also includes: During the garbage collection process, checking whether a plurality of available blank pages in the destination block have been completely written; as well as In response to the multiple available blank pages in the destination block being completely written, the destination block is closed, and the logical-to-physical address mapping table is updated for the written data in the destination block for further access to the written data, wherein the written data includes the first data.
6. The method according to claim 1, It is characterized in that Also includes: After the first data is written into the first blank block, a physical-to-logical address mapping table in the first blank block is updated according to the first data.
7. The method according to claim 1, It is characterized in that Also includes: Determining whether the other data belongs to the cold data group or the hot data group according to at least one characteristic parameter of the other data; as well as In response to the other data belonging to the hot data group, the other data is written into the first blank block, so as to use the first blank block as a data block of the other data.
8. The method according to claim 1, It is characterized in that The at least one characteristic parameter for the first data includes an access count parameter, and the access count parameter indicates a cumulative access count of a logical address of the first data.
9. The method according to claim 1, It is characterized in that The at least one characteristic parameter for the first data includes a type parameter, and the type parameter indicates a data type of the first data.
10. The method according to claim 1, It is characterized in that Also includes: determining whether a second blank block belongs to the cold block group or the hot block group according to an erasure count of the second blank block; In response to the second blank block belonging to the hot block group, selecting the second blank block from the plurality of blank blocks as another target block for data writing, wherein the plurality of blank blocks includes the second blank block; determining, according to at least one characteristic parameter of second data to be written, whether the second data belongs to the cold data group or the hot data group; as well as In response to the second data belonging to the cold data group, the second data is written into the second blank block, so as to use the second blank block as a data block of the second data.
11. The method according to claim 10, It is characterized in that The first data and the second data are received from a host device, the operation of writing the first data is performed according to a write instruction received from the host device, and the operation of writing the second data is performed according to another write instruction received from the host device.
12. The method according to claim 11, It is characterized in that Also includes: updating the logical-to-physical address mapping table for first written data in the first blank block for further access to the first written data, wherein the first written data includes the first data; as well as The logical-to-physical address mapping table is updated for second written data in the second blank block for further access to the second written data, wherein the second written data includes the second data.
13. The method according to claim 10, It is characterized in that Each of the target block and the another target block is a destination block for a garbage collection process, the first data is originally stored in a first used block, and the second data is originally stored in a second used block; And the method further comprises: In response to the first data in the first used block belonging to the hot data group, selecting the first used block from a plurality of used blocks as a source block for the garbage collection process, wherein the plurality of blocks include the plurality of used blocks, and the plurality of used blocks include the first used block; as well as In response to the second data in the second used block belonging to the cold data group, the second used block is selected from the plurality of used blocks as another source block for the garbage collection procedure, wherein the plurality of used blocks includes the second used block.
14. The method according to claim 10, It is characterized in that Each of the target block and the another target block is a destination block related to a garbage collection process, and the first data and the second data are originally stored in at least one used block; And the method further comprises: In response to the first data and the second data in the at least one used block belonging to the hot data group and the cold data group respectively, the at least one used block is selected from a plurality of used blocks as at least one source block for the garbage collection procedure, wherein the plurality of blocks include the plurality of used blocks, and the plurality of used blocks include the at least one used block.
15. The method of claim 14, It is characterized in that Also includes: During the garbage collection process, checking whether a plurality of available blank pages in the destination block have been completely written; as well as In response to the multiple available blank pages in the destination block being completely written, the destination block is closed, and the logical-to-physical address mapping table is updated for the written data in the destination block for further access to the written data, wherein the written data includes one of the first data and the second data.
16. The method of claim 10, It is characterized in that Also includes: After the second data is written into the second blank block, a physical-to-logical address mapping table in the second blank block is updated according to the second data.
17. The method of claim 10, It is characterized in that Also includes: Determining whether the other data belongs to the cold data group or the hot data group according to at least one characteristic parameter of the other data; as well as In response to the other data belonging to the cold data group, the other data is written into the second blank block, so as to use the second blank block as a data block of the other data.
18. The method of claim 10, It is characterized in that The at least one characteristic parameter for the second data includes an access count parameter, and the access count parameter indicates a cumulative access count of a logical address of the second data.
19. The method of claim 10, It is characterized in that The at least one characteristic parameter for the second data includes a type parameter, and the type parameter indicates a data type of the second data.
20. A memory device, It is characterized in that include: a non-volatile memory for storing information, wherein the non-volatile memory comprises at least one non-volatile memory component, and the at least one non-volatile memory component comprises a plurality of blocks; as well as a controller coupled to the non-volatile memory for controlling the operation of the memory device, wherein the controller comprises: a processing circuit for controlling the controller according to a plurality of master device commands from a master device to allow the master device to access the non-volatile memory through the controller; in: The controller determines whether the first blank block belongs to a cold block group or a hot block group according to an erase count of a first blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range; In response to the first blank block belonging to the cold block group, the controller selects the first blank block from a plurality of blank blocks as a target block for data writing, wherein the plurality of blocks include the plurality of blank blocks, and the plurality of blank blocks include the first blank block; The controller determines whether the first data to be written belongs to a cold data group or a hot data group according to at least one characteristic parameter of the first data to be written, wherein the cold data group and the hot data group correspond to a first access probability range and a second access probability range, respectively, and any value in the second access probability range is greater than any value in the first access probability range; and In response to the first data belonging to the hot data group, the controller writes the first data into the first blank block to use the first blank block as a data block of the first data, wherein a plurality of entries of a logical-to-physical address mapping table for managing a mapping relationship between a logical address and a physical address when accessing the non-volatile memory are respectively built-in with a plurality of characteristic parameters, During the period of writing a plurality of sets of data into the nonvolatile memory, it is determined whether any set of data among the plurality of sets of data belongs to the cold data group or the hot data group to dynamically switch between writing into the cold block group and writing into the hot block group.
21. A memory device as claimed in claim 20, It is characterized in that The controller determines whether the second blank block belongs to the cold block group or the hot block group according to an erasure count of the second blank block; In response to the second blank block belonging to the hot block group, the controller selects the second blank block from the plurality of blank blocks as another target block for data writing, wherein the plurality of blank blocks include the second blank block; the controller determines whether the second data to be written belongs to the cold data group or the hot data group according to at least one characteristic parameter of the second data to be written; In response to the second data belonging to the cold data group, the controller writes the second data into the second blank block to use the second blank block as a data block of the second data.
22. An electronic device comprising the memory device as claimed in claim 20, It is characterized in that Also includes: The main device is coupled to the memory device, wherein the main device comprises: at least one processor for controlling the operation of the host device; and a power supply circuit, coupled to the at least one processor, for providing power to the at least one processor and the memory device; The memory device provides storage space for the main device.
23. A controller for a memory device, It is characterized in that The memory device includes the controller and a non-volatile memory, the non-volatile memory includes at least one non-volatile memory component, the at least one non-volatile memory component includes a plurality of blocks, the controller includes: a processing circuit, used to control the controller according to a plurality of master device instructions from a master device, so as to allow the master device to access the non-volatile memory through the controller; wherein: The controller determines whether the first blank block belongs to a cold block group or a hot block group according to an erase count of a first blank block, wherein the cold block group and the hot block group correspond to a first erase count range and a second erase count range, respectively, and any value in the second erase count range is greater than any value in the first erase count range; In response to the first blank block belonging to the cold block group, the controller selects the first blank block from a plurality of blank blocks as a target block for data writing, wherein the plurality of blocks include the plurality of blank blocks, and the plurality of blank blocks include the first blank block; The controller determines whether the first data to be written belongs to a cold data group or a hot data group according to at least one characteristic parameter of the first data to be written, wherein the cold data group and the hot data group correspond to a first access probability range and a second access probability range, respectively, and any value in the second access probability range is greater than any value in the first access probability range; and In response to the first data belonging to the hot data group, the controller writes the first data into the first blank block to use the first blank block as the data block of the first data, wherein a plurality of entries of a logic-to-physical address mapping table for managing the mapping relationship between the logical address and the physical address when accessing the non-volatile memory are respectively built with a plurality of characteristic parameters for determining whether any of the plurality of data belongs to the cold data group or the hot data group during the period of writing the plurality of data into the non-volatile memory to dynamically switch between writing into the cold block group and writing into the hot block group.
