CPU-based memory management method, system and equipment and storage medium

By dividing the memory into multiple buffers and using the CPU to process application and usage information, the problem of low buffer resource utilization in the prior art is solved, and the working efficiency of the firmware and system performance are improved.

CN118550698APending Publication Date: 2024-08-27HANGZHOU CORE POWER SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410639064.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-22
Publication Date
2024-08-27

AI Technical Summary

Technical Problem

When the existing storage controller manages the memory buffer, the resource utilization rate is low, resulting in the buffer not being used in time, affecting system performance, and frequent application and release operations reduce efficiency.

Method used

By dividing the memory into multiple buffers, the CPU is used to process buffer application and usage information, and generate corresponding allocation and release instructions, thereby improving the flexibility and utilization of the buffer and reducing frequent application and release operations.

Benefits of technology

Improves firmware efficiency, reduces buffer waste, and improves memory utilization and system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118550698A
    Figure CN118550698A
Patent Text Reader

Abstract

The invention provides a memory management method, system and equipment based on a CPU (Central Processing Unit) and a storage medium. The method comprises the following steps of: dividing a memory into a plurality of buffers; the buffer is used for storing basic data and metadata; receiving buffer application information of the host firmware, generating a buffer allocation instruction according to the buffer application information, and sending the buffer allocation instruction to the storage controller, so that the storage controller allocates a plurality of buffers to the host firmware, and writes storage basic data and metadata into the storage controller; and receiving buffer use information of the host firmware, generating a buffer use instruction according to the buffer use information, and issuing the buffer use instruction to the storage controller, so that the storage controller allocates a buffer to the host firmware according to the buffer use instruction. According to the method and the device, a plurality of buffers can be distributed for the firmware at one time according to the buffer application information of the firmware, and when the firmware needs to use the buffers, the buffers can be selected from the applied buffers, so that the working efficiency of the firmware is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of storage controllers, and in particular to a CPU-based memory management method, system, device and storage medium. Background Art

[0002] At present, the storage controller generally uses the CPU to manage the memory buffer of the storage. Every time the firmware needs to apply for a buffer, it needs to scan the memory buffer to determine whether the corresponding buffer has been applied for. In addition, the management of each buffer is relatively simple, and the use of the buffer is not flexible enough, which may cause the buffer to not be used in time, resulting in a waste of buffer resources and reducing the utilization rate of memory. In addition, the data cached in the buffer is often read and written frequently, and the status information of the buffer will also change continuously. Applying and releasing the buffer through the firmware will affect the system performance of the entire storage controller. Summary of the invention

[0003] In view of this, the purpose of the present invention is to overcome the deficiencies in the prior art and to provide a CPU-based memory management method, system, device and storage medium.

[0004] The present invention provides the following technical solutions:

[0005] In a first aspect, the present application provides a CPU-based memory management method, which is applied to a memory management system, wherein the memory management system includes a CPU, a storage controller and a host, wherein the storage controller is connected to the CPU and the host respectively, and the storage controller includes a memory, including:

[0006] Dividing the memory into a plurality of buffers; the buffers are used to store basic data and metadata;

[0007] receiving buffer application information of the host firmware, generating a buffer allocation instruction according to the buffer application information, and sending the buffer allocation instruction to the storage controller so that the storage controller allocates a plurality of the buffers to the host firmware, and writes the storage basic data and metadata into the storage controller;

[0008] Receive the buffer usage information of the host firmware, generate a buffer usage instruction according to the buffer usage information and send it to the storage controller, so that the storage controller allocates the buffer to the host firmware according to the buffer usage instruction.

[0009] In one embodiment, the storage controller includes a bus parsing module and a host parsing module, and the receiving of buffer application information from the host firmware, generating a buffer allocation instruction according to the buffer application information, and sending the buffer allocation instruction to the storage controller includes:

[0010] Using a host analysis module to receive the buffer application information of the host firmware, and sending the buffer application information to the bus analysis module;

[0011] forwarding the buffer request information to the CPU through the bus parsing module;

[0012] The CPU processes the buffer application information to obtain the buffer allocation instruction, and sends the buffer allocation instruction to the storage controller through the bus parsing module.

[0013] In one embodiment, the memory management system includes a flash memory chip, and the receiving of the buffer usage information of the host firmware, generating a buffer usage instruction according to the buffer usage information and sending the instruction to the storage controller includes:

[0014] determining a type of the buffer usage information;

