Memory weight interleaving method and device, medium and product

By pre-configuring the memory interleaving policy file and dynamically determining the NUMA memory interleaving policy, the problem of restarting the program to switch policies in the existing technology is solved, and flexible configuration of thread-level policies and weights is achieved, thereby improving memory allocation efficiency and system flexibility.

CN120743566AActive Publication Date: 2025-10-03LANGCHAO ELECTRONIC INFORMATION IND CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
CN202511255565.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-04
Publication Date
2025-10-03
Estimated Expiration
2045-09-04

AI Technical Summary

Technical Problem

The existing NUMA memory interleaving solution requires restarting the program to switch policies, global unified weight configuration, and thread-level policies and weights cannot be customized, resulting in poor flexibility.

Method used

A memory weight interleaving method is provided. By pre-configuring a memory interleaving policy configuration file, which contains memory interleaving configuration policies corresponding to different threads and processes, the target interleaving policy is dynamically determined according to the memory application request, avoiding restarting the program and realizing flexible configuration of thread-level policies and weights.

Benefits of technology

It improves the efficiency of memory interleaving execution, reduces the risk of service interruption, meets thread-level heterogeneity requirements, and enhances the system's flexibility and performance optimization capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120743566A_ABST
    Figure CN120743566A_ABST
Patent Text Reader

Abstract

The invention discloses a memory weight interleaving method and device, a medium and a product, and relates to the technical field of computers. According to the scheme, a memory interleaving strategy configuration file is pre-configured, and the memory interleaving strategy configuration file comprises memory interleaving configuration strategies corresponding to different threads and memory interleaving configuration strategies corresponding to different processes; due to the fact that multiple different memory interleaving configuration strategy selections are provided, global unified memory interleaving weight configuration can be avoided, meanwhile, thread-level strategy and weight configuration is achieved, and higher flexibility is achieved. When the memory allocation is executed, the memory application information is determined according to the memory application request, and the target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file according to the memory application information, so that the application allocation of the memory can be executed based on the target memory interleaving configuration strategy without restarting a program; the service interruption risk is greatly reduced, and the memory interleaving execution efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a memory weight interleaving method, device, medium and product. Background Art

[0002] In a Non-Uniform Memory Access (NUMA) architecture, memory interleaving is statically configured at process startup by setting the memory interleaving policy (numactl --interleave). This uses round-robin to distribute memory requests to designated nodes, preventing performance issues caused by memory exhaustion on a single node.

[0003] However, this solution has obvious shortcomings: first, policy adjustments lack dynamism, and the memory policy is fixed within the process life cycle. The process needs to be restarted to switch the policy, posing a serious interruption risk to long-term services; second, the policy granularity is coarse, only supporting a unified process-level policy, which cannot meet the heterogeneous requirements at the thread level, making it difficult for different threads to adopt the most suitable memory policy; in addition, the weight control is too global, and differentiated weight allocation cannot be performed for specific processes or threads, limiting system flexibility and performance optimization space.

[0004] In view of the above, how to solve the current NUMA memory interleaving solution, which requires restarting the program to switch strategies, global unified weight configuration, and the inability to customize thread-level strategies and weights, and has poor flexibility, is an urgent problem that needs to be solved by technical personnel in this field. Summary of the Invention

[0005] The present invention provides a memory weight interleaving method, device, medium and product to at least solve the problems of the current NUMA memory interleaving solution, such as the need to restart the program to switch strategies, global unified weight configuration, and the inability to customize thread-level strategies and weights, resulting in poor flexibility.

[0006] The present invention provides a memory weight interleaving method, comprising: When a memory application request is received, memory application information is determined according to the memory application request; wherein the memory application information at least includes a memory type of the memory application, and thread information and process information of the memory application; Obtaining a pre-configured memory interleaving policy configuration file; wherein the memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different threads and memory interleaving configuration policies corresponding to different processes; Determine a target memory interleaving configuration policy in a memory interleaving policy configuration file according to the memory application information; Execute the memory allocation based on the target memory interleaving configuration strategy.

[0007] The present invention also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any one of the above-mentioned memory weight interleaving methods when executing the computer program.

[0008] The present invention also provides a computer-readable storage medium, in which a computer program is stored, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned memory weight interleaving methods are implemented.

[0009] The present invention also provides a computer program product, comprising a computer program, which implements the steps of any of the above-mentioned memory weight interleaving methods when executed by a processor.

[0010] The beneficial effect of the present invention is that a memory interleaving policy configuration file is pre-configured, which includes memory interleaving configuration policies corresponding to different threads and memory interleaving configuration policies corresponding to different processes; since a variety of different memory interleaving configuration policy options are provided, it is possible to avoid using a global unified memory interleaving weight configuration, while realizing the configuration of thread-level policies and weights, which has higher flexibility. When executing memory allocation, the memory application information is determined according to the memory application request, and the target memory interleaving configuration policy is determined in the memory interleaving policy configuration file according to the memory application information. Then, the memory application allocation can be executed based on the target memory interleaving configuration policy without restarting the program, which greatly reduces the risk of service interruption and improves the efficiency of memory interleaving execution.

[0011] In addition, the present invention also provides a memory weight interleaving device, medium and product, with the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0013] Figure 1 A flowchart of a memory weight interleaving method provided by an embodiment of the present invention; Figure 2 A schematic diagram of a memory weight interleaving device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0014] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0015] It should be noted that, in the description of the present invention, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. The terms "first," "second," etc., in the present invention are used to distinguish similar objects, and are not used to describe a particular order or precedence.

[0016] In order to enable those skilled in the art to better understand the solutions of the present invention, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0017] In NUMA systems, the current mainstream approach to managing memory interleaving relies on statically configuring the memory policy via the numactl --interleave command at process startup, and using system-level files to globally adjust the weight distribution across different nodes. The core idea of ​​this approach is to distribute all memory allocation requests from a process across designated NUMA nodes in a round-robin fashion, thus avoiding performance degradation caused by memory exhaustion on a single node. For example, databases like MongoDB experience the "NUMA trap" issue caused by the default local allocation policy (localalloc). However, this design has significant limitations.

