Memory management method and device and storage medium

By counting and analyzing the cross-group memory access request popularity of physical memory pages and dynamically adjusting the memory group to which they belong, the problem of frequent memory access across nodes in NUMA architecture is solved, and memory access efficiency is improved.

CN119690631APending Publication Date: 2025-03-25HANGZHOU ALICLOUD FEITIAN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311235255.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-22
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the NUMA architecture, memory access across nodes occurs frequently, affecting memory access efficiency.

Method used

By counting the cross-group memory access request heat on the physical memory page, if the heat exceeds the specified criteria, the memory group belonging to is re-determined for the target physical memory page and allocated to the re-determined memory group.

Benefits of technology

By dynamically scheduling physical memory pages to more suitable memory groups, the proportion of memory access across groups is reduced, thereby improving memory access efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119690631A_ABST
    Figure CN119690631A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a memory management method and device and a storage medium. In the embodiment of the invention, for each physical memory page which is pre-divided into a memory group on a physical machine, the cross-group memory access request heat of the physical memory page within a period of time can be counted during the use of the memory, and if the cross-group memory access request heat exceeds a specified standard, the memory group to which the physical memory page belongs is re-determined for the physical memory page. And distributing the physical memory page to the re-determined memory group. Therefore, the cross-group memory access request condition on the physical memory page can be sensed in the use process of the physical memory page, and the physical memory page is dynamically scheduled to a more appropriate memory group according to the cross-group memory access request condition on the physical memory page. Through dynamic scheduling of each physical memory page, dynamic adjustment of the physical memory pages in each memory group on the physical machine can be realized, so that the proportion of cross-group memory access on the physical machine is reduced, and the memory access efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory management method, device and storage medium. Background Art

[0002] NUMA (Non-Uniform Memory Access) is an architectural model for how multiple processor cores access physical memory. In the NUMA architecture, physical memory is divided into multiple NUMA nodes, each of which contains a set of processor cores and local memory. In the NUMA architecture, each node has its own local memory, and the connection between local memory and processor core is faster, which means that the processor core can access the memory of the local node faster. Memory access to other nodes needs to be carried out through a slower interconnect structure.

[0003] In order to improve the utilization of physical memory, memory swapping (SWAP) is supported in the NUMA architecture, that is, the local memory in a NUMA node can be temporarily swapped out for use by other NUMA nodes. This results in frequent cross-node memory access, which affects memory access efficiency. Summary of the invention

[0004] Multiple aspects of the present application provide a memory management method, device and storage medium for improving memory access efficiency under a memory grouping architecture.

[0005] The present application provides a memory management method, wherein a physical machine is preset with multiple memory groups, and the memory groups contain physical memory pages, and the method includes:

[0006] In response to a management instruction for a target physical memory page, counting the heat of cross-group memory access requests on the target physical memory page in a current statistical cycle;

[0007] If the heat of the cross-group memory access request exceeds a specified standard, re-determining the memory group to which the target physical memory page belongs;

[0008] The target physical memory page is allocated to the re-determined memory group.

[0009] Optionally, re-determining the memory group to which the target physical memory page belongs includes:

[0010] Determine the source memory group corresponding to each cross-group memory access request monitored on the target physical memory page during the current statistical period;

[0011] For each determined source memory group, respectively counting the number of cross-group memory access requests corresponding to the target physical memory page in the current statistical period;

[0012] The source memory group whose number of cross-group memory access requests meets the specified condition is used as the memory group to be re-determined for the target physical memory page.

[0013] Optionally, the specified condition includes: the number of cross-group memory access requests is the largest.

[0014] Optionally, the method further comprises:

[0015] Setting a plurality of sampling periods within the current statistical period;

[0016] When the start time of the target sampling period is reached, the access identifier in the page table entry where the target physical memory page is located is cleared, so that an access fault is triggered when an access request for the target physical memory page occurs within the target sampling period;

[0017] If an access failure to the target physical memory page is received within the target sampling period, identifying from the access failure a source memory group corresponding to the access request that triggers the access failure;

[0018] If the identified source memory group is inconsistent with the memory group to which the target physical memory page currently belongs, it is determined that a cross-group memory access request is monitored;

[0019] The target sampling period is any one of the multiple sampling periods.

[0020] Optionally, counting the heat of cross-group memory access requests on the target physical memory page in the current statistical period includes:

[0021] Based on the access failures received in the current statistical period, counting the total number of access requests corresponding to the target physical memory page in the current statistical period and the total number of cross-group memory access requests;

[0022] A ratio between the total number of cross-group memory access requests and the total number of access requests is calculated as the cross-group memory access request heat.

[0023] Optionally, the method further comprises:

[0024] After completing the identification operation within the target sampling period, adding an access identifier to a target page table entry used by the access request that triggers the access fault;

[0025] triggering the access request to continue execution;

[0026] Wherein, based on the added access identifier, the access request that continues to be executed and the subsequent access request initiated by using the target page table entry within the target sampling period no longer trigger an access fault.

[0027] Optionally, the method further comprises:

[0028] If the heat of the cross-group memory access request exceeds the specified standard, after the current statistical period ends, a specified physical memory page for replacing the target physical memory page is selected from the memory group to which the target physical memory page currently belongs;

[0029] The designated physical memory page is used to respond to an access request subsequently initiated in the memory group to which the target physical memory page currently belongs, which originally needs to be responded to by the target physical memory page.

[0030] Optionally, using the designated physical memory page to respond to an access request subsequently initiated in the memory group to which the target physical memory page currently belongs, which originally needs to be responded to by the target physical memory page, includes:

[0031] Finding the page table entries used by each of the intra-group memory access requests monitored on the target physical memory page during the current statistical period;

[0032] Clearing the access identifier associated with the target physical memory page in each page table entry found, so that an access request for the target physical memory page initiated based on each page table entry found can trigger an access fault;

[0033] In the process of processing the access fault, the physical address of the target physical memory page in the corresponding page table entry is replaced with the physical address corresponding to the specified physical memory page;

[0034] After completing the replacement operation, adding an access identifier for the specified physical memory page in the corresponding page table entry;

[0035] The access request that triggered the completed access fault processing continues to be executed to respond to the access request in accordance with the intra-group memory access manner.

[0036] Optionally, when the target physical memory page is mapped to the virtual machine memory space, the method is applicable to the virtual machine manager on the physical machine; when the target physical memory page is not mapped to the virtual machine memory space, the method is applicable to the memory management unit on the physical machine.

[0037] Optionally, the memory group uses a NUMA node or a CPU slot as a memory grouping unit.

[0038] An embodiment of the present application also provides a physical machine, including a memory and a processor, the memory providing physical memory pages, a plurality of memory groups preset on the physical machine, the memory groups containing physical memory pages, the memory access rate within the group is higher than the memory access rate across groups, the memory is used to store one or more computer instructions; the processor is coupled to the memory, and is used to execute the one or more computer instructions, so as to execute the aforementioned memory management method.

[0039] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned memory management method.