[0015] If it is write operation information, generating a write instruction according to the write operation information, and sending the write instruction to the storage controller, so that the storage controller writes the write operation information into the flash memory chip through the buffer;

[0016] If it is read operation information, a read instruction is generated according to the read operation information, and the read instruction is sent to the storage controller, so that the storage controller stores the target read content in the flash memory chip into the buffer.

[0017] In one embodiment, the storage controller includes a buffer management module, and the step of enabling the storage controller to allocate the buffer to the host firmware according to the buffer use instruction includes:

[0018] Obtaining the buffer usage quantity in the buffer usage information through the buffer management module, and determining whether the buffer usage quantity is greater than the remaining quantity of the buffer;

[0019] If the used number of buffers is greater than the remaining number of buffers, buffer application information is generated and sent to the buffer management module to apply for the target number of buffers.

[0020] In one embodiment, after causing the storage controller to allocate the buffer to the host firmware according to the buffer use instruction, the method includes:

[0021] Determining whether data transmission of a used buffer in the buffer has been completed;

[0022] If it is completed, a releasable flag is added to the used buffer, and the memory of the used buffer with the releasable flag is released.

[0023] In one implementation, the determining whether data transmission of a used buffer in the buffer has been completed includes:

[0024] Periodically acquiring status information of the buffer, wherein the status information includes transmitting, transmitting completed, and idle;

[0025] The buffer whose status information indicates that the transmission is completed is used as a first target buffer, the memory of the first target buffer is released, and the status information of the first target buffer is updated to be idle.

[0026] In one implementation, the periodically obtaining the status information of the buffer includes:

[0027] Assigning initial state information to each buffer through the buffer management module, wherein the initial state information is idle;

[0028] Determine whether the buffer is allocated to the host firmware, and if so, periodically obtain status information of the allocated second target buffer.

[0029] In a second aspect, the present application provides a CPU-based memory management system, including:

[0030] A partitioning module, used for partitioning the memory into a plurality of buffers; the buffers are used for storing basic data and metadata;

[0031] a receiving module, configured to receive buffer application information of the host firmware, generate a buffer allocation instruction according to the buffer application information, and send the buffer allocation instruction to the storage controller, so that the storage controller allocates a plurality of the buffers to the host firmware, and writes the storage basic data and metadata into the storage controller;

[0032] The allocation module is used to receive the buffer usage information of the host firmware, generate a buffer usage instruction according to the buffer usage information, and send it to the storage controller, so that the storage controller allocates the buffer to the host firmware according to the buffer usage instruction.

[0033] In a third aspect, the present application provides an electronic device comprising a memory and at least one processor, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the CPU-based memory management method as described in the first aspect.

[0034] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed, the CPU-based memory management method as described in the first aspect is implemented.

[0035] The embodiments of the present invention have the following beneficial effects:

[0036] The CPU-based memory management method provided by the present invention can allocate multiple buffers to the firmware at one time by dividing the memory into multiple buffers and then according to the buffer application information of the firmware. When the firmware needs to use the buffer, it can select from the applied buffers without having to apply for it every time it is used, thereby improving the working efficiency of the firmware.

[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and understandable, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 A schematic diagram of a CPU-based memory management method flow is shown;

[0040] Figure 2 A schematic diagram of a memory management system connection relationship is shown;

[0041] Figure 3 A schematic flow chart of a buffer working method is shown;

[0042] Figure 4 A schematic flow chart of a buffer allocation method is shown;

[0043] Figure 5 A schematic diagram of the connection relationship of a buffer management module is shown;

[0044] Figure 6 A schematic diagram of the structure of a buffer management module is shown;

[0045] Figure 7 A schematic diagram of a bus analysis module functional module is shown;

[0046] Figure 8 A schematic diagram of the framework structure of a CPU-based memory management system is shown.

[0047] Explanation of main component symbols: 100-CPU; 200-host; 300-storage controller; 400-flash memory chip; 500-bus analysis module; 600-host analysis module; 700-buffer management module; 800-chip management module; 501-bus bridge module; 502-register control module; 503-modulator module; 504-command analysis module; 505-host control module; 506-chip control module; 701-buffer management unit; 702-buffer; 7011-buffer setting subunit; 7012-buffer clearing subunit; 7013-buffer status subunit; 7014-buffer; 900-CPU-based memory management system; 901-division module; 902-receiving module; 903-allocation module. DETAILED DESCRIPTION

[0048] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0049] The terms "first", "first", "second", "third", "fourth", "fif ...