[0018] First, this solution lacks dynamism. Because numactl policy binding occurs during process initialization, the kernel solidifies the memory policy for the life of the process. If the policy needs to be switched, the process must be restarted. This poses a significant risk of interruption for long-term services. For example, during peak business hours, if MySQL needs to adjust its NUMA policy to adapt to load changes, it can only wait until a maintenance window to restart the instance. Otherwise, the rigid policy could lead to memory imbalance or a surge in swap partitions.

[0019] Secondly, the policy granularity of this solution is too coarse and cannot meet the needs of thread-level heterogeneity. In modern multi-threaded applications, different threads often exhibit completely different memory behaviors: front-end threads frequently allocate small objects, which are suitable for the localalloc strategy to reduce local access latency; back-end batch processing threads require large blocks of continuous memory, which are more suitable for the interleaving strategy to improve bandwidth utilization. However, numactl only supports a unified process-level strategy, forcing all threads to adopt a compromise solution. For example, a process that is a mixture of latency-sensitive and bandwidth-sensitive threads may lose response speed due to increased remote access latency of the front-end threads if the interleaving strategy is forced to be used uniformly; if the local priority strategy is adopted, the back-end threads may trigger swap due to insufficient local memory.

[0020] In addition, the global nature of weight control further weakens flexibility. Modifying the interleaving weight (interleave_weight) will affect all processes that use the interleaving strategy, and it is impossible to assign differentiated weights to specific processes or threads. For example, in high-performance computing scenarios, critical threads may need to give priority to low-latency dynamic random-access memory (DRAM) nodes (with higher weights), while non-critical threads can be allocated to high-capacity non-volatile memory (NVM) nodes (with lower weights), but the current solution cannot achieve such fine-grained control. These problems together limit the adaptability and performance optimization capabilities of existing NUMA memory management solutions in complex application scenarios. Therefore, in order to solve the above problems, the present invention provides a memory weight interleaving method.

[0021] Figure 1 A flow chart of a memory weight interleaving method provided by an embodiment of the present invention. Figure 1 As shown, the method includes: S10: When a memory application request is received, memory application information is determined according to the memory application request.

[0022] The memory application information at least includes the memory type of the current memory application, and the thread information and process information of the current memory application.

[0023] Memory application and allocation are typically implemented through the memory map (mmap) system call. In this embodiment, memory application requests are monitored in kernel mode using the Extended Berkeley Packet Filter (EBPF) memory allocation monitor. This monitors the mmap system call and synchronizes it to user mode via the Extended Berkeley Packet Filter Map (EBPF Map).

[0024] It should be noted that the memory application request contains memory application information, and the memory application information at least includes the memory type of the memory applied for this time, as well as the thread information and process information of the memory applied for this time. It can be understood that in the operating system, the process is the basic unit of resource allocation, responsible for applying for and managing system resources such as memory and file descriptors. The thread is the execution unit within the process, sharing the memory space and resources of the process, responsible for the execution of specific tasks, and improving program efficiency through multi-threaded concurrent operation. In this embodiment, there is no restriction on the memory type of the memory applied for this time, which can be a memory of a preset size or a memory of a preset storage medium, depending on the specific implementation situation. At the same time, in this embodiment, there is no restriction on the specific content contained in the thread information and process information, which depends on the specific implementation situation.

[0025] Furthermore, after the EBPF map synchronizes the mmap system call information (memory allocation information) to user mode, the memory interleaving service program checks the memory allocation information through the EBPF map. It's important to note that the memory interleaving service program is the user-mode counterpart of the EBPF memory allocation monitor program. The memory interleaving service program runs immediately upon system startup and is also responsible for loading the EBPF memory allocation monitor program.

[0026] S11: Obtain a pre-configured memory interleaving policy configuration file.

[0027] The memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different threads and memory interleaving configuration policies corresponding to different processes.

[0028] Furthermore, a pre-configured memory interleaving policy configuration file is obtained. It is worth noting that the memory interleaving policy configuration file contains memory interleaving configuration policies corresponding to different threads, and memory interleaving configuration policies corresponding to different processes. In other words, the present invention pre-sets corresponding memory interleaving configuration policies for different threads and different processes, and each memory interleaving configuration policy is different, so as to adapt to the memory interleaving requirements of different application services. In this embodiment, there is no restriction on the process of obtaining the memory interleaving policy configuration file, and the specific content of each memory interleaving configuration policy therein, which depends on the specific implementation situation.

[0029] S12: Determine a target memory interleaving configuration policy in a memory interleaving policy configuration file according to the memory application information.

[0030] S13: Execute the memory application allocation based on the target memory interleaving configuration strategy.

[0031] Because memory request information includes at least the memory type, thread information, and process information for the memory request, after obtaining the memory interleaving policy configuration file, the target memory interleaving configuration policy corresponding to the memory request information can be determined by searching the configuration file. Finally, the memory request is allocated based on the target memory interleaving configuration policy.

[0032] It should be noted that this embodiment does not limit the process of determining the target memory interleaving configuration policy, nor does it limit the specific process of executing the current memory application allocation based on the target memory interleaving configuration policy, which depends on the specific implementation situation.

[0033] In this embodiment, a memory interleaving policy configuration file is pre-configured, which includes memory interleaving configuration policies corresponding to different threads and memory interleaving configuration policies corresponding to different processes. Since a variety of different memory interleaving configuration policy options are provided, it is possible to avoid using a global unified memory interleaving weight configuration, while achieving thread-level policy and weight configuration, which has higher flexibility. When executing memory allocation, the memory application information is determined according to the memory application request, and the target memory interleaving configuration policy is determined in the memory interleaving policy configuration file according to the memory application information. The memory application allocation can be executed based on the target memory interleaving configuration policy without restarting the program, which greatly reduces the risk of service interruption and improves the efficiency of memory interleaving execution.

[0034] Based on the above embodiment, in some embodiments, determining the memory application information according to the memory application request includes: S101: Determine the memory type of the memory requested this time according to the memory request.

[0035] The memory type includes a first type of memory and a second type of memory; the byte size of the first type of memory is greater than a threshold, and the byte size of the second type of memory is not greater than the threshold.