[0040] In an embodiment of the present application, for each physical memory page that is pre-divided into a memory group on a physical machine, the heat of cross-group memory access requests of the physical memory page within a period of time can be counted during the use of the memory. If the heat of the cross-group memory access request exceeds the specified standard, the memory group to which the physical memory page belongs is re-determined, and the physical memory page is allocated to the re-determined memory group. In this way, the cross-group memory access request situation on the physical memory page can be sensed during the use of the physical memory page, and the physical memory page can be dynamically scheduled to a more appropriate memory group according to the cross-group memory access request situation on the physical memory page. Through the dynamic scheduling of each physical memory page, the dynamic adjustment of the physical memory pages in each memory group on the physical machine can be achieved, thereby reducing the proportion of cross-group memory access on the physical machine, thereby improving memory access efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0042] Figure 1 A flowchart of a memory management method provided for an exemplary embodiment of the present application;

[0043] Figure 2 A logical schematic diagram of a memory management method provided for an exemplary embodiment of the present application;

[0044] Figure 3 A flowchart of another memory management method provided for an exemplary embodiment of the present application;

[0045] Figure 4 A flowchart of a memory management method is provided for an exemplary embodiment of the present application;

[0046] Figure 5aA schematic diagram of a scheme logic in an exemplary application scenario provided for an exemplary embodiment of the present application;

[0047] Figure 5b A schematic diagram of a time period setting scheme in an exemplary application scenario provided in an exemplary embodiment of the present application;

[0048] Figure 6 A schematic diagram of the structure of a physical machine provided for another exemplary embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0050] Before introducing the technical solutions provided by the embodiments of the present application, several technical concepts involved in the present application are briefly described as follows.

[0051] NUMA (Non-Uniform Memory Access): In the NUMA architecture, physical memory is divided into multiple nodes, each of which contains a set of processor cores and local memory. In the NUMA architecture, each node has its own local memory, and the connection between the memory and the processor core in the same node is faster. This means that the processor core can access the memory in its node faster, while memory access to other nodes needs to be carried out through a slower interconnect structure (for example, network connection interconnect, etc.).

[0052] Memory swapping (SWAP) is a technology that copies infrequently used physical memory pages to external storage areas such as disks and releases physical memory pages to increase system available memory.

[0053] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.

[0054] Figure 1 A flowchart of a memory management method provided as an exemplary embodiment of the present application, the method being applicable to a physical machine. Figure 2 A logical diagram of a memory management method provided by an exemplary embodiment of the present application, referring to Figure 2 , a plurality of memory groups are preset on the physical machine in this embodiment.

[0055] The memory management method provided in this embodiment can be applied to various memory grouping architectures. In different memory grouping architectures, the memory grouping units used may be different. For example, the memory group in this embodiment can use the aforementioned NUMA node as the memory grouping unit, that is, the physical memory pages on the physical machine can be pre-divided into NUMA nodes. Of course, the memory group in this embodiment can also use other memory grouping units, such as CPU sockets, core chiplets CCD (Core Chiplet Die) or processor module units CCX (CPU Complex), etc. This embodiment does not limit the memory grouping units used. For example, when the CPU socket is used as the memory grouping unit, the physical memory pages can be divided into the CPU socket, so that a memory group will contain all processor cores in the corresponding CPU socket and the physical memory pages allocated to the memory group.

[0056] refer to Figure 2 , the memory group in this embodiment may contain physical memory pages. Generally, the memory access rate within a group is higher than the memory access rate across groups. The specific implementation logic of memory access within a group and memory access across groups will not be described in detail here. You can refer to the background knowledge of various memory grouping architectures (such as the aforementioned NUMA architecture) for information. This embodiment assumes that the memory grouping architecture has this property.

[0057] At present, in various memory grouping architectures, the memory grouping scheme is basically determined during the architecture initialization process, and in the subsequent memory usage process, the initialized memory grouping scheme will remain unchanged, that is, the physical memory pages contained in each memory group remain unchanged to maintain the rate advantage of memory access within the group.

[0058] The inventor discovered during the research that in order to improve memory utilization, the memory grouping architecture is usually superimposed with the aforementioned memory swapping technology, which results in the physical memory pages in the memory group being frequently swapped out. The swapped-out physical memory pages can be accessed by the processor cores in other memory groups, and the processor cores in other memory groups need to access the swapped-out physical memory pages through cross-group memory access. Therefore, under the memory grouping architecture, cross-group memory access often occurs, affecting memory access efficiency.

[0059] To this end, this embodiment proposes an innovative memory management method to improve memory access efficiency under a memory grouping architecture.

[0060] refer to Figure 1 , the method may include:

[0061] Step 100: In response to a management instruction for a target physical memory page, count the heat of cross-group memory access requests on the target physical memory page in a current statistical cycle;

[0062] Step 101: if the heat of the cross-group memory access request exceeds a specified standard, then re-determine the memory group to which the target physical memory page belongs;

[0063] Step 102: Allocate the target physical memory page to the re-determined memory group.

[0064] The memory management method provided in this embodiment can support virtualization scenarios and non-virtualization scenarios. In a virtualization scenario, physical memory pages will be allocated to virtual machines on a physical machine for use, that is, physical memory pages will be mapped to the memory space of the virtual machine. In this case, the memory management method provided in this embodiment can be applied to the virtual machine manager (VMM, Virtual Machine Manager) on the physical machine. In a non-virtualization scenario, physical memory pages will be allocated to applications on the physical machine for use, that is, physical memory pages will be mapped to the virtual address space of the physical machine. In this case, the memory management method provided in this embodiment can be applied to the memory management unit (MM, Memory Management) on the physical machine. It should be understood that there may be some physical memory pages on the physical machine for virtualization scenarios and some physical memory pages for non-virtualization scenarios. In this case, the two parts of physical memory pages can be implemented by different execution entities for memory management, that is, the part of physical memory pages used in the virtualization scenario is managed by the virtual machine manager according to the memory management method provided in this embodiment, and the part of physical memory pages used in the non-virtualization scenario is managed by the memory management unit according to the memory management method provided in this embodiment. In this way, the two scenarios can coexist on one physical machine, and the memory management solution provided in this embodiment does not conflict with each other in the two scenarios.

[0065] refer to Figure 1In step 100, in response to the management instruction for the target physical memory page, the heat of the cross-group memory access request on the target physical memory page can be counted within the current statistical period. Among them, the management instruction in this embodiment can be automatically triggered at a fixed time. For example, a management cycle can be set, and the management instruction is automatically triggered when the management cycle is reached. The management cycle can be 1 hour or 1 day, etc., which can be set according to actual needs. For another example, several management start times can also be set. When the management start time is reached, the management instruction can be automatically triggered. The management start time can be 1:00, 3:00 and 5:00 every day, etc., which can also be set according to actual needs. No more examples are given for the automatic triggering time here. Of course, the management instruction in this embodiment can also be triggered on demand. For example, the staff can manually trigger the management instruction as needed. No more examples are given for on-demand triggering here. In addition, in this embodiment, the triggering timing of the management instructions on different physical memory pages may not be exactly the same.

[0066] For ease of description, the memory management scheme is described in this embodiment from the perspective of a target physical memory page. It should be understood that the target physical memory page can be any physical memory page on a physical machine.