[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein in the specification of the template are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0051] Example 1

[0052] See also Figure 1 , Figure 1 The CPU-based memory management method provided in this embodiment can be applied to various memory management systems to improve the working efficiency of firmware. The method includes:

[0053] S101. Divide a memory into a plurality of buffers; the buffers are used to store basic data and metadata.

[0054] See also Figure 2 , Figure 2 A schematic diagram of the connection relationship of a memory management system provided in this embodiment.

[0055] The memory management system includes a CPU 100 , a storage controller 300 and a host 200 , wherein the storage controller 300 is connected to the CPU 100 and the host 200 , respectively, and the storage controller 300 includes a memory.

[0056] Specifically, the memory is first divided into multiple buffers, each buffer stores part of the metadata and space for storing basic data, wherein the metadata is mainly used to describe the properties and related information of the stored basic data, and can be regarded as an electronic catalog.

[0057] After dividing the memory into multiple buffers, different information can be stored in different buffers, thereby improving the working efficiency of the memory.

[0058] S102, receiving buffer request information from the host firmware, generating a buffer allocation instruction based on the buffer request information, and sending the buffer allocation instruction to the storage controller so that the storage controller allocates multiple buffers to the host firmware and writes the storage basic data and metadata into the storage controller.

[0059] See also Figure 2 The storage controller 300 further includes a buffer management module 700, a bus analysis module 500 and a host analysis module 600. The bus analysis module 500 is respectively connected to the CPU 100 and the buffer management module 700. The bus analysis module 500 is also connected to the host analysis module 600, and the host analysis module 600 is connected to the host 200.

[0060] In one embodiment, receiving buffer request information from host firmware, generating a buffer allocation instruction according to the buffer request information, and sending the buffer allocation instruction to the storage controller includes:

[0061] Utilize the host analysis module 600 to receive the buffer application information of the firmware of the host 200, and send the buffer application information to the bus analysis module 500;

[0062] forwarding the buffer request information to the CPU 100 through the bus analysis module 500;

[0063] The CPU 100 processes the buffer application information to obtain the buffer allocation instruction, and sends the buffer allocation instruction to the storage controller 300 through the bus parsing module 500 .

[0064] Specifically, the bus analysis module 500 can be used to receive control information from the CPU 100 to control the buffer management module 700 , and can also feed back the status information of the buffer 7014 in the buffer management module 700 to the CPU 100 .

[0065] See also Figure 3 , step S102 further includes:

[0066] S1021. Determine the type of the buffer usage information.

[0067] When the host 200 operates the chip, there are usually two types of operations, namely, read operation and write operation. The read operation is used to read information in the chip, and the write operation is to write new information into the chip for storage. Different operation types correspond to different buffer usage methods.

[0068] S1022: If it is write operation information, generate a write instruction according to the write operation information, and send the write instruction to the storage controller, so that the storage controller writes the write operation information into the flash memory chip through the buffer.

[0069] See also Figure 2 The memory management system further includes a flash memory chip 400 and a chip management module 800. The chip management module 800 is connected to the flash memory chip 400, the bus parsing module 500 and the buffer management module 700 respectively.

[0070] Specifically, the host 200 first sends the write operation information to the CPU 100 through the bus parsing module 500 via the host parsing module 600. The CPU 100 generates a write instruction based on the write operation information, and then sends the write instruction to the buffer management module 700. The CPU 100 then controls the chip management module 800 to read data from the buffer management module 700 and write it into the flash memory chip 400.

[0071] S1023: If it is read operation information, generate a read instruction according to the read operation information, and send the read instruction to the storage controller, so that the storage controller stores the target read content in the flash memory chip into the buffer.

[0072] Specifically, the host 200 first sends the read operation information to the CPU 100 through the bus parsing module 500 via the host parsing module 600. The CPU 100 generates a read instruction based on the read operation information, and then sends the read instruction to the buffer management module 700. The CPU 100 then controls the chip management module 800 to read data from the flash memory chip 400, and sends the read data to the host 200 through the buffer management module 700.

[0073] S103: Receive buffer usage information of the host firmware, generate a buffer usage instruction according to the buffer usage information, and send the buffer usage instruction to the storage controller, so that the storage controller allocates the buffer to the host firmware according to the buffer usage instruction.