[0036] S102: Determine the target thread identifier, target thread name, target process identifier and target process name, and the corresponding virtual address of the memory application according to the memory application request.

[0037] In a specific implementation, in order to determine the memory application information of this time, the memory type of the memory applied for this time is determined specifically according to the memory application request. It should be noted that the memory type includes a first type of memory and a second type of memory; the byte size of the first type of memory is greater than the threshold, and the byte size of the second type of memory is not greater than the threshold. In this embodiment, there is no restriction on the threshold size, for example, it can be 4KB; that is, the byte size of the first type of memory is greater than 4KB, and the first type of memory is "large block memory", and the byte size of the second type of memory is not greater than 4KB, and the second type of memory is "small block memory".

[0038] At the same time, the target thread identifier, target thread name, target process identifier, target process name, and corresponding virtual address for this memory request are determined based on the memory request. It is understood that in an operating system, thread identifiers (TIDs) and thread names are used to uniquely identify and describe threads, while process identifiers (PIDs) and process names are used to uniquely identify and describe processes. Identifiers are system-assigned numbers that ensure uniqueness, while names are strings that are easily understood and recognized by users or developers. The virtual address is the address corresponding to the memory request.

[0039] In this way, by determining the specific content in the memory application information, it is possible to accurately match the corresponding memory interleaving configuration strategy according to the specific content in the memory application information.

[0040] Based on the above embodiment, in some embodiments, obtaining a pre-configured memory interleaving policy configuration file includes: S111: Determine whether the hash value of the local memory interleaving policy configuration file has changed; if not, proceed to step S112; if so, proceed to step S113.

[0041] S112: Directly obtain a local memory interleaving policy configuration file.

[0042] S113: Reload the memory interleaving policy configuration file to the local computer; Among them, the memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different thread identifiers, different thread names, different process identifiers and different process names; the memory interleaving configuration policy includes information about non-uniform memory access nodes to which memory can be allocated and the corresponding node weights.

[0043] Because the memory interleaving policy configuration file is pre-configured, it is pre-stored locally on the computing device for easy access. In this embodiment, to prevent the new memory interleaving configuration policy from being delayed, when obtaining the memory interleaving policy configuration file, a determination is made as to whether the hash value of the local memory interleaving policy configuration file has changed. For example, a determination is made as to whether the MD5 (Message Digest Algorithm 5) value of the local memory interleaving policy configuration file has changed.

[0044] If the hash value of the local memory interleaving policy configuration file has not changed, the local memory interleaving policy configuration file is the latest one and you can directly obtain the local memory interleaving policy configuration file. If the hash value of the local memory interleaving policy configuration file has changed, the local memory interleaving policy configuration file is not the latest one and you need to reload the local memory interleaving policy configuration file to ensure that it is the latest one.

[0045] It should be noted that the memory interleaving policy configuration file contains memory interleaving configuration policies corresponding to different thread identifiers, different thread names, different process identifiers, and different process names. The memory interleaving configuration policy contains information about the non-uniform memory access nodes (NUMA nodes) to which memory can be allocated and the corresponding node weights. For example, in a memory interleaving configuration policy, the NUMA nodes to which memory can be allocated are node0 and node1, the node weight of node0 is 2, and the node weight of node1 is 1. Subsequently, memory can be requested from node0 and node1 based on a node weight ratio of 2:1.

[0046] In this embodiment, by judging the change of the hash value of the local memory interleaving policy configuration file, it is possible to ensure that the memory interleaving policy configuration file is the latest version, thereby further ensuring the accuracy of subsequent memory interleaving execution.

[0047] Based on the above embodiment, in some embodiments, determining a target memory interleaving configuration policy in a memory interleaving policy configuration file according to memory application information includes: S121: When the memory type is the first type of memory, determine a target memory interleaving configuration policy in a memory interleaving policy configuration file according to a target thread identifier, a target thread name, a target process identifier, and a target process name.

[0048] S122: When the memory type is the second type memory, obtain the application quantity of the second type memory applied for this time.

[0049] S123: When the number of applications for the second type of memory is multiple, determine a target memory interleaving configuration policy in a memory interleaving policy configuration file according to the target thread identifier, the target thread name, the target process identifier, and the target process name.

[0050] S124: When the number of applications for the second type of memory is 1, directly allocate the second type of memory according to the default allocation policy.

[0051] In a specific implementation, when the memory type is the first type of memory, confirm that this application is for "large block memory", and directly determine the target memory interleaving configuration policy in the memory interleaving policy configuration file based on the target thread identifier, target thread name, target process identifier and target process name. When the memory type is the second type of memory, confirm that this application is for "small block memory", and at this time, it is necessary to judge the quantity of the second type of memory applied for this time. Specifically, obtain the application quantity of the second type of memory applied for this time. When the application quantity of the second type of memory is multiple, that is, when applying for multiple "small blocks of memory", determine the target memory interleaving configuration policy in the memory interleaving policy configuration file based on the target thread identifier, target thread name, target process identifier and target process name. When the application quantity of the second type of memory is 1, that is, when only 1 "small block of memory" is applied for, the second type of memory is directly allocated according to the default allocation policy.

[0052] In this embodiment, there is no restriction on the default allocation strategy. Different memory interleaving configuration strategies are adopted based on different memory types, which can effectively improve memory allocation efficiency.

[0053] Based on the above embodiments, in some embodiments, determining a target memory interleaving configuration policy in a memory interleaving policy configuration file according to a target thread identifier, a target thread name, a target process identifier, and a target process name includes: S131: Determine whether there is a memory interleaving configuration policy corresponding to the target thread identifier and / or a memory interleaving configuration policy corresponding to the target thread name in the memory interleaving policy configuration file. If yes, proceed to step S132; if not, proceed to step S133; S132: Determine the memory interleaving configuration policy corresponding to the target thread identifier, or the memory interleaving configuration policy corresponding to the target thread name, as the target memory interleaving configuration policy.

[0054] S133: Determine whether the memory interleaving policy configuration file contains a memory interleaving policy corresponding to the target process identifier and / or a memory interleaving policy corresponding to the target process name. If yes, proceed to step S134; if not, proceed to step S135.