[0067] The statistical period mentioned in step 100 can be a specified period of time, the length of which can be set as needed, and, in response to the different triggering methods of the management instructions mentioned above, the lengths of different statistical periods can be the same or different. In this way, in step 100, the heat of cross-group memory access requests within a period of time can be counted for the target physical memory page. Among them, the heat of cross-group memory access requests is used to reflect the comparison between the cross-group memory access requests and the intra-group memory access requests received on the target physical memory page within the statistical period. The heat of the cross-group memory access request in this embodiment can be characterized in the form of a cross-group memory access request ratio or a cross-group memory access request frequency. Among them, the cross-group memory access request ratio can refer to the proportion of cross-group memory access requests received on the target physical memory page within the statistical period in all the access requests it receives; the cross-group memory access request frequency can refer to the ratio between the number of cross-group memory access requests received on the target physical memory page within the statistical period and the length of the statistical period.

[0068] The cross-group memory access request in this embodiment refers to an access request initiated by a processor core that is not in the same memory group as the target physical memory page to the target physical memory page. As mentioned above, the response rate of the cross-group memory access request is usually much lower than the response rate of the intra-group memory access request.

[0069] Continue to refer Figure 1, in step 101, if the heat of the cross-group memory access request exceeds the specified standard, the memory group to which the target physical memory page belongs is re-determined. Among them, the specified standard can be set according to actual needs. For example, if the cross-group memory access request ratio is used to characterize the heat of the cross-group memory access request, the specified standard can be preset as a ratio threshold, so that if the cross-group memory access request ratio counted for the target physical memory page in step 100 exceeds the ratio threshold, it can be determined that the heat of the cross-group memory access request exceeds the specified standard. For another example, if the cross-group memory access request frequency is used to characterize the heat of the cross-group memory access request, the specified standard can be preset to exceed the specified frequency threshold and be greater than the memory access request frequency within the group, so that if the cross-group memory access request frequency counted for the target physical memory page in step 100 exceeds the specified frequency threshold and is greater than the memory access request frequency within the group, it can be determined that the heat of the cross-group memory access request exceeds the specified standard. Here, the cross-group memory access request heat exceeds the specified standard, indicating that the target physical memory has a low demand for access by the processor cores in the group, but has a higher demand for access by the processor cores in other memory groups. Accordingly, in step 101, a more suitable memory group can be found for the target physical memory page.

[0070] In this embodiment, a variety of implementation methods can be used to redetermine the memory group to which the target physical memory page belongs. The specific implementation methods will be exemplified in the following text and will not be described in detail here. Through step 101, a more suitable memory group can be redetermined for the target physical memory page when the heat of cross-group memory access requests exceeds a specified standard. It should be understood that the redetermined memory group will usually no longer be the memory group to which the target physical memory page currently belongs.

[0071] It can be seen that in this embodiment, in steps 100 and 101, the cross-group memory access request heat index is introduced, and based on this index, the idea of ​​dynamically adjusting the memory group to which the target physical memory page belongs is further proposed, breaking the technical cognition that the memory grouping scheme must remain unchanged in the current memory grouping architecture. From the overall perspective of the memory grouping architecture, in this embodiment, the physical memory pages contained in each memory group can be dynamically scheduled.

[0072] On this basis, if the heat of the cross-group memory access request exceeds the specified standard, at least two aspects of processing can be performed in step 102: on the one hand, the intra-group memory access relationship between the target physical memory page and the processor core in the memory group to which it currently belongs can be disconnected. On the other hand, an intra-group memory access relationship between the target physical memory page and the processor core in the memory group to which it is reallocated can be established. In this way, the target physical memory page will be called the local memory in the memory group to which it is reallocated, and a higher response rate can be provided for the access requests occurring in the memory group to which it is reallocated. From the perspective of the memory group to which the target physical memory page is reallocated, the process in it that originally needed to access the target physical memory page through the cross-group memory access method can now complete the access to the target physical memory page through the intra-group memory access method, and the access efficiency is greatly improved.

[0073] In this embodiment, after completing the current scheduling management for the target physical memory page based on the current statistical cycle, the target physical memory page can be scheduled again in the next statistical cycle. By implementing multiple statistical cycles, the dynamic scheduling of the target physical memory page can be achieved. Other physical memory pages on the physical machine can also be dynamically scheduled according to the same technical logic, so that the physical memory pages with relatively low usage in each memory group can be scheduled to a more appropriate memory group, thereby effectively reducing the situation of cross-group memory access.

[0074] In addition, in this embodiment, automatic expansion and contraction of memory groups can also be supported. The affinity between memory groups and physical memory pages is introduced as a scheduling reference for automatic expansion and contraction. To this end, in a further improved solution:

[0075] After the target physical memory page is allocated to the re-determined memory group, the affinity between it and the target physical memory page can be updated under the re-determined memory group according to the preset accumulation rule. Among them, an exemplary accumulation rule can be that each time it is allocated to the memory group, the affinity is increased by 1. In this way, the affinity between the relevant physical memory page can be monitored separately under each memory group. It should be understood that the affinity here can be used to reflect the access preference of the memory group to the physical memory page.

[0076] On this basis, when a memory group needs to be expanded, the affinity between the memory group and the physical memory pages outside the group can be checked, and the physical memory pages with higher affinity are preferentially selected from the physical memory pages outside the group for memory expansion.

[0077] In this way, when the memory group is expanded, the physical memory pages preferred by the memory group can be rescheduled back to the memory group, thereby effectively ensuring the memory access performance in the expanded memory group.

[0078] In summary, in this embodiment, for each physical memory page that is pre-divided into a memory group on the physical machine, the heat of cross-group memory access requests of the physical memory page within a period of time can be counted during the use of the memory. If the heat of the cross-group memory access request exceeds the specified standard, the memory group to which the physical memory page belongs is re-determined, and the physical memory page is allocated to the re-determined memory group. In this way, the cross-group memory access request situation on the physical memory page can be sensed during the use of the physical memory page, and the physical memory page can be dynamically scheduled to a more appropriate memory group according to the cross-group memory access request situation on the physical memory page. Through the dynamic scheduling of each physical memory page, the dynamic adjustment of the physical memory pages in each memory group on the physical machine can be realized, thereby reducing the proportion of cross-group memory access on the physical machine, and then improving the memory access efficiency.

[0079] Figure 3 A flowchart of another memory management method provided by an exemplary embodiment of the present application. Figure 3 , the method may include:

[0080] Step 300: In response to a management instruction for a target physical memory page, count the heat of cross-group memory access requests on the target physical memory page in a current statistical cycle;

[0081] Step 301: If the heat of cross-group memory access requests exceeds a specified standard, determine the source memory groups corresponding to each cross-group memory access request monitored on the target physical memory page within the current statistical period;

[0082] Step 302: for each determined source memory group, count the number of cross-group memory access requests corresponding to the target physical memory page in the current statistical period;

[0083] Step 303: Use the source memory group whose number of cross-group memory access requests meets the specified condition as the memory group to be re-determined for the target physical memory page;

[0084] Step 304: Allocate the target physical memory page to the re-determined memory group.

[0085] Wherein, step 300 and step 304 may refer to the relevant description in the above-mentioned embodiment, and will not be repeated here. In this embodiment, based on step 301 to step 303, an implementation method for re-determining the memory group to which the target physical memory page belongs is provided.