[0074] See also Figure 4 , step S103 includes:

[0075] S1031. Obtain the buffer usage quantity in the buffer usage information through the buffer management module, and determine whether the buffer usage quantity is greater than the remaining quantity of the buffer.

[0076] Specifically, the firmware can apply for a certain number of buffers according to demand after applying for the buffers for the first time, but the total number of buffers is limited. For example, if ten buffers are applied for the first time, and one buffer is used each time, then when it is used for the eleventh time, even if the use information is sent, there will be no extra buffers to allocate.

[0077] S1032: If the number of used buffers is greater than the remaining number of buffers, generate buffer application information, and send the buffer application information to the buffer management module to apply for the target number of buffers.

[0078] When the remaining buffers cannot meet the usage requirements, it is necessary to re-apply for buffers, that is, regenerate buffer application information and then send it to the buffer management module 700. The buffer management module 700 reallocates the target number of buffers to the firmware from the available buffers.

[0079] See also Figure 5 and Figure 6 , Figure 5 and Figure 6 A schematic diagram of the structure of a buffer management module provided in this embodiment.

[0080] The buffer management module 700 includes a buffer management unit 701 and a buffer 702. The buffer management unit 701 includes a buffer setting subunit 7011, a buffer clearing subunit 7012, a buffer status subunit 7013 and a buffer 7014. The buffer setting subunit 7011, the buffer clearing subunit 7012 and the buffer status subunit 7013 are all registers.

[0081] The buffer management unit 701 is connected to the bus analysis module 500 and the buffer 702 respectively, and the buffer 702 is connected to the host analysis module 600 and the chip management module 800 respectively.

[0082] The buffer 702 is used to temporarily store the read or write data received by the host analysis module 600 from the host 200, and then store it in the buffer 7014, or forward it to the chip management module 800. Alternatively, the data of the chip management module 800 is sent to the host 200 through the host analysis module 600, which can be regarded as an information temporary storage and transfer tool. All information in the buffer 7014 needs to be accessed through the buffer 702.

[0083] The buffer setting subunit 7011 is used to receive buffer setting information of the bus analysis module 500 , so as to control the status information of the corresponding buffer 7014 .

[0084] The buffer clearing subunit 7012 is used to receive clearing information from the bus analysis module 500, thereby clearing the status information of the buffer 7014. In addition, a lock mark can be added to a specific buffer through the buffer setting subunit 7011, and the buffer with the lock mark cannot be released by hardware and can only be released by the buffer clearing subunit 7012.

[0085] The buffer status subunit 7013 is used to send the status information of the buffer 7014 to the CPU 100 through the bus analysis module 500 .

[0086] In one embodiment, after causing the storage controller to allocate the buffer to the host firmware according to the buffer use instruction, the method includes:

[0087] Determine whether data transmission of the used buffer in the buffer 7014 has been completed;

[0088] If it is completed, a releasable flag is added to the used buffer, and the memory of the used buffer with the releasable flag is released.

[0089] Specifically, since the number of buffers 7014 is limited, if buffers 7014 continue to be occupied after data transmission is completed, there will be a situation where available buffers 7014 are getting fewer and fewer. In order to avoid the occurrence of this situation, the existing technology usually utilizes firmware to release the buffers 7014 after data transmission is completed.

[0090] However, releasing buffer 7014 through firmware may result in buffer 7014 not being utilized in a timely manner. Furthermore, if the number of available buffers 7014 is insufficient, the application process may be delayed, making the waiting time for the application too long.

[0091] Therefore, in this embodiment, the CPU adds a releasable flag to the buffer after data transmission is completed, and regularly releases the memory, so that when the firmware needs to apply for the buffer, it does not need to release it temporarily, thereby improving the utilization rate of the buffer.

[0092] In one implementation, the determining whether data transmission of a used buffer in the buffer has been completed includes:

[0093] Periodically acquiring status information of the buffer, wherein the status information includes transmitting, transmitting completed, and idle;

[0094] The buffer whose status information indicates that the transmission is completed is used as a first target buffer, the memory of the first target buffer is released, and the status information of the first target buffer is updated to be idle.

[0095] Specifically, each buffer 7014 may be assigned an initial state information through the buffer management module 700, and the initial state information of each buffer 7014 is idle. As the buffer 7014 changes over time, its state will also change, so the state information of the buffer 7014 may be obtained periodically.

