Memory management method, device and equipment and computer readable storage medium

By determining the mapping between I/O virtual addresses and application identities in autonomous driving devices, the problem of high cost of memory isolation between applications in IOMMU-less systems is solved, and memory protection and isolation are achieved in systems with and without IOMMU.

CN121009027APending Publication Date: 2025-11-25SIENGINE TECH CO LTD

Patent Information

Application Number
CN202511547423.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-28
Publication Date
2025-11-25

AI Technical Summary

Technical Problem

In the absence of an IOMMU, autonomous driving devices lack the necessary means for memory isolation between applications, resulting in high memory management costs.

Method used

By determining the target I/O virtual address and application identity corresponding to the mapping request, the mapping between the request and the physical memory address can be established or de-mapped, thereby achieving memory isolation between applications and reducing hardware design complexity on systems with IOMMU.

Benefits of technology

Enhance memory protection capabilities on systems without IOMMU, reduce hardware costs and complexity, and achieve effective isolation between applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121009027A_ABST
    Figure CN121009027A_ABST
Patent Text Reader

Abstract

The invention discloses a memory management method, device and equipment and a computer readable storage medium. The method comprises the following steps: when a mapping request exists, determining a target I / O virtual address corresponding to the mapping request and triggering an application identity identifier of the mapping request; detecting whether the target I / O virtual address is associated with the application identity label or not; and if yes, establishing mapping between the target I / O virtual address and the corresponding memory physical address. According to the method and the device, the memory protection capability of the equipment can be enhanced on a system without IOMMU (Input / Output Management Unit); and the complexity of hardware design can be reduced on a system with an IOMMU, and the hardware cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, in particular to a memory management method, device and equipment and computer readable storage medium. BACKGROUND

[0002] In the field of automatic driving, in order to reduce system delay, the direct address (pointer or handle) is used for transmission between multiple applications in the device, so there is a lot of memory sharing between applications. If this memory sharing is not considered for protection, it is likely to interfere or damage the memory between applications, which violates the FFI (free from interference) design principle in functional safety.

[0003] On the device without IOMMU (input / output memory management unit), the management of device memory depends on the mechanism of the kernel, but the traditional operating system kernel often ignores the needs of this part, so it does not have this ability. In the design of the newer chip, the device accesses the memory through IOMMU, which can expand the access ability of the device full address space through the device page table on the one hand, and enhance the isolation of the device memory on the other hand. IOMMU can provide address isolation between VMs (virtual machines) through the design of the second level page table, but there is a lack of necessary means between application isolation. One way is to bind the identification of the substream in the device to the application to achieve the isolation of the device memory used by the application and the application. But SSID (Substream ID, which is a identifier used to distinguish different data streams in the system memory management unit) needs to be indexed through 20-bit hardware connection to associate the application device memory page table, which increases the hardware cost. SUMMARY

[0004] The present application provides a memory management method, device and equipment and computer readable storage medium, which can solve the technical problem of high cost of the memory isolation scheme in the prior art.

[0005] In a first aspect, the present application provides a memory management method, which comprises: When there is a mapping request, determining the target I / O virtual address corresponding to the mapping request and the application identity tag triggering the mapping request; Detecting whether the target I / O virtual address and the application identity tag are associated; If there is an association, establishing the mapping between the target I / O virtual address and the corresponding memory physical address.

[0006] In conjunction with the first aspect, in one implementation, before determining the target virtual address corresponding to the mapping request and the application identity that triggered the mapping request when a mapping request exists, the method further includes: Different I / O virtual addresses are pre-allocated for different applications; When a physical address request is received from an application, a memory physical address that has not been associated with the identity of other applications is allocated to the application. Establish the association between the application's identity, the pre-allocated I / O virtual address for the application, and the physical memory address allocated to the application.

[0007] In conjunction with the first aspect, in one implementation, after establishing the association between the application's identity, the pre-allocated I / O virtual address for the application, and the allocated memory physical address for the application, the method further includes: When an application-triggered unmapping request is received, the association between the pre-allocated I / O virtual address and the physical memory address allocated to the application is severed.

