Data processing method and device, electronic equipment and readable storage medium
By deciding whether to use a write accelerator based on the target data and the information of the memory device, the problem of increasing the write amplification coefficient affecting the life of the memory device is solved, and the life span and performance improvement of the memory device are achieved.
Patent Information
- Application Number
- CN202411328783.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-12-20
AI Technical Summary
In the prior art, all data is written to the memory device through a write accelerator (WB), resulting in an increase in the write amplification coefficient, affecting the service life and performance of the memory device.
When detecting the write request of the target data, based on the information of the target data and the information of the storage device, it is determined whether to write data to the storage device through the write accelerator, reducing unnecessary data handling and erasing times, and reducing the use of the storage device. frequency.
While ensuring user write experience, it reduces the number of erases of memory devices, extends the service life of memory devices and improves performance.
Smart Images

Figure CN119166070A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the technical field of electronic equipment, and specifically relates to a data processing method, device, electronic equipment and readable storage medium. Background Art
[0002] Most storage technologies used in mobile electronic devices use the Write Booster (WB) function. The WB function process includes: dynamically converting a portion of the storage medium triple-level cell (TLC) flash memory (NAND) in the storage device to a faster single-level cell (SLC) NAND, so that the host writes data to the SLC and returns, in order to achieve accelerated writing speed, and then move the SLC data to the TLC when the device is idle.
[0003] However, although moving data from SLC to TLC will speed up data writing, it also has some defects:
[0004] In the current technology, WB is always open, and all data writes will first pass through SLC. The extra data transfer will cause the write amplification factor to become larger, and the increase in the write amplification factor will affect the service life and performance of the storage device. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a data processing method, device, electronic device and readable storage medium, which can solve the problem in the prior art that all data is written into the storage device through WB, affecting the service life and performance of the storage device.
[0006] In a first aspect, an embodiment of the present application provides a data processing method, the method comprising:
[0007] In the case of detecting a write request for target data, determining whether to write the target data into a storage device through a write accelerator according to the target information;
[0008] Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
[0009] In a second aspect, an embodiment of the present application provides a data processing device, the device comprising:
[0010] A determination module, configured to determine whether to write the target data into a storage device through a write accelerator according to target information when a write request for target data is detected:
[0011] Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
[0012] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the program or instructions are executed by the processor, the steps of the method described in the first aspect are implemented.
[0013] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0014] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0015] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method described in the first aspect.
[0016] In an embodiment of the present application, the electronic device determines to write part of the target data into the storage device through a write accelerator based on the first information of the target data and the second information of the storage device; thereby reducing the number of data transfers while ensuring a good user writing experience, thereby reducing the number of erase times used by the storage device, thereby improving the service life and performance of the storage device. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A flowchart showing the steps of the data processing method provided in an embodiment of the present application;
[0018] Figure 2 An example diagram showing a data processing method provided by an embodiment of the present application;
[0019] Figure 3 A schematic diagram showing the structure of a data processing device provided in an embodiment of the present application;
[0020] Figure 4 One of the structural schematic diagrams of the electronic device provided in the embodiment of the present application is shown;
[0021] Figure 5 The second structural schematic diagram shows the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0023] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0024] The data processing method provided in the embodiment of the present application is described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.
[0025] like Figure 1 As shown, an embodiment of the present application provides a data processing method, the method comprising:
[0026] Step 101, when a write request for target data is detected, determining whether to write the target data into a storage device through a write accelerator according to target information;
[0027] Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
[0028] It should be noted that writing data through the write accelerator WB will result in one more data transfer, and transferring data requires consuming the number of erasures of the storage device, and the life calculation method of the storage device is to count the number of erasures, so reducing the number of WB writes can increase the service life of the storage device. Therefore, in the embodiment of the present application, the electronic device determines to write part of the target data to the storage device through the write accelerator WB based on the first information of the target data and the second information of the storage device; thereby reducing the number of data transfers while ensuring a good user writing experience of WB, thereby reducing the number of erasures used by the storage device, so as to improve the service life and performance of the storage device.
[0029] In at least one embodiment of the present application, step 101 includes:
[0030] Determine write instruction information based on the first information of the target data using a central processing unit;
[0031] The storage device is used to determine whether to write the target data into the storage device through the write accelerator based on the write indication information and second information of the storage device.
[0032] Optionally, the write indication information is used to indicate whether the central processing unit decides to write the target data to the storage device through the write accelerator. The decision can be understood as a suggestion of the processor, for example, the central processing unit suggests writing the target data to the storage device through the write accelerator, or the central processing unit suggests not writing the target data to the storage device through the write accelerator.
[0033] The electronic device in the embodiment of the present application includes a central processing unit CPU and a storage device.
[0034] In an optional embodiment, the CPU provides data type and foreground and background information of the data, and decides whether to recommend writing the data through WB, and then sends the decision information to the storage device. The storage device can selectively not write some data through WB when WB is normally open, thereby improving the service life of the storage device.
[0035] It should be noted that if there is a certain amount of remaining space but the device is severely fragmented, if data is written to the above storage device through WB, it is necessary to first perform garbage collection (i.e., defragmentation to free up clean space for writing data) in one area to get a clean SLC, then write data to the clean SLC, and then perform garbage collection in another area to get a clean TLC. This will cause the storage device to have frequent garbage collection, and trigger foreground garbage collection during continuous writing (i.e., the storage device is doing garbage collection while writing data), which seriously affects performance. If WB writing is not performed on the above storage device, the storage device does not need to frequently perform garbage collection to free up clean SLC, but only needs to free up clean TLC, which will greatly reduce the possibility of foreground garbage collection.
[0036] In another optional embodiment, the storage device comprehensively determines whether to write data through WB based on its own remaining space and / or the degree of device fragmentation, so that a storage device with a certain amount of remaining space but severe device fragmentation does not write data through WB, thereby reducing the possibility of triggering foreground garbage collection and greatly reducing the serious performance degradation caused by triggering foreground garbage collection during the writing process.
[0037] As an optional embodiment, using a central processor to determine the write instruction information based on the first information of the target data includes:
[0038] In a case where the first information satisfies a first condition, the write instruction information instructs the target data to be written into the storage device through the write accelerator;
[0039] The first condition includes at least one of the following:
[0040] The initiating application of the target data is a foreground application;
[0041] The initiating thread of the target data belongs to the hot thread whitelist;
[0042] The type of the target data belongs to the hotspot type whitelist.
[0043] As an optional embodiment, before the step of using the storage device to determine whether to write the target data into the storage device through the write accelerator based on the write indication information and the second information of the storage device, the method further includes:
[0044] A write command is sent to the storage device through the central processing unit, and a preset field of the write command carries the write indication information.
[0045] For example, bit 2 of byte 1 of a write command has a reserved field "Reserved", and the CPU uses the "Reserved" field to carry write indication information, for example: a WB write mark is 1, and a non-WB write mark is 0.
[0046] As an optional embodiment, the determining, by using the storage device based on the write indication information and the second information of the storage device, whether to write the target data into the storage device through the write accelerator includes:
[0047] When the write indication information and the second information of the storage device satisfy a second condition, determining to write the target data into the storage device through the write accelerator;
[0048] The second condition includes any one of the following:
[0049] The write indication information indicates that the target data is written into the storage device through the write accelerator, and the remaining space of the storage device is greater than or equal to a first threshold;
[0050] The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a first threshold and greater than a second threshold, and the fragmentation degree of the storage device is less than or equal to a fourth threshold;
[0051] The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a second threshold and greater than a third threshold, and the fragmentation degree of the storage device is less than or equal to a fifth threshold;
[0052] Among them, the first threshold is greater than the second threshold, the second threshold is greater than the third threshold; and the fourth threshold is greater than the fifth threshold.
[0053] In an optional implementation, the degree of fragmentation of the storage device can be divided into three levels: "A" represents no fragmentation or slight fragmentation, and the degree of fragmentation is less than or equal to the fifth threshold; "B" represents moderate fragmentation, and the degree of fragmentation is less than or equal to the fourth threshold; "C" represents severe fragmentation, and the degree of fragmentation is greater than or equal to the sixth threshold.
[0054] In another optional implementation, the strategy for determining the degree of fragmentation of the storage device may be to increase the statistics of the write data delay within the last 3 seconds and the emergency garbage collection warning of the device; wherein,
[0055] If the maximum latency during this period is less than 30ms and there is no emergency garbage collection warning, the fragmentation level of the storage device is A;
[0056] If the maximum latency during this period is greater than 30ms and less than 100ms and there is no emergency garbage collection warning, the fragmentation level of the storage device is B;
[0057] If the maximum delay during this period is greater than 100 ms and there is no emergency garbage collection warning, or there is an emergency garbage collection warning, the fragmentation degree of the storage device is C.
[0058] For example, the data processing method provided in the embodiment of the present application includes:
[0059] When the host (such as the CPU) is ready to initiate data writing, it determines whether it is initiated by the foreground application. If so, it is decided to write to WB; if not, it determines whether it is hot data. If it is hot data, it is decided to write to WB, and if not, it is decided to write to non-WB. For hot data, the judgment strategy is:
[0060] Create a hot thread whitelist to distinguish data initiation threads, such as kswapd threads, memory fusion threads, update_engine threads for over-the-air download technology OTA upgrades, and file system GC threads;
[0061] Create a hotspot type whitelist based on data type, such as file system metadata, database files, etc.
[0062] For example, add a hot thread whitelist and a hot type whitelist in the code of the file system of the electronic device; Figure 2 As shown, when a data write operation is to be performed, the file system first determines whether the initiator of the data write is a foreground application;
[0063] If it is a foreground application, the decision is to write to WB;
[0064] If it is not a foreground application, determine whether the thread initiating the data is in the hot thread whitelist;
[0065] If it is in the hot thread whitelist, the decision WB is written;
[0066] If it is neither a foreground application nor the initiating thread is in the hot thread whitelist, determine whether the data type is in the hot type whitelist;
[0067] If it is in the hotspot type whitelist, the decision WB is written;
[0068] If it is not in the hotspot type whitelist, the decision is not WB write;
[0069] The host side sends the data to be written along with the decision of whether to write WB to the storage subsystem to transfer the information to the storage device;
[0070] After the storage device receives the data write request sent by the host, if it determines that the decision conclusion of the host side is non-WB write, it performs the non-WB write operation;
[0071] If the host side's decision is to perform WB writing, the storage device determines the remaining space, and performs WB writing if the remaining space is greater than 50%;
[0072] If the remaining space is less than or equal to 50%, determine whether the remaining space is greater than 20%. If the remaining space is greater than 20%, determine whether the device fragmentation degree is A / B.
[0073] If it is A / B, perform WB write;
[0074] If not A / B, perform non-WB write;
[0075] If the remaining space is less than or equal to 20%, determine whether the remaining space is greater than 5%. If not, perform non-WB write; if so, determine whether the device fragmentation degree is A. If it is A, perform WB write; if not A, perform non-WB write.
[0076] In summary, in the embodiment of the present application, the electronic device determines to write part of the target data into the storage device through the write accelerator WB based on the first information of the target data and the second information of the storage device; thereby reducing the number of data transfers while ensuring a good user writing experience of WB, thereby reducing the number of erase times used by the storage device, thereby improving the service life and performance of the storage device.
[0077] The data processing method provided in the embodiment of the present application can be executed by a data processing device. In the embodiment of the present application, the data processing device provided in the embodiment of the present application is described by taking the data processing method executed by the data processing device as an example.
[0078] like Figure 3 As shown, the embodiment of the present application further provides a data processing device 300, wherein the device 300 includes:
[0079] The determination module 301 is used to determine whether to write the target data into the storage device through the write accelerator according to the target information when a write request of the target data is detected:
[0080] Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
[0081] As an optional embodiment, the determining module includes:
[0082] A first determining submodule, configured to determine write instruction information based on the first information of the target data using a central processing unit;
[0083] The second determination submodule is configured to determine, using the storage device based on the write indication information and second information of the storage device, whether to write the target data into the storage device through the write accelerator.
[0084] As an optional embodiment, the first determining submodule includes:
[0085] a first determining unit, configured to, when the first information satisfies a first condition, instruct, using the write indication information, to write the target data into the storage device through the write accelerator;
[0086] The first condition includes at least one of the following:
[0087] The initiating application of the target data is a foreground application;
[0088] The initiating thread of the target data belongs to the hot thread whitelist;
[0089] The type of the target data belongs to the hotspot type whitelist.
[0090] As an optional embodiment, the device further includes:
[0091] A sending unit is used to send a write command to the storage device through the central processing unit, and a preset field of the write command carries the write indication information.
[0092] As an optional embodiment, the second determining submodule includes:
[0093] a second determining unit, configured to determine, if the write indication information and the second information of the storage device satisfy a second condition, to write the target data into the storage device through the write accelerator;
[0094] The second condition includes any one of the following:
[0095] The write indication information indicates that the target data is written into the storage device through the write accelerator, and the remaining space of the storage device is greater than or equal to a first threshold;
[0096] The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a first threshold and greater than a second threshold, and the fragmentation degree of the storage device is less than or equal to a fourth threshold;
[0097] The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a second threshold and greater than a third threshold, and the fragmentation degree of the storage device is less than or equal to a fifth threshold;
[0098] Among them, the first threshold is greater than the second threshold, the second threshold is greater than the third threshold; and the fourth threshold is greater than the fifth threshold.
[0099] In an embodiment of the present application, the electronic device determines to write part of the target data into the storage device through the write accelerator WB based on the first information of the target data and the second information of the storage device; thereby reducing the number of data transfers while ensuring a good user writing experience of WB, thereby reducing the number of erase times used by the storage device, thereby improving the service life and performance of the storage device.
[0100] It should be noted that the data processing device provided in the embodiment of the present application is a device capable of executing the above-mentioned data processing method. All embodiments of the above-mentioned data processing method are applicable to the device and can achieve the same or similar beneficial effects, which will not be repeated here.
[0101] The data processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0102] The data processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0103] The data processing device provided in the embodiment of the present application can realize Figure 1 to Figure 2 To avoid repetition, the various processes implemented by the method embodiment are not described here.
[0104] Alternatively, if Figure 4 As shown, an embodiment of the present application also provides an electronic device 400, including a processor 401 and a memory 402, wherein the memory 402 stores programs or instructions that can be executed on the processor 401, and when the program or instructions are executed by the processor 401, the various steps of the above-mentioned data processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.
[0105] It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and non-mobile electronic devices mentioned above.
[0106] Figure 5 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.
[0107] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, and a processor 510.
[0108] Those skilled in the art will appreciate that the electronic device 500 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 510 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Figure 5 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.
[0109] The processor 510 is configured to determine whether to write the target data into the storage device through the write accelerator according to the target information when a write request for the target data is detected;
[0110] Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
[0111] Optionally, the processor 510 is further configured to determine, according to the target information, whether to write the target data into the storage device through the write accelerator when a write request for the target data is detected;
[0112] Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
[0113] Optionally, the processor 510 is further configured to, when the first information satisfies a first condition, instruct the write indication information to write the target data into the storage device through the write accelerator;
[0114] The first condition includes at least one of the following:
[0115] The initiating application of the target data is a foreground application;
[0116] The initiating thread of the target data belongs to the hot thread whitelist;
[0117] The type of the target data belongs to the hotspot type whitelist.
[0118] Optionally, the radio frequency unit 501 is further configured to send a write command to the storage device through the central processor, and a preset field of the write command carries the write indication information.
[0119] Optionally, the processor 510 is further configured to determine to write the target data into the storage device through the write accelerator when the write indication information and the second information of the storage device meet a second condition;
[0120] The second condition includes any one of the following:
[0121] The write indication information indicates that the target data is written into the storage device through the write accelerator, and the remaining space of the storage device is greater than or equal to a first threshold;
[0122] The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a first threshold and greater than a second threshold, and the fragmentation degree of the storage device is less than or equal to a fourth threshold;
[0123] The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a second threshold and greater than a third threshold, and the fragmentation degree of the storage device is less than or equal to a fifth threshold;
[0124] Among them, the first threshold is greater than the second threshold, the second threshold is greater than the third threshold; and the fourth threshold is greater than the fifth threshold.
[0125] In an embodiment of the present application, the electronic device determines to write part of the target data into the storage device through the write accelerator WB based on the first information of the target data and the second information of the storage device; thereby reducing the number of data transfers while ensuring a good user writing experience of WB, thereby reducing the number of erase times used by the storage device, thereby improving the service life and performance of the storage device.
[0126] It should be noted that the electronic device provided in the embodiment of the present application is an electronic device capable of executing the above-mentioned data processing method. All embodiments of the above-mentioned data processing method are applicable to the electronic device and can achieve the same or similar beneficial effects, which will not be repeated here.
[0127] It should be understood that in the embodiment of the present application, the input unit 504 may include a graphics processor (GPU) 5041 and a microphone 5042, and the graphics processor 5041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 506 may include a display panel 5061, and the display panel 5061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 507 includes a touch panel 5071 and at least one of other input devices 5072. The touch panel 5071 is also called a touch screen. The touch panel 5071 may include two parts: a touch detection device and a touch controller. Other input devices 5072 may include, but are not limited to, a physical keyboard, function keys (such as a volume control button, a switch button, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0128] The memory 509 can be used to store software programs and various data. The memory 509 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 509 may include a volatile memory or a non-volatile memory, or the memory x09 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 509 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.
[0129] The processor 510 may include one or more processing units; optionally, the processor 510 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 510.
[0130] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the various processes of the above-mentioned data processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0131] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.
[0132] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0133] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0134] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned data processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0135] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0136] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0137] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data processing method, characterized in that: The method comprises: In the case of detecting a write request for target data, determining whether to write the target data into a storage device through a write accelerator according to the target information; Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
2. The method according to claim 1, characterized in that The step of determining whether to write the target data into the storage device through the write accelerator according to the target information includes: Determine write instruction information based on the first information of the target data using a central processing unit; The storage device is used to determine whether to write the target data into the storage device through the write accelerator based on the write indication information and second information of the storage device.
3. The method according to claim 2, characterized in that Determining write instruction information based on the first information of the target data by using a central processing unit includes: In a case where the first information satisfies a first condition, the write instruction information instructs the target data to be written into the storage device through the write accelerator; The first condition includes at least one of the following: The initiating application of the target data is a foreground application; The initiating thread of the target data belongs to the hot thread whitelist; The type of the target data belongs to the hotspot type whitelist.
4. The method according to claim 2, characterized in that: Before the step of using the storage device to determine whether to write the target data into the storage device through the write accelerator based on the write indication information and the second information of the storage device, the method further includes: A write command is sent to the storage device through the central processing unit, and a preset field of the write command carries the write indication information.
5. The method according to claim 2, characterized in that: The using the storage device to determine whether to write the target data into the storage device through the write accelerator based on the write indication information and the second information of the storage device includes: When the write indication information and the second information of the storage device satisfy a second condition, determining to write the target data into the storage device through the write accelerator; The second condition includes any one of the following: The write indication information indicates that the target data is written into the storage device through the write accelerator, and the remaining space of the storage device is greater than or equal to a first threshold; The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a first threshold and greater than a second threshold, and the fragmentation degree of the storage device is less than or equal to a fourth threshold; The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a second threshold and greater than a third threshold, and the fragmentation degree of the storage device is less than or equal to a fifth threshold; Among them, the first threshold is greater than the second threshold, the second threshold is greater than the third threshold; and the fourth threshold is greater than the fifth threshold.
6. A data processing device, characterized in that: Applied to electronic equipment, the device comprises: A determination module, configured to determine whether to write the target data into a storage device through a write accelerator according to target information when a write request for target data is detected: Among them, the target information includes: first information of the target data and second information of the storage device; the first information of the target data includes at least one of the following: an initiating application of the target data, an initiating thread of the target data, and a type of the target data; the second information of the storage device includes at least one of the following: the remaining space of the storage device and the degree of fragmentation of the storage device.
7. The device according to claim 6, characterized in that The determination module comprises: A first determining submodule, configured to determine write instruction information based on the first information of the target data using a central processing unit; The second determination submodule is configured to determine, using the storage device based on the write indication information and second information of the storage device, whether to write the target data into the storage device through the write accelerator.
8. The device according to claim 7, characterized in that The first determining submodule includes: a first determining unit, configured to, when the first information satisfies a first condition, instruct, using the write indication information, to write the target data into the storage device through the write accelerator; The first condition includes at least one of the following: The initiating application of the target data is a foreground application; The initiating thread of the target data belongs to the hot thread whitelist; The type of the target data belongs to the hotspot type whitelist.
9. The device according to claim 7, characterized in that The device also includes: A sending unit is used to send a write command to the storage device through the central processing unit, and a preset field of the write command carries the write indication information.
10. The device according to claim 7, characterized in that The second determining submodule includes: a second determining unit, configured to determine, if the write indication information and the second information of the storage device satisfy a second condition, to write the target data into the storage device through the write accelerator; The second condition includes any one of the following: The write indication information indicates that the target data is written into the storage device through the write accelerator, and the remaining space of the storage device is greater than or equal to a first threshold; The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a first threshold and greater than a second threshold, and the fragmentation degree of the storage device is less than or equal to a fourth threshold; The write indication information indicates that the target data is written into the storage device through the write accelerator, the remaining space of the storage device is less than a second threshold and greater than a third threshold, and the fragmentation degree of the storage device is less than or equal to a fifth threshold; Among them, the first threshold is greater than the second threshold, the second threshold is greater than the third threshold; and the fourth threshold is greater than the fifth threshold.
11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores programs or instructions that can be run on the processor, and when the programs or instructions are executed by the processor, the steps of the data processing method according to any one of claims 1 to 5 are implemented.
12. A readable storage medium, characterized in that: The readable storage medium stores programs or instructions, and when the programs or instructions are executed by the processor, the steps of the data processing method according to any one of claims 1 to 5 are implemented.