[0086] refer to Figure 3In this implementation, in step 301, the cross-group memory access request on the target physical memory page can be monitored in the current statistical period, and the source memory group corresponding to each of the monitored cross-group memory access requests can be obtained. The source memory group refers to the memory group where the processor core used by the requesting party such as the process or thread that initiates the cross-group memory access request is located.

[0087] It should be understood that, in actual applications, the cross-group memory access request on the target physical memory may come from multiple different source memory groups, and a single source memory group may issue multiple cross-group memory access requests to the target physical memory page within the current statistical period. To this end, in this implementation, in step 302, for each source memory group determined in step 301, the number of cross-group memory access requests issued to the target physical memory page within the current statistical period can be counted separately. Among them, the number of cross-group memory access requests can reflect the access requirements of the corresponding source memory group to the target physical memory page.

[0088] On this basis, in step 303, the source memory group whose number of cross-group memory access requests meets the specified condition can be used as the memory group re-determined for the target physical memory page. In a preferred scheme: from each source memory group determined in step 301, the source memory group that initiates the most cross-group memory access requests to the target physical memory page in the current statistical period can be found as the memory group re-determined for the target physical memory page. It can be understood that in this priority scheme, the specified condition can be understood as the maximum number of cross-group memory access requests issued to the target physical memory page in the current statistical period. That is, in this preferred scheme, each source memory group that issues a cross-group memory access request to the target physical memory page in the current statistical period is compared, and specifically the number of cross-group memory access requests initiated by these source memory groups to the target physical memory page in the current statistical period is compared. Thus, in the preferred solution, the source memory group that issues the most cross-group memory access requests to the target physical memory page in the current statistical period can be selected from the various source memory groups that issue cross-group memory access requests to the target physical memory page, and used as the new memory group corresponding to the target physical memory page. As mentioned above, the number of cross-group memory access requests can reflect the access requirements of the corresponding source memory group to the target physical memory page. Therefore, in the preferred solution, the memory group with the highest cross-group memory access requirements to the target physical memory page can be used as the memory group re-determined for the target physical memory page.

[0089] Accordingly, in this implementation, the target physical memory page can be reallocated to a more appropriate memory group. After the reallocation is completed, the memory access request issued to the target physical memory page in the reallocated memory group will be responded to in the manner of intra-group memory access, and the response rate is greatly improved. Moreover, since the reallocated memory group originally initiated a large number of cross-group memory access requests to the target physical memory, this part of the cross-group memory access request number can be avoided in the reallocated memory group. From the perspective of the memory grouping architecture, the cross-group memory access request issued to the target physical memory page in the reallocated memory group can be avoided through dynamic scheduling of the target physical memory page, and the effect of reducing cross-group memory access requests can be obtained in almost every memory group. Therefore, the proportion of cross-group memory access requests in the entire memory grouping architecture will be greatly reduced, and the overall memory access efficiency will be improved.

[0090] The inventors discovered during the research process that both intra-group memory access requests and cross-group memory access requests are imperceptible to the virtual manager or memory management unit on the physical machine, which brings difficulties to the implementation of step 301 in the above implementation method.

[0091] To this end, in this implementation, a solution for monitoring cross-group memory access requests on the target physical memory page is further proposed. In an exemplary solution, the access identifier in the page table entry where the target physical memory page is located can be used to monitor the cross-group memory access requests on the target physical memory page.

[0092] In this exemplary solution: multiple sampling periods can be set within the current statistical cycle; when the start time of the target sampling period is reached, the access identifier in the page table entry where the target physical memory page is located is cleared, so that an access fault is triggered when an access request for the target physical memory page occurs within the target sampling period; if an access fault is received for the target physical memory page within the target sampling period, the source memory group corresponding to the access request that triggered the access fault is identified from the access fault; if the identified source memory group is inconsistent with the memory group to which the target physical memory page currently belongs, it is determined that a cross-group memory access request is monitored; wherein the target sampling period is any one of the multiple sampling periods.

[0093] In practical applications, the current statistical period can be divided into multiple continuous sampling periods. Of course, multiple discontinuous sampling periods can also be set within the current statistical period. This embodiment does not limit the specifications and intervals of the sampling periods, and can be flexibly adjusted according to actual sampling accuracy requirements.

[0094] In this exemplary solution, the access flag (AF) mentioned is an existing concept in the field of memory management technology. The access flag is used to indicate whether the physical memory page in the page table entry has been accessed for the first time. If the physical memory page in the page table entry has not been accessed for the first time, there will be no access flag on it, and an access fault may be triggered when the first access occurs; if the physical memory page in the page table entry has been accessed for the first time, an access flag will be added to it. At present, the access flag is usually automatically maintained by the hardware on the physical machine (such as the memory manager MMU, Memory Management Unit), and the virtual machine manager or memory management unit on the physical machine is unaware of this, and only acts as a passive recipient of the access fault to handle the access fault.

[0095] In this exemplary solution, it is proposed that in a virtualized scenario, the virtual machine manager participates in maintaining the access identifier; in a non-virtualized scenario, the memory management unit participates in maintaining the access identifier.

[0096] For ease of understanding, in this exemplary solution, the target sampling period is used as an example to describe the scheme for monitoring cross-group memory access requests in a single sampling period. It should be understood that the same scheme can be used in other sampling periods to implement monitoring of cross-group memory access requests.

[0097] In this exemplary solution, it is proposed that when the start time of the target sampling period is reached, the access identifier in the page table entry where the target physical memory page is located can be actively cleared. It should be noted here that at the same time, there is usually only one page table entry where the target physical memory page is located. This is because through the aforementioned memory interaction technology, after the target physical memory page is swapped out, the physical address of the target physical memory page originally recorded in the corresponding page table entry will be deleted, and this type of page table entry will not be recognized by this embodiment as a page table entry that requires access identifier clearing. Of course, if with the development of technology, at the same time, there can be multiple page table entries where the target physical memory page is located, then in this embodiment, it can support the clearing of access identifiers of all page table entries where the target physical memory page is located. In the field of memory management technology, the page table entries used by different applications are isolated from each other. Therefore, when multiple applications use the target physical memory page, different applications will use their own exclusive page table entries to access the target physical memory page.

[0098] Among them, in the virtualization scenario, the page table entry here refers to the page table entry that records the mapping relationship between the virtual machine physical memory address (GPA, Guest Physical Address) and the physical machine physical memory address (HPA, Host Physical Address). This is not limited to the memory virtualization technology used in the virtualization scenario. For example, the extended page table (EPT) mechanism can be used to implement memory virtualization. Of course, shadow page tables, nested paging and other mechanisms can also be used to implement it. No limitation is made here, and no more examples are given. This embodiment can support various memory virtualization technologies. This is because no matter which memory virtualization technology is used, it is necessary to construct the mapping relationship between the aforementioned GPA and HPA to achieve access to physical memory pages. In the virtualization scenario, two stages of address mapping are usually required: the virtual machine's operating system GUEST OS completes the mapping from GVA (Guest Virtual Address, virtual machine virtual memory address) to GPA; then the hardware such as MMU and / or IOMMU in the physical machine completes the mapping from GPA to HPA, and finally accesses the required physical memory page. In this exemplary solution, the virtual machine manager can actively clear the access identifier recorded for the target physical memory page in the mapping relationship between the GPA and the HPA as needed in the subsequent address mapping stage. It should be understood that in the virtualization scenario, the virtual machine manager has the maintenance authority for the mapping relationship between the GPA and the HPA, so it can perform the access identifier clearing operation required in this embodiment without any obstacles.