[0008] In conjunction with the first aspect, in one implementation, after decoupling the pre-allocated I / O virtual address for the application from the physical memory address allocated to the application, the method further includes: When the driver is unloaded, the data in the physical memory address allocated to the application is cleared, and the physical memory address allocated to the application is released.

[0009] In conjunction with the first aspect, in one implementation, before determining the target virtual address corresponding to the mapping request and the application identity that triggered the mapping request when a mapping request exists, the method further includes: When an I / O virtual address request triggered by an application is received, an I / O virtual address that has not been associated with the identity of other applications is allocated to the application, and an association is established between the application's identity and the I / O virtual address allocated to the application. When a memory association request triggered by an application is received, it is checked whether the I / O virtual address associated with the request is consistent with the I / O virtual address associated with the application's identity. If they match, then allocate a physical memory address to the application that is not associated with the identity of other applications; Establish the association between the application's identity, the I / O virtual address allocated to the application, and the memory physical address allocated to the application.

[0010] In conjunction with the first aspect, in one implementation, after establishing the association between the application's identity, the I / O virtual address allocated to the application, and the memory physical address allocated to the application, the method further includes: When an application-triggered unmapping request is received, it is checked whether the I / O virtual address to be unmapped is consistent with the I / O virtual address associated with the application's identity. If they match, the association between the application's identity and the I / O virtual address assigned to the application is severed.

[0011] In conjunction with the first aspect, in one implementation, after deassociating the application's identity with the I / O virtual address allocated to the application, the method further includes: When a release request triggered by an application is received, it is checked whether the physical address of the memory to be released is consistent with the physical address of the memory associated with the identity of the application. If they match, then clear the data in the physical memory address and release the physical memory address.

[0012] Secondly, embodiments of this application provide a memory management device, the memory management device comprising: The determination module is used to determine the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request when a mapping request exists; The detection module is used to detect whether there is an association between the target I / O virtual address and the application identity identifier; A module is established to create a mapping between the target I / O virtual address and the corresponding memory physical address if an association exists.

[0013] Thirdly, embodiments of this application provide a memory management device, the memory management device including a processor, a memory, and a memory management program stored in the memory and executable by the processor, wherein when the memory management program is executed by the processor, it implements the steps of the memory management method as described in the first aspect.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a memory management program, wherein when the memory management program is executed by a processor, it implements the steps of the memory management method as described in the first aspect.

[0015] The beneficial effects of the technical solutions provided in this application include: In this embodiment, when a mapping request exists, the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request are determined; whether there is an association between the target I / O virtual address and the application identity identifier is detected; if there is an association, a mapping is established between the target I / O virtual address and the corresponding physical memory address. Through this embodiment, the memory protection capability of the device can be enhanced on systems without an IOMMU; it can also reduce the complexity of hardware design and reduce hardware costs on systems with an IOMMU. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating an embodiment of the memory management method of this application; Figure 2 This is a functional module diagram of an embodiment of the memory management device of this application; Figure 3 This is a schematic diagram of the hardware structure of the memory management device involved in the embodiments of this application. Detailed Implementation

[0017] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.

[0018] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0019] Firstly, embodiments of this application provide a memory management method.

[0020] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the memory management method of this application. Figure 1 As shown, memory management methods include: Step S10: When a mapping request exists, determine the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request; Step S20: Detect whether there is an association between the target I / O virtual address and the application identity identifier; Step S30: If an association exists, establish a mapping between the target I / O virtual address and the corresponding memory physical address.

[0021] In this embodiment, the memory management method is executed by the operating system kernel.

[0022] Taking two applications as examples, namely a face recognition application and an object detection application; the application identity of the face recognition application is denoted as ID_A, and the application identity of the object detection application is denoted as ID_B; the I / O virtual address associated with ID_A is 0x5000-0x5FFF, and the I / O virtual address associated with ID_B is 0x6000-0x6FFF; the memory physical address associated with 0x5000-0x5FFF is PA1, and the memory physical address associated with 0x6000-0x6FFF is PA2.

[0023] When a face recognition application calls the mmap(0x5000) function to request mapping, it determines that the target I / O virtual address corresponding to this mapping request is 0x5000-0x5FFF, and the identity of the application that triggered this mapping request is ID_A. Then it checks whether there is an association between 0x5000-0x5FFF and ID_A. Since there is an association between 0x5000-0x5FFF and ID_A, and the physical memory address associated with 0x5000-0x5FFF is PA1, then 0x5000-0x5FFF is mapped to PA1.