[0055] S134: Determine the memory interleaving configuration policy corresponding to the target process identifier or the memory interleaving configuration policy corresponding to the target process name as the target memory interleaving configuration policy.

[0056] S135: Determine the default memory interleaving configuration policy in the memory interleaving policy configuration file as the target memory interleaving configuration policy.

[0057] To determine the target memory interleaving configuration policy, in this embodiment, a determination is first made as to whether a memory interleaving configuration policy corresponding to the target thread identifier and / or a memory interleaving configuration policy corresponding to the target thread name exists in the memory interleaving policy configuration file. If a memory interleaving configuration policy corresponding to the target thread identifier and / or a memory interleaving configuration policy corresponding to the target thread name exists, the memory interleaving configuration policy corresponding to the target thread identifier or the memory interleaving configuration policy corresponding to the target thread name is determined as the target memory interleaving configuration policy.

[0058] If it is confirmed that there is no memory interleaving configuration policy corresponding to the target thread identifier and the memory interleaving configuration policy corresponding to the target thread name, then determine whether there is a memory interleaving configuration policy corresponding to the target process identifier and / or a memory interleaving configuration policy corresponding to the target process name in the memory interleaving policy configuration file. If it is confirmed that there is a memory interleaving configuration policy corresponding to the target process identifier and / or a memory interleaving configuration policy corresponding to the target process name, then the memory interleaving configuration policy corresponding to the target process identifier or the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy. If it is confirmed that there is no memory interleaving configuration policy corresponding to the target process identifier and the memory interleaving configuration policy corresponding to the target process name, then the default memory interleaving configuration policy in the memory interleaving policy configuration file is determined as the target memory interleaving configuration policy.

[0059] It should be noted that because the configuration priority of a thread is higher than that of a process, when matching the target memory interleaving configuration policy in this embodiment, the memory interleaving configuration policy of the target thread identifier / name is first matched, and then the memory interleaving configuration policy of the target process identifier / name is matched. Furthermore, this embodiment does not impose any restrictions on the default memory interleaving configuration policy, which is determined based on specific implementation circumstances.

[0060] In this embodiment, the target memory interleaving configuration policy is determined by sequentially matching the memory interleaving configuration policy of the target thread identifier / name and the memory interleaving configuration policy of the target process identifier / name. This can adapt to the memory requests of different threads / processes and further refine the goals of memory weight interleaving. Different threads of the same process can be equipped with different memory weight interleaving strategies.

[0061] Based on the above embodiments, in some embodiments, determining the memory interleaving configuration policy corresponding to the target thread identifier or the memory interleaving configuration policy corresponding to the target thread name as the target memory interleaving configuration policy includes: S141: When there is a memory interleaving configuration policy corresponding to the target thread identifier and there is a memory interleaving configuration policy corresponding to the target thread name, determine the memory interleaving configuration policy corresponding to the target thread identifier as the target memory interleaving configuration policy.

[0062] S142: When there is a memory interleaving configuration policy corresponding to the target thread identifier and there is no memory interleaving configuration policy corresponding to the target thread name, determine the memory interleaving configuration policy corresponding to the target thread identifier as the target memory interleaving configuration policy.

[0063] S143: When there is no memory interleaving configuration policy corresponding to the target thread identifier and there is a memory interleaving configuration policy corresponding to the target thread name, the memory interleaving configuration policy corresponding to the target thread name is determined as the target memory interleaving configuration policy.

[0064] To determine a specific target memory interleaving configuration policy among the memory interleaving configuration policies corresponding to the target thread identifier / name, in this embodiment, when a memory interleaving configuration policy corresponding to the target thread identifier exists, the memory interleaving configuration policy corresponding to the target thread identifier is determined as the target memory interleaving configuration policy, regardless of whether a memory interleaving configuration policy corresponding to the target thread name exists. This is because thread identifiers are unique in an application, while thread names are not. If no memory interleaving configuration policy corresponding to the target thread identifier exists, but a memory interleaving configuration policy corresponding to the target thread name exists, the memory interleaving configuration policy corresponding to the target thread name is determined as the target memory interleaving configuration policy. Specifically, the memory interleaving configuration policy corresponding to the first retrieved target thread name is determined as the target memory interleaving configuration policy.

[0065] Correspondingly, determining the memory interleaving configuration policy corresponding to the target process identifier or the memory interleaving configuration policy corresponding to the target process name as the target memory interleaving configuration policy includes: S144: When there is a memory interleaving configuration policy corresponding to the target process identifier and there is a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process identifier is determined as the target memory interleaving configuration policy.

[0066] S145: When there is a memory interleaving configuration policy corresponding to the target process identifier and there is no memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process identifier is determined as the target memory interleaving configuration policy.

[0067] S146: When there is no memory interleaving configuration policy corresponding to the target process identifier and there is a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy.

[0068] Similarly, in order to determine a specific target memory interleaving configuration policy among the memory interleaving configuration policies corresponding to the target process identifier / name, in this embodiment, when there is a memory interleaving configuration policy corresponding to the target process identifier, the memory interleaving configuration policy corresponding to the target process identifier is determined as the target memory interleaving configuration policy regardless of whether there is a memory interleaving configuration policy corresponding to the target process name. This is because the process identifier is unique in the application, while the process name is not unique. When there is no memory interleaving configuration policy corresponding to the target process identifier, and there is a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy, and specifically the memory interleaving configuration policy corresponding to the first retrieved target process name is determined as the target memory interleaving configuration policy. Accurate selection of the target memory interleaving configuration policy is achieved.

[0069] Based on the above embodiment, in some embodiments, when the memory type is the first type of memory, executing the current memory application allocation based on the target memory interleaving configuration policy includes: S151: Obtain information of each non-uniform memory access node and the corresponding node weight in the target memory interleaving configuration strategy.

[0070] S152: Apply for memory in each non-uniform memory access node according to the corresponding node weight until the byte size of the first type of memory is reached.