[0096] If the buffer 7014 has been allocated to the host 200 firmware, the status information of the allocated second target buffer 7014 is periodically obtained.

[0097] When it is found that there is a first target buffer, the memory of the first target buffer can be released in time, or when the number of first target buffers reaches a preset number, the memory can be released collectively, thereby improving the utilization rate of the buffer 7014.

[0098] Specifically, when buffer 7014 is allocated to the firmware, it is used as the second buffer, and the status information of the second buffer is monitored periodically or in real time. When the data transmission of the second buffer is completed, it is regarded as the first buffer, indicating that the memory can be released at this time. If buffer 7014 is not allocated to the firmware, its status information may not be monitored, or the monitoring frequency may be reduced, thereby reducing the workload of CPU 100.

[0099] See also Figure 7 , Figure 7 A schematic diagram of a bus parsing module functional module provided in this embodiment.

[0100] The bus parsing module 500 includes: a bus bridge module 501 , a register control module 502 , a modulator module 503 , a command parsing module 504 , a host control module 505 and a chip control module 506 .

[0101] The register control module 502 is connected to the modulator module 503 and the bus bridge module 501 respectively, and is used to operate the management registers of the buffer separately, such as the buffer setting subunit 7011, the buffer clearing subunit 7012 and the buffer status subunit 7013.

[0102] The command parsing module 504 is connected to the modulator module 503 and the bus bridge module 501 respectively, and is used to parse the commands from the CPU 100 so as to operate the management register of the buffer.

[0103] The host control module 505 is connected to the bus bridge module 501 and the host analysis module 600 respectively, and is used to implement various operations of the CPU on the host analysis module.

[0104] The chip control module 506 is connected to the bus bridge module 501 and the chip management module 800 respectively, and is used to implement various operations of the CPU on the chip management module.

[0105] The modulator module 503 is connected to the register control module 502 and the command parsing module 504 respectively, and is used to select whether the current CPU operates the buffer through register operation or through buffer command operation.

[0106] This embodiment implements the management of different components in the memory management system by the CPU by setting different management modules, thereby improving the comprehensive management capability of the CPU.

[0107] Example 2

[0108] See also Figure 8 The present application also provides a CPU-based memory management system 900, including:

[0109] A partitioning module 901 is used to partition the memory into a plurality of buffers; the buffers are used to store basic data and metadata;

[0110] The receiving module 902 is used to receive buffer application information of the host firmware, generate a buffer allocation instruction according to the buffer application information, and send the buffer allocation instruction to the storage controller so that the storage controller allocates a plurality of the buffers to the host firmware and writes the storage basic data and metadata into the memory;

[0111] The allocation module 903 is used to receive the buffer usage information of the host firmware, generate a buffer usage instruction according to the buffer usage information, and send it to the storage controller, so that the storage controller allocates the buffer to the host firmware according to the buffer usage instruction.

[0112] The CPU-based memory management system provided in this embodiment divides the memory into multiple buffers, and then allocates multiple buffers to the firmware at one time according to the buffer application information of the firmware. When the firmware needs to use the buffer, it can select from the applied buffers without having to apply for it every time it is used, thereby improving the working efficiency of the firmware.

[0113] It can be understood that the implementation method of the CPU-based memory management method described in the above embodiment 1 is also applicable to this embodiment, so it will not be repeated here.

[0114] Example 3

[0115] The embodiment of the present application also provides a computer device, for example, the computer device can be, but is not limited to, a desktop computer, a notebook, etc., and its existence form is not limited, mainly depending on whether it needs to support the interface display function of the browser web page, etc. Exemplarily, the computer device includes a memory and at least one processor, the memory stores a computer program, and the processor is used to execute the computer program to implement the CPU-based memory management method described in the above embodiment 1.

[0116] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU100), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. At least one. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0117] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0118] Furthermore, the memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function; the data storage area may store data (such as iteration data, version data, etc.) created according to the use of the computer device, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0119] Example 4

[0120] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to execute the CPU-based memory management method described in the above embodiment 1.

[0121] It can be understood that the implementation method of the CPU-based memory management method described in the above embodiment 1 is also applicable to this embodiment, so it will not be repeated here.

[0122] The computer-readable storage medium may be either a non-volatile storage medium or a volatile storage medium. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0123] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0124] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0125] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art, and the computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk.

[0126] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

[0127] In all examples shown and described herein, any specific values ​​should be interpreted as merely exemplary and not as limiting, and thus other examples of the exemplary embodiments may have different values.

