Health monitoring method and device of memory, electronic equipment and storage medium
By setting the SLC characteristic storage space in the memory, reading and evaluating the data write amount, and generating health alarm information, the problem of inaccurate memory health assessment in the prior art is solved, and timely evaluation and early warning of memory health status is achieved, and the The service life of the memory.
Patent Information
- Application Number
- CN202310799695.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2043-06-30
AI Technical Summary
The prior art is difficult to accurately evaluate the health status of the memory, resulting in timely warning of memory damage, resulting in user losses.
By setting a target storage space with SLC characteristics in the memory, reading the data write amount of the memory, determining the write alarm conditions based on the maximum data write amount, and generating health alarm information for timely evaluation and early warning.
It improves the accuracy and timeliness of memory health assessment, reduces losses caused by memory corruption, and extends the service life of the memory.
Smart Images

Figure CN119226011A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a method, device, electronic device and storage medium for health monitoring of a storage device. Background Art
[0002] During the use of memory, it is inevitable that it will be damaged. How to accurately evaluate the health of the memory (i.e., the life of the memory, etc.) has always been a problem that has troubled electronic product designers. The current health evaluation method for memory used in the industry is usually to reserve a certain number of unused healthy memory blocks in the memory and evaluate the health of the memory by counting the usage of the reserved healthy memory blocks. This evaluation method is relatively simple and not accurate enough. Summary of the invention
[0003] The embodiments of the present application disclose a method, device, electronic device and storage medium for monitoring the health of a memory, which can more accurately evaluate the health of the memory and enrich the evaluation methods for the health of the memory.
[0004] The embodiment of the present application discloses a memory health monitoring method, which is applied to an electronic device, wherein the electronic device includes the memory, wherein a target storage space is provided in the memory, wherein the target storage space has a single-layer storage unit SLC characteristic, and the target storage space is used to store the data written amount of the memory; the method includes:
[0005] Reading the current data write amount of the memory from the target storage space;
[0006] If the current data write amount meets the write alarm condition, health alarm information for the memory is generated; wherein the write alarm condition is determined based on the maximum data write amount of the memory, and the health alarm information is used to warn about the health status of the memory.
[0007] The embodiment of the present application discloses a memory health monitoring device, which is applied to an electronic device, wherein the electronic device includes the memory, wherein a target storage space is provided in the memory, wherein the target storage space has a single-layer storage unit SLC characteristic, and wherein the target storage space is used to store the data written amount of the memory; the device includes:
[0008] A write amount reading module, used for reading the current data write amount of the memory from the target storage space;
[0009] An alarm module is used to generate health alarm information for the memory if the current data writing amount meets the write alarm condition; wherein the write alarm condition is determined based on the maximum data writing amount of the memory, and the health alarm information is used to warn about the health status of the memory.
[0010] An embodiment of the present application discloses an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the method described above.
[0011] An embodiment of the present application discloses a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the processor implements the method described above.
[0012] The memory health monitoring method, device, electronic device and storage medium disclosed in the embodiment of the present application read the current data write amount of the memory from the target storage space, and if the current data write amount meets the write alarm condition, generate health alarm information for the memory, and use the target storage space with single-layer storage unit SLC characteristics in the memory to store the data write amount of the memory, which can improve the accuracy and stability of the stored data write amount, ensure the reliability of the current data write amount read, and use the current data write amount and maximum data write amount of the memory to evaluate the health of the memory, which can more accurately evaluate the health of the memory and enrich the evaluation method of the health of the memory. In addition, it can generate health alarm information for the memory in a timely and accurate manner, which is convenient for users to know the health of the memory and reduce unnecessary losses caused to users due to memory damage. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0014] Figure 1 An overall architecture diagram of an eMMC in one embodiment;
[0015] Figure 2 This is an application scenario diagram of a method for monitoring the health of a memory in an embodiment;
[0016] Figure 3 is a flow chart of a method for monitoring the health of a memory in one embodiment;
[0017] Figure 4is a flow chart of a method for monitoring the health of a memory in another embodiment;
[0018] Figure 5 A schematic diagram of the structure of an eMMC in one embodiment;
[0019] Fig. 6A A schematic diagram of an interface for outputting health warning information and writing amount prompt information in one embodiment;
[0020] Figure 6B A schematic diagram of an interface for outputting writing amount prompt information in an embodiment;
[0021] Figure 7 is a flow chart of a method for monitoring the health of a memory in another embodiment;
[0022] Figure 8 is a flow chart of a method for monitoring the health of a memory in another embodiment;
[0023] Fig. 9 is a block diagram of a memory health monitoring device according to an embodiment;
[0024] Fig.10 FIG. 4 is a structural block diagram of an electronic device in an embodiment. DETAILED DESCRIPTION
[0025] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0026] It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0027] It is understood that the terms "first", "second", etc. used in this application can be used to describe various elements in this article, but these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of this application, the first partition can be referred to as the second partition, and similarly, the second partition can be referred to as the first partition. Both the first partition and the second partition are storage partitions within the target storage space, but they are not the same storage partition. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the schemes, or any combination of multiple schemes.
[0028] eMMC (Embedded Multi Media Card) is a Flash Memory Card standard that defines the architecture of MMC (Multi Media Card) and the interface and protocol for accessing Flash Memory. eMMC is an extension of MMC that can meet higher standards of performance, cost, size, stability, ease of use, etc. For example, Figure 1 FIG. 1 is a diagram showing the overall architecture of an eMMC in an embodiment. Figure 1 As shown, eMMC may include three parts: Flash Memory, Flash Controller and Host Interface. Among them, the flash memory can be used to store various types of data such as system, application and user, and the flash memory can be NAND flash memory. The flash memory controller can be used to complete functions such as erase and write leveling, bad block management, ECC (Error Correcting Code, error checking and correction) verification. Compared with directly connecting the flash memory to the host (Host) side, integrating the flash memory controller inside the eMMC can shield the physical characteristics of the flash memory to reduce the complexity of the host software and reduce the special processing of the flash memory by the host. The host interface can be used to provide various interfaces for the eMMC to communicate with the host. The MMC controller in the host can transmit data with the eMMC according to the various communication interfaces defined in the eMMC bus protocol.
[0029] The health assessment of the write life of eMMC flash memory during use has always been a difficult problem that has plagued electronic product designers, and there is currently no direct assessment method. In related technologies, the storage particles inside the eMMC flash memory are usually NAND flash memory particles. This technology determines that the entire storage characteristics inevitably have bad blocks, and bad blocks are divided into bad blocks that exist at the factory and bad blocks generated by repeated erasures during user use. When the number of bad blocks reaches a certain threshold trigger threshold, the eMMC flash memory can no longer store data correctly, and the eMMC flash memory can no longer be used for data storage. When the number of bad blocks is less than the threshold specified by the eMMC flash memory, the eMMC flash memory is considered to be healthy and can be used normally. At present, the industry usually evaluates the health of eMMC flash memory in the following ways:
[0030] Method 1: Reserve a certain number of unused healthy blocks inside the eMMC flash memory chip. When the system finds a bad block, it will directly replace the bad block with a healthy block, allowing the eMMC flash memory to continue to be used. When these reserved healthy blocks are exhausted, it is considered that the life of the eMMC flash memory has basically reached the end, and the eMMC flash memory will be declared bad and can no longer be used normally.
[0031] Method 2: JEDEC (Joint Electron Device Engineering Council) formulated relevant standards for eMMC health assessment when formulating the eMMC5.0 protocol: Equipment Life Cycle Health Assessment Model TYPE-A and TYPE-B, which specifically establish a set of flash memory health data statistics inside the eMMC flash memory chip. The main method is to evaluate the ratio of the number of reserved healthy blocks that have been used to the total reserved healthy blocks, and give 10 levels of 1 to 10 for the ratio, representing 10% to 100% damage. When the damage reaches 100%, it is basically declared that the eMMC flash memory is close to or has been broken and can no longer be used normally.
[0032] At present, the health assessment index for the write life of eMMC flash memory is single and basically depends on the manufacturer's own implementation. It is difficult to provide more guidance information during the use of flash memory devices and cannot provide users with relevant effective information. Moreover, the current assessment method can only obtain the numerical percentage of the device life cycle health assessment model TYPE-A and TYPE-B given by JEDEC by querying in the register, and make a rough estimate with poor accuracy.
[0033] The embodiments of the present application disclose a method, device, electronic device and storage medium for monitoring the health of a memory, which can more accurately evaluate the health of the memory and enrich the evaluation methods for the health of the memory.
[0034] Figure 2FIG. 1 is an application scenario diagram of a method for monitoring the health of a memory in an embodiment. Figure 2 As shown, the memory health monitoring method provided in the embodiment of the present application can be applied to an electronic device 20, which may include but is not limited to mobile phones, wearable devices, vehicle-mounted terminals, tablet computers, PCs (Personal Computers), PDAs (Personal Digital Assistants) and other terminal devices. The electronic device 20 can also be a server device, which is not limited by the embodiment of the present application.
[0035] The electronic device 20 may be provided with a memory 210, which may include a flash memory, etc. Further, the memory 210 may include an eMMC, etc. It should be noted that the memory 210 may also be other types of memory, such as an erasable programmable memory (Erasable Programmable Read Only Memory, EPROM), an electrically erasable PROM (Electrically Erasable PROM, EEPROM), a random access memory (random access memory, RAM), etc., and the embodiments of the present application are not limited to this.
[0036] The memory 210 may be provided with a target storage space, which has SLC (Single-Level Cell, single-layer storage unit) characteristics, fast operation and response speed, at least 100,000 erase and write times, and very reliable data storage. In an embodiment of the present application, the target storage space in the memory 210 can be used to store the amount of data written to the memory 210, and for query by the operating system or host of the electronic device 20. The electronic device 20 can read the current amount of data written to the memory 210 from the target storage space of the memory 210. If the current amount of data written meets the write alarm condition, a health alarm message for the memory 210 is generated, and the health alarm message can be used to warn the health of the memory 210.
[0037] like Figure 3 As shown, in one embodiment, a method for monitoring the health of a memory is provided, which can be applied to the above-mentioned electronic device. The method may include the following steps:
[0038] Step 310: read the current data write amount of the memory from the target storage space.
[0039] The memory of the electronic device may be provided with a target storage space, which has SLC characteristics, fast operation and response speed, at least 100,000 erase and write times, and very reliable data storage. For flash memory such as eMMC, a storage area with SLC characteristics is usually provided, which is specially provided by the memory chip manufacturer to third-party users for storing key data. For example, it can be used to store key system firmware such as bootloader. The space size of the storage area is about 512KB (kilobytes) to 1MB (megabytes). In an embodiment of the present application, based on the partition structure of the storage area with SLC characteristics provided in the memory, the target storage space can be divided from the storage area with SLC characteristics to store the data written to the memory.
[0040] Each time the electronic device writes data to the memory, the data write amount stored in the target storage space can be updated and maintained to ensure that the data write amount stored in the target storage space is the latest data write amount of the memory. Optionally, the target storage space can be an SLC partition in the memory, or a pSLC (Pseudo Single-Level Cell) partition in the memory, etc. By using a target storage space with SLC characteristics to store the data write amount of the memory, the accuracy and stability of the stored data write amount can be improved, and the accuracy of the assessment of the health of the memory can be further improved. In addition, the original partition structure of the memory is utilized to improve the reasonable utilization rate of the memory.
[0041] When an electronic device needs to evaluate the health of its memory, it can read the current amount of data written to the memory from the target storage space in the memory, and determine whether the current amount of data written meets the write alarm condition. If it is determined that the current amount of data written meets the write alarm condition, it can indicate that the current health of the memory is relatively dangerous, and the life of the memory has ended or is nearing the end, then health warning information for the memory can be generated.
[0042] In an embodiment of the present application, the write alarm condition is determined based on the maximum data write amount of the memory, which may refer to the total amount of written data corresponding to the entire life of the memory in theory. The maximum data write amount may be the write amount of the memory for the entire life cycle calibrated when the memory leaves the factory. For example, the write amount of the memory for the entire life cycle calibrated when the memory leaves the factory is 1TBW (terabyte write), then the maximum data write amount may be 1TBW, etc., but is not limited to this.
[0043] Optionally, the write warning condition can be determined based on the maximum data write amount of the memory. For example, the write warning condition may be that the current data write amount of the memory reaches the maximum data write amount or is close to the maximum data write amount. In this case, the memory is prone to data loss, and thus the life of the memory can be basically declared over.
[0044] Step 320: If the current data write amount meets the write warning condition, generate health warning information for the memory.
[0045] Health warning information can be used to warn about the health status of the memory. For example, the health warning information can remind the user that the life of the memory is about to end or has ended and can no longer be used, etc., which makes it convenient for the user to know the health status of the memory. It can also facilitate the user to replace the memory in time, or adjust the data storage to reduce the writing of data to the memory, thereby reducing unnecessary losses to the user due to memory damage.
[0046] Optionally, after the electronic device generates health warning information, it can output the health warning information. The way of outputting the health warning information may include but is not limited to displaying the health warning information through a display screen in the form of pictures or text, or playing the health warning information in the form of voice through a speaker, etc. The embodiment of the present application does not limit the way of outputting the health warning information.
[0047] In some embodiments, the timing for the electronic device to evaluate the health of the memory can be set according to actual needs. For example, the health of the memory can be evaluated at a fixed time period, such as evaluating the health of the memory at a fixed time every day; or, the health of the memory can be evaluated each time the electronic device is started; or, the electronic device can also be connected to a host computer for communication, and when the electronic device receives an evaluation request sent by the host computer, the health of the memory is evaluated, etc., but not limited to this.
[0048] In some embodiments, after the electronic device reads the current amount of data written to the memory from the target storage space and determines whether the current amount of data written meets the write alarm condition, the memory information such as the current amount of data written read this time and the judgment result (whether the write alarm condition is met) can be reported to the server. The server can monitor the health of the memories on multiple electronic devices, obtain the current amount of data written to the memories and the judgment results reported by multiple electronic devices respectively, and store the memory information reported by each electronic device. The memory chip manufacturer can also better monitor the health of the memories on each electronic device based on the memory information stored on the server. Optionally, when the memory of the electronic device fails, the maintenance personnel can use the memory information stored on the server, which intuitively reflects the health of the memory, thereby helping the maintenance personnel to more accurately analyze the problem of the memory and formulate relevant maintenance plans.
[0049] In an embodiment of the present application, the current data write amount of the memory is read from the target storage space. If the current data write amount meets the write alarm condition, a health alarm message for the memory is generated. The target storage space with the single-layer storage unit SLC characteristics in the memory is used to store the data write amount of the memory, which can improve the accuracy and stability of the stored data write amount, ensure the reliability of the current data write amount read, and use the current data write amount and the maximum data write amount of the memory to evaluate the health of the memory, which can more accurately evaluate the health of the memory and enrich the evaluation method of the health of the memory. In addition, health alarm information for the memory can be generated in a timely and accurate manner, which is convenient for users to know the health of the memory and reduce unnecessary losses caused to users due to memory damage.
[0050] like Figure 4 As shown, in another embodiment, a method for monitoring the health of a memory is provided, which can be applied to the above-mentioned electronic device. The method may include the following steps:
[0051] Step 402: read the current first data written amount of the memory from the first partition, and / or read the current second data written amount of the memory from the second partition.
[0052] The target storage space may include a first partition and a second partition, both of which are used to store the amount of data written to the memory, and the first partition and the second partition are backed up for each other, that is, the data stored in the first partition and the second partition are kept synchronized. The first partition and the second partition may be two storage partitions with smaller spaces extracted from a storage area with SLC characteristics in the memory, for example, the space size of the first partition and the second partition may be 4KB, 5KB, etc., but not limited to this, the space size of the first partition and the second partition may be the same or different. The first partition and the second partition are extracted from the storage area with SLC characteristics in the memory, and are specifically used to store the amount of data written to the memory for query by the operating system of the electronic device, so as to ensure the accuracy of the current amount of data written to the memory read each time.
[0053] Each time the electronic device writes data to the memory, the data written amount stored in the first partition and the second partition can be updated and maintained respectively, and the data written amount recorded in the first partition and the second partition can be ensured to be consistent. Figure 5 FIG. 1 is a schematic diagram of the structure of an eMMC in an embodiment. Figure 5 As shown, SLC / pSLC partitions are set in the eMMC, and the first partition 502 and the second partition 504 can be extracted from the SLC / pSLC partition. The first partition 502 and the second partition 504 back up each other and keep synchronized. The first partition 502 can record the data writing amount A of the memory, and the second partition 504 can record the data writing amount B of the memory. When the data writing amount A and the data writing amount B are correct, the data writing amount A is equal to the data writing amount B.
[0054] When an electronic device needs to evaluate the health of a memory, it can read the current first data write amount of the memory from a first partition of the memory, and upon determining that the current first data write amount is correct, determine whether the current first data write amount satisfies a write alarm condition; and / or, it can read the current second data write amount of the memory from a second partition of the memory, and upon determining that the current second data write amount is correct, determine whether the current second data write amount satisfies a write alarm condition.
[0055] As a specific implementation, in order to further ensure the accuracy of the health status assessment, the electronic device can read the current first data write amount of the memory from the first partition, and read the current second data write amount of the memory from the second partition, and determine the correct current data write amount of the memory based on the current first data write amount and the current second data write amount. For example, if it is determined that the current first data write amount is correct, the current first data write amount can be determined as the current data write amount of the memory. If it is determined that the current second data write amount is correct, the current second data write amount can be determined as the current data write amount of the memory, and the like, and a subsequent judgment is made as to whether the write alarm condition is met. By reading the stored data write amount from the first partition and the second partition at the same time, the accuracy of the numerical value used in the health status assessment can be ensured, thereby ensuring the accuracy of the assessment.
[0056] Step 404, when it is determined that the current first data write amount is correct and the current first data write amount meets the write alarm condition, or when it is determined that the current second data write amount is correct and the current second data write amount meets the write alarm condition, generate health warning information for the memory.
[0057] In some embodiments, the electronic device may verify the current first data write amount read to determine whether the current first data write amount is correct. Each time the first data write amount stored in the first partition is updated, a first verification value corresponding to the first data write amount stored in the first partition (i.e., the latest data write amount written to the first partition) may be generated, and the first verification value may be used to verify the accuracy of the read first data write amount in a subsequent health assessment process.
[0058] When the electronic device needs to evaluate the health of the memory, the current first data write amount can be read from the first partition, and the first check value corresponding to the current first data write amount can be read from the first partition, and the current first data write amount can be checked according to the first check value. If the current first data write amount is successfully checked according to the first check value, it is determined that the current first data write amount is correct.
[0059] Optionally, the verification algorithm for verifying the current first data writing amount may include but is not limited to any one of CRC (Cyclic Redundancy Check) verification, parity check, checksum and the like.
[0060] As a specific implementation, each time the first data write amount stored in the first partition is updated, a set verification algorithm can be used to calculate the first verification value corresponding to the latest first data write amount, and the latest first data write amount and the corresponding first verification value are written into the first partition. When evaluating the health of the memory, the current first data write amount and the corresponding first verification value are read from the first partition, and the set verification algorithm can be used to calculate the third verification value corresponding to the current first data write amount, and the third verification value is compared with the read first verification value to determine whether the two are consistent. If the two are consistent, the verification is successful, and it is determined that the read current first data write amount is correct.
[0061] Similar to the way of verifying the current first data write amount read, in some embodiments, the electronic device can verify the second data write amount read to determine whether the current second data write amount is correct. Each time the second data write amount stored in the second partition is updated, a second verification value corresponding to the second data write amount stored in the second partition (i.e., the latest data write amount written to the second partition) can be generated, and the second verification value can be used to verify the accuracy of the second data write amount read in the subsequent health assessment process.
[0062] When the electronic device needs to evaluate the health of the memory, the current second data write amount can be read from the second partition, and the second check value corresponding to the current second data write amount can be read from the second partition, and the current second data write amount can be checked according to the second check value. If the current second data write amount is successfully checked according to the second check value, it is determined that the current second data write amount is correct.
[0063] It should be noted that the verification method for the current second data write amount is similar to the verification method for the current first data write amount introduced in the above embodiment. Therefore, you can refer to the relevant description of verifying the current first data write amount in the above embodiment, and will not repeat it here.
[0064] In an embodiment of the present application, during the process of evaluating the health of the memory, the current first data write amount read from the first partition and the current second data write amount read from the second partition are verified to ensure that the correct current data write amount of the memory is obtained for health assessment, thereby improving the accuracy of the health assessment of the memory.
[0065] In some embodiments, when an error is detected in the current first data write amount stored in the first partition and / or the current second data write amount stored in the second partition, the erroneous data write amount may be corrected. If it is determined that the current first data write amount is erroneous and the current second data write amount is correct, the first data write amount stored in the first partition may be updated according to the current second data write amount. If it is determined that the current first data write amount is correct and the current second data write amount is erroneous, the second data write amount stored in the second partition may be updated according to the current first data write amount.
[0066] In the case that only one of the first and second partitions has an error in the amount of data written stored, the correct amount of data written stored in the other partition can be used to correct the amount of data written stored in the partition with the error, thereby ensuring that the amount of data written stored in the two partitions is correct and consistent.
[0067] If it is determined that the current first data write amount and the current second data write amount are both wrong, the latest data write amount of the memory is read from the memory, and the first data write amount stored in the first partition and the second data write amount stored in the second partition are updated according to the latest data write amount. Optionally, the latest data write amount of the memory can be stored in the memory each time data is written to the memory, that is, the data write amount of the memory is also recorded in the memory. When it is detected that the data write amount stored in the first partition and the second partition is wrong, the correct data write amount (that is, the above-mentioned latest data write amount) can be read from the memory, and the data write amount stored in the first partition and the second partition can be corrected to ensure that the data write amount stored in the two partitions is correct and consistent. The above-mentioned correction mechanism can ensure that the data write amount stored in the two partitions is correct and consistent, thereby improving the accuracy of evaluating the health of the memory.
[0068] Optionally, when it is determined that the current first data write amount is correct, the current first data write amount can be used as the current data write amount of the memory, and it is determined whether the current first data write amount meets the write alarm condition. If the current first data write amount meets the write alarm condition, a health warning message for the memory can be generated. Optionally, when it is determined that the current second data write amount is correct, the current second data write amount can be used as the current data write amount of the memory, and it is determined whether the current second data write amount meets the write alarm condition. If the current second data write amount meets the write alarm condition, a health warning message for the memory can be generated.
[0069] In some embodiments, the write warning condition may include but is not limited to any of the following:
[0070] (1) The current data writing amount (which may be the correct current first data writing amount, or the correctly determined current second data writing amount) reaches the maximum data writing amount;
[0071] (2) a difference between the maximum data writing amount and the current data writing amount (which may be the correct current first data writing amount, or the correctly determined current second data writing amount) is less than or equal to the first writing amount threshold;
[0072] (3) The ratio of the current data writing amount (which may be the correct current first data writing amount, or the correctly determined current second data writing amount) to the maximum data writing amount is greater than or equal to the ratio threshold.
[0073] Among them, the difference between the maximum data writing amount and the current data writing amount is the current remaining data writing amount. If the current remaining data writing amount is less than or equal to the first writing amount threshold, it means that the current data writing amount of the memory is close to the maximum data writing amount, and the memory is basically unusable.
[0074] It should be noted that the above-mentioned first write amount threshold and ratio threshold can be set according to actual needs, and the embodiment of the present application does not limit this. For example, the ratio threshold can be 90%, 95%, 93%, etc., and the first write amount threshold can be 200KB, 100KB, etc., but is not limited thereto. The write alarm condition can also be flexibly set according to actual needs.
[0075] In some embodiments, the electronic device may generate writing amount prompt information according to the current data writing amount of the memory, and the writing amount prompt information may be used to prompt the current data writing amount and / or prompt the current remaining data writing amount. The current remaining data writing amount is the difference between the safety data writing amount and the current data writing amount, and the safety data writing amount may be determined according to the maximum data writing amount.
[0076] Optionally, the safe data writing amount can be set according to actual needs, and the safe data writing amount is less than or equal to the maximum data writing amount. For example, the safe data writing amount can be a preset percentage of the maximum data writing amount (such as 80%, 90%, 88%, etc.). By reserving a certain amount of data writing, it is possible to ensure that the memory is replaced in time to avoid losses caused by replacing the memory after it is completely broken.
[0077] Furthermore, if it is determined that the current data write amount of the memory satisfies the write warning condition, a health warning message and a write amount prompt message may be generated and output. Fig. 6A This is a schematic diagram of an interface for outputting health warning information and writing amount prompt information in one embodiment. Fig. 6AAs shown, if it is determined that the current data writing amount of the memory meets the write alarm condition, a health warning message 610 (such as "Warning: The eMMC of this machine is damaged") and a write amount prompt message 620 (such as "The current data writing amount of the eMMC is 1022GB, and the remaining data writing amount is 2GB") can be output.
[0078] If it is determined that the current data write amount of the memory does not meet the write warning condition, write amount prompt information can be generated and output. Figure 6B This is a schematic diagram of an interface for outputting writing amount prompt information in an embodiment. Figure 6B As shown, if it is determined that the current data write amount of the memory does not meet the write alarm condition, the write amount prompt information 630 (such as "the current data write amount of the MMC is 200GB, and the remaining data write amount is 824GB") can be output. Through the write amount prompt information, the user can accurately know the current data write amount and / or the remaining data write amount of the memory, can more intuitively know the health status of the memory, and can back up data in advance, update the memory, etc. according to the current data write amount and / or the remaining data write amount of the memory.
[0079] In an embodiment of the present application, a first partition and a second partition are extracted from a storage area having SLC characteristics inside a memory, and both the first partition and the second partition are used to store the amount of data written to the memory, and the first partition and the second partition back up each other, thereby ensuring the accuracy of the amount of data written when evaluating the health of the memory, thereby improving the accuracy of the evaluation of the health of the memory.
[0080] like Figure 7 As shown, in another embodiment, a method for monitoring the health of a memory is provided, which can be applied to the above-mentioned electronic device. The method may include the following steps:
[0081] Step 702: Obtain a data write request, and write data into the cache space according to the data write request.
[0082] In an embodiment of the present application, a cache space may be set in the memory of the electronic device, and the cache space may be used to cache data to be written to the memory (such as eMMC). The size of the cache space may be set according to actual needs, for example, it may be a cache space of 1MB, 2MB, etc. Optionally, the size of the cache space may also be dynamically adjusted according to the actual writing situation of the memory. For example, when the writing frequency of the memory is high, a larger cache space may be allocated to reduce the writing frequency of writing to the memory, etc., but is not limited thereto.
[0083] If a data write request issued by the operating system is obtained, the data to be written into the memory can be obtained according to the data write request, and the data to be written into the memory can be first written into the cache space.
[0084] Step 704: if it is detected that the cache space is full, the data stored in the cache space is written into the memory, and the data write amount stored in the target storage space is updated according to the target data write amount to be written into the memory this time.
[0085] It can detect whether the cache space is full. If the cache space is full, data can no longer be written to the cache space, and the data stored in the cache space can be written to the memory. Optionally, a write volume maintenance process can be run in the operating system of the electronic device. After the data stored in the cache space is written to the memory, a maintenance notification can be sent to the write volume maintenance process. The write volume maintenance process can update and maintain the data write volume stored in the target storage space according to the maintenance notification.
[0086] As a specific implementation, the write volume maintenance process can add the target data write volume written to the memory this time to the data write volume originally stored in the target storage space to update the data write volume stored in the target storage space. The write volume maintenance process can first read the current data write volume of the memory from the target storage space, and add the read current data write volume to the target data write volume to obtain the updated data write volume, and then write the updated data write volume to the target storage space to complete the update of the data write volume stored in the target storage space.
[0087] Optionally, since data is written to the memory when the cache space is full, the target data write amount of the memory this time can be the size of the cache space, and the target data write amount of the memory each time is the same, which is the size of the cache space. The data write amount can be updated by simply appending the target data write amount to the data write amount stored in the target storage space, which can simplify the data write amount update process.
[0088] In some embodiments, the target storage space may include a first partition and a second partition. The first data write amount stored in the first partition may be updated according to the target data write amount of the memory this time, and the second data write amount stored in the second partition may be updated according to the target data write amount of the memory this time, and it is determined whether the updated first data write amount is consistent with the updated second data write amount.
[0089] The first partition and the second partition are kept updated synchronously and back up each other. Optionally, an initial value of the write amount can be determined, and the initial value of the write amount can be written into the first partition as the initial first data write amount, and the initial value of the write amount can be written into the second partition as the initial second data write amount. The initial value of the write amount can be set according to actual needs. The initial value of the write amount can be a pre-set fixed value, or an initial value determined based on business situation evaluation. The business situation can include the size of the software package of the basic application in the operating system, or the size of the space occupied by the boot loader in the operating system. Each time data is written to the memory, the write amount maintenance process can update the first data write amount stored in the first partition and the second data write amount stored in the second partition, and can add the target data write amount written to the memory each time to the first data write amount stored in the first partition and the second data write amount stored in the second partition, so as to update the data write amount stored in the first partition and the second partition.
[0090] In some embodiments, in order to ensure that the data write amounts stored in the first partition and the second partition are correct and consistent, after the first data write amount and the second data write amount are updated, it can be determined whether the updated first data write amount is consistent with the updated second data write amount. As an implementation method, after the first data write amount and the second data write amount are updated, a first check value corresponding to the updated first data write amount and a second check value for the updated second data write amount can be generated, and it can be determined whether the generated first check value is the same as the generated second check value. If the generated first check value is the same as the second check value, it can be determined that the updated first data write amount is consistent with the updated second data write amount. Furthermore, the write amount maintenance process can write the generated first check value to the first partition and the generated second check value to the second partition, which can be used to subsequently verify the correctness of the first data write amount and the second data write amount.
[0091] As another implementation, after the first data write amount and the second data write amount are updated, the write amount maintenance process may first generate a first verification value corresponding to the updated first data write amount, and generate a second verification value for the updated second data write amount, and write the updated first data write amount and the corresponding first verification value to the first partition, and write the updated second data write amount and the corresponding second verification value to the second partition. The most recently written first data write amount and the first verification value may be read from the first partition again, and the read first verification value may be used to verify the read first data write amount to determine whether the read first data write amount is correct. Similarly, the most recently written second data write amount and the second verification value may be read from the second partition again, and the read second verification value may be used to verify the read second data write amount to determine whether the read second data write amount is correct. If it is determined that the read first data write amount and the second data write amount are both correct, it can be determined that the updated first data write amount is consistent with and correct to the updated second data write amount. It should be noted that the method of verifying the first data write amount and the second data write amount to determine whether they are correct can refer to the relevant description of the health status assessment process of the memory in the previous embodiment, which will not be repeated here.
[0092] If it is detected that the updated first data write amount is different from the updated second data write amount, such as the generated first verification value is different from the second verification value, or an error is detected during verification, the updated first data write amount and / or the updated second data write amount can be corrected to make the updated first data write amount consistent with the updated second data write amount.
[0093] Optionally, if it is determined that the updated first data write amount is incorrect and the updated second data write amount is correct, the updated first data write amount can be corrected according to the updated second data write amount; if it is determined that the updated second data write amount is incorrect and the updated first data write amount is correct, the updated second data write amount can be corrected according to the updated first data write amount.
[0094] If it is detected that both the updated first data write amount and the updated second data write amount are erroneous, the first data write amount and the second data write amount can be updated again. Optionally, the first data write amount before the update and the second data write amount before the update can be re-acquired, and the first data write amount before the update and the second data write amount before the update can be appended according to the target data write amount. Optionally, since the memory also maintains the latest data write amount of the memory each time data is written to the memory, the latest data write amount of the memory can be read from the memory, and the data write amount stored in the first partition and the second partition can be corrected according to the latest data write amount.
[0095] In an embodiment of the present application, when maintaining the data write amount of the first partition and the second partition, the consistency and correctness of the data write amount stored in the first partition and the second partition are guaranteed, thereby ensuring the accuracy of subsequent health assessment of the memory.
[0096] Step 706: read the current data write amount of the memory from the target storage space.
[0097] Step 708: If the current data write amount meets the write warning condition, generate health warning information for the storage.
[0098] The description of steps 706 to 708 may refer to the relevant description in the above embodiments, and will not be repeated here.
[0099] In some embodiments, the electronic device may also count data writing information written into the memory within the target time period, and determine a write adjustment strategy based on the data writing information.
[0100] Among them, the data writing information may include the frequency of writing data to the memory within the target time period, and / or the total data writing amount corresponding to the memory within the target time period. It should be noted that the target time period can be set according to actual needs, such as 1 day, 1 week, 12 hours, etc., but is not limited to this. When the frequency of writing data to the memory within the target time period is greater than or equal to the frequency threshold, or the total data writing amount corresponding to the memory within the target time period is greater than or equal to the second writing amount threshold, it can be said that the writing amount of the memory within the target time period is too large, and a write adjustment strategy can be determined. The write adjustment strategy can be used to reduce the frequency of writing data to the memory, and / or reduce the amount of data written to the memory. The write adjustment strategy can be used to change the writing method of the memory, thereby improving the write life of the memory.
[0101] Optionally, the write adjustment strategy may include increasing the cache space, writing data to other memories, prompting the user to reduce business processing in the electronic device, etc. Increasing the cache space refers to increasing the size of the current cache space. The cache space can store more data, thereby reducing the frequency of writing to the memory. Writing data to other memories refers to writing data to other memories in the electronic device, thereby reducing the amount of writing to the memory. Prompting the user to reduce business processing in the electronic device means that prompt information can be output to reduce the number of times the user performs business processing in the electronic device, thereby reducing the generated business data, that is, reducing the amount of writing to the memory. By detecting the data write information of the memory over a period of time, the operating system can be warned to change the writing method and increase the write life of the memory.
[0102] In some embodiments, the method of evaluating the health of the memory using the amount of data written can also be combined with the method proposed by JEDEC of evaluating the health of the memory using the reserved block usage rate. For example, if it is determined that the current amount of data written meets the write alarm condition, the ratio of the number of reserved healthy blocks currently used to the total number of reserved healthy blocks can be obtained, and the ratio can be fed back to the manufacturer of the electronic device to help the manufacturer of the electronic device select a more reliable memory chip. For example, when the amount of data written meets the write alarm condition, the number of reserved healthy blocks used to the total number of reserved healthy blocks can be selected. The memory chip has a smaller ratio. For another example, the health of the memory can be evaluated first based on the ratio of the number of reserved healthy blocks used to the total number of reserved healthy blocks. When it is detected that the ratio is greater than the set threshold (such as 80%, 90%, etc.), the health of the memory is evaluated secondarily based on the amount of data written to the memory to determine whether the write alarm condition is met. First, a rough evaluation is performed using the reserved block usage rate, and then a detailed evaluation is performed using the amount of data written, which can reduce the frequency of reading the amount of data written in the memory, reduce power consumption and reduce resource waste, and ensure the accuracy of the evaluation of the health of the memory.
[0103] In an embodiment of the present application, the amount of data written to the memory can be maintained, and the accuracy of the written data is guaranteed. Cache space is allocated, the writing mechanism of the memory is standardized, the writing frequency of the memory is reduced, and the writing life of the memory is improved.
[0104] like Figure 8 As shown, in another embodiment, a method for monitoring the health of a memory is provided, which can be applied to the above-mentioned electronic device. The method may include the following steps:
[0105] Step 802, waiting for the system to issue a data write request.
[0106] Step 804: When the system issues a data write request, the data is written into the cache space.
[0107] Step 806, determine whether the cache space is full, if so, execute step 808, if not, execute step 802.
[0108] Step 808, writing the data in the cache space into the flash memory space.
[0109] Step 810, after writing is completed, notify the write volume maintenance process to add the current target data write volume to the first partition and the second partition.
[0110] Step 812, update the check values corresponding to the first partition and the second partition respectively, and check the data consistency, if inconsistent, make corrections.
[0111] Step 814, notify the system to complete the flash memory write volume maintenance.
[0112] Step 816, query the current data write amount of the flash memory.
[0113] Step 818, read the data writing amount stored in the first partition and the second partition respectively, and perform verification to obtain the correct data writing amount.
[0114] Step 820 , determining whether the current data writing amount exceeds or approaches the maximum data writing amount specified by the manufacturer, if so, executing step 822 , if not, executing step 824 .
[0115] Step 822, output a warning and inform the current data writing amount and the remaining writing amount.
[0116] Step 824, inform the current data writing amount and the remaining writing amount.
[0117] In the embodiment of the present application, the first partition and the second partition of the memory having the single-layer storage unit SLC characteristics are used to store the data write amount of the memory respectively, which can improve the accuracy and stability of the stored data write amount, ensure the reliability of the current data write amount read, and use the current data write amount and the maximum data write amount of the memory to evaluate the health of the memory, which can more accurately evaluate the health of the memory and enrich the evaluation method of the health of the memory. In addition, it can generate health warning information for the memory in a timely and accurate manner, which is convenient for users to know the health of the memory and reduce unnecessary losses caused to users due to memory damage.
[0118] like Fig. 9 As shown, in one embodiment, a memory health monitoring device 900 is provided, which can be applied to the above electronic device, the electronic device includes a memory, a target storage space is set in the memory, the target storage space has SLC characteristics, and the target storage space is used to store the data written amount of the memory. The memory health monitoring device 900 includes a write amount reading module 910 and an alarm module 920.
[0119] The write amount reading module 910 is used to read the current data write amount of the memory from the target storage space. The alarm module 920 is used to generate health alarm information for the memory if the current data write amount meets the write alarm condition; wherein the write alarm condition is determined according to the maximum data write amount of the memory, and the health alarm information is used to warn about the health of the memory.
[0120] In the embodiment of the present application, the target storage space with single-layer storage unit SLC characteristics in the memory is used to store the data write amount of the memory, which can improve the accuracy and stability of the stored data write amount, ensure the reliability of the current data write amount read, and use the current data write amount and the maximum data write amount of the memory to evaluate the health of the memory, which can more accurately evaluate the health of the memory and enrich the evaluation method of the health of the memory. In addition, it can generate health warning information for the memory in a timely and accurate manner, which is convenient for users to know the health of the memory and reduce unnecessary losses caused to users by memory damage.
[0121] In one embodiment, the target storage space includes a first partition and a second partition, both of which are used to store data written to the memory, and the first partition and the second partition back up each other.
[0122] The write amount reading module 910 is also used to read the current first data write amount of the memory from the first partition. The alarm module 920 is also used to generate health alarm information for the memory when it is determined that the current first data write amount is correct and the current first data write amount meets the write alarm condition.
[0123] Optionally, the write amount reading module 910 is further configured to read the current second data write amount of the memory from the second partition. The alarm module 920 is further configured to generate health alarm information for the memory when it is determined that the current second data write amount is correct and the current second data write amount meets the write alarm condition.
[0124] In one embodiment, the memory health monitoring device 900 further includes a verification module. The verification module is used to read a first verification value corresponding to the current first data write amount from the first partition; if the current first data write amount is successfully verified according to the first verification value, the current first data write amount is determined to be correct. The verification module is also used to read a second verification value corresponding to the current second data write amount from the second partition; if the current second data write amount is successfully verified according to the second verification value, the second data write amount is determined to be correct.
[0125] In one embodiment, the memory health monitoring device 900 further includes a correction module. The correction module is used to update the first data write amount stored in the first partition according to the current second data write amount if it is determined that the current first data write amount is wrong and the current second data write amount is correct; if it is determined that the current first data write amount is correct and the current second data write amount is wrong, then update the second data write amount stored in the second partition according to the current first data write amount; if it is determined that both the current first data write amount and the current second data write amount are wrong, then read the latest data write amount of the memory from the memory, and update the first data write amount stored in the first partition and the second data write amount stored in the second partition according to the latest data write amount.
[0126] In one embodiment, the write alarm condition includes any one of the following: the current data write amount reaches the maximum data write amount; the difference between the maximum data write amount and the current data write amount is less than or equal to the first write amount threshold; the proportion of the current data write amount to the maximum data write amount is greater than or equal to the proportion threshold.
[0127] In one embodiment, the memory health monitoring device 900 further includes a write prompt module. The write prompt module is used to generate write amount prompt information according to the current data write amount, and the write amount prompt information is used to prompt the current data write amount and / or prompt the current remaining data write amount; wherein the current remaining data write amount is the difference between the safe data write amount and the current data write amount, and the safe data write amount is determined according to the maximum data write amount.
[0128] In an embodiment of the present application, a first partition and a second partition are extracted from a storage area having SLC characteristics inside a memory, and both the first partition and the second partition are used to store the amount of data written to the memory, and the first partition and the second partition back up each other, thereby ensuring the accuracy of the amount of data written when evaluating the health of the memory, thereby improving the accuracy of the evaluation of the health of the memory.
[0129] In one embodiment, the memory health monitoring device 900 further includes a write module and an update module. The write module is used to obtain a data write request, write data into the cache space according to the data write request, and write the data stored in the cache space into the memory if it is detected that the cache space is full. The update module is used to update the data write amount stored in the target storage space according to the target data write amount of the memory this time.
[0130] In one embodiment, the target storage space includes a first partition and a second partition.
[0131] The update module is also used to update the first data write amount stored in the first partition according to the target data write amount of the memory this time; update the second data write amount stored in the second partition according to the target data write amount of the memory this time; and determine that the updated first data write amount is consistent with the updated second data write amount.
[0132] In one embodiment, the update module is also used to generate a first verification value corresponding to the updated first data write amount, and to generate a second verification value corresponding to the updated second data write amount; if the generated first verification value is the same as the generated second verification value, it is determined that the updated first data write amount is consistent with the updated second data write amount.
[0133] In one embodiment, the correction module is also used to correct the updated first data write amount and / or the updated second data write amount if it is detected that the updated first data write amount is different from the updated second data write amount, so that the updated first data write amount is consistent with the updated second data write amount.
[0134] In one embodiment, the memory health monitoring device 900 further includes a statistical module. The statistical module is used to count the data writing information written to the memory within the target time period; the data writing information includes the frequency of writing data to the memory within the target time period, and / or the total amount of data written to the memory within the target time period; and is used to determine the write adjustment strategy according to the data writing information.
[0135] Optionally, the statistical module is also used to determine a write adjustment strategy if the frequency of writing data to the memory within the target time period is greater than or equal to a frequency threshold, or the total data write amount corresponding to the memory within the target time period is greater than or equal to a second write amount threshold; the write adjustment strategy is used to reduce the frequency of writing data to the memory, and / or reduce the amount of data written to the memory.
[0136] In an embodiment of the present application, the amount of data written to the memory can be maintained, and the accuracy of the written data is guaranteed. Cache space is allocated, the writing mechanism of the memory is standardized, the writing frequency of the memory is reduced, and the writing life of the memory is improved.
[0137] Fig.10 FIG. 1 is a structural block diagram of an electronic device in an embodiment. Fig.10 As shown, the electronic device 1000 may include one or more of the following components: a processor 1010, and a memory 1020 coupled to the processor 1010, wherein the memory 1020 may store one or more computer programs, and the one or more computer programs may be configured to implement the methods described in the above embodiments when executed by one or more processors 1010.
[0138] The processor 1010 may include one or more processing cores. The processor 1010 uses various interfaces and lines to connect various parts of the entire electronic device 1000, and executes various functions and processes data of the electronic device 1000 by running or executing instructions, programs, code sets or instruction sets stored in the memory 1020, and calling data stored in the memory 1020. Optionally, the processor 1010 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 1010 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 1010, but may be implemented separately through a communication chip.
[0139] The memory 1020 may include a random access memory (RAM) or a read-only memory (ROM). The memory 1020 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 1020 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The data storage area may also store data created by the electronic device 1000 during use, etc.
[0140] It is understandable that the electronic device 1000 may include more or fewer structural elements than those in the above structural block diagram, for example, a power module, physical buttons, a WiFi (Wireless Fidelity) module, a speaker, a Bluetooth module, a sensor, etc., and is not limited here.
[0141] An embodiment of the present application discloses a computer-readable storage medium storing a computer program, wherein the computer program implements the methods described in the above embodiments when executed by a processor.
[0142] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a ROM, etc.
[0143] As used herein, any reference to memory, storage, database, or other medium may include nonvolatile and / or volatile memory. Suitable nonvolatile memory may include ROM, programmable ROM (Programmable ROM, PROM), erasable PROM (Erasable PROM, EPROM), electrically erasable PROM (Electrically Erasable PROM, EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which is used as an external cache memory. By way of illustration and not limitation, RAM may be in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), memory bus direct RAM (RDRAM) and direct memory bus dynamic RAM (DRDRAM).
[0144] It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required for the present application.
[0145] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0146] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0147] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0148] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0149] The above is a detailed introduction to a memory health monitoring method, device, electronic device and storage medium disclosed in the embodiment of the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for monitoring the health of a memory, characterized in that: Applied to an electronic device, the electronic device includes the memory, a target storage space is set in the memory, the target storage space has a single-layer storage unit SLC characteristic, and the target storage space is used to store the data written amount of the memory; the method includes: Reading the current data write amount of the memory from the target storage space; If the current data write amount meets the write alarm condition, health alarm information for the memory is generated; wherein the write alarm condition is determined based on the maximum data write amount of the memory, and the health alarm information is used to warn about the health status of the memory.
2. The method according to claim 1, characterized in that The target storage space includes a first partition and a second partition. The first partition and the second partition are both used to store the data written to the memory. The first partition and the second partition back up each other.
3. The method according to claim 2, characterized in that The step of reading the current data write amount of the memory from the target storage space includes: Reading a current first data write amount of the memory from the first partition; If the current data write amount meets the write warning condition, generating health warning information for the memory includes: In the case where it is determined that the current first data write amount is correct and the current first data write amount meets a write warning condition, generating health warning information for the memory; and / or, The step of reading the current data write amount of the memory from the target storage space includes: Reading a current second data write amount of the memory from the second partition; If the current data write amount meets the write warning condition, generating health warning information for the memory includes: When it is determined that the current second data write amount is correct and the current second data write amount meets a write warning condition, health warning information for the memory is generated.
4. The method according to claim 3, characterized in that In the case where it is determined that the current first data write amount is correct and the current first data write amount meets the write warning condition, before generating the health warning information for the memory, the method further includes: Reading a first check value corresponding to the current first data write amount from the first partition; If the current first data writing amount is successfully verified according to the first verification value, it is determined that the current first data writing amount is correct; In the case where it is determined that the current second data write amount is correct and the current second data write amount meets the write warning condition, before generating the health warning information for the memory, the method further includes: Reading a second check value corresponding to the current second data write amount from the second partition; If the current second data writing amount is successfully verified according to the second verification value, it is determined that the second data writing amount is correct.
5. The method according to claim 3, characterized in that: The method further comprises: If it is determined that the current first data writing amount is wrong and the current second data writing amount is correct, updating the first data writing amount stored in the first partition according to the current second data writing amount; If it is determined that the current first data writing amount is correct and the current second data writing amount is wrong, updating the second data writing amount stored in the second partition according to the current first data writing amount; If it is determined that both the current first data write amount and the current second data write amount are wrong, the latest data write amount of the storage is read from the memory, and the first data write amount stored in the first partition and the second data write amount stored in the second partition are updated respectively according to the latest data write amount.
6. The method according to claim 1, characterized in that The write alarm condition includes any one of the following: The current data writing amount reaches the maximum data writing amount; The difference between the maximum data writing amount and the current data writing amount is less than or equal to a first writing amount threshold; The ratio of the current data writing amount to the maximum data writing amount is greater than or equal to a ratio threshold.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Generate writing amount prompt information according to the current data writing amount, wherein the writing amount prompt information is used to prompt the current data writing amount and / or prompt the current remaining data writing amount; The current remaining data writing amount is the difference between the safety data writing amount and the current data writing amount, and the safety data writing amount is determined according to the maximum data writing amount.
8. The method according to claim 1, characterized in that The method further comprises: Obtaining a data write request, and writing data into the cache space according to the data write request; If it is detected that the cache space is full, the data stored in the cache space is written into the memory, and the data writing amount stored in the target storage space is updated according to the target data writing amount written into the memory this time.
9. The method according to claim 8, characterized in that The target storage space includes a first partition and a second partition; and updating the data writing amount stored in the target storage space according to the target data writing amount written to the memory this time includes: According to the target data writing amount written to the memory this time, updating the first data writing amount stored in the first partition; According to the target data writing amount written to the memory this time, updating the second data writing amount stored in the second partition; It is determined whether the updated first data writing amount is consistent with the updated second data writing amount.
10. The method according to claim 9, characterized in that The determining whether the updated first data writing amount is consistent with the updated second data writing amount includes: generating a first check value corresponding to the updated first data write amount, and generating a second check value corresponding to the updated second data write amount; Determining that the generated first check value is the same as the generated second check value; If the generated first verification value is the same as the generated second verification value, it is determined that the updated first data write amount is consistent with the updated second data write amount.
11. The method according to claim 9, characterized in that The method further comprises: If it is detected that the updated first data write amount is different from the updated second data write amount, the updated first data write amount and / or the updated second data write amount are corrected to make the updated first data write amount consistent with the updated second data write amount.
12. The method according to any one of claims 8 to 11, characterized in that: The method further comprises: Counting data writing information written to the memory within the target time period; the data writing information includes the frequency of writing data to the memory within the target time period, and / or the total amount of data written to the memory within the target time period; A write adjustment strategy is determined according to the data write information.
13. The method according to claim 12, characterized in that: Determining a write adjustment strategy according to the data write information includes: If the frequency of writing data to the memory within the target time period is greater than or equal to the frequency threshold, or the total data write amount corresponding to the memory within the target time period is greater than or equal to the second write amount threshold, a write adjustment strategy is determined; the write adjustment strategy is used to reduce the frequency of writing data to the memory and / or reduce the amount of data written to the memory.
14. The method according to any one of claims 1 to 6 and 8 to 11, characterized in that: The memory includes an embedded multimedia card eMMC, and the target storage space includes an SLC partition and / or a pseudo single-layer storage unit pSLC partition.
15. A memory health monitoring device, characterized in that: Applied to an electronic device, the electronic device includes the memory, a target storage space is set in the memory, the target storage space has a single-layer storage unit SLC characteristic, and the target storage space is used to store the data written amount of the memory; the device includes: A write amount reading module, used for reading the current data write amount of the memory from the target storage space; An alarm module is used to generate health alarm information for the memory if the current data writing amount meets the write alarm condition; wherein the write alarm condition is determined based on the maximum data writing amount of the memory, and the health alarm information is used to warn about the health status of the memory.
16. An electronic device, characterized in that: The method comprises a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the method according to any one of claims 1 to 14.
17. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the processor is enabled to implement the method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Alarming method of memory space inadequate in network storage system
CN101291250A
Fast data recovery method and system based on flash memory
CN108038026A
Solid state disk service life visualization method and device, electronic equipment and medium
CN109918283A
Memory controller and operating method thereof
CN113688066A
Cited By
Memory and allocation method of flash memory blocks thereof
CN119668523A