[0024] When a face recognition application calls the mmap(0x6000) function to request mapping, it determines that the target I / O virtual address corresponding to this mapping request is 0x6000-0x6FFF, and the identity identifier of the application that triggered this mapping request is ID_A. Then it checks whether there is an association between 0x6000-0x6FFF and ID_A. Since there is no association between 0x6000-0x6FFF and ID_A, the mapping request is rejected and EPERM is returned.

[0025] Similarly: When the target detection application calls the mmap(0x6000) function to request mapping, it determines that the target I / O virtual address corresponding to this mapping request is 0x6000-0x6FFF, and the identity of the application that triggered this mapping request is ID_B. Then it checks whether there is an association between 0x6000-0x6FFF and ID_B. Since there is an association between 0x6000-0x6FFF and ID_B, and the memory physical address associated with 0x6000-0x6FFF is PA2, then 0x6000-0x6FFF is mapped to PA2.

[0026] When the target detection application calls the mmap(0x5000) function to request mapping, it determines that the target I / O virtual address corresponding to this mapping request is 0x5000-0x5FFF, and the identity of the application that triggered this mapping request is ID_B; then it checks whether there is an association between 0x5000-0x5FFF and ID_B. Since there is no association between 0x5000-0x5FFF and ID_B, the mapping request is rejected and EPERM is returned.

[0027] In this embodiment, when a mapping request exists, the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request are determined; whether there is an association between the target I / O virtual address and the application identity identifier is detected; if there is an association, a mapping is established between the target I / O virtual address and the corresponding physical memory address. Through this embodiment, the memory protection capability of the device can be enhanced on systems without an IOMMU; it can also reduce the complexity of hardware design and reduce hardware costs on systems with an IOMMU.

[0028] Furthermore, in one embodiment, before step S10, the method further includes: Step S011: Pre-allocate different I / O virtual addresses for different applications; Step S012: When a physical address request triggered by an application is received, allocate a memory physical address to the application that has not been associated with the identity of other applications. Step S013: Establish the association between the application's identity, the pre-allocated I / O virtual address for the application, and the allocated physical memory address for the application.

[0029] In this embodiment, when the operating system starts, the kernel pre-allocates I / O virtual addresses of 0x5000-0x5FFF for the face recognition application, denoted as IOVA_A; and pre-allocates I / O virtual addresses of 0x6000-0x6FFF for the target detection application, denoted as IOVA_B.

[0030] When a face recognition application calls the ioctl(ALLOC_IO_ADDR) function to request an address, i.e., when a physical address request is received triggered by the face recognition application, a memory physical address, such as PA1, is allocated to the face recognition application that has not been associated with the identity identifier of other applications, and the association between ID_A, IOVA_A, and PA1 is established.

[0031] When the target detection application calls the ioctl(ALLOC_IO_ADDR) function to request an address, that is, when the physical address request triggered by the target detection application is received, a memory physical address that has not been associated with the identity of other applications, such as PA2, is allocated to the target detection application, and the association between ID_B, IOVA_B and PA2 is established.

[0032] Based on this, physical memory is isolated and distinguished by binding IOVA with application ID, and the kernel maintains a mapping table of PA1-ID_A-IOVA_A and PA2-ID_B-IOVA_B.

[0033] Furthermore, in one embodiment, after step S013, the method further includes: Step S411: When a demapping request triggered by the application is received, the association between the I / O virtual address pre-allocated for the application and the memory physical address allocated for the application is released.

[0034] In this embodiment, when the face recognition application calls munmap(IOVA_A) to unmap, that is, when the face recognition application triggers the unmap request, the association between ID_A and IOVA_A is severed, which is equivalent to removing the face recognition application's permission to access IOVA_A.

[0035] Similarly, when the target detection application calls munmap(IOVA_B) to unmap, i.e., receives an unmap request triggered by the target detection application, the association between ID_B and IOVA_B is severed, which is equivalent to removing the target detection application's permission to access IOVA_B.