[0128] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0129] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. It should be pointed out that for ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A CPU-based memory management method is applied to a memory management system, wherein the memory management system includes a CPU, a storage controller and a host, wherein the storage controller is connected to the CPU and the host respectively, and the storage controller includes a memory, wherein: include: Divide memory into multiple buffers; The buffer is used to store basic data and metadata; receiving buffer application information of the host firmware, generating a buffer allocation instruction according to the buffer application information, and sending the buffer allocation instruction to the storage controller so that the storage controller allocates a plurality of the buffers to the host firmware, and writes the storage basic data and metadata into the storage controller; Receive the buffer usage information of the host firmware, generate a buffer usage instruction according to the buffer usage information and send it to the storage controller, so that the storage controller allocates the buffer to the host firmware according to the buffer usage instruction.

2. According to the CPU-based memory management method of claim 1, the storage controller comprises a bus parsing module and a host parsing module, characterized in that: The receiving buffer application information of the host firmware, generating a buffer allocation instruction according to the buffer application information, and sending the buffer allocation instruction to the storage controller includes: Using a host analysis module to receive the buffer application information of the host firmware, and sending the buffer application information to the bus analysis module; forwarding the buffer request information to the CPU through the bus parsing module; The CPU processes the buffer application information to obtain the buffer allocation instruction, and sends the buffer allocation instruction to the storage controller through the bus parsing module.

3. The CPU-based memory management method according to claim 2, wherein the memory management system comprises a flash memory chip, wherein: The receiving the buffer usage information of the host firmware, generating a buffer usage instruction according to the buffer usage information and sending the instruction to the storage controller includes: determining a type of the buffer usage information; If it is write operation information, generating a write instruction according to the write operation information, and sending the write instruction to the storage controller, so that the storage controller writes the write operation information into the flash memory chip through the buffer; If it is read operation information, a read instruction is generated according to the read operation information, and the read instruction is sent to the storage controller, so that the storage controller stores the target read content in the flash memory chip into the buffer.

4. The CPU-based memory management method according to claim 2, wherein the storage controller comprises a buffer management module, characterized in that: The method of causing the storage controller to allocate the buffer to the host firmware according to the buffer use instruction comprises: Obtaining the buffer usage quantity in the buffer usage information through the buffer management module, and determining whether the buffer usage quantity is greater than the remaining quantity of the buffer; If the used number of buffers is greater than the remaining number of buffers, buffer application information is generated and sent to the buffer management module to apply for the target number of buffers.

5. The CPU-based memory management method according to claim 4, characterized in that: After enabling the storage controller to allocate the buffer to the host firmware according to the buffer use instruction, the method includes: Determining whether data transmission of a used buffer in the buffer has been completed; If it is completed, a releasable flag is added to the used buffer, and the memory of the used buffer with the releasable flag is released.

6. The CPU-based memory management method according to claim 5, characterized in that: The determining whether the data transmission of the used buffer in the buffer has been completed includes: Periodically acquiring status information of the buffer, wherein the status information includes transmitting, transmitting completed, and idle; The buffer whose status information indicates that the transmission is completed is used as a first target buffer, the memory of the first target buffer is released, and the status information of the first target buffer is updated to be idle.

7. The CPU-based memory management method according to claim 6, characterized in that: The periodically acquiring the status information of the buffer includes: Assigning initial state information to each buffer through the buffer management module, wherein the initial state information is idle; Determine whether the buffer is allocated to the host firmware, and if so, periodically obtain status information of the allocated second target buffer.

8. A CPU-based memory management system, characterized in that: include: A partitioning module for partitioning the memory into a plurality of buffers; The buffer is used to store basic data and metadata; a receiving module, configured to receive buffer application information of the host firmware, generate a buffer allocation instruction according to the buffer application information, and send the buffer allocation instruction to the storage controller, so that the storage controller allocates a plurality of the buffers to the host firmware, and writes the storage basic data and metadata into the storage controller; The allocation module is used to receive the buffer usage information of the host firmware, generate a buffer usage instruction according to the buffer usage information, and send it to the storage controller, so that the storage controller allocates the buffer to the host firmware according to the buffer usage instruction.

9. An electronic device, characterized in that: The method comprises a memory and at least one processor, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the CPU-based memory management method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the CPU-based memory management method according to any one of claims 1 to 7 is implemented.