[0099] Among them, in a non-virtualized scenario, the page table entry here refers to the page table entry that records the mapping relationship between the virtual address (VA, VirtualAddress) and the physical address (PA, PhysicalAddress). In this exemplary solution, the memory management unit can actively clear the access identifier recorded for the target physical memory page in the mapping relationship between VA and PA as needed. Similarly, in a non-virtualized scenario, the memory management unit has the maintenance authority for the mapping relationship between VA and PA, so it can also perform the access identifier clearing operation required in this embodiment without obstacles.

[0100] After completing the aforementioned access identification clearing operation for the target sampling period, when an access request for the target physical memory page occurs on the page table entry being operated, it will be deemed to be the first access to the target physical memory page, thereby triggering an access fault. In a virtualization scenario, an access fault will cause the virtual machine to exit. The virtual machine manager can intercept the access fault and perform access fault processing. Here, in addition to performing access fault processing in a conventional manner, the virtual machine manager will also identify the source memory group corresponding to the access request that triggers the access fault. It should be understood that the virtual machine manager has a global perspective on each virtual machine and memory group in the physical machine, so the identification operation here can be implemented without obstacles. Similarly, in a non-virtualization scenario, the memory management unit can also intercept the access fault and identify the source memory group corresponding to the access request that triggers the access fault. Further, the virtual machine manager or the memory management unit can also determine whether the identified source memory group is consistent with the memory group to which the target physical memory page currently belongs. If they are consistent, the corresponding access request is determined as an intra-group memory access request. If they are inconsistent, the corresponding access request can be determined as a cross-group memory access request.

[0101] It should be understood that for the page table entry where the target physical memory page is located, the first access request for the target physical memory page that occurs during the target sampling period will trigger an access fault. Therefore, during the target sampling period, if an access request for the target physical memory page occurs on the page table entry where the target physical memory page is located, the access fault will be intercepted in this embodiment. In this way, the access faults intercepted during different sampling periods may be triggered by access requests initiated by different applications, and different applications may use different processor cores, and different processor cores may come from different memory groups. Therefore, by querying layer by layer, the source memory group corresponding to the access request that triggers the access fault can be identified, and the memory access request within the group and the memory access request across the group can be distinguished.

[0102] It can be seen that in this exemplary solution, the cross-group memory access request on the target physical memory page can be monitored by actively clearing the access identifier in the page table entry where the target physical memory page is located on demand. This enables the virtual manager or memory management unit on the physical machine to correctly perceive the cross-group memory access request and intra-group memory access request occurring on each physical memory page.

[0103] On this basis, access fault interception can be implemented in each sampling period within the current statistical cycle, and it can be distinguished whether the access request that triggers each access fault is an intra-group memory access request or a cross-group memory access request. Therefore, the total number of intra-group access requests and the total number of cross-group memory access requests on the target physical memory page can be counted in the current statistical cycle; and then, the aforementioned cross-group memory access request heat can be calculated based on the total number of cross-group memory access requests and the total number of intra-group access requests. In response to the two exemplary heat characterization methods mentioned above, here, the sum of the total number of cross-group memory access requests and the total number of intra-group access requests can be calculated; and the ratio between the total number of cross-group memory access requests and the sum is calculated as the aforementioned cross-group memory access request ratio. Here, the ratio between the total number of cross-group memory access requests and the current statistical cycle length can also be calculated as the aforementioned cross-group memory access request frequency. In addition, it should be understood that in actual applications, some sampling periods may not have access requests for the target physical memory page, so access faults will not be intercepted.

[0104] It should be understood that the above-mentioned operations of counting the heat of cross-group memory access requests on the target physical memory page, identifying the source memory group corresponding to each cross-group memory access request, and distinguishing whether the access request is an intra-group memory access request or a cross-group memory access request can all be completed within the current statistical cycle. In this way, after the current statistics are completed, sufficient basis can be obtained to determine whether it is necessary to redetermine the memory group to which the target physical memory page belongs and to which memory group it is more appropriate to reallocate the target physical page.

[0105] Furthermore, in order to avoid excessive access failures that may have a negative impact on memory access efficiency, this exemplary solution also proposes: after completing the identification operation within the target sampling period, an access identifier may be added to the target page table entry used by the access request that triggered the access failure; the access request is triggered to continue execution; wherein, based on the added access identifier, the access request that continues to be executed and subsequent access requests initiated using the target page table entry within the target sampling period no longer trigger an access failure.

[0106] Taking the virtualization scenario as an example, the virtual machine manager can add an access identifier to the target page table entry used by the access request that triggers the access fault after completing the aforementioned operations of counting the heat of cross-group memory access requests on the target physical memory page, identifying the source memory group corresponding to each cross-group memory access request, and distinguishing whether the access request is an intra-group memory access request or a cross-group memory access request; and after completing the access identifier addition operation, the processing right of the access request can be returned to the virtual machine (for example, the return can be achieved by the virtual machine entering the VMentry mechanism) to trigger the virtual machine to continue to execute the access request. At this time, the virtual machine continues to execute the access request. In the aforementioned second address mapping stage, since the access identifier has been added to the target physical memory page in the corresponding page table entry, the access fault will no longer be triggered, and the subsequent access request for the target physical memory page on the page table entry will no longer trigger the access fault, thereby avoiding triggering too many access faults.

[0107] Based on this, within a single sampling period, the page table entry where the target physical page is located will trigger an access fault when the first access request to the target physical memory page occurs, and subsequent access requests will not trigger an access fault. Although such a setting may make it impossible to monitor all access requests that actually occur on the target physical memory page within a single sampling period, since the concept of this embodiment only needs to evaluate the cross-group memory access situation on the target physical memory page, there is no need to strictly pursue the accuracy of the evaluation. Moreover, in actual applications, the required evaluation accuracy can be achieved by adjusting the sampling frequency. It can be seen that this mechanism of timely and proactively restoring the access identifier for the target physical memory page by the virtual machine manager or memory management unit can effectively reduce the number of access failures on the basis of ensuring the normal implementation of the memory management scheme of this embodiment, and avoid negative impacts on memory access efficiency.

[0108] Figure 4 A flowchart of a memory management method is provided for an exemplary embodiment of the present application. Figure 4 , the method may include:

[0109] Step 400: In response to a management instruction for a target physical memory page, count the heat of cross-group memory access requests on the target physical memory page in a current statistical cycle;

[0110] Step 401: if the heat of the cross-group memory access request exceeds a specified standard, then re-determine the memory group to which the target physical memory page belongs;

[0111] Step 402: Allocate the target physical memory page to the re-determined memory group;

[0112] Step 403: After the current statistical cycle ends, a designated physical memory page for replacing the target physical memory page is selected from the memory group to which the target physical memory page currently belongs;

[0113] Step 404: Use the designated physical memory page to respond to access requests that are subsequently initiated from the memory group to which the target physical memory page currently belongs and that are originally required to be responded to by the target physical memory page.

