CN-121979672-A - Memory processing method and device, memory management system, electronic equipment and chip
Abstract
The disclosure relates to a memory processing method, a memory processing device, a memory management system, electronic equipment and a chip, and belongs to the technical field of memory management. The method comprises the steps of responding to a memory processing request, adopting a target memory to perform memory allocation and memory recovery processing corresponding to the memory processing request, wherein the target memory is a memory allocated to target hardware of the electronic device by a processor of the electronic device, responding to a first quantity of idle memory in the target memory being smaller than a first set threshold value, requesting the processor to allocate the idle memory to the target hardware so as to increase the first quantity, and responding to the first quantity being larger than a second set threshold value, and releasing the idle memory to the processor so as to reduce the first quantity. Therefore, the processor can allocate the target memory to the target hardware, the target hardware can respond to the memory processing request, and the target memory is adopted for memory allocation and recovery processing, so that the load of the processor can be remarkably reduced, and the memory processing efficiency can be remarkably improved.
Inventors
- CHENG CONG
Assignees
- 北京玄戒技术有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20251230
Claims (20)
- 1. A memory processing method, comprising: responding to a memory processing request, and adopting a target memory to perform memory allocation and memory recovery processing corresponding to the memory processing request, wherein the target memory is the memory allocated to target hardware of the electronic equipment by a processor of the electronic equipment; requesting the processor to allocate free memory to the target hardware to increase the first number in response to the first number of free memory in the target memory being less than a first set threshold; Releasing free memory to the processor to reduce the first amount in response to the first amount being greater than a second set threshold; Wherein the first set threshold is less than the second set threshold.
- 2. The method of claim 1, wherein the requesting the processor, after allocating free memory to the target hardware, further comprises: the method comprises the steps of receiving first indication information sent by the processor, wherein the first indication information is used for indicating that a first memory of the electronic equipment in an idle state is successfully distributed to the target hardware; And responding to the first indication information, and determining that the first memory belongs to the target memory.
- 3. The method of claim 2, wherein the first indication is triggered when the processor writes a memory address of the first memory to a target memory space of the electronic device, the target memory space being configured to store the memory address of the target memory.
- 4. The method of claim 1, wherein the requesting the processor to allocate free memory to the target hardware comprises: Determining a first difference between the first number and the first set threshold; determining a second amount of free memory to be allocated to the target hardware based on the first difference; requesting the processor to allocate the second amount of free memory to the target hardware.
- 5. The method of claim 1, wherein the releasing free memory to the processor comprises: The memory address of the second memory in the idle state is taken out from the target memory space of the electronic equipment, wherein the target memory space is used for storing the memory address of the target memory; and sending the memory address of the second memory to the processor so as to release the second memory to the processor.
- 6. The method of claim 5, wherein after sending the memory address of the second memory to the processor, further comprising: receiving second indication information sent by the processor, wherein the second indication information is used for indicating that the second memory is successfully released to the processor, and the second indication information is triggered when the processor receives a memory address of the second memory; and responding to the second indication information, and determining that the second memory does not belong to the target memory.
- 7. The method of claim 1, wherein the releasing free memory to the processor comprises: Determining a second difference between the first number and the second set threshold; Determining a third amount of free memory to be released to the processor based on the second difference; And releasing the third amount of free memory to the processor.
- 8. The method according to any one of claims 1-7, wherein the performing memory allocation and memory reclamation processing corresponding to the memory processing request with the target memory includes: Determining a memory allocation requirement of a target functional module based on the memory processing request to determine a target application queue, wherein the target application queue is used for storing a memory address of a memory allocated to the target functional module; Determining a first memory address of a free memory from memory addresses from a target memory space of the electronic device as a memory address of a memory allocated to the target functional module based on the memory allocation requirement, wherein the target memory space is used for storing the memory address of the target memory; and writing the first memory address into the target application queue, wherein the target application queue is used for taking out the memory address by the target functional module so as to perform read-write operation on the corresponding memory.
- 9. The method of claim 8, wherein determining a first memory address of free memory from memory addresses from a target memory space of the electronic device based on the memory allocation requirements comprises: determining the first memory address from the target memory space based on the memory allocation requirement, or And determining the first memory address from a local storage space of the target hardware based on the memory allocation requirement, wherein the memory address in the local storage space is determined based on the memory address fetched from the target storage space.
- 10. The method of claim 8, wherein the target storage space comprises a plurality of candidate address pools, any one of the candidate address pools for storing memory addresses of a single type of original memory block; Different types of the original memory blocks include at least one of different amounts of memory and different physical media of origin.
- 11. The method of claim 10, wherein determining a first memory address of free memory from memory addresses from a target memory space of the electronic device based on the memory allocation requirements comprises: Determining an association relation between a candidate application queue and the candidate address pools, wherein the candidate application queue is used for storing memory addresses of memories distributed to the candidate functional modules, and at least one candidate address pool and a plurality of candidate application queues have an association relation; determining a target address pool from a plurality of candidate address pools based on the association relation; The first memory address is determined from memory addresses from the pool of target addresses based on the memory allocation requirements.
- 12. The method of claim 11, wherein the determining a target address pool from a plurality of the candidate address pools based on the association relationship comprises: Determining a candidate address pool corresponding to the target application queue based on the association relation as a first address pool; Determining whether the target application queue has the acquisition permission of the memory address in the first address pool based on an arbitration policy; responding to the target application queue with the acquisition authority of only one first address pool, and taking the corresponding first address pool as the target address pool; And determining the target address pool from the plurality of first address pools in response to the target application queue having the acquisition rights of the plurality of first address pools.
- 13. The method of claim 10, wherein determining a first memory address allocated to the memory of the target functional module from memory addresses from a target memory space of the electronic device based on the memory allocation requirements comprises: determining a target address pool from a plurality of candidate address pools; Determining the first memory address from memory addresses from the pool of target addresses based on the memory allocation requirements; Determining an auxiliary address pool from candidate address pools outside the target address pool in response to the target address pool not meeting the memory allocation requirement; And continuously determining the first memory address from the memory addresses from the auxiliary address pool based on the memory allocation requirement.
- 14. The method of claim 13, wherein said determining a secondary address pool from a candidate address pool other than said target address pool comprises: responding to any candidate address pool except the target address pool to meet a set condition, and taking the corresponding candidate address pool as the auxiliary address pool; Wherein the setting condition includes at least one of: The candidate address pool meets the memory allocation requirement; And the memory addresses from the candidate address pool do not have candidate application queues to be written in, wherein the candidate application queues are used for storing the memory addresses distributed to the memories of the candidate functional modules.
- 15. The method of claim 14, wherein the responding to any one of the candidate address pools other than the target address pool satisfying a set condition, taking the corresponding candidate address pool as the auxiliary address pool, comprises: determining a hierarchical relationship between a plurality of the candidate address pools; Determining a candidate address pool of the next level of the target address pool based on the level relation, and taking the candidate address pool as a candidate address pool traversed currently; Responding to the current traversed candidate address pool to meet the set condition, and taking the current traversed candidate address pool as the auxiliary address pool; Determining a candidate address pool of a next level of the currently traversed candidate address pool as a second address pool based on the level relation in response to the currently traversed candidate address pool not meeting the set condition; And updating the currently traversed candidate address pool into the second address pool, and re-determining that the currently traversed candidate address pool meets the third setting condition.
- 16. The method of claim 10, wherein the performing memory allocation and memory reclamation processing corresponding to the memory processing request using the target memory comprises: Determining the memory reclamation requirement of the target functional module based on the memory processing request to determine a target reclamation queue, wherein the target reclamation queue is used for storing the memory address of the memory used by the target functional module; taking out the memory address from the target recovery queue as a second memory address to be recovered; And writing the second memory address into a local storage space of the target hardware, or writing the memory address of the original memory block to which the second memory address belongs into a candidate address pool associated with the original memory block in response to the fact that the original memory block to which the second memory address belongs is used.
- 17. The method of claim 16, wherein prior to writing the second memory address to the local storage space of the target hardware, further comprising: and determining that a memory allocation request sent by at least one candidate functional module is received.
- 18. The method of claim 16, wherein the method further comprises: determining that the corresponding original memory block is used in response to the second memory address being the memory address of any original memory block; And determining whether the corresponding original memory block is used or not based on the segmentation information of the memory address of the corresponding original memory block and the number of the second memory addresses belonging to the corresponding original memory block, wherein the second memory address is obtained by segmentation processing based on the memory address of any original memory block.
- 19. A memory processing apparatus, comprising: the first processing module is configured to respond to a memory processing request and adopt a target memory to perform memory allocation and memory recycling processing corresponding to the memory processing request, wherein the target memory is a memory allocated to target hardware of the electronic equipment by a processor of the electronic equipment; A second processing module configured to request the processor to allocate free memory to the target hardware to increase the first amount in response to a first amount of free memory in the target memory being less than a first set threshold; A third processing module configured to release free memory to the processor to reduce the first amount in response to the first amount being greater than a second set threshold; Wherein the first set threshold is less than the second set threshold.
- 20. The apparatus of claim 19, wherein the second processing module, after requesting the processor to allocate free memory to the target hardware, is further configured to: the method comprises the steps of receiving first indication information sent by the processor, wherein the first indication information is used for indicating that a first memory of the electronic equipment in an idle state is successfully distributed to the target hardware; And responding to the first indication information, and determining that the first memory belongs to the target memory.
Description
Memory processing method and device, memory management system, electronic equipment and chip Technical Field The present disclosure relates to the field of memory management technologies, and in particular, to a memory processing method, a device, a memory management system, an electronic device, a chip, and a storage medium. Background Currently, memory processing operations (such as memory allocation and reclamation) of an electronic device are mostly performed by a processor, for example, a CPU (Central Processing Unit ) is often performed during operation, and complex processing logic is usually involved, so that a load of the processor is significantly increased, which affects overall performance of the electronic device, and is more prominent in application scenarios with high concurrency, large data volume or high real-time requirements. Disclosure of Invention The present disclosure provides a memory processing method, apparatus, memory management system, electronic device, chip and storage medium, so as to at least solve the problem of heavy processor load in the related art. The technical scheme of the present disclosure is as follows: According to a first aspect of the embodiment of the present disclosure, a memory processing method is provided, which includes performing memory allocation and memory reclamation processing corresponding to a memory processing request by using a target memory in response to the memory processing request, where the target memory is a memory allocated to target hardware of an electronic device by a processor of the electronic device, requesting the processor to allocate free memory to the target hardware to increase the first number in response to a first number of free memory in the target memory being smaller than a first set threshold, and releasing free memory to the processor to decrease the first number in response to the first number being larger than a second set threshold, where the first set threshold is smaller than the second set threshold. According to a second aspect of the embodiment of the present disclosure, there is provided a memory processing apparatus, including a first processing module configured to perform memory allocation and memory reclamation processing corresponding to a memory processing request with a target memory in response to the memory processing request, wherein the target memory is a memory allocated to target hardware of an electronic device by a processor of the electronic device, a second processing module configured to request the processor to allocate free memory to the target hardware to increase the first amount in response to a first amount of free memory in the target memory being less than a first set threshold, and a third processing module configured to release free memory to the processor to decrease the first amount in response to the first amount being greater than a second set threshold, wherein the first set threshold is less than the second set threshold. According to a third aspect of the embodiments of the present disclosure, there is provided a memory management system, including a processor, target hardware and a target memory, where the processor is configured to allocate the target memory to the target hardware, and the target hardware is configured to execute the steps of the memory processing method according to the first aspect of the embodiments of the present disclosure. According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic device, including the memory management system according to the third aspect of the embodiments of the present disclosure. According to a fifth aspect of embodiments of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the steps of the memory processing method according to the first aspect of embodiments of the present disclosure. According to a sixth aspect of embodiments of the present disclosure, there is provided a chip comprising an interface circuit for inputting or outputting a signal and a processing circuit coupled to each other, the processing circuit being configured to implement the steps of the memory processing method according to the first aspect of embodiments of the present disclosure. According to a seventh aspect of the embodiments of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the steps of the memory processing method according to the first aspect of the embodiments of the present disclosure. The technical scheme provided by the embodiment of the disclosure has the advantages that the memory allocation and the memory reclamation processing corresponding to the memory processing request are performed by adopting the target memory in response to the memory processing request, wherein the