CN-121233497-B - Method and device for solving regional void caused by repeated registration and reverse registration of MTT (methyl thiazolyl tetrazolium)
Abstract
The invention provides a method and a device for solving the problem of regional void caused by repeated registration and reverse registration of MTT, which relate to the technical field of memory registration and comprise the steps of receiving a mapping allocation request which carries mapping size information and a physical address; determining whether to trigger a linked list mechanism based on the mapping size information, if yes, determining a plurality of target item units bound by the mapping allocation request from the item units with maximum capacity released by the MTT space, writing the physical address into the target item units based on the linked list mechanism, and if not, determining the target item units bound by the mapping allocation request from the item units released by the MTT space based on the matching result between the mapping size information and the capacity, and writing the physical address into the target item units. The invention can solve the problems of low efficiency of storing translation tables, low space utilization rate and the like.
Inventors
- CHEN NENG
- YAN HONGLIANG
- LIN YUKAI
- CAI XINYAO
Assignees
- 翼华科技(北京)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20250923
Claims (7)
- 1. A method for solving a region hole caused by repeated registration and anti-registration of an MTT, wherein an MTT space contains a plurality of entry units of a plurality of capacities, the number of the entry units of each of the capacities is a plurality of, the entry units being a minimum logical unit for storing a mapping relationship between a virtual address to a physical address in the MTT space, the method comprising: receiving a mapping allocation request, wherein the mapping allocation request carries mapping size information and a physical address; Judging whether to trigger a linked list mechanism based on the mapping size information, wherein the method comprises the steps of determining to trigger the linked list mechanism under the condition that the mapping size information is larger than the maximum capacity; if so, determining a plurality of target entry units bound by the mapping allocation request from the entry units with the maximum capacity released by the MTT space, and writing the physical address into the target entry units based on the linked list mechanism; If not, determining a target entry unit bound by the mapping allocation request from the entry units released by the MTT space based on a matching result between the mapping size information and the capacity, and writing the physical address into the target entry unit; Traversing the target item units to sequentially write the physical addresses into the target item units, and indicating the context relation among the target item units through the linked list mechanism; The method comprises the steps of setting a link table at the last position of an item unit of the maximum capacity, wherein each item unit corresponds to a unique item identification, and indicating the context relation between target item units through a link table mechanism, wherein the method comprises the steps of writing the item identification of the next target item unit into the link table of the target item unit for any target item unit so as to indicate the context relation between the target item unit and the next target item unit.
- 2. The method for resolving area holes caused by repeated registration and de-registration of MTT according to claim 1, wherein determining a plurality of target entry units to which the map allocation request is bound from among the entry units of maximum capacity for which the MTT space has been released, comprises: determining the number of entries required for the map allocation request based on the map size information and the maximum capacity; And determining a target item unit bound by the mapping allocation request from the item units of the maximum capacity, wherein the MTT space is released according to the item number.
- 3. The method for resolving area holes caused by repeated registration and de-registration of MTT according to claim 1, wherein determining a target entry unit to which the map allocation request is bound from the entry units for which the MTT space has been released based on a result of matching between the map size information and the capacity, comprises: judging whether the mapping size information is consistent with the capacity; if so, determining that the mapping size information is matched with the capacity, and determining a target entry unit bound by the mapping allocation request from the entry units of the capacity which are released by the MTT space and matched with the mapping size information.
- 4. The method for resolving an area hole caused by repeated registration and de-registration of an MTT according to claim 1, wherein before receiving a map allocation request, the method further comprises: and carrying out pooling treatment on the MTT space so that the MTT space after the pooling treatment contains entry units with various capacities.
- 5. An apparatus for resolving a region hole caused by repeated registration and de-registration of an MTT, wherein an MTT space includes a plurality of entry units of a plurality of capacities, the number of the entry units of each of the capacities being a minimum logical unit for storing a mapping relationship between virtual addresses to physical addresses in the MTT space, the apparatus comprising: the request receiving module is used for receiving a mapping allocation request, and the mapping allocation request carries mapping size information and a physical address; The judging module is used for judging whether to trigger a linked list mechanism based on the mapping size information, and comprises the steps of determining to trigger the linked list mechanism under the condition that the mapping size information is larger than the maximum capacity; a first writing unit, configured to determine, if the determination result of the determination module is yes, a plurality of target entry units bound by the mapping allocation request from the entry units of the maximum capacity that have been released by the MTT space, and write the physical address into the target entry units based on the linked list mechanism; A second writing unit configured to determine, if the determination result of the determination module is no, a target entry unit to which the mapping allocation request is bound from the entry units that have been released from the MTT space based on a result of matching between the mapping size information and the capacity, and write the physical address into the target entry unit; Traversing the target item units to sequentially write the physical addresses into the target item units, and indicating the context relation among the target item units through the linked list mechanism; The first writing unit is specifically configured to write, for any one of the target entry units, the entry identifier of the next target entry unit into the linked list bit of the target entry unit to indicate a context relationship between the target entry unit and the next target entry unit.
- 6. An electronic device comprising a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method of any one of claims 1 to 4.
- 7. A computer readable storage medium storing computer executable instructions which, when invoked and executed by a processor, cause the processor to implement the method of any one of claims 1 to 4.
Description
Method and device for solving regional void caused by repeated registration and reverse registration of MTT (methyl thiazolyl tetrazolium) Technical Field The invention relates to the technical field of memory registration, in particular to a method and a device for solving the problem of regional hollowness caused by repeated registration and reverse registration of MTT (methyl thiazolyl tetrazolium). Background With the rapid development of computer technology, virtual memory technology has become a core component of modern operating systems. Virtual memory provides a continuous and much larger address space for applications than real physical memory by combining physical memory with disk storage. To achieve virtual to physical address translation, processors typically employ MTT (Multi-Level Translation Table, memory translation table) space to store address translation relationships, however, prior art techniques generate a large number of unused page table entries, so-called "page table holes," when dealing with sparse address space with MTT space. These holes, although not actually occupying physical memory, still occupy positions in the page table structure, and thus cause problems such as low efficiency in storing translation tables and low space utilization. Disclosure of Invention In view of the above, the present invention aims to provide a method and apparatus for solving the problem of low efficiency of storing translation tables, low space utilization, etc. caused by repeated registration and reverse registration of MTT. In a first aspect, the present invention provides a method for solving a region hole caused by repeated registration and anti-registration of an MTT, where an MTT space includes a plurality of capacity entry units, each capacity entry unit has a plurality of number, and the entry unit is a minimum logical unit in the MTT space for storing a mapping relationship between a virtual address and a physical address, the method includes: receiving a mapping allocation request, wherein the mapping allocation request carries mapping size information and a physical address; Judging whether to trigger a linked list mechanism or not based on the mapping size information; if so, determining a plurality of target entry units bound by the mapping allocation request from the entry units with the maximum capacity released by the MTT space, and writing the physical address into the target entry units based on a linked list mechanism; if not, determining a target entry unit bound by the mapping allocation request from the entry units released by the MTT space based on the matching result between the mapping size information and the capacity, and writing the physical address into the target entry unit. In one embodiment, determining whether to trigger a linked list mechanism based on the mapping size information includes: And determining a trigger linked list mechanism under the condition that the mapping size information is larger than the maximum capacity. In one embodiment, determining a plurality of target entry units to which the map allocation request binds from the entry units of maximum capacity for which the MTT space has been freed, includes: determining the number of entries required for the map allocation request based on the map size information and the maximum capacity; According to the item data, a target item unit to which the mapping allocation request is bound is determined from the item units of the maximum capacity in which the MTT space is released. In one embodiment, writing a physical address to a target entry unit based on a linked list mechanism includes: traversing the target item units to sequentially write the physical addresses into the target item units, and indicating the context relationship between the target item units through a linked list mechanism. In one embodiment, the last bit of the maximum capacity item unit is provided with a chain table, and each item unit corresponds to a unique item identification, and the context relationship between the target item units is indicated through a linked list mechanism, and the method comprises the following steps: For any target entry unit, the entry identification of the next target entry unit is written to the chain table of that target entry unit to indicate the context relationship between that target entry unit and the next target entry unit. In one embodiment, determining a target entry unit to which the map allocation request is bound from the entry units for which the MTT space has been freed based on a result of the matching between the map size information and the capacity, includes: judging whether the mapping size information is consistent with the capacity; if so, determining that the mapping size information is matched with the capacity, and determining a target entry unit bound by the mapping allocation request from entry units of the capacity which is released by the MTT space and matched with the mappi