[0114] Among them, step 400-step 402 can refer to the relevant description in the above embodiment, and will not be repeated here. In this embodiment, based on step 403-step 404, a memory optimization solution is provided in the memory group to which the target physical memory page originally belongs when the target physical memory page is reallocated to other memory groups.

[0115] As mentioned above, in the current statistical period, not only cross-group memory access requests will occur on the target physical memory page, but also some intra-group memory access requests will occur. After the target physical memory page is allocated to other memory groups in step 402, the target physical memory page is no longer a local memory for the memory group to which it originally belongs, but becomes a remote memory. Accordingly, the access request initiated in the memory group to which the target physical memory page originally belongs, which originally needs to be responded by the target physical memory page, becomes a cross-group memory access request, and the response rate of this part of the access request will be greatly reduced.

[0116] In order to avoid this problem, it is proposed in step 403 that after the current statistical cycle ends, if the heat of cross-group memory access requests exceeds the specified standard, that is, the target physical memory page needs to be reallocated to other memory groups, then a specified physical memory page for replacing the target physical memory page can be selected from the memory group to which the target physical memory page currently belongs, and in step 404, the specified physical memory page is used to respond to the access request that was originally initiated in the memory group to which the target physical memory page originally belonged, and that was originally required to be responded to by the target physical memory page. Among them, the specified physical memory page selected here can be any free physical memory page in the memory group to which the target physical memory page originally belonged.

[0117] Here, the target physical memory page can be swapped out and the designated physical memory page used to replace the target physical memory page can be swapped in through the aforementioned memory swap (SWAP) technology. After the memory swap, the target physical memory page is released, so that it can be reallocated to a new memory group. It should be understood that for the processor core in the memory group to which the target physical memory page originally belongs, it does not perceive which physical memory page is specifically accessed when performing memory access. The memory access request initiated by the processor core usually carries a virtual memory address, and then the memory access request needs to be mapped based on the aforementioned page table before it reaches the corresponding physical memory page. In this way, by implementing the memory optimization scheme, the access request that was subsequently initiated in the memory group to which the target physical memory page originally belonged and that was originally required to be responded to by the target physical memory page can still be responded to in the manner of intra-group memory access, and will not become a cross-group memory access manner due to the reallocation of the target physical memory page, resulting in the generation of a new cross-group memory access request.

[0118] In order to implement the replacement of the target physical memory page with the specified physical memory page, in an exemplary implementation scheme:

[0119] After the current statistical period ends, the page table entries used by each memory access request within the group monitored on the target physical memory page during the current statistical period can be searched;

[0120] Clearing the access identifier associated with the target physical memory page in each page table entry found, so that the access request for the target physical memory page initiated based on each page table entry found can trigger an access fault;

[0121] In the process of handling the access failure, the physical memory address of the target physical memory page in the corresponding page table entry is replaced with the physical address corresponding to the specified physical memory page;

[0122] After the replacement operation is completed, an access identifier is added to the corresponding page table entry for the specified physical memory page;

[0123] The access request that triggered the completed access fault processing continues to execute to respond to the access request in the same manner as the memory access within the group.

[0124] In this exemplary implementation, the access identifier associated with the target physical memory page in the page table entry used by the memory access request in each group can be actively cleared, so that when the access request for the target physical memory page occurs subsequently on these page table entries, an access fault can be triggered. Thus, the virtual machine manager or the memory management unit can intercept these access faults, which gives the virtual machine manager or the memory management unit an opportunity to replace the target physical memory page. That is, the virtual machine manager or the memory management unit can handle the intercepted access faults and replace the physical address in the page table entry during the access fault processing to complete the fault processing. Among them, the process of handling the access fault can refer to the page fault recovery logic, that is, the virtual memory address in the corresponding page table is identified as being in a page fault state, and an idle physical memory page is found as the aforementioned designated physical memory page, and the designated physical memory page is swapped in, so that the original mapping relationship in the page table entry can be updated, and the target physical memory page has been replaced by the designated physical memory page in the updated mapping relationship. After the replacement operation of the physical address is completed, an access identifier can be added to the corresponding page table entry for the specified physical memory page and the access request that has completed the fault processing can be triggered to continue to execute. After such access request continues to execute, the specified physical memory page will respond in the manner of intra-group memory access.

[0125] It is worth noting that, in actual applications, the reallocation process of the target physical page mentioned in step 401-step 402 and the physical memory page replacement process mentioned in step 403-step 404 can be executed in parallel without affecting each other, so as to avoid cross-group memory access requests in the memory group to which the target physical memory page originally belongs due to the reallocation of the target physical memory page.

[0126] in addition, Figure 4 The memory optimization scheme proposed in the memory group to which the target physical page originally belongs can be combined with Figure 3 The implementation scheme proposed in is combined with the one proposed in the paper to redetermine the memory group to which the target physical memory page belongs.

[0127] In summary, in the memory optimization scheme provided in this embodiment, when the target physical memory page is reallocated to other memory groups, not only can the cross-group memory access request for the target physical memory page in the memory group to which it is reallocated be converted into an intra-group memory access request, but also the intra-group memory access request in the memory group to which it originally belongs, which originally needs to be responded by the target physical memory page, can still be responded in accordance with the intra-group memory access method. In this way, from the perspective of the memory grouping architecture, through the memory management method provided in this embodiment, a part of the cross-group memory access requests occurring therein are converted into intra-group memory access requests, while the original intra-group memory access requests therein continue to be responded in accordance with the intra-group memory access method. Therefore, the cross-group memory access requests in the memory grouping architecture will be greatly reduced, so that the application will be more likely to complete the memory access through the intra-group memory access method, thereby effectively improving the memory access efficiency.

[0128] Figure 5a A schematic diagram of a scheme logic in an exemplary application scenario provided by an exemplary embodiment of the present application. Figure 5a The memory management method provided in this embodiment is applied to a virtual machine manager in a physical machine, which is described as VMM below. There are multiple NUMA nodes preset on the physical machine, for example, Figure 5a NUMA node0 and NUMA node1 in the physical machine. Multiple virtual machines are running on the physical machine. Applications in the virtual machines can initiate memory access requests. Figure 5a Typically, a virtual machine can contain multiple VCPUs, which will be implemented by the processor core (CPU) on the physical machine. An application can contain multiple processes, and the virtual machine can schedule a single process of the application to a VCPU in the virtual machine. Ultimately, the memory access request initiated by the process of the application on the virtual machine will reach the processor core on the physical machine.

[0129] refer to Figure 5a, the target physical memory page b on the physical machine is currently divided into NUMA node1. Taking application a in virtual machine A as an example, if process c in application a is scheduled to VCPU1, and VCPU1 is implemented on physical CPUX, the access request for the target physical memory page b initiated by process c will reach CPUX, and CPUX is located in NUMAnode0, so the access request will reach the target physical memory page b through cross-group memory access; if process d in application a is scheduled to VCPU2, and VCPU2 is implemented in physical CPUY, the access request for the target physical memory page b initiated by process d will reach CPUY, and CPUY is located in NUMA node0, and belongs to the same NUMAnode0 as the target physical memory page b, so the access request can reach the target physical memory page b through intra-group memory access.