[0036] Furthermore, in one embodiment, after step S411, the method further includes: Step S412: When the driver is unloaded, the data in the physical memory address allocated to the application is cleared, and the physical memory address allocated to the application is released.

[0037] In this embodiment, unlike the previous embodiment, only the association between the pre-allocated I / O virtual address and the allocated physical memory address for the application is severed; the data in the allocated physical memory address is still retained. To prevent data leakage, when the driver is uninstalled, the data in the allocated physical memory address is zeroed out, and the allocated physical memory address is released.

[0038] Furthermore, in one embodiment, before step S10, the method further includes: Step S021: When an I / O virtual address request triggered by an application is received, an I / O virtual address that has not been associated with the identity of other applications is allocated to the application, and an association is established between the identity of the application and the I / O virtual address allocated to the application. Step S022: When a memory association request triggered by an application is received, it is detected whether the I / O virtual address associated with the request is consistent with the I / O virtual address associated with the application's identity. Step S023: If they match, then allocate a physical memory address to the application that has not been associated with the identity of other applications. Step S024: Establish the association between the application's identity, the I / O virtual address allocated to the application, and the memory physical address allocated to the application.

[0039] In this embodiment, when the face recognition application calls ioctl(ALLOC_IO_ADDR) to request an address, i.e., when the I / O virtual address request triggered by the face recognition application is received, an I / O virtual address that has not been associated with the identity identifier of other applications is allocated to the face recognition application. For example, the I / O virtual address allocated to the face recognition application is 0x7000-0x7FFF, denoted as IOVA_A, and an association is established between IOVA_A and the identity identifier ID_A of the face recognition application. Similarly, when the target detection application calls ioctl(ALLOC_IO_ADDR) to request an address, i.e., when the I / O virtual address request triggered by the target detection application is received, an I / O virtual address that has not been associated with the identity identifier of other applications is allocated to the target detection application. For example, the I / O virtual address allocated to the target detection application is 0x8000-0x8FFF, denoted as IOVA_B, and an association is established between IOVA_B and the identity identifier ID_B of the target detection application.

[0040] Subsequently, when the face recognition application calls ioctl(ALLOC_MEM) to request memory associated with IOVA_A, i.e., when a memory association request triggered by the application is received, it checks whether the requested I / O virtual address (i.e., IOVA_A) is consistent with the I / O virtual address associated with the face recognition application's identity ID_A. Since the I / O virtual address associated with ID_A is IOVA_A, a physical memory address that has not been associated with the identity of other applications, such as PA3, is allocated to the application, and an association is established between ID_A, IOVA_A, and PA3.

[0041] If the object detection application calls ioctl(ALLOC_MEM) to request memory associated with IOVA_A, the memory association request triggered by the object detection application will be rejected because the I / O virtual address associated with ID_B is not IOVA_A.

[0042] Based on the above embodiments, when the target detection application attempts mmap(0x7000), and the kernel detects that the owner ID_A of 0x7000 does not equal the requester ID_B, it returns an EACCES error.

[0043] Furthermore, in one embodiment, after step S024, the method further includes: Step S421: When a demapping request triggered by an application is received, it is detected whether the I / O virtual address to be demapped is consistent with the I / O virtual address associated with the application's identity identifier; Step S422: If they match, then disconnect the application's identity from the I / O virtual address assigned to the application.

[0044] In this embodiment, when the face recognition application calls the `munmap(IOVA_A)` function, it receives a demapping request triggered by the face recognition application. Since the I / O virtual address to be demapped, IOVA_A, is consistent with the I / O virtual address associated with the face recognition application's identity ID_A, the association between IOVA_A and ID_A is severed. At this time, PA3 still belongs to ID_A (and needs to be explicitly released). A page fault is triggered when the object detection application attempts to access IOVA_A.

[0045] Correspondingly, when the target detection application calls the munmap(IOVA_A) function, it receives a demapping request triggered by the target detection application. Since the I / O virtual address to be demapped, IOVA_A, is inconsistent with the I / O virtual address IOVA_B associated with the target detection application's identity ID_B, the demapping request is rejected.