[0071] In order to realize the application and allocation of memory, in this embodiment, when the memory type is the first type of memory, the information of each NUMA node and the corresponding node weight in the target memory interleaving configuration strategy are specifically obtained. Finally, memory is applied for in each NUMA node according to the corresponding node weight until the byte size of the first type of memory is reached. For example, the NUMA nodes that can allocate memory in the target memory interleaving configuration strategy are node0 and node1, the node weight of node0 is 2, and the node weight of node1 is 1. Based on the node weight ratio of 2:1, memory is applied for in node0 and node1 respectively until the byte size of the first type of memory is reached. In this way, the interleaving configuration of "large block memory" is realized.

[0072] In order to further improve the performance of "small memory" application, based on the above embodiment, in some embodiments, before receiving the memory application request, the following steps are further included: S161: Loading a pre-configured memory allocation library based on a command to set a dynamic linker preload library; wherein the memory allocation library supports memory allocation and release.

[0073] S162: Apply for a memory to be split in each non-uniform memory access node through a memory allocation library, and split each memory to be split into a plurality of second-type memories.

[0074] S163: Setting a used memory linked list and an unused memory linked list in each non-uniform memory access node through the memory allocation library, and mounting each corresponding second type memory to the unused memory linked list.

[0075] Before actual business operations are carried out, the pre-configured memory allocation library is loaded by setting the dynamic linker preload library command export LD_PRELOAD= / path_to_memalloc.so. The memory allocation library implements the dynamic memory allocation function malloc, the dynamic memory clearing function calloc, the memory reallocation function realloc, and the memory release function free, supporting memory allocation and release. The memory allocation library is then used to apply for memory to be split in each NUMA node, and each memory to be split is split into multiple second-type memories, that is, into "small blocks of memory," for example, multiple 1KB blocks of memory.

[0076] Finally, the split memory is managed in the form of a linked list. A used memory linked list and an unused memory linked list are set in each NUMAnode through the memory allocation library, and the corresponding second type of memory is mounted to the unused memory linked list. It can be understood that the second type of memory mounted in the used memory linked list is all used, and the second type of memory mounted in the unused memory linked list is not used. In this way, each time a small block of memory is requested, a small block of memory is removed from the unused memory linked list and returned to the user for use, and at the same time mounted to the end of the used memory linked list; and each time a small block of memory is released, the small block of memory is removed from the used memory linked list and mounted to the end of the unused memory linked list. By allocating and using small blocks of memory in this way in advance, the efficiency of applying for small blocks of memory can be greatly improved.

[0077] Based on the above embodiment, in some embodiments, when the memory type is the second type memory and the corresponding application quantity is multiple, executing the application allocation of this memory based on the target memory interleaving configuration policy includes: S171: Obtain information of each non-uniform memory access node and the corresponding node weight in the target memory interleaving configuration strategy.

[0078] S172: Apply for a second type of memory in the unused memory linked list corresponding to each non-uniform memory access node according to the corresponding node weight, and mount the applied second type of memory to the corresponding used memory linked list until the corresponding application quantity is reached.

[0079] When applying for multiple types of second memory, since the used memory list and the unused memory list are set for each NUMA node in advance, when allocating, first obtain the information of each NUMA node and the corresponding node weight in the target memory interleaving configuration strategy, and then apply for the second type of memory in the unused memory list corresponding to each NUMA node according to the corresponding node weight, and mount the applied second type of memory to the corresponding used memory list until the corresponding application quantity is reached.

[0080] For example, if five blocks of Type 2 memory are needed, and the NUMA nodes that can allocate memory in the target memory interleaving policy are node0 and node1, the node weight corresponding to node0 is 2, and the node weight corresponding to node1 is 1, then memory allocation is performed with a 2:1 weight: first apply for two blocks of Type 2 memory from node0, then apply for one block of Type 2 memory from node1, and then apply for two more blocks of Type 2 memory from node0, for a total of five Type 2 memories. During the application process, the allocated Type 2 memory needs to be mounted from the corresponding unused memory linked list to the used memory linked list.

[0081] As can be seen, the allocation of small memory blocks also complies with the memory interleaving strategy. Furthermore, the second type of memory after application is moved from the unused memory list to the used memory list, which improves the management efficiency of small memory blocks.

[0082] Furthermore, after executing the current memory allocation based on the target memory interleaving configuration policy, upon receiving a command to release Type 2 memory, the target Type 2 memory to be released is determined based on the command and released using the free function. Finally, the target Type 2 memory is moved from the corresponding used memory list to the corresponding unused memory list, allowing it to be used in subsequent service applications, improving Type 2 memory management efficiency and memory resource utilization.

[0083] Based on the above embodiment, in some embodiments, directly allocating the second type of memory according to the default allocation policy includes: S181: Determine whether there is any remaining memory in the non-uniform memory access node of the current program; if so, proceed to step S182; if not, proceed to step S183.

[0084] S182: Apply for allocation of a second type of memory in the non-uniform memory access node where the current program is running.

[0085] S183: Determine a target non-uniform memory access node that is closest to the non-uniform memory access node on which the current program is running, among all non-uniform memory access nodes.

[0086] S184: Apply for allocation of the second type of memory in the target non-uniform memory access node.

[0087] In this embodiment, when the number of second-type memory applications is 1, that is, only one "small memory block" is applied for, it is specifically determined whether the NUMA node where the current program is running has any remaining memory.

[0088] If the NUMA node where the current program is running is confirmed to have free memory, a request is made to allocate Type 2 memory to that node. If the NUMA node where the current program is running is confirmed to have no free memory, the system determines the closest target NUMA node to the current program's node based on the hardware Advanced Configuration and Power Interface (ACPI) table. A request is then made to allocate Type 2 memory to that target NUMA node. This achieves Type 2 memory allocation under the default allocation policy, resulting in higher allocation efficiency.

[0089] In order to ensure the rationality of the configuration content of the memory interleaving policy configuration file, based on the above embodiment, some embodiments further include: S191: Determine whether each memory interleaving configuration policy in the memory interleaving policy configuration file includes a non-uniform memory access node for the current program; if so, end; if not, proceed to step S192.

[0090] S192: Output prompt information indicating adjustment of the memory interleaving configuration strategy.