[0130] refer to Figure 5a , the VMM can monitor the access requests received on the target physical memory page b. To do this, Figure 5b This is a schematic diagram of a time period setting scheme in an exemplary application scenario provided by an exemplary embodiment of the present application. Figure 5b , set the statistical period to 1 hour, and divide the statistical period into N consecutive sampling periods. VMM can clear the access identifier AF associated with the target physical memory page b in the page table entry where the target physical memory page b is located (for example, the page table entry where the target physical memory page b is located in the EPT page table) at the start time of each sampling period. In this way, if an access request for the target physical memory page b occurs on the operated page table entry within a certain sampling period, an access fault will be triggered, and the virtual machine will exit the Vmexit event. VMM can intercept these access faults.

[0131] In addition to the conventional processing of these access failures, the VMM can also parse out the source NUMAnode corresponding to the access request that triggered the access failure from these access failures. For example, Figure 5a When the access request initiated by process d in the example above for the target physical memory page b causes an access failure, the VMM can identify that the access request comes from NUMAnode1 and determine that it is an intra-group memory access request; Figure 5a When an access request initiated by process c for target physical memory page b causes an access failure, the VMM can identify that the access request originates from NUMAnode0 and determines that it is a cross-group memory access request.

[0132] For example, reference Figure 5b, in the first sampling period, an access failure to the target physical memory page b was detected, and its corresponding source memory group was NUMAnode1; in the second sampling period, an access failure to the target physical memory page b was detected, and its corresponding source memory group was NUMAnode0; in the third sampling period, no access failure to the target physical memory page b was detected; in the fourth sampling period, an access failure to the target physical memory page b was detected, and its corresponding source memory group was NUMAnode0; in the fifth sampling period, an access failure to the target physical memory page b was detected, and its corresponding source memory group was NUMAnode2. Assuming that N=5, it can be calculated that in this statistical period, the proportion of cross-group memory access requests corresponding to the target physical memory page b is 3 / 4, among which the number of cross-group memory access requests issued to the target physical memory page in NUMAnode1 is the largest.

[0133] Since 3 / 4 has exceeded the specified standard 1 / 2, therefore, reference Figure 5a , VMM reallocates the target physical memory to NUMAnode0, so that subsequent access requests to the target physical memory page b initiated by the requester such as process c in NUMAnode0 will be responded to in the same way as the intra-group memory access, greatly improving the memory access rate. Figure 5b , VMM also uses physical memory page e to replace the target physical memory page b in NUMAnode1, so that physical memory page e can continue to respond to the intra-group memory access request that was originally required to be responded to by the target physical memory page b in the manner of intra-group memory access.

[0134] refer to Figure 5a and 5b The memory management method provided in this embodiment can realize dynamic scheduling of physical memory pages under the memory grouping architecture, and dynamically schedule physical memory pages to appropriate memory groups, so as to convert as many access requests as possible that originally need to be responded to in the memory grouping architecture according to the cross-group memory access method into intra-group memory access requests, thereby improving memory access efficiency.

[0135] It should be noted that in some of the processes described in the above embodiments and the accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel, and the sequence numbers of the operations, such as 301, 302, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel.

[0136] Figure 6 FIG. 1 is a schematic diagram of a physical machine structure provided by another exemplary embodiment of the present application. Figure 6 As shown, the physical machine may include: a memory 60 and a processor 61. The memory 60 may provide physical memory pages. The physical machine is preset with multiple memory groups, each memory group includes physical memory pages, and the memory access rate within the group is higher than the memory access rate across the group. The memory is used to store one or more computer instructions; the processor is coupled to the memory and is used to execute one or more computer instructions, so as to:

[0137] In response to a management instruction for a target physical memory page, counting the heat of cross-group memory access requests on the target physical memory page in a current statistical cycle;

[0138] If the heat of the cross-group memory access request exceeds a specified standard, re-determining the memory group to which the target physical memory page belongs;

[0139] The target physical memory page is allocated to the re-determined memory group.

[0140] In an optional embodiment, when the processor 61 redetermines the memory group to which the target physical memory page belongs, it may be specifically configured to:

[0141] Determine the source memory group corresponding to each cross-group memory access request monitored on the target physical memory page during the current statistical period;

[0142] For each determined source memory group, respectively counting the number of cross-group memory access requests corresponding to the target physical memory page in the current statistical period;

[0143] The source memory group whose number of cross-group memory access requests meets the specified condition is used as the memory group to be re-determined for the target physical memory page.

[0144] In an optional embodiment, when the processor 61 uses the source memory group whose number of cross-group memory access requests meets the specified condition as the memory group to be re-determined for the target physical memory page, it can be specifically used to:

[0145] From the determined source memory groups, find the source memory group that initiates the most cross-group memory access requests to the target physical memory page in the current statistical period, as the memory group that is re-determined for the target physical memory page.

[0146] In an optional embodiment, the processor 61 may also be configured to:

[0147] Setting a plurality of sampling periods within the current statistical period;

[0148] When the start time of the target sampling period is reached, the access identifier in the page table entry where the target physical memory page is located is cleared, so that an access fault is triggered when an access request for the target physical memory page occurs within the target sampling period;

[0149] If an access failure to the target physical memory page is received within the target sampling period, identifying from the access failure a source memory group corresponding to the access request that triggers the access failure;

[0150] If the identified source memory group is inconsistent with the memory group to which the target physical memory page currently belongs, it is determined that a cross-group memory access request is monitored;

[0151] The target sampling period is any one of the multiple sampling periods.

[0152] In an optional embodiment, when the processor 61 counts the heat of the cross-group memory access request on the target physical memory page in the current statistical period, it can be used to:

[0153] Based on the access failures received in the current statistical period, counting the total number of intra-group access requests and the total number of cross-group memory access requests corresponding to the target physical memory page in the current statistical period;

[0154] The heat of the cross-group memory access request is calculated according to the total number of cross-group memory access requests and the total number of intra-group access requests.

[0155] In an optional embodiment, the processor 61 may also be configured to:

[0156] After completing the identification operation within the target sampling period, adding an access identifier to a target page table entry used by the access request that triggers the access fault;

[0157] triggering the access request to continue execution;

[0158] Wherein, based on the added access identifier, the access request that continues to be executed and the subsequent access request initiated by using the target page table entry within the target sampling period no longer trigger an access fault.

[0159] In an optional embodiment, the processor 61 may also be configured to:

[0160] If the heat of the cross-group memory access request exceeds the specified standard, after the current statistical period ends, a specified physical memory page for replacing the target physical memory page is selected from the memory group to which the target physical memory page currently belongs;

[0161] The designated physical memory page is used to respond to an access request subsequently initiated in the memory group to which the target physical memory page currently belongs, which originally needs to be responded to by the target physical memory page.

[0162] In an optional embodiment, when the processor 61 uses the designated physical memory page to respond to an access request subsequently initiated in the memory group to which the target physical memory page currently belongs and which originally needs to be responded to by the target physical memory page, it can be specifically used to:

[0163] Finding the page table entries used by each of the intra-group memory access requests monitored on the target physical memory page during the current statistical period;