[0046] Furthermore, in one embodiment, after step S422, the method further includes: Step S423: When a release request triggered by an application is received, check whether the physical address of the memory to be released is consistent with the physical address of the memory associated with the identity of the application. Step S424: If they match, clear the data in the physical memory address and release the physical memory address.

[0047] In this embodiment, when the face recognition application calls ioctl(FREE_MEM) to release PA3, a release request triggered by the face recognition application is received. Since the physical memory address associated with the face recognition application's identity ID_A is PA3, the data in PA3 is cleared and PA3 is released, that is, the association between IOVA_A and PA3 is severed.

[0048] Correspondingly, when the target detection application calls ioctl(FREE_MEM) to release PA3, the release request triggered by the target detection application is received. Since the physical memory address associated with the target detection application's identity ID_B is not PA3, the release request is rejected and EOWNERDEAD is returned.

[0049] Secondly, embodiments of this application also provide a memory management device.

[0050] In one embodiment, reference is made to Figure 2 , Figure 2 This is a functional module diagram of an embodiment of the memory management device of this application. Figure 2 As shown, the memory management device includes: The determination module 10 is used to determine the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request when a mapping request exists; Detection module 20 is used to detect whether there is an association between the target I / O virtual address and the application identity identifier; Module 30 is used to establish a mapping between the target I / O virtual address and the corresponding memory physical address if an association exists.

[0051] Furthermore, in one embodiment, the memory management device further includes a first management module, configured to: Different I / O virtual addresses are pre-allocated for different applications; When a physical address request is received from an application, a memory physical address that has not been associated with the identity of other applications is allocated to the application. Establish the association between the application's identity, the pre-allocated I / O virtual address for the application, and the physical memory address allocated to the application.

[0052] Furthermore, in one embodiment, the first management module is also used for: When an application-triggered unmapping request is received, the association between the pre-allocated I / O virtual address and the physical memory address allocated to the application is severed.

[0053] Furthermore, in one embodiment, the first management module is also used for: When the driver is unloaded, the data in the physical memory address allocated to the application is cleared, and the physical memory address allocated to the application is released.

[0054] Furthermore, in one embodiment, the memory management device further includes a second management module, used for: When an I / O virtual address request triggered by an application is received, an I / O virtual address that has not been associated with the identity of other applications is allocated to the application, and an association is established between the application's identity and the I / O virtual address allocated to the application. When a memory association request triggered by an application is received, it is checked whether the I / O virtual address associated with the request is consistent with the I / O virtual address associated with the application's identity. If they match, then allocate a physical memory address to the application that is not associated with the identity of other applications; Establish the association between the application's identity, the I / O virtual address allocated to the application, and the memory physical address allocated to the application.

[0055] Furthermore, in one embodiment, the second management module is also used for: When an application-triggered unmapping request is received, it is checked whether the I / O virtual address to be unmapped is consistent with the I / O virtual address associated with the application's identity. If they match, the association between the application's identity and the I / O virtual address assigned to the application is severed.

[0056] Furthermore, in one embodiment, the second management module is also used for: When a release request triggered by an application is received, it is checked whether the physical address of the memory to be released is consistent with the physical address of the memory associated with the identity of the application. If they match, then clear the data in the physical memory address and release the physical memory address.

[0057] The functions of each module in the memory management device correspond to the steps in the memory management method embodiments described above, and their functions and implementation processes will not be described in detail here.

[0058] Thirdly, embodiments of this application provide a memory management device, which can be a personal computer (PC), laptop computer, server, or other device with data processing capabilities.

[0059] Reference Figure 3 , Figure 3 This is a schematic diagram of the hardware structure of the memory management device involved in the embodiments of this application. In the embodiments of this application, the memory management device may include a processor, a memory, a communication interface, and a communication bus.

[0060] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.

[0061] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces used for interconnecting devices within the memory management device, as well as interfaces used for interconnecting the memory management device with other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.

[0062] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.

[0063] The processor can be a general-purpose processor, which can call a memory management program stored in memory and execute the memory management method provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the memory management program is called can be referred to in the various embodiments of the memory management method of this application, and will not be repeated here.

[0064] Those skilled in the art will understand that Figure 3 The hardware structure shown does not constitute a limitation of this application and may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0065] Fourthly, embodiments of this application also provide a computer-readable storage medium.