[0091] Specifically, the system checks whether each memory interleaving configuration policy in the memory interleaving policy configuration file includes the NUMA node where the current program is running. Specifically, it checks whether the NUMA node where the current program is running is among the nodes allowed by the weighted interleaving policy. If so, the determination process ends. If not, a prompt indicating the need to adjust the memory interleaving configuration policy is output, allowing the user / administrator to determine and adjust the memory interleaving policy, thereby ensuring the rationality of the configuration content in the memory interleaving policy configuration file.

[0092] Furthermore, to adapt to changes in application load, after executing the current memory request allocation based on the target memory interleaving configuration policy, monitoring tools (such as numastat) can be used to view each NUMA node's memory usage and cross-node access frequency to evaluate the interleaving effect. This information also provides information on overall system resource usage, particularly memory usage, to help identify memory-intensive processes. Furthermore, overall system memory usage and virtual memory statistics are obtained to determine if insufficient memory is present. If so, the memory interleaving policy is dynamically adjusted based on changes in application load, specifically adjusting the NUMA nodes that can allocate memory and their weights to better accommodate the memory allocation needs of different applications.

[0093] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.

[0094] Figure 2 Schematic diagram of a memory weight interleaving device provided by an embodiment of the present invention. Figure 2 As shown, the device includes: An information determination module 10 is configured to determine memory application information based on a memory application request when a memory application request is received; wherein the memory application information includes at least a memory type of the memory application, and thread information and process information of the memory application; A file acquisition module 11 is configured to acquire a pre-configured memory interleaving policy configuration file; wherein the memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different threads and memory interleaving configuration policies corresponding to different processes; A strategy determination module 12 is configured to determine a target memory interleaving configuration strategy in a memory interleaving strategy configuration file according to the memory application information; The memory allocation module 13 is configured to execute the memory application allocation based on the target memory interleaving configuration strategy.

[0095] In some embodiments, the information determination module 10 includes: a type determination module, configured to determine a memory type of the memory requested this time according to the memory application request; wherein the memory type includes a first type of memory and a second type of memory; wherein the byte size of the first type of memory is greater than a threshold, and the byte size of the second type of memory is not greater than the threshold; The target thread and process information determination module is used to determine the target thread identifier, target thread name, target process identifier and target process name, as well as the corresponding virtual address of the memory application according to the memory application request.

[0096] In some embodiments, the file acquisition module 11 includes: The first judgment submodule is used to judge whether the hash value of the local memory interleaving policy configuration file has changed; if not, directly obtain the local memory interleaving policy configuration file; if so, reload the memory interleaving policy configuration file to the local; Among them, the memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different thread identifiers, different thread names, different process identifiers and different process names; the memory interleaving configuration policy includes information about non-uniform memory access nodes to which memory can be allocated and the corresponding node weights.

[0097] In some embodiments, the policy determination module 12 includes: A first determining submodule is configured to determine a target memory interleaving configuration policy in a memory interleaving policy configuration file according to a target thread identifier, a target thread name, a target process identifier, and a target process name when the memory type is a first type of memory; The first acquisition submodule is used to obtain the application quantity of the second type of memory in this application when the memory type is the second type of memory; A second determining submodule is configured to determine a target memory interleaving configuration policy in a memory interleaving policy configuration file according to a target thread identifier, a target thread name, a target process identifier, and a target process name when the number of applications for the second type of memory is multiple; The first allocation submodule is configured to allocate the second type of memory directly according to a default allocation policy when the number of applications for the second type of memory is 1.

[0098] In some embodiments, a target memory interleaving configuration policy is determined in a memory interleaving policy configuration file based on a target thread identifier, a target thread name, a target process identifier, and a target process name, including: determining whether a memory interleaving configuration policy corresponding to the target thread identifier and / or a memory interleaving configuration policy corresponding to the target thread name exists in the memory interleaving policy configuration file; if it is confirmed that a memory interleaving configuration policy corresponding to the target thread identifier and / or a memory interleaving configuration policy corresponding to the target thread name exists, determining the memory interleaving configuration policy corresponding to the target thread identifier or the memory interleaving configuration policy corresponding to the target thread name as the target memory interleaving configuration policy; if it is confirmed that there is no memory interleaving configuration policy corresponding to the target thread identifier and / or a memory interleaving configuration policy corresponding to the target thread name, If it is confirmed that there is a memory interleaving configuration policy corresponding to the target process identifier and / or a memory interleaving configuration policy corresponding to the target process name in the memory interleaving policy configuration file, then it is determined whether there is a memory interleaving configuration policy corresponding to the target process identifier and / or a memory interleaving configuration policy corresponding to the target process name; if it is confirmed that there is a memory interleaving configuration policy corresponding to the target process identifier and / or a memory interleaving configuration policy corresponding to the target process name, then the memory interleaving configuration policy corresponding to the target process identifier or the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy; if it is confirmed that there is no memory interleaving configuration policy corresponding to the target process identifier and the memory interleaving configuration policy corresponding to the target process name, then the default memory interleaving configuration policy in the memory interleaving policy configuration file is determined as the target memory interleaving configuration policy.

[0099] In some embodiments, determining the memory interleaving configuration policy corresponding to the target thread identifier or the memory interleaving configuration policy corresponding to the target thread name as the target memory interleaving configuration policy includes: when there is a memory interleaving configuration policy corresponding to the target thread identifier and there is a memory interleaving configuration policy corresponding to the target thread name, determining the memory interleaving configuration policy corresponding to the target thread identifier as the target memory interleaving configuration policy; when there is a memory interleaving configuration policy corresponding to the target thread identifier and there is no memory interleaving configuration policy corresponding to the target thread name, determining the memory interleaving configuration policy corresponding to the target thread identifier as the target memory interleaving configuration policy; when there is no memory interleaving configuration policy corresponding to the target thread identifier and there is a memory interleaving configuration policy corresponding to the target thread name, determining the memory interleaving configuration policy corresponding to the target thread name as the target memory interleaving configuration policy; Correspondingly, the memory interleaving configuration policy corresponding to the target process identifier, or the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy, including: when there is a memory interleaving configuration policy corresponding to the target process identifier and there is a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process identifier is determined as the target memory interleaving configuration policy; when there is a memory interleaving configuration policy corresponding to the target process identifier and there is no memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process identifier is determined as the target memory interleaving configuration policy; when there is no memory interleaving configuration policy corresponding to the target process identifier and there is a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy.

