A method, apparatus, medium, and product for memory weight interleaving.
By pre-configuring the memory interleaving strategy file and dynamically determining the target memory interleaving strategy, the problem of needing to restart the program for NUMA memory interleaving schemes is solved. This enables flexible configuration of thread-level strategies and weights, improving memory allocation efficiency and system adaptability.
Patent Information
- Application Number
- CN202511255565.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-04
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-09-04
AI Technical Summary
Existing NUMA memory interleaving schemes require a program restart to switch strategies, have globally unified weight configurations, and cannot customize thread-level strategies and weights, resulting in poor flexibility.
A memory weight interleaving method is provided. By pre-configuring a memory interleaving strategy configuration file, which contains memory interleaving configuration strategies corresponding to different threads and processes, the target memory interleaving configuration strategy is dynamically determined according to the memory request, so as to achieve flexible configuration of thread-level strategies and weights and avoid program restart.
It improves the efficiency of memory interleaving execution, reduces the risk of service interruption, and enables flexible configuration of thread-level strategies and weights to adapt to the memory allocation needs of different threads and processes.
Smart Images

Figure CN120743566B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus, medium and product for memory weight interleaving. Background Technology
[0002] In a Non-Uniform Memory Access (NUMA) architecture, memory interleaving is mainly achieved by setting a memory interleaving strategy (numactl --interleave) statically configured at process startup. This strategy uses a round-robin approach to distribute memory requests to designated nodes, preventing performance issues caused by a single node running out of memory.
[0003] However, this solution has significant shortcomings: First, the strategy adjustment lacks dynamism, and the memory strategy is fixed throughout the process's lifecycle, requiring a process restart to switch strategies, posing a serious risk of interruption to long-term services; second, the strategy granularity is coarse, only supporting a unified strategy at the process level, which cannot meet the heterogeneous requirements at the thread level, making it difficult for different threads to adopt the most suitable memory strategy; in addition, the weight control is too global, making it impossible to allocate differentiated weights for specific processes or threads, limiting the system's flexibility and performance optimization space.
[0004] Given the above, how to solve the problems of the current NUMA memory interleaving scheme requiring a program restart to switch strategies, globally unified weight configuration, and the lack of customizability of thread-level strategies and weights, resulting in poor flexibility, are urgent issues that technical personnel in this field need to address. Summary of the Invention
[0005] This invention provides a memory weight interleaving method, device, medium, and product to at least solve the problems of current NUMA memory interleaving schemes, such as the need to restart the program to switch strategies, globally unified weight configuration, and the inability to customize thread-level strategies and weights, resulting in poor flexibility.
[0006] This invention provides a memory weight interleaving method, comprising:
[0007] When a memory request is received, the memory request information is determined based on the memory request; the memory request information includes at least the memory type requested, as well as the thread information and process information of the requested memory.
[0008] Obtain the pre-configured memory interleaving strategy configuration file; the memory interleaving strategy configuration file contains memory interleaving configuration strategies for different threads and memory interleaving configuration strategies for different processes;
[0009] Determine the target memory interleaving configuration strategy in the memory interleaving strategy configuration file based on the memory request information;
[0010] The memory allocation for this request is performed based on the target memory interleaving configuration strategy.
[0011] 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 of the above-described memory weight interleaving methods when executing the computer program.
[0012] The present invention also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described memory weight interleaving methods.
[0013] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described memory weight interleaving methods.
[0014] The beneficial effects of this invention are that it pre-configures a memory interleaving strategy configuration file, which includes memory interleaving configuration strategies corresponding to different threads and different processes. Because it provides multiple different memory interleaving configuration strategy options, it avoids using a globally uniform memory interleaving weight configuration, while simultaneously implementing thread-level strategy and weight configuration, thus offering greater flexibility. During memory allocation, the memory request information is determined based on the memory request, and the target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file based on this information. The memory allocation can then be performed based on the target memory interleaving configuration strategy without restarting the program, greatly reducing the risk of service interruption and improving the efficiency of memory interleaving execution.
[0015] In addition, the present invention also provides a memory weight interleaving device, medium and product, with the same effect as above. Attached Figure Description
[0016] To more clearly illustrate the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart of a memory weight interleaving method provided in an embodiment of the present invention;
[0018] Figure 2 This is a schematic diagram of a memory weight interleaving device provided in an embodiment of the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0020] It should be noted that, in the description of this invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0021] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0022] In NUMA architecture systems, the current mainstream approach to managing memory interleaving primarily relies on statically configuring memory policies at process startup using the `numactl --interleave` command, and globally adjusting the weight allocation of different nodes through system-level files. The core idea of this approach is to distribute all memory allocation requests from a process to designated NUMA nodes in a round-robin fashion, thereby avoiding performance degradation caused by a single node running out of memory. Examples include the "NUMA trap" problem caused by the default local allocation strategy (`localalloc`) in databases like MongoDB. However, this design has significant limitations.
[0023] First, this approach lacks dynamism because numactl policy binding occurs during process initialization, and the kernel fixes its memory policy throughout the process's lifecycle. If a policy switch is needed, the process must be restarted. This poses a significant risk of interruption for long-running services. For example, during peak business periods, if MySQL needs to adjust its NUMA policy to adapt to load changes, it can only wait for a maintenance window to restart the instance; otherwise, policy rigidity may lead to memory imbalances or a surge in swap space usage.
[0024] Secondly, the granularity of this approach is too coarse to meet the heterogeneous requirements at the thread level. In modern multithreaded applications, different threads often exhibit drastically different memory behaviors: front-end threads frequently allocate small objects, making the `localalloc` strategy suitable to reduce local access latency; back-end batch processing threads require large blocks of contiguous memory, making the interleaving strategy more suitable to improve bandwidth utilization. However, numactl only supports a process-level unified strategy, forcing all threads to adopt a compromise. For example, a process containing both latency-sensitive and bandwidth-sensitive threads, if forced to uniformly use the interleaving strategy, may suffer a loss of responsiveness due to increased remote access latency from front-end threads; if a local-first strategy is adopted, it may cause back-end threads to trigger swap due to insufficient local memory.
[0025] Furthermore, the global nature of weight control further reduces flexibility. Modifying the interleave weight affects all processes using the interleave strategy, making it impossible to assign differentiated weights to specific processes or threads. For example, in high-performance computing scenarios, critical threads may need to prioritize low-latency Dynamic Random-Access Memory (DRAM) nodes (increased weight), while non-critical threads can be assigned to high-capacity Non-Volatile Memory (NVM) nodes (decreased weight), but current solutions cannot achieve such fine-grained control. These issues collectively limit the adaptability and performance optimization capabilities of existing NUMA memory management solutions in complex application scenarios. Therefore, to address these problems, this invention provides a memory weight interleave method.
[0026] Figure 1 This is a flowchart illustrating a memory weight interleaving method provided in an embodiment of the present invention. Figure 1 As shown, the method includes:
[0027] S10: When a memory request is received, determine the memory request information based on the memory request.
[0028] The memory allocation information includes at least the memory type requested, as well as the thread and process information for this memory allocation.
[0029] Memory allocation and request are typically handled through the memory map (mmap) system call. In this embodiment, to monitor memory request requests, the extended Berkeley Packet Filter (EBPF) memory allocation monitoring program is used in kernel space to monitor the mmap system call and synchronize this information to user space via the extended Berkeley Packet Filter Map (EBPF Map).
[0030] It is important to note that the memory allocation request includes memory allocation information, which at least includes the type of memory requested, as well as the thread and process information involved. In an operating system, a process, as the basic unit of resource allocation, is responsible for allocating and managing system resources such as memory and file descriptors. A thread, as the execution unit within a process, shares the process's memory space and resources and is responsible for executing specific tasks. Multithreaded concurrent execution improves program efficiency. This embodiment does not restrict the type of memory requested; it can be a preset size of memory or memory on a preset storage medium, depending on the specific implementation. Similarly, this embodiment does not restrict the specific content of the thread and process information; it also depends on the specific implementation.
[0031] Furthermore, after the EBPF Map synchronizes the mmap system call information, i.e., memory allocation information, to user space, the memory interleaving service program views the memory allocation information through the EBPF Map. It's important to note that the memory interleaving service program is the user-space program corresponding to the EBPF memory allocation monitoring program; the memory interleaving service program runs immediately upon system boot and is also responsible for loading the EBPF memory allocation monitoring program.
[0032] S11: Obtain the pre-configured memory interleaving strategy configuration file.
[0033] The memory interleaving strategy configuration file contains memory interleaving configuration strategies for different threads and memory interleaving configuration strategies for different processes.
[0034] Furthermore, a pre-configured memory interleaving strategy configuration file is obtained. It is worth noting that the memory interleaving strategy configuration file contains memory interleaving configuration strategies corresponding to different threads and different processes. In other words, this invention pre-sets corresponding memory interleaving configuration strategies for different threads and different processes. These memory interleaving configuration strategies are not entirely the same, thereby adapting to the memory interleaving requirements of different application services. This embodiment does not limit the process of obtaining the memory interleaving strategy configuration file, nor the specific content of each memory interleaving configuration strategy therein; it depends on the specific implementation.
[0035] S12: Determine the target memory interleaving configuration strategy in the memory interleaving strategy configuration file based on the memory request information.
[0036] S13: Execute the memory allocation for this request based on the target memory interleaving configuration strategy.
[0037] Since the memory request information includes at least the memory type, thread information, and process information, after obtaining the memory interleaving policy configuration file, a search can be performed within the configuration file to determine the target memory interleaving configuration policy corresponding to the memory request information. Finally, the memory allocation is executed based on the target memory interleaving configuration policy.
[0038] It should be noted that this embodiment does not restrict the process of determining the target memory interleaving configuration strategy, nor does it restrict the specific process of executing the memory allocation based on the target memory interleaving configuration strategy; it depends on the specific implementation.
[0039] In this embodiment, a memory interleaving strategy configuration file is pre-configured, containing memory interleaving configuration strategies for different threads and for different processes. Because multiple different memory interleaving configuration strategies are provided, the use of a globally uniform memory interleaving weight configuration can be avoided. Simultaneously, thread-level strategy and weight configuration is implemented, offering greater flexibility. During memory allocation, memory request information is determined based on the memory request, and the target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file based on this information. The memory allocation can then be performed based on the target memory interleaving configuration strategy without requiring a program restart, significantly reducing the risk of service interruption and improving memory interleaving execution efficiency.
[0040] Based on the above embodiments, in some embodiments, determining memory request information according to the memory request includes:
[0041] S101: Determine the memory type requested in this memory request based on the memory request request.
[0042] The memory types include a first type of memory and a second type of memory; the size of the first type of memory in bytes is greater than the threshold, while the size of the second type of memory in bytes is not greater than the threshold.
[0043] S102: Determine the target thread identifier, target thread name, target process identifier, and target process name, as well as the corresponding virtual address, based on the memory request.
[0044] In practical implementation, to determine the memory request information, the memory type requested is determined based on the memory request itself. 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 a threshold, while 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, if the byte size of the first type of memory is greater than 4KB, it is considered "large block memory," and if the byte size of the second type of memory is not greater than 4KB, it is considered "small block memory."
[0045] Simultaneously, based on the memory allocation request, the target thread identifier, target thread name, target process identifier, and target process name, as well as the corresponding virtual address, are determined. It's understandable that in the operating system, the thread identifier (Thread ID, TID) and thread name are used to uniquely identify and describe a thread, while the process identifier (Process ID, PID) and process name are used to uniquely identify and describe a process. The identifier is a system-assigned number ensuring uniqueness, while the name is a string that is easy for users or developers to understand and recognize. The virtual address is the address corresponding to the memory allocated in this request.
[0046] In this way, by determining the specific content in the memory request information, it is possible to accurately match the corresponding memory interleaving configuration strategy based on the specific content in the memory request information.
[0047] Based on the above embodiments, some embodiments obtain a pre-configured memory interleaving strategy configuration file, including:
[0048] S111: Determine whether the hash value of the local memory interleaving strategy configuration file has changed; if not, proceed to step S112; if yes, proceed to step S113.
[0049] S112: Directly obtain the local memory interleaving strategy configuration file.
[0050] S113: Reload the memory interleaving strategy configuration file to local;
[0051] The memory interleaving strategy configuration file contains memory interleaving configuration strategies corresponding to different thread identifiers, different thread names, different process identifiers, and different process names; the memory interleaving configuration strategy contains information about non-uniform memory access nodes that can allocate memory and their corresponding node weights.
[0052] Since the memory interleaving strategy configuration file is pre-configured, it is stored locally on the computing device for easy access. In this embodiment, to prevent new memory interleaving configuration strategies from not being updated in a timely manner, when retrieving the memory interleaving strategy configuration file, it is specifically determined whether the hash value of the local memory interleaving strategy configuration file has changed, for example, whether the MD5 (Message Digest Algorithm 5) value of the local memory interleaving strategy configuration file has changed.
[0053] If the hash value of the local memory interleaving strategy configuration file has not changed, then the local memory interleaving strategy configuration file is currently up-to-date, and you can directly retrieve the local memory interleaving strategy configuration file. If the hash value of the local memory interleaving strategy configuration file has changed, then the local memory interleaving strategy configuration file is not currently up-to-date, and you need to reload the memory interleaving strategy configuration file to the local machine to ensure that the memory interleaving strategy configuration file is the latest version.
[0054] It should be noted that the memory interleaving strategy configuration file contains memory interleaving configuration strategies corresponding to different thread identifiers, different thread names, different process identifiers, and different process names. The memory interleaving configuration strategy includes information about the non-uniform memory access nodes (NUMA nodes) that can allocate memory, along with their corresponding node weights. For example, in a memory interleaving configuration strategy, the NUMA nodes that can allocate memory are node0 and node1, with node0 having a node weight of 2 and node1 having a node weight of 1. Subsequently, memory can be allocated from node0 and node1 respectively based on their 2:1 node weight ratio.
[0055] In this embodiment, by judging the change of the hash value of the local memory interleaving strategy configuration file, it can be ensured that the memory interleaving strategy configuration file is the latest version, which further ensures the accuracy of subsequent memory interleaving execution.
[0056] Based on the above embodiments, in some embodiments, the target memory interleaving configuration policy is determined in the memory interleaving policy configuration file according to the memory allocation information, including:
[0057] S121: When the memory type is Type I memory, determine the target memory interleaving configuration strategy in the memory interleaving strategy configuration file based on the target thread identifier, target thread name, target process identifier, and target process name.
[0058] S122: When the memory type is second type memory, obtain the number of second type memory requested in this application.
[0059] S123: When there are multiple requests for the second type of memory, the target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file based on the target thread identifier, target thread name, target process identifier, and target process name.
[0060] S124: When the number of requests for second-type memory is 1, second-type memory is allocated directly according to the default allocation strategy.
[0061] In practice, when the memory type is Type 1 memory, the request is confirmed as a "large memory block," and the target memory interleaving configuration strategy is determined directly in the memory interleaving strategy configuration file based on the target thread identifier, target thread name, target process identifier, and target process name. When the memory type is Type 2 memory, the request is confirmed as a "small memory block," and the quantity of Type 2 memory to be requested needs to be determined. Specifically, the quantity of Type 2 memory to be requested is obtained. When there are multiple Type 2 memory requests (i.e., multiple "small memory blocks"), the target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file based on the target thread identifier, target thread name, target process identifier, and target process name. When there is only one Type 2 memory request (i.e., only one "small memory block"), Type 2 memory is allocated directly according to the default allocation strategy.
[0062] This embodiment does not restrict the default allocation strategy. Adopting different memory interleaving configuration strategies based on different memory types can effectively improve memory allocation efficiency.
[0063] Based on the above embodiments, in some embodiments, the target memory interleaving configuration policy is determined in the memory interleaving policy configuration file according to the target thread identifier, target thread name, target process identifier, and target process name, including:
[0064] S131: Determine whether a memory interleaving configuration policy corresponding to the target thread identifier and / or the target thread name exists in the memory interleaving policy configuration file. If yes, proceed to step S132; otherwise, proceed to step S133.
[0065] S132: Determine the memory interleaving configuration strategy corresponding to the target thread identifier or the memory interleaving configuration strategy corresponding to the target thread name as the target memory interleaving configuration strategy.
[0066] S133: Determine whether a memory interleaving configuration policy corresponding to the target process identifier and / or the target process name exists in the memory interleaving policy configuration file. If yes, proceed to step S134; otherwise, proceed to step S135.
[0067] 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.
[0068] S135: Set the default memory interleaving configuration policy in the memory interleaving policy configuration file as the target memory interleaving configuration policy.
[0069] To determine the target memory interleaving configuration strategy, this embodiment first checks whether a memory interleaving configuration strategy corresponding to the target thread identifier and / or the target thread name exists in the memory interleaving strategy configuration file. If it is confirmed that a memory interleaving configuration strategy corresponding to the target thread identifier and / or the target thread name exists, then the memory interleaving configuration strategy corresponding to the target thread identifier or the target thread name is determined as the target memory interleaving configuration strategy.
[0070] If it is confirmed that there is no memory interleaving configuration policy corresponding to the target thread identifier and the target thread name, then it is determined whether there is a memory interleaving configuration policy corresponding to the target process identifier and / or 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 the target process name, then the memory interleaving configuration policy corresponding to the target process identifier or 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 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.
[0071] It should be noted that, since thread configuration priority is higher than process configuration priority, in this embodiment, when matching the target memory interleaving configuration strategy, the memory interleaving configuration strategy of the target thread identifier / name is matched first, and then the memory interleaving configuration strategy of the target process identifier / name is matched. Furthermore, this embodiment does not restrict the default memory interleaving configuration strategy; it depends on the specific implementation.
[0072] In this embodiment, the target memory interleaving configuration strategy is determined by sequentially matching the memory interleaving configuration strategy of the target thread identifier / name and the memory interleaving configuration strategy of the target process identifier / name. This can adapt to the memory requests of different threads / processes and further refine the target of memory weight interleaving. Different threads of the same process can be equipped with different memory weight interleaving strategies.
[0073] Based on the above embodiments, in some embodiments, the memory interleaving configuration strategy corresponding to the target thread identifier, or the memory interleaving configuration strategy corresponding to the target thread name, is determined as the target memory interleaving configuration strategy, including:
[0074] S141: When there is a memory interleaving configuration policy corresponding to the target thread identifier and a memory interleaving configuration policy corresponding to the target thread name, the memory interleaving configuration policy corresponding to the target thread identifier shall be determined as the target memory interleaving configuration policy.
[0075] S142: When there is a memory interleaving configuration strategy corresponding to the target thread identifier, but no memory interleaving configuration strategy corresponding to the target thread name exists, the memory interleaving configuration strategy corresponding to the target thread identifier is determined as the target memory interleaving configuration strategy.
[0076] S143: When there is no memory interleaving configuration policy corresponding to the target thread identifier, but there is a memory interleaving configuration policy corresponding to the target thread name, the memory interleaving configuration policy corresponding to the target thread name shall be determined as the target memory interleaving configuration policy.
[0077] To determine the 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, regardless of whether a memory interleaving configuration policy corresponding to the target thread name exists, the memory interleaving configuration policy corresponding to the target thread identifier is determined as the target memory interleaving configuration policy. This is because thread identifiers are unique in the application, while thread names are not. Only when a memory interleaving configuration policy corresponding to the target thread identifier does not exist, but a memory interleaving configuration policy corresponding to the target thread name exists, is the memory interleaving configuration policy corresponding to the target thread name determined as the target memory interleaving configuration policy. Specifically, the first memory interleaving configuration policy corresponding to the target thread name retrieved is determined as the target memory interleaving configuration policy.
[0078] 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:
[0079] S144: When there is a memory interleaving configuration policy corresponding to the target process identifier and a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process identifier shall be determined as the target memory interleaving configuration policy.
[0080] S145: When there is a memory interleaving configuration policy corresponding to the target process identifier, but no memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process identifier shall be determined as the target memory interleaving configuration policy.
[0081] S146: When there is no memory interleaving configuration policy corresponding to the target process identifier, but there is a memory interleaving configuration policy corresponding to the target process name, the memory interleaving configuration policy corresponding to the target process name shall be determined as the target memory interleaving configuration policy.
[0082] Similarly, to determine the specific target memory interleaving configuration policy among the memory interleaving configuration policies corresponding to the target process identifier / name, in this embodiment, when a memory interleaving configuration policy corresponding to the target process identifier exists, regardless of whether a memory interleaving configuration policy corresponding to the target process name exists, the memory interleaving configuration policy corresponding to the target process identifier is determined as the target memory interleaving configuration policy. This is because process identifiers are unique in an application, while process names are not. Only when a memory interleaving configuration policy corresponding to the target process identifier does not exist, but a memory interleaving configuration policy corresponding to the target process name exists, is the memory interleaving configuration policy corresponding to the target process name determined as the target memory interleaving configuration policy. Specifically, the first memory interleaving configuration policy corresponding to the target process name retrieved is determined as the target memory interleaving configuration policy. This achieves accurate selection of the target memory interleaving configuration policy.
[0083] Based on the above embodiments, in some embodiments, when the memory type is the first type of memory, the memory allocation is performed based on the target memory interleaving configuration strategy, including:
[0084] S151: Obtain information about each non-uniform memory access node and its corresponding node weight in the target memory interleaving configuration strategy.
[0085] S152: Request memory in each non-uniform memory access node according to the corresponding node weight, until the size of the first type of memory in bytes is reached.
[0086] To achieve memory allocation, in this embodiment, when the memory type is Type 1 memory, the information of each NUMA node and its corresponding node weight in the target memory interleaving configuration strategy are specifically obtained. Finally, memory is allocated in each NUMA node according to the corresponding node weight until the size of Type 1 memory in bytes is reached. For example, if the NUMA nodes with allocatable memory in the target memory interleaving configuration strategy are node0 and node1, with node0 having a node weight of 2 and node1 having a node weight of 1, memory is allocated in node0 and node1 respectively based on a 2:1 node weight ratio until the size of Type 1 memory in bytes is reached. This achieves the interleaving configuration of "large memory blocks".
[0087] To further improve the performance of "small block memory" allocation, based on the above embodiments, in some embodiments, before receiving the memory allocation request, the following steps are also included:
[0088] S161: Load a pre-configured memory allocation library based on the command to set the dynamic linker preload library; wherein, the memory allocation library supports memory allocation and release.
[0089] S162: Request memory to be split in each non-uniform memory access node through the memory allocation library, and split each memory to be split into multiple second-type memory.
[0090] S163: Set up used memory lists and unused memory lists in each non-uniform memory access node through the memory allocation library, and mount the corresponding second type of memory to the unused memory list.
[0091] Before actual business operations commence, a pre-configured memory allocation library is loaded based on the dynamic linker pre-loading command `export LD_PRELOAD= / path_to_memalloc.so`. This library implements functions such as `malloc` for dynamic memory allocation, `calloc` for clearing dynamically allocated memory, `realloc` for reallocating memory, and `free` for releasing memory, supporting memory allocation and deallocation. Furthermore, the memory allocation library requests memory to be split across each NUMA node and then splits this memory into multiple second-type memory blocks, or "small memory blocks," for example, multiple 1KB blocks.
[0092] Finally, linked lists are used to manage the allocated memory. A memory allocation library sets up used and unused memory lists in each NUMAnode, and the corresponding second-type memory is attached to the unused memory list. Understandably, all second-type memory attached to the used memory list is used, while all second-type memory attached to the unused memory list is unused. Therefore, each time a small block of memory is requested, a small block of memory is removed from the unused memory list and returned to the user, while simultaneously being attached to the end of the used memory list; conversely, each time a small block of memory is released, it is removed from the used memory list and attached to the end of the unused memory list. This method of pre-allocating and using small blocks of memory significantly improves the efficiency of small memory allocation.
[0093] Based on the above embodiments, in some embodiments, when the memory type is second type memory and the corresponding number of requests is multiple, the memory allocation for this request is performed based on the target memory interleaving configuration strategy, including:
[0094] S171: Obtain information about each non-uniform memory access node and its corresponding node weight in the target memory interleaving configuration strategy.
[0095] S172: Based on the corresponding node weight, request second-type memory from the unused memory list of each non-uniform memory access node, and attach the requested second-type memory to the corresponding used memory list until the corresponding request quantity is reached.
[0096] When requesting multiple Type II memory, since a used memory list and an unused memory list are pre-set for each NUMA node, during allocation, the information of each NUMA node and its corresponding node weight in the target memory interleaving configuration policy are first obtained. Then, according to the corresponding node weight, Type II memory is requested from the unused memory list corresponding to each NUMA node, and the requested Type II memory is attached to the corresponding used memory list, until the corresponding request quantity is reached.
[0097] For example, if 5 blocks of Type II memory are needed, and the NUMA nodes available for memory allocation in the target memory interleaving strategy are node0 and node1, with node0 having a node weight of 2 and node1 having a node weight of 1, then memory allocation will be performed with a 2:1 weight: first, request 2 blocks of Type II memory from node0, then request 1 block of Type II memory from node1, and then request 2 more blocks of Type II memory from node0, for a total of 5 blocks of Type II memory. During the allocation process, the allocated Type II memory needs to be moved from the corresponding unused memory list to the used memory list.
[0098] It can be seen that the allocation of small memory blocks also conforms to the memory interleaving strategy. Furthermore, the second type of memory allocated is linked from the unused memory list to the used memory list, which improves the management efficiency of small memory blocks.
[0099] Furthermore, after allocating memory based on the target memory interleaving configuration strategy, upon receiving a command indicating the release of second-type memory, the target second-type memory to be released is determined according to the command, and the target second-type memory is released using the `free` function. Finally, the target second-type memory is attached from the corresponding used memory list to the corresponding unused memory list, enabling it to be used in subsequent business requests, thus improving the management efficiency of second-type memory and memory resource utilization.
[0100] Based on the above embodiments, in some embodiments, the second type of memory is allocated directly according to the default allocation strategy, including:
[0101] S181: Determine if there is any remaining memory on the non-uniform memory access node where the current program is running; if yes, proceed to step S182. If no, proceed to step S183.
[0102] S182: Request allocation of second type memory in the non-uniform memory access node where the current program is running.
[0103] S183: Determine the target non-uniform memory access node that is closest to the non-uniform memory access node where the current program is running among all non-uniform memory access nodes.
[0104] S184: Request allocation of second type memory in the target non-uniform memory access node.
[0105] In this embodiment, when the number of requests for the second type of memory is 1, that is, only one "small block of memory" is requested, it is specifically determined whether there is any remaining memory in the NUMA node where the current program is running.
[0106] If it is confirmed that the NUMA node where the currently running program is running has remaining memory, then the program requests and allocates second-type memory within that NUMA node. If it is confirmed that the NUMA node where the currently running program is running has no remaining memory, then based on the Advanced Configuration and Power Interface (ACPI) table, the program determines the nearest target NUMA node to the currently running program among all NUMA nodes, and requests and allocates second-type memory within that target NUMA node. This achieves the allocation of second-type memory under the default allocation strategy, resulting in higher allocation efficiency.
[0107] To ensure the rationality of the configuration content in the memory interleaving strategy configuration file, in some embodiments, in addition to the above embodiments, the following further methods are included:
[0108] S191: Determine whether each memory interleaving configuration strategy in the memory interleaving strategy configuration file contains a non-uniform memory access node of the currently running program; if yes, end; if no, proceed to step S192.
[0109] S192: Outputs a prompt message indicating that the memory interleaving configuration strategy has been adjusted.
[0110] Specifically, the process checks whether each memory interleaving configuration policy in the memory interleaving policy configuration file contains the NUMA node of the currently running program; that is, it checks whether the NUMA node of the currently running program is among the nodes allowed by the weighted interleaving policy. If it exists, the judgment process ends. If it does not exist, a prompt message indicating that the memory interleaving configuration policy should be adjusted 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.
[0111] Furthermore, to adapt to changes in application load, after allocating memory based on the target memory interleaving configuration strategy, monitoring tools (such as numastat) can be used to view the memory usage and cross-node access frequency of each NUMA node, evaluate the interleaving effect, and obtain overall system resource usage, especially memory consumption, to help identify memory-intensive processes. Additionally, overall system memory usage and virtual memory statistics can be obtained to determine if there are memory shortage issues. If so, the memory interleaving strategy can be dynamically adjusted according to changes in application load, specifically adjusting the allocatable NUMA nodes and their weights to better adapt to the memory allocation needs of different applications.
[0112] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0113] Figure 2 This is a schematic diagram of a memory weight interleaving device provided in an embodiment of the present invention. Figure 2 As shown, the device includes:
[0114] The information determination module 10 is used to determine memory request information based on the memory request when a memory request is received; wherein, the memory request information includes at least the memory type of the memory requested, as well as the thread information and process information of the memory requested.
[0115] The file acquisition module 11 is used to acquire a pre-configured memory interleaving strategy configuration file; wherein, the memory interleaving strategy configuration file contains memory interleaving configuration strategies corresponding to different threads and memory interleaving configuration strategies corresponding to different processes;
[0116] The strategy determination module 12 is used to determine the target memory interleaving configuration strategy in the memory interleaving strategy configuration file based on the memory request information.
[0117] The memory allocation module 13 is used to perform the memory request and allocation based on the target memory interleaving configuration strategy.
[0118] In some embodiments, the information determining module 10 includes:
[0119] The type determination module is used to determine the memory type of the memory requested based on the memory request; wherein the memory type includes a first type of memory and a second type of memory; wherein the size of the first type of memory in bytes is greater than a threshold, and the size of the second type of memory in bytes is not greater than a threshold.
[0120] 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, based on the memory request.
[0121] In some embodiments, the file acquisition module 11 includes:
[0122] The first judgment submodule is used to determine whether the hash value of the local memory interleaving strategy configuration file has changed; if not, the local memory interleaving strategy configuration file is directly obtained; if so, the memory interleaving strategy configuration file is reloaded to the local machine.
[0123] The memory interleaving strategy configuration file contains memory interleaving configuration strategies corresponding to different thread identifiers, different thread names, different process identifiers, and different process names; the memory interleaving configuration strategy contains information about non-uniform memory access nodes that can allocate memory and their corresponding node weights.
[0124] In some embodiments, the strategy determination module 12 includes:
[0125] The first determination submodule is used to determine the target memory interleaving configuration strategy in the memory interleaving strategy configuration file based on the target thread identifier, target thread name, target process identifier, and target process name when the memory type is the first type of memory.
[0126] The first acquisition submodule is used to obtain the number of second-type memory requests when the memory type is second-type memory.
[0127] The second determination submodule is used to determine the target memory interleaving configuration strategy in the memory interleaving strategy configuration file based on the target thread identifier, target thread name, target process identifier, and target process name when there are multiple requests for the second type of memory.
[0128] The first allocation submodule is used to allocate second-type memory directly according to the default allocation strategy when the number of requests for second-type memory is 1.
[0129] In some embodiments, determining a target memory interleaving configuration policy 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 includes: 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, then 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; 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 does not exist ... and / or the target process name is determined as the target memory interleaving configuration policy. If a memory interleaving configuration policy is specified for the process name, then it is determined whether a memory interleaving configuration policy corresponding to the target process identifier and / or the target process name exists in the memory interleaving policy configuration file. If a memory interleaving configuration policy corresponding to the target process identifier and / or the target process name exists, then the memory interleaving configuration policy corresponding to the target process identifier or the target process name is determined as the target memory interleaving configuration policy. If a memory interleaving configuration policy corresponding to the target process identifier and the target process name does not exist, then the default memory interleaving configuration policy in the memory interleaving policy configuration file is determined as the target memory interleaving configuration policy.
[0130] 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 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 but 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 but a 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.
[0131] 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 there is a memory interleaving configuration policy corresponding to the target process identifier and a memory interleaving configuration policy corresponding to the target process name, determining the memory interleaving configuration policy corresponding to the target process identifier as the target memory interleaving configuration policy; when there is a memory interleaving configuration policy corresponding to the target process identifier but no memory interleaving configuration policy corresponding to the target process name, determining the memory interleaving configuration policy corresponding to the target process identifier as the target memory interleaving configuration policy; when there is no memory interleaving configuration policy corresponding to the target process identifier but a memory interleaving configuration policy corresponding to the target process name exists, determining the memory interleaving configuration policy corresponding to the target process name as the target memory interleaving configuration policy.
[0132] In some embodiments, the memory allocation module 13 includes:
[0133] The second acquisition submodule is used to acquire information about each non-uniform memory access node and its corresponding node weight in the target memory interleaving configuration strategy.
[0134] The first memory allocation module is used to allocate memory in each non-uniform memory access node according to the corresponding node weight, until the size of the first type of memory in bytes is reached.
[0135] In some embodiments, it also includes:
[0136] The memory allocation library loading module is used to load a pre-configured memory allocation library based on the dynamic linker pre-load library setting command; the memory allocation library supports memory allocation and deallocation;
[0137] The memory splitting module is used to request memory to be split in each non-uniform memory access node through the memory allocation library, and split each memory to be split into multiple second-type memory.
[0138] The linked list setting module is used to set up used memory linked lists and unused memory linked lists in each non-uniform memory access node through the memory allocation library, and to attach the corresponding second type of memory to the unused memory linked list.
[0139] In some embodiments, the memory allocation module 13 includes:
[0140] The third acquisition submodule is used to acquire information about each non-uniform memory access node and its corresponding node weight in the target memory interleaving configuration strategy.
[0141] The second memory allocation module is used to allocate second-type memory from the unused memory list corresponding to each non-unified memory access node according to the corresponding node weight, and to attach the allocated second-type memory to the corresponding used memory list until the corresponding allocation quantity is reached.
[0142] In some embodiments, it also includes:
[0143] The target second type memory determination module is used to determine the target second type memory to be released based on the command when a command representing the release of second type memory is received.
[0144] The second type of memory release module is used to release the second type of memory using the memory release function.
[0145] The mounting module is used to mount the target second type of memory from the corresponding used memory list to the corresponding unused memory list.
[0146] In some embodiments, the first allocation submodule includes:
[0147] The second judgment submodule is used to determine whether there is remaining memory in the non-uniform memory access node where the current program is running; if yes, the second allocation submodule is triggered; if no, the target non-uniform memory access node determination submodule is triggered.
[0148] The second allocation submodule is used to request the allocation of a second type of memory in the non-uniform memory access node where the current program is running;
[0149] The target non-uniform memory access node determination submodule is used to determine the target non-uniform memory access node that is closest to the non-uniform memory access node currently running in the program among all non-uniform memory access nodes;
[0150] The second allocation submodule is used to request the allocation of a second type of memory in the target non-uniform memory access node.
[0151] In some embodiments, it also includes:
[0152] The third judgment submodule is used to determine whether each memory interleaving configuration strategy in the memory interleaving strategy configuration file contains a non-uniform memory access node of the currently running program; if not, it outputs a prompt message indicating that the memory interleaving configuration strategy should be adjusted.
[0153] For a 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, which will not be repeated here.
[0154] Embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above-described memory weight interleaving method embodiments.
[0155] Embodiments of the present invention also provide a computer-readable storage medium storing a computer program configured to execute the steps in any of the above-described memory weight interleaving method embodiments at runtime.
[0156] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0157] Embodiments of the present invention also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described memory weight interleaving method embodiments.
[0158] Embodiments of the present invention also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described memory weight interleaving method embodiments.
[0159] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0160] The foregoing has provided a detailed description of a memory weighted interleaving method, apparatus, medium, and product provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only intended to aid in understanding the method and core ideas of the present invention. It should be noted that those skilled in the art can make various improvements and modifications to the present invention without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims
1. A memory weight interleaving method, characterized in that, include: When a memory request is received, memory request information is determined based on the memory request; wherein, the memory request information includes at least the memory type of the memory requested, as well as the thread information and process information of the memory requested. Obtain a pre-configured memory interleaving strategy configuration file; wherein, the memory interleaving strategy configuration file contains memory interleaving configuration strategies corresponding to different threads and memory interleaving configuration strategies corresponding to different processes, specifically including memory interleaving configuration strategies corresponding to different thread identifiers, different thread names, different process identifiers, and different process names; the memory interleaving configuration strategy includes information on non-uniform memory access nodes that can allocate memory and their corresponding node weights; The target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file based on the memory request information. The memory allocation for this request will be performed based on the target memory interleaving configuration strategy. The memory request information is determined based on the memory request, including: The memory type requested in this memory request is determined based on the memory request 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; Based on the memory request, determine the target thread identifier, target thread name, target process identifier, and target process name, as well as the corresponding virtual address, for this memory request; When the memory type is the first type of memory, the memory allocation for this request is performed based on the target memory interleaving configuration strategy, including: Obtain information about each non-uniform memory access node and its 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 size of the first type of memory in bytes is reached.
2. The memory weight interleaving method according to claim 1, characterized in that, Obtain the pre-configured memory interleaving strategy configuration file, including: Determine whether the hash value of the local memory interleaving strategy configuration file has changed; If not, directly obtain the local memory interleaving strategy configuration file; If so, reload the memory interleaving strategy configuration file to the local machine.
3. The memory weight interleaving method according to claim 1, characterized in that, Based on the memory request information, the target memory interleaving configuration policy is determined in the memory interleaving policy configuration file, including: When the memory type is the first type of memory, the target memory interleaving configuration strategy is determined in the memory interleaving strategy 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 of memory, obtain the number of second type of memory requested in this application; When there are multiple requests for the second type of memory, the target memory interleaving configuration strategy is determined in the memory interleaving strategy configuration file based on the target thread identifier, the target thread name, the target process identifier, and the target process name. When the number of requests for the second type of memory is 1, the second type of memory is allocated directly according to the default allocation strategy.
4. The memory weight interleaving method according to claim 3, characterized in that, Based on the target thread identifier, the target thread name, the target process identifier, and the target process name, the target memory interleaving configuration policy is determined in the memory interleaving policy configuration file, including: 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 there is a memory interleaving configuration strategy corresponding to the target thread identifier and / or the memory interleaving configuration strategy corresponding to the target thread name, then the memory interleaving configuration strategy corresponding to the target thread identifier or the memory interleaving configuration strategy corresponding to the target thread name is determined as the target memory interleaving configuration strategy; If it is confirmed that there is no memory interleaving configuration policy corresponding to the target thread identifier and no memory interleaving configuration policy corresponding to the target thread name, then it is determined whether there is a memory interleaving configuration policy corresponding to the target process identifier and / or the 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 strategy corresponding to the target process identifier and / or the memory interleaving configuration strategy corresponding to the target process name, then the memory interleaving configuration strategy corresponding to the target process identifier or the memory interleaving configuration strategy corresponding to the target process name is determined as the target memory interleaving configuration strategy. If it is confirmed that there is no memory interleaving configuration policy corresponding to the target process identifier and no 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.
5. The memory weight interleaving method according to claim 4, 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 there exists a memory interleaving configuration strategy corresponding to the target thread identifier and a memory interleaving configuration strategy corresponding to the target thread name, the memory interleaving configuration strategy corresponding to the target thread identifier is determined as the target memory interleaving configuration strategy. When a memory interleaving configuration strategy corresponding to the target thread identifier exists, but a memory interleaving configuration strategy corresponding to the target thread name does not exist, the memory interleaving configuration strategy corresponding to the target thread identifier is determined as the target memory interleaving configuration strategy. When there is no memory interleaving configuration strategy corresponding to the target thread identifier, but there is a memory interleaving configuration strategy corresponding to the target thread name, the memory interleaving configuration strategy corresponding to the target thread name is determined as the target memory interleaving configuration strategy; 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 there exists a memory interleaving configuration policy corresponding to the target process identifier and 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 a memory interleaving configuration strategy corresponding to the target process identifier exists, but a memory interleaving configuration strategy corresponding to the target process name does not exist, the memory interleaving configuration strategy corresponding to the target process identifier is determined as the target memory interleaving configuration strategy. When there is no memory interleaving configuration policy corresponding to the target process identifier, but 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.
6. The memory weight interleaving method according to claim 3, characterized in that, Before receiving the memory request, the process also includes: A pre-configured memory allocation library is loaded based on the dynamic linker pre-load library setting command; wherein, the memory allocation library supports memory allocation and release; The memory allocation library is used to request memory to be split in each non-uniform memory access node, and each memory to be split is split into multiple second type memory. The memory allocation library is used to set up used memory lists and unused memory lists in each non-uniform memory access node, and the corresponding second type of memory is mounted to the unused memory list.
7. The memory weight interleaving method according to claim 6, characterized in that, When the memory type is the second type of memory and there are multiple corresponding requests, the memory allocation for this request is performed based on the target memory interleaving configuration strategy, including: Obtain information about each non-uniform memory access node and its corresponding node weight in the target memory interleaving configuration strategy; Based on the corresponding node weight, the second type of memory is requested from the unused memory list corresponding to each non-unified memory access node, and the requested second type of memory is attached to the corresponding used memory list until the corresponding request quantity is reached.
8. The memory weight interleaving method according to claim 7, characterized in that, After performing this memory allocation based on the target memory interleaving configuration strategy, the process also includes: When a command indicating the release of the second type of memory is received, the target second type of memory to be released is determined according to the command; Use the memory release function to release the target second type of memory; The target second type of memory is attached from the corresponding used memory list to the corresponding unused memory list.
9. The memory weight interleaving method according to claim 3, characterized in that, The second type of memory is allocated directly according to the default allocation strategy, including: Determine if there is any remaining memory on the non-uniform memory access node where the program is currently running; If so, then request and allocate the second type of memory in the non-uniform memory access node where the current program is running; If not, then determine the target non-uniform memory access node that is closest to the non-uniform memory access node where the current program is running among all non-uniform memory access nodes; The second type of memory is requested and allocated in the target non-uniform memory access node.
10. The memory weight interleaving method according to any one of claims 1 to 9, characterized in that, Also includes: Determine whether each memory interleaving configuration strategy in the memory interleaving strategy configuration file contains a non-uniform memory access node of the currently running program; If not, output a prompt message indicating that the memory interleaving configuration strategy needs to be adjusted.
11. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the memory weight interleaving method as described in any one of claims 1 to 10 when executing the computer program.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, it implements the steps of the memory weight interleaving method as described in any one of claims 1 to 10.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the memory weight interleaving method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Multi-JVM deployment method based on non-uniform memory accessing technology
CN106897122A
Memory interleaving matching method and device, readable storage medium and electronic equipment
CN115934489A