[0066] The present application has a computer-readable storage medium storing a memory management program, wherein when the memory management program is executed by a processor, it implements the steps of the memory management method described above.

[0067] The methods implemented when the memory management program is executed can be referred to in various embodiments of the memory management method of this application, and will not be repeated here.

[0068] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0069] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.

[0070] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.

[0071] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0072] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.

[0073] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.

[0074] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A memory management method, characterized in that, The memory management method includes: When a mapping request exists, determine the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request; Detect whether there is an association between the target I / O virtual address and the application identity; If a relationship exists, a mapping is established between the target I / O virtual address and the corresponding memory physical address.

2. The memory management method as described in claim 1, characterized in that, Before determining the target virtual address corresponding to the mapping request and the application identity that triggered the mapping request when a mapping request exists, the method further includes: Different I / O virtual addresses are pre-allocated for different applications; When a physical address request is received from an application, a memory physical address that has not been associated with the identity of other applications is allocated to the application. Establish the association between the application's identity, the pre-allocated I / O virtual address for the application, and the physical memory address allocated to the application.

3. The memory management method as described in claim 2, characterized in that, After establishing the association between the application's identity, the pre-allocated I / O virtual address for the application, and the allocated physical memory address for the application, the following is also included: When an application-triggered unmapping request is received, the association between the pre-allocated I / O virtual address and the physical memory address allocated to the application is severed.

4. The memory management method as described in claim 3, characterized in that, After decoupling the pre-allocated I / O virtual addresses and the allocated memory physical addresses for the application, the process further includes: When the driver is unloaded, the data in the physical memory address allocated to the application is cleared, and the physical memory address allocated to the application is released.

5. The memory management method as described in claim 1, characterized in that, Before determining the target virtual address corresponding to the mapping request and the application identity that triggered the mapping request when a mapping request exists, the method further includes: When an I / O virtual address request triggered by an application is received, an I / O virtual address that has not been associated with the identity of other applications is allocated to the application, and an association is established between the application's identity and the I / O virtual address allocated to the application. When a memory association request triggered by an application is received, it is checked whether the I / O virtual address associated with the request is consistent with the I / O virtual address associated with the application's identity. If they match, then allocate a physical memory address to the application that is not associated with the identity of other applications; Establish the association between the application's identity, the I / O virtual address allocated to the application, and the memory physical address allocated to the application.

6. The memory management method as described in claim 5, characterized in that, After establishing the association between the application's identity, the I / O virtual address allocated to the application, and the memory physical address allocated to the application, the following is also included: When an application-triggered unmapping request is received, it is checked whether the I / O virtual address to be unmapped is consistent with the I / O virtual address associated with the application's identity. If they match, the association between the application's identity and the I / O virtual address assigned to the application is severed.

7. The memory management method as described in claim 6, characterized in that, After deassociating the application's identity with the I / O virtual address assigned to the application, the process further includes: When a release request triggered by an application is received, it is checked whether the physical address of the memory to be released is consistent with the physical address of the memory associated with the identity of the application. If they match, then clear the data in the physical memory address and release the physical memory address.

8. A memory management device, characterized in that, The memory management device includes: The determination module is used to determine the target I / O virtual address corresponding to the mapping request and the application identity identifier that triggered the mapping request when a mapping request exists; The detection module is used to detect whether there is an association between the target I / O virtual address and the application identity identifier; A module is established to create a mapping between the target I / O virtual address and the corresponding memory physical address if an association exists.

9. A memory management device, characterized in that, The memory management device includes a processor, a memory, and a memory management program stored in the memory and executable by the processor, wherein when the memory management program is executed by the processor, it implements the steps of the memory management method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a memory management program, wherein when the memory management program is executed by a processor, it implements the steps of the memory management method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Memory access method, chip, electronic equipment and computer readable storage medium

    CN116136826A

  • Memory management method and device, computer equipment and storage medium

    CN116302491A

Cited By

  • Cache management method, reasoning method, cache management unit, reasoning unit, electronic equipment and storage medium

    CN121349911A

  • Cache management method, inference method, cache management unit, inference unit, electronic device, and storage medium

    CN121349911B