[0100] In some embodiments, the memory allocation module 13 includes: The second acquisition submodule is used to obtain information of each non-uniform memory access node and the corresponding node weight in the target memory interleaving configuration strategy; The first memory application module is used to apply for memory in each non-uniform memory access node according to the corresponding node weight until the byte size of the first type of memory is reached.

[0101] In some embodiments, further comprising: A memory allocation library loading module is used to load a pre-configured memory allocation library based on a command to set a dynamic linker preload library; wherein the memory allocation library supports memory allocation and release; A memory splitting module is used to apply for a memory to be split in each non-uniform memory access node through a memory allocation library, and split each memory to be split into a plurality of second-type memories; The linked list setting module is used to set a used memory linked list and an unused memory linked list in each non-uniform memory access node through the memory allocation library, and mount the corresponding second type memory to the unused memory linked list.

[0102] In some embodiments, the memory allocation module 13 includes: The third acquisition submodule is used to obtain information of each non-uniform memory access node and the corresponding node weight in the target memory interleaving configuration strategy; The second memory application module is used to apply for the second type of memory in the unused memory linked list corresponding to each non-uniform memory access node according to the corresponding node weight, and mount the applied second type of memory to the corresponding used memory linked list until the corresponding application quantity is reached.

[0103] In some embodiments, further comprising: a target second-type memory determining module, configured to, upon receiving a command indicating release of the second-type memory, determine a target second-type memory to be released according to the command; A target second type memory release module, configured to release the target second type memory using a memory release function; The mounting module is used to mount the target second type memory from the corresponding used memory linked list to the corresponding unused memory linked list.

[0104] In some embodiments, the first allocation submodule includes: The second judgment submodule is used to judge whether there is any remaining memory in the non-uniform memory access node of the current program; if so, the second allocation submodule is triggered; if not, the target non-uniform memory access node determination submodule is triggered; A second allocation submodule is used to apply for allocation of a second type of memory in the non-uniform memory access node where the current program is running; a target non-uniform memory access node determination submodule, configured to determine, among all non-uniform memory access nodes, a target non-uniform memory access node that is closest to the non-uniform memory access node on which the current program is running; The second allocation submodule is used to apply for allocation of the second type of memory in the target non-uniform memory access node.

[0105] In some embodiments, further comprising: The third judgment submodule is used to judge whether each memory interleaving configuration policy in the memory interleaving policy configuration file contains a non-uniform memory access node of the current program; if not, output a prompt message indicating adjustment of the memory interleaving configuration policy.

[0106] For the description of the features in the embodiment corresponding to the memory weight interleaving device, please refer to the relevant description of the embodiment corresponding to the memory weight interleaving method, and will not be repeated here.

[0107] An embodiment of the present invention also provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above-mentioned memory weight interleaving method embodiments.

[0108] An embodiment of the present invention also provides a computer-readable storage medium, which stores a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned memory weight interleaving method embodiments when running.

[0109] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0110] An embodiment of the present invention further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned memory weight interleaving method embodiments.

[0111] An embodiment of the present invention also provides another computer program product, including a non-volatile computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the steps in any of the above-mentioned memory weight interleaving method embodiments.

[0112] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0113] The above is a detailed introduction to the memory weight interleaving method, device, medium and product provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only applicable to help understand the method of the present invention and its core idea. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.

Claims

1. A memory weight interleaving method, characterized in that: include: When a memory application request is received, memory application information is determined according to the memory application request; wherein the memory application information at least includes a memory type of the memory application, and thread information and process information of the memory application; Obtaining a pre-configured memory interleaving policy configuration file; wherein the memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different threads and memory interleaving configuration policies corresponding to different processes; Determining a target memory interleaving configuration policy in the memory interleaving policy configuration file according to the memory application information; The memory application allocation is performed based on the target memory interleaving configuration strategy.

2. The memory weight interleaving method according to claim 1, characterized in that: Determining memory application information according to the memory application request includes: Determining the memory type of the memory currently applied for according to the memory application request; wherein the memory type includes a first type of memory and a second type of memory; wherein the byte size of the first type of memory is greater than a threshold, and the byte size of the second type of memory is not greater than the threshold; The target thread identifier, target thread name, target process identifier and target process name, as well as the corresponding virtual address of the memory application are determined according to the memory application request.

3. The memory weight interleaving method according to claim 1, wherein: Get a pre-configured memory interleaving policy profile, including: Determine whether the hash value of the local memory interleaving policy configuration file has changed; If not, directly obtain the local memory interleaving strategy configuration file; If yes, reload the memory interleaving policy configuration file to the local computer; Among them, the memory interleaving policy configuration file includes memory interleaving configuration policies corresponding to different thread identifiers, different thread names, different process identifiers and different process names; the memory interleaving configuration policy includes information of non-uniform memory access nodes to which memory can be allocated and corresponding node weights.

4. The memory weight interleaving method according to claim 2, wherein: Determining a target memory interleaving configuration policy in the memory interleaving policy configuration file according to the memory application information includes: When the memory type is the first type of memory, determining a target memory interleaving configuration policy in the memory interleaving policy configuration file according to the target thread identifier, the target thread name, the target process identifier, and the target process name; When the memory type is the second type memory, obtaining the application quantity of the second type memory applied for this time; When the number of applications for the second type of memory is multiple, determining a target memory interleaving configuration policy in the memory interleaving policy configuration file according to the target thread identifier, the target thread name, the target process identifier, and the target process name; When the application quantity of the second type memory is 1, the second type memory is directly allocated according to the default allocation policy.