[0164] Clearing the access identifier associated with the target physical memory page in each page table entry found, so that an access request for the target physical memory page initiated based on each page table entry found can trigger an access fault;

[0165] In the process of processing the access fault, the physical address of the target physical memory page in the corresponding page table entry is replaced with the physical address corresponding to the specified physical memory page;

[0166] After completing the replacement operation, adding an access identifier for the specified physical memory page in the corresponding page table entry;

[0167] The access request that triggered the completed access fault processing continues to be executed to respond to the access request in accordance with the intra-group memory access manner.

[0168] In an optional embodiment, when the target physical memory page is mapped to the virtual machine memory space, the memory management logic executed by the processor 61 may be implemented by the virtual machine manager on the physical machine; when the target physical memory page is not mapped to the virtual machine memory space, the memory management logic executed by the processor 61 may be implemented by the memory management unit on the physical machine.

[0169] In an optional embodiment, the memory group uses a NUMA node or a CPU slot as a memory grouping unit.

[0170] In an optional embodiment, the processor 61 may also be configured to:

[0171] After the target physical memory page is allocated to the re-determined memory group, the affinity with the target physical memory page is updated under the re-determined memory group according to a preset accumulation rule; when the re-determined memory group needs to perform memory expansion, the physical memory pages that are outside the re-determined memory group and whose affinity with the re-determined memory group meets the specified requirements will be re-scheduled back to the re-determined memory group.

[0172] Further, if Figure 6 As shown, the physical machine also includes: a communication component 62, a power supply component 63 and other components. Figure 6 Only some components are shown schematically, which does not mean that the physical machine only includes Figure 6 Components shown.

[0173] It is worth noting that the technical details in the above-mentioned embodiments of the physical machine can refer to the relevant description in the aforementioned method embodiments. In order to save space, they will not be repeated here, but this should not cause a loss in the scope of protection of this application.

[0174] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which can implement the steps in the above method embodiment when the computer program is executed.

[0175] Above Figure 6 The memory in the computer is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0176] Above Figure 6 The communication component in is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0177] Above Figure 6 The power supply component in the device provides power to various components of the device where the power supply component is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device where the power supply component is located.

[0178] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0179] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0180] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0181] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0182] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0183] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0184] The above is only the embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims

1. A memory management method, characterized in that: A plurality of memory groups are preset on the physical machine, and the memory groups contain physical memory pages. The method includes: In response to a management instruction for a target physical memory page, counting the heat of cross-group memory access requests on the target physical memory page in a current statistical cycle; If the heat of the cross-group memory access request exceeds a specified standard, re-determining the memory group to which the target physical memory page belongs; The target physical memory page is allocated to the re-determined memory group.

2. The method according to claim 1, characterized in that Re-determining the memory group to which the target physical memory page belongs, including: Determine the source memory group corresponding to each cross-group memory access request monitored on the target physical memory page during the current statistical period; For each determined source memory group, respectively counting the number of cross-group memory access requests corresponding to the target physical memory page in the current statistical period; The source memory group whose number of cross-group memory access requests meets the specified condition is used as the memory group to be re-determined for the target physical memory page.

3. The method according to claim 2, characterized in that The method further comprises: using a source memory group whose number of cross-group memory access requests meets a specified condition as a memory group to be re-determined for the target physical memory page, including: From the determined source memory groups, find the source memory group that initiates the most cross-group memory access requests to the target physical memory page in the current statistical period, as the memory group that is re-determined for the target physical memory page.

4. The method according to claim 2, characterized in that: Also includes: Setting a plurality of sampling periods within the current statistical period; When the start time of the target sampling period is reached, the access identifier in the page table entry where the target physical memory page is located is cleared, so that an access fault is triggered when an access request for the target physical memory page occurs within the target sampling period; If an access failure to the target physical memory page is received within the target sampling period, identifying from the access failure a source memory group corresponding to the access request that triggers the access failure; If the identified source memory group is inconsistent with the memory group to which the target physical memory page currently belongs, it is determined that a cross-group memory access request is monitored; The target sampling period is any one of the multiple sampling periods.

5. The method according to claim 4, characterized in that Counting the heat of cross-group memory access requests on the target physical memory page in the current statistical period includes: Based on the access failures received in the current statistical period, counting the total number of intra-group access requests and the total number of cross-group memory access requests corresponding to the target physical memory page in the current statistical period; The heat of the cross-group memory access request is calculated according to the total number of cross-group memory access requests and the total number of intra-group access requests.

6. The method according to claim 4, characterized in that Also includes: After completing the identification operation within the target sampling period, adding an access identifier to a target page table entry used by the access request that triggers the access fault; triggering the access request to continue execution; Wherein, based on the added access identifier, the access request that continues to be executed and the subsequent access request initiated by using the target page table entry within the target sampling period no longer trigger an access fault.

7. The method according to claim 1, characterized in that Also includes: If the heat of the cross-group memory access request exceeds the specified standard, after the current statistical period ends, a specified physical memory page for replacing the target physical memory page is selected from the memory group to which the target physical memory page currently belongs; The designated physical memory page is used to respond to an access request subsequently initiated in the memory group to which the target physical memory page currently belongs, which originally needs to be responded to by the target physical memory page.

8. The method according to claim 7, characterized in that Using the designated physical memory page to respond to an access request subsequently initiated in the memory group to which the target physical memory page currently belongs, which originally needs to be responded to by the target physical memory page, includes: Finding the page table entries used by each of the intra-group memory access requests monitored on the target physical memory page during the current statistical period; Clearing the access identifier associated with the target physical memory page in each page table entry found, so that an access request for the target physical memory page initiated based on each page table entry found can trigger an access fault; In the process of processing the access fault, the physical address of the target physical memory page in the corresponding page table entry is replaced with the physical address corresponding to the specified physical memory page; After completing the replacement operation, adding an access identifier for the specified physical memory page in the corresponding page table entry; The access request that triggered the completed access fault processing continues to be executed to respond to the access request in accordance with the intra-group memory access manner.

9. The method according to claim 1, characterized in that: When the target physical memory page is mapped to the virtual machine memory space, the method is applicable to the virtual machine manager on the physical machine; when the target physical memory page is not mapped to the virtual machine memory space, the method is applicable to the memory management unit on the physical machine.

10. The method according to claim 1, characterized in that The memory group uses a NUMA node or a CPU slot as a memory grouping unit.

11. The method according to claim 1, characterized in that: Also includes: After the target physical memory page is allocated to the re-determined memory group, the affinity between the target physical memory page and the re-determined memory group is updated according to a preset accumulation rule; In the case that the re-determined memory group needs to be expanded, the physical memory pages that are outside the re-determined memory group and whose affinity with the re-determined memory group meets the specified requirements are rescheduled back to the re-determined memory group.

12. A physical machine, characterized in that: It includes a memory and a processor, the memory provides physical memory pages, the physical machine is preset with multiple memory groups, the memory groups contain physical memory pages, the memory access rate within the group is higher than the memory access rate across groups, the memory is used to store one or more computer instructions; the processor is coupled to the memory, and is used to execute the one or more computer instructions, so as to execute the memory management method described in any one of claims 1-11.

13. A computer-readable storage medium storing computer instructions, characterized in that: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the memory management method according to any one of claims 1 to 11.