5. The memory weight interleaving method according to claim 4, characterized in that: Determining a target memory interleaving configuration policy in the memory interleaving policy configuration file according to the target thread identifier, the target thread name, the target process identifier, and the target process name includes: Determine whether the memory interleaving configuration policy corresponding to the target thread identifier and / or the memory interleaving configuration policy corresponding to the target thread name exists in the memory interleaving policy configuration file; If it is confirmed that the memory interleaving configuration policy corresponding to the target thread identifier and / or the memory interleaving configuration policy corresponding to the target thread name exists, then determining the memory interleaving configuration policy corresponding to the target thread identifier or the memory interleaving configuration policy corresponding to the target thread name as the target memory interleaving configuration policy; If it is confirmed that the memory interleaving configuration policy corresponding to the target thread identifier and the memory interleaving configuration policy corresponding to the target thread name do not exist, then determining whether the memory interleaving configuration policy corresponding to the target process identifier and / or the memory interleaving configuration policy corresponding to the target process name exist in the memory interleaving policy configuration file; If it is confirmed that the memory interleaving configuration policy corresponding to the target process identifier and / or the memory interleaving configuration policy corresponding to the target process name exists, then the memory interleaving configuration policy corresponding to the target process identifier or the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy; If it is confirmed that the memory interleaving configuration policy corresponding to the target process identifier and the memory interleaving configuration policy corresponding to the target process name do not exist, the default memory interleaving configuration policy in the memory interleaving policy configuration file is determined as the target memory interleaving configuration policy.

6. The memory weight interleaving method according to claim 5, characterized in that: Determining the memory interleaving configuration policy corresponding to the target thread identifier, or the memory interleaving configuration policy corresponding to the target thread name, as the target memory interleaving configuration policy includes: When the memory interleaving configuration policy corresponding to the target thread identifier exists and the memory interleaving configuration policy corresponding to the target thread name exists, determining the memory interleaving configuration policy corresponding to the target thread identifier as the target memory interleaving configuration policy; When the memory interleaving configuration policy corresponding to the target thread identifier exists, and the memory interleaving configuration policy corresponding to the target thread name does not exist, determining the memory interleaving configuration policy corresponding to the target thread identifier as the target memory interleaving configuration policy; When the memory interleaving configuration policy corresponding to the target thread identifier does not exist, and the memory interleaving configuration policy corresponding to the target thread name exists, determining the memory interleaving configuration policy corresponding to the target thread name as the target memory interleaving configuration policy; Correspondingly, determining the memory interleaving configuration policy corresponding to the target process identifier, or the memory interleaving configuration policy corresponding to the target process name as the target memory interleaving configuration policy includes: When the memory interleaving configuration policy corresponding to the target process identifier exists and the memory interleaving configuration policy corresponding to the target process name exists, determining the memory interleaving configuration policy corresponding to the target process identifier as the target memory interleaving configuration policy; When the memory interleaving configuration policy corresponding to the target process identifier exists, and the memory interleaving configuration policy corresponding to the target process name does not exist, determining the memory interleaving configuration policy corresponding to the target process identifier as the target memory interleaving configuration policy; When the memory interleaving configuration policy corresponding to the target process identifier does not exist, and the memory interleaving configuration policy corresponding to the target process name exists, the memory interleaving configuration policy corresponding to the target process name is determined as the target memory interleaving configuration policy.

7. The memory weight interleaving method according to claim 4, characterized in that: When the memory type is the first type of memory, executing the current memory application allocation based on the target memory interleaving configuration policy includes: Obtaining information of each non-uniform memory access node and corresponding node weight in the target memory interleaving configuration strategy; Memory is requested in each of the non-uniform memory access nodes according to the corresponding node weight until the byte size of the first type of memory is reached.

8. The memory weight interleaving method according to claim 4, wherein: Before receiving the memory application request, the method further includes: Loading a preconfigured memory allocation library based on a command to set a dynamic linker preload library; wherein the memory allocation library supports memory allocation and release; Applying for a memory to be split in each non-uniform memory access node through the memory allocation library, and splitting each memory to be split into a plurality of second-type memories; A used memory linked list and an unused memory linked list are set in each non-uniform memory access node through the memory allocation library, and the corresponding second type memories are mounted to the unused memory linked list.

9. The memory weight interleaving method according to claim 8, characterized in that: When the memory type is the second type of memory and the corresponding application quantity is multiple, executing the application allocation of this memory based on the target memory interleaving configuration strategy includes: Obtaining information of each non-uniform memory access node and corresponding node weight in the target memory interleaving configuration strategy; Apply for the second type of memory in the unused memory linked list corresponding to each non-uniform memory access node according to the corresponding node weight, and mount the applied second type of memory to the corresponding used memory linked list until the corresponding application quantity is reached.

10. The memory weight interleaving method according to claim 9, characterized in that: After executing the memory application allocation based on the target memory interleaving configuration strategy, the method further includes: When a command indicating release of the second type of memory is received, determining a target second type of memory to be released according to the command; Release the target second type memory using a memory release function; The target second type memory is mounted from the corresponding used memory linked list to the corresponding unused memory linked list.

11. The memory weight interleaving method according to claim 4, wherein: Directly allocating the second type of memory according to the default allocation policy includes: Determine whether there is any remaining memory in the non-uniform memory access node where the current program is running; If so, applying for allocation of the second type of memory in the non-uniform memory access node where the current program is running; If not, determining the target non-uniform memory access node closest to the non-uniform memory access node on which the current program is running among all the non-uniform memory access nodes; Apply for allocating the second type of memory in the target non-uniform memory access node.

12. The memory weight interleaving method according to any one of claims 1 to 11, characterized in that: Also includes: Determine whether each memory interleaving configuration policy in the memory interleaving policy configuration file includes a non-uniform memory access node for the current program; If not, a prompt message indicating adjustment of the memory interleaving configuration strategy is output.

13. An electronic device, characterized in that: include: memory for storing computer programs; A processor, configured to implement the steps of the memory weight interleaving method as claimed in any one of claims 1 to 12 when executing the computer program.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the memory weight interleaving method according to any one of claims 1 to 12.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the memory weight interleaving method as claimed in any one of claims 1 to 12 are implemented.

Citation Information

Patent Citations

  • Memory distribution method, memory distribution device and server

    CN106294192A

  • Multi-JVM deployment method based on non-uniform memory accessing technology

    CN106897122A

  • Interleaver mapping and dynamic memory management system and method

    CN108845958A

  • Memory interleaving matching method and device, readable storage medium and electronic equipment

    CN115934489A

  • Product adaptation method and device of system-on-chip, electronic equipment and storage medium

    CN117555852A