Memory access optimization method and device, electronic equipment, storage medium and program

By monitoring and dynamically managing memory access data in real time and optimizing memory swapping strategies, remote memory is migrated to local memory, solving the problem of memory access latency under high memory demand and improving system performance.

CN121300993APending Publication Date: 2026-01-09SUIYUAN INTELLIGENT TECH (CHENGDU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511406396.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-29
Publication Date
2026-01-09

AI Technical Summary

Technical Problem

In scenarios with high memory requirements, application memory access latency and bandwidth are limited, and existing technologies cannot efficiently manage non-affinity memory resources, leading to a decline in system performance.

Method used

By dynamically monitoring the application's memory access data in real time, when the remote memory access data meets the swapping conditions, the target local memory for swapping is selected from the local memory, and the memory swapping process is performed to migrate the target remote memory to the target local memory for swapping.

Benefits of technology

It reduces remote memory access latency, improves memory access efficiency, and enhances overall system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121300993A_ABST
    Figure CN121300993A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a memory access optimization method and device, electronic equipment, a storage medium and a program.The method comprises the steps that memory access data of an application program are dynamically monitored in real time, and remote memory access data of the application program are determined according to the memory access data of the application program; under the condition of determining that the remote memory access data of the application program meets the memory exchange condition, determining a target exchange local memory from local memories; determining a target exchange remote memory according to the remote memory access data of the application program; and performing memory exchange processing on the target exchange local memory and the target exchange remote memory. According to the technical scheme provided by the embodiment of the invention, efficient management of the memory can be realized in a high-memory-demand use scene, and memory access delay is reduced, so that the memory access efficiency is improved, and the overall performance of the system 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 access optimization method, apparatus, electronic device, storage medium and program. Background Technology

[0002] NUMA (Non-Uniform Memory Access) is a computer architecture that allows multiple processors or processing nodes to share memory resources, but the latency for each node to access different memory regions is different.

[0003] When writing applications, it's necessary to configure affinity settings based on the application's memory usage requirements and characteristics. During program runtime, binding methods such as `taskset` (a command-line tool for setting or obtaining a process's CPU (Central Processing Unit) affinity), `cgroup` (a kernel feature that allows resource management and restriction of processes), or `numactl` (Non-Uniform Memory Access Control, a tool for managing NUMA memory architecture in Linux systems, allowing users to specify which CPU and memory nodes an application should use to optimize performance and resource utilization) can be used to bind the application to compatible computing and memory resources for more efficient program operation.

[0004] In the process of developing this invention, the inventors discovered the following drawbacks in the existing technology: In certain scenarios, the memory resources required by an application may be enormous, exceeding the affinity memory size of the application's host CPU. In such cases, the excess affinity memory will inevitably be allocated by non-affinity memory nodes. The application's access to this non-affinity memory will be affected by high latency and low bandwidth. Summary of the Invention

[0005] This invention provides a memory access optimization method, apparatus, electronic device, storage medium, and program that can achieve efficient memory management in high memory demand scenarios, reduce memory access latency, thereby improving memory access efficiency and ultimately enhancing the overall system performance.

[0006] According to one aspect of the present invention, a memory access optimization method is provided, comprising:

[0007] Real-time dynamic monitoring of application memory access data, and determination of application remote memory access data based on the application's memory access data;

[0008] If it is determined that the remote memory access data of the application satisfies the memory swapping conditions, the target local memory to be swapped is determined from the local memory;

[0009] The target remote memory to be swapped is determined based on the remote memory access data of the application.

[0010] The target local memory and the target remote memory are swapped.

[0011] According to another aspect of the present invention, a memory access optimization apparatus is provided, comprising:

[0012] The remote memory access data determination module is used to monitor the memory access data of the application in real time and determine the remote memory access data of the application based on the memory access data of the application.

[0013] The target local memory swapping determination module is used to determine the target local memory swapping from the local memory when it is determined that the remote memory access data of the application satisfies the memory swapping conditions.

[0014] A target swap remote memory determination module is used to determine the target swap remote memory based on the remote memory access data of the application.

[0015] The memory swapping module is used to perform memory swapping processing on the target local memory and the target remote memory.

[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the memory access optimization method according to any embodiment of the present invention.

[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the memory access optimization method according to any embodiment of the present invention.

[0021] According to another aspect of the present invention, a computer program product is also provided, comprising a computer program that, when executed by a processor, implements the memory access optimization method described in any embodiment of the present invention.

[0022] This invention, through real-time dynamic monitoring of application memory access data, determines the application's remote memory access data based on this data. When the application's remote memory access data satisfies the memory swapping conditions, a target local swap memory is determined from local memory, and a target remote swap memory is determined based on the application's remote memory access data. Then, memory swapping is performed between the target local swap memory and the target remote swap memory. This technical solution, by switching the target remote swap memory accessed by the application that meets the memory swapping conditions to the target local swap memory, can improve the access speed of the memory data corresponding to the target remote swap memory. It solves the problem of inefficient memory management in existing memory access methods, enabling efficient memory management in high memory demand scenarios, reducing memory access latency, thereby improving memory access efficiency and ultimately enhancing the overall system performance.

[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0024] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.

[0025] Figure 1 This is a flowchart of a memory access optimization method provided in an embodiment of the present invention;

[0026] Figure 2 This is a schematic diagram of the structure of a multi-node system composed of multiple processor nodes provided in an embodiment of the present invention;

[0027] Figure 3 This is a flowchart of another memory access optimization method provided in an embodiment of the present invention;

[0028] Figure 4 This is a schematic diagram illustrating the effect of an initial memory allocation state provided in an embodiment of the present invention;

[0029] Figure 5 This is a schematic diagram illustrating the effect of prioritizing the allocation of local memory to applications, as provided in an embodiment of the present invention.

[0030] Figure 6 This is a schematic diagram illustrating the effect of allocating remote memory to an application when local memory is insufficient, according to an embodiment of the present invention.

[0031] Figure 7 This is a schematic diagram of a memory allocation process provided in an embodiment of the present invention;

[0032] Figure 8 This is a schematic diagram illustrating the effect of local memory and remote memory exchange according to an embodiment of the present invention;

[0033] Figure 9 This is a schematic diagram of a memory access and swapping process provided in an embodiment of the present invention;

[0034] Figure 10 This is a schematic diagram of a memory access optimization device provided in an embodiment of the present invention;

[0035] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0036] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. 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 skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0037] It should be noted that the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such process, method, product or device.

[0038] Figure 1 This is a flowchart of a memory access optimization method provided by an embodiment of the present invention. This embodiment is applicable to situations where remote memory that meets the swapping conditions is swapped with the corresponding local memory based on the monitoring of remote memory access data. This method can be executed by a memory access optimization device, which can be implemented in software and / or hardware, and is generally integrated into the processor's memory manager. The processor is integrated into an electronic device, which can be a terminal device or a server device. This embodiment of the present invention does not limit the specific device type of the electronic device. Accordingly, as... Figure 1 As shown, the method includes the following operations:

[0039] S110. Monitor the application's memory access data in real time and determine the application's remote memory access data based on the application's memory access data.

[0040] Memory access data refers to the data accessed by applications to the memory of kernel nodes. This means that applications can access the local memory of their local kernel node, as well as the remote memory of other kernel nodes. Remote memory access data can be related to the remote memory of the local kernel node accessed by the application.

[0041] In this embodiment of the invention, the processor can be a multi-core processor, and each processor can include multiple kernel dies. A kernel can be called a kernel node. Each thread can run as an application on a specific kernel node. For each application, the kernel node on which the application runs can be called the local kernel node. The memory directly connected to the local kernel node can be called the local memory of the local kernel node, and the memory directly connected to other kernel nodes can be called the remote memory of the local kernel node. A processor can run a memory manager, which is a system-level component responsible for dynamically allocating, monitoring, and reclaiming memory resources, mainly used to manage the allocation and use of system memory. The memory manager runs at the CPU layer and can be called by applications on each kernel node, and is executed on the corresponding kernel node to allocate corresponding memory resources to the application.

[0042] Figure 2 This is a schematic diagram of a multi-node system composed of multiple processor nodes provided in an embodiment of the present invention. In a specific example, such as... Figure 2 As shown, a multi-node system can include multiple processors. Figure 2 This illustration only shows processors 0 (CPU0) and 1 (CPU1), but in actual architectures, more processors may be included, such as processor 2 (CPU2), processor 3 (CPU3), and processor 4 (CPU4). This embodiment of the invention does not limit the number of processors included in a multi-node system. A multi-node system can be a system including multiple processor nodes. Different processor nodes can be integrated into one device or into different devices; this embodiment of the invention does not impose any limitations on this. Each processor node in a multi-node system can include multiple kernel nodes, also known as memory nodes. For example, a multi-node system can be a NUMA system or a data center system, as long as the system allows multiple processors or kernel nodes to share memory resources. This embodiment of the invention does not limit the specific type of multi-node system. In a multi-node system, each processor node is connected to each other through a high-speed interconnect network to achieve data sharing and communication.

[0043] In a multi-node system, the memory of each processor's kernel node can consist of two parts: local memory and remote memory. Local memory is the memory of the kernel node itself, while remote memory refers to the memory of other nodes (such as those on the same processor or other kernel nodes on different processors) that the kernel node accesses and is located at least one hop away from it. For example... Figure 2 As shown, for the memory node Die0 in CPU0, memory that Die0 can directly access without a network, such as DDR (Double Data Rate SDRAM), is Die0's local memory. Memory that Die0 needs to access via a network, such as the DDR memory of Die1 in CPU0 or the DDR memory of Die3 in CPU1, is Die0's remote memory. Local memory can be directly accessed by the local kernel node, resulting in faster access speeds, lower latency, and better performance. This is because local memory and the local kernel node reside on the same node, resulting in shorter data transfer distances and faster access speeds. Furthermore, local memory access typically has higher bandwidth, supporting high-throughput data transfer and further improving overall performance. Accessing remote memory, on the other hand, requires the local kernel node to transmit data with the remote memory through the interconnect network between nodes, resulting in slower access speeds, higher latency, and poorer performance. Besides latency, remote memory access also typically has lower bandwidth, which limits data transfer speed and leads to performance degradation. This non-uniformity of memory access is a key characteristic of multi-node systems.

[0044] Remote memory can be further divided based on the ownership relationship between kernel nodes and processors. Specifically, for a local kernel node, the remote memory of other kernel nodes belonging to the same processor is considered remote memory between dies of the same processor, while the remote memory of kernel nodes not belonging to the same processor is considered remote memory outside dies of different processors. For example... Figure 2 As shown, assuming CPU0's Die2 is a local kernel node, then the local memory of CPU0's Die1 is remote memory between dies of the same processor relative to CPU0's Die2; the local memory of CPU1's Die1 is remote memory outside of dies of different processors relative to CPU0's Die2. In a typical NUMA CPU architecture of a NUMA system, the latency of CPU accessing remote memory between dies can be more than 1.5 times that of local memory, and the latency of accessing remote memory outside of dies can be more than 2.5 times.

[0045] In this embodiment of the invention, an affinity relationship can be configured between processors and memory in a multi-node system. Specifically, when an application needs to access memory resources, it can send a memory request to the memory manager. In response to the memory request, the memory manager prioritizes allocating local memory—memory that can be directly accessed by the application's local kernel node—to reduce remote memory access, improve memory access speed, and thus enhance memory access performance. In this way, the system and applications can optimize memory access efficiency by setting an affinity strategy.

[0046] Optionally, applications can request and manage memory in the form of memory blocks. When allocating memory to an application, if the application's local memory resources meet its memory access needs, the memory manager can prioritize allocating contiguous memory blocks using local memory. When local memory is insufficient, the memory manager can use an intelligent memory allocation strategy to select appropriate remote memory resources and allocate contiguous memory blocks to reduce latency in remote memory access. A memory block is essentially a contiguous segment of memory. Optionally, the memory manager can adapt the configured memory block size to different types of applications. For example, for applications with high memory access demands, the memory manager can allocate larger memory blocks; for applications with low memory access demands, the memory manager can allocate smaller memory blocks. Dynamically allocating memory blocks of appropriate size can improve the flexibility and adaptability of memory access, further improving memory access efficiency.

[0047] Correspondingly, the memory manager can dynamically monitor application memory access data in real time to obtain the application's memory access patterns, and obtain the memory access data corresponding to each application in real time based on the real-time monitoring results. For the memory access data corresponding to each application, the memory manager can analyze it to determine the remote memory access data of each application, and obtain the specific access situation of each application to remote memory through the remote memory access data of each application.

[0048] S120. If it is determined that the remote memory access data of the application satisfies the memory swapping conditions, the target local memory to be swapped is determined from the local memory.

[0049] The memory swapping condition can be used to determine whether it is necessary to swap remote memory and local memory. The target local memory to be swapped can be local memory that can be swapped with remote memory.

[0050] The memory manager analyzes the specific accesses to remote memory by each application in real time, filtering out remote memory access data that meets the conditions for memory swapping. To reduce the frequency of remote memory access, remote memory access data that can reduce the overall frequency of remote memory access after a memory swap can be considered as meeting the conditions for memory swapping.

[0051] For example, if it is determined from an application's remote memory access data that the application frequently accesses the same remote memory, then it can be determined that the application's remote memory access data satisfies the memory swapping condition. Alternatively, if it is determined from an application's remote memory access data that the application accesses remote memory more frequently than it accesses local memory, then it can be determined that the application's remote memory access data satisfies the memory swapping condition. This embodiment of the invention does not limit the specific method for determining the memory swapping condition.

[0052] Correspondingly, if the memory manager determines that the remote memory access data of one or more applications meets the memory swapping conditions, it can filter out local memory that can be swapped as the target local memory for swapping.

[0053] S130. Determine the target remote memory to be swapped based on the remote memory access data of the application.

[0054] The target swapped remote memory can be remote memory that can be swapped with local memory.

[0055] Meanwhile, for each application whose remote memory access data meets the conditions for memory swapping, the memory manager can further parse the remote memory access data of each application to select the remote memory that can be swapped as the target remote memory for swapping.

[0056] S140, Perform memory swapping processing on the target swap local memory and the target swap remote memory.

[0057] Accordingly, after determining the target local memory and the target remote memory, memory swapping can be performed on the target local memory and the target remote memory. Memory swapping can also be called memory migration, which involves migrating data stored in the target local memory to the target remote memory, and vice versa.

[0058] Therefore, by performing memory swapping between the target local memory and the target remote memory, the operation of the application accessing the target remote memory can be migrated to the target local memory. This reduces the latency of remote memory access during the dynamic memory migration process and improves the efficiency of memory access.

[0059] This invention, through real-time dynamic monitoring of application memory access data, determines the application's remote memory access data based on this data. When the application's remote memory access data satisfies the memory swapping conditions, a target local swap memory is determined from local memory, and a target remote swap memory is determined based on the application's remote memory access data. Then, memory swapping is performed between the target local swap memory and the target remote swap memory. This technical solution, by switching the target remote swap memory accessed by the application that meets the memory swapping conditions to the target local swap memory, can improve the access speed of the memory data corresponding to the target remote swap memory. It solves the problem of inefficient memory management in existing memory access methods, enabling efficient memory management in high memory demand scenarios, reducing memory access latency, thereby improving memory access efficiency and ultimately enhancing the overall system performance.

[0060] Figure 3 This is a flowchart of another memory access optimization method provided by an embodiment of the present invention. This embodiment is based on the above embodiment and is further specified. In this embodiment, various specific optional implementation methods are given for determining that the remote memory access data of the application satisfies the memory swapping condition, determining the target local memory to swap from local memory, and determining the target remote memory to swap. Accordingly, as Figure 3 As shown, the method in this embodiment may include:

[0061] S210. Monitor the application's memory access data in real time and determine the application's remote memory access data based on the application's memory access data.

[0062] S220. Determine whether the remote memory access data of the application meets the memory swapping conditions. If yes, execute S230; otherwise, return to execute S210.

[0063] In an optional embodiment of the present invention, determining that the remote memory access data of the application satisfies the memory swapping condition may include: determining the access frequency of the application to each remote memory based on the remote memory access data of the application; and determining that the remote memory access data of the application satisfies the memory swapping condition when it is determined that the access frequency of the application to the target remote memory exceeds a set access frequency threshold.

[0064] The access frequency threshold can be a threshold configured according to actual needs, and this embodiment of the invention does not limit the specific value of the access frequency threshold. The target remote memory can be remote memory whose access frequency exceeds the set access frequency threshold.

[0065] Specifically, the memory manager can dynamically monitor the access frequency of each application to each remote memory location in real time using the application's remote memory access data. Based on the access frequency of each application to each remote memory location, it can determine whether the application is frequently accessing remote memory. If it is determined that the application's access frequency to the target remote memory exceeds the set access frequency threshold, it indicates that the application has been frequently accessing the target remote memory recently. At this point, it can be determined that the application's remote memory access data meets the memory swapping conditions.

[0066] S230. Determine the access time information and / or access frequency information of each memory block in the local memory based on the memory access association information of the local memory.

[0067] The memory access association information can be related to memory access, such as including but not limited to memory identifiers, location information, access time, and access frequency. As long as it can reflect the memory attribute information and related information about memory access, the specific information content of the memory access association information is not limited in this embodiment of the invention.

[0068] Frequent access to target remote memory leads to high-latency memory access operations, thus degrading memory access performance. Therefore, when it is determined that an application is frequently accessing target remote memory, a memory migration operation can be triggered. Before performing the memory migration operation, the memory manager can first obtain the memory access association information of the local memory to obtain the attribute information of the local memory and the accessed information. Furthermore, the memory manager parses the memory access association information of the local memory to determine the specific information of the accessed memory blocks, such as the access time information and / or access frequency information.

[0069] S240. Based on the access time information and / or access frequency information of each memory block in the local memory, at least one target swap local memory is selected from each memory block in the local memory.

[0070] After obtaining the access time information and / or access frequency information of each memory block in local memory, the memory manager can perform comprehensive analysis and judgment on the access time information and / or access frequency information of each memory block in local memory, so as to select at least one memory block as the target for swapping local memory.

[0071] In an optional embodiment of the present invention, the step of selecting at least one target swap local memory from each memory block in the local memory based on the access time information and / or access frequency information of each memory block in the local memory may include: selecting the memory block with the earliest access time information in the local memory as the target swap local memory; selecting the memory block with the lowest access frequency information in the local memory as the target swap local memory; and / or, determining the weight values ​​of the access time information and the access frequency information, calculating the swap benefit evaluation value of each memory block in the local memory based on the access time information, access frequency information and corresponding weight values ​​of each memory block in the local memory, and selecting the target swap local memory based on the swap benefit evaluation value of each memory block in the local memory.

[0072] Among them, the swap benefit assessment value can be used to evaluate the performance benefits of memory access after memory swapping.

[0073] Optionally, when selecting targets for local memory swapping, the memory manager can analyze the access time of each memory block in local memory. It's understandable that the earlier a memory block is accessed, the lower the probability of that block being accessed frequently. Therefore, the memory block with the earliest access time in local memory can be selected as the target for local memory swapping.

[0074] Optionally, when selecting targets for local memory swapping, the memory manager can also analyze the access frequency of each memory block in local memory. It's understandable that the lower the access frequency of a memory block, the lower the probability that the memory block is frequently accessed. Therefore, the memory block with the lowest access frequency in local memory can be selected as the target for local memory swapping.

[0075] Optionally, when filtering target local memory for swapping, the memory manager can also simultaneously analyze the access time and frequency of each memory block in local memory. Specifically, a first weight value can be set for access time, and a second weight value can be set for access frequency. Further, the product of the access time and the first weight value for each memory block is calculated to obtain a first evaluation value; the product of the access frequency and the second weight value for each memory block is calculated to obtain a second evaluation value; and the first and second evaluation values ​​are summed to obtain the final swapping benefit evaluation value for each memory block. The smaller the swapping benefit evaluation value, the greater the performance benefit brought by memory swapping. Therefore, the memory block with the smallest swapping benefit evaluation value in local memory can be selected as the target local memory for swapping.

[0076] Optionally, one or more target swap local memory blocks can be obtained by using at least one of the target swap local memory filtering methods described above. The number of target swap local memory blocks can be equal to, less than, or greater than the number of target swap remote memory blocks; this embodiment of the invention does not impose any limitations on this. When the number of target swap local memory blocks is greater than the number of target swap remote memory blocks, memory blocks that can bring the greatest performance benefit can be further filtered from the target swap local memory blocks, so that the number of filtered memory blocks is equal to the number of target swap remote memory blocks. This satisfies the swapping requirements of the target swap remote memory blocks while bringing the maximum performance benefit of memory swapping.

[0077] The above technical solution improves the flexibility and reliability of target swap local memory screening by employing multiple optional methods to screen target swap local memory.

[0078] S250. Determine the access frequency of the application to each remote memory based on the remote memory access data of the application, and filter the target swap remote memory based on the access frequency of the remote memory.

[0079] When selecting target remote memory for swapping, the memory manager can also determine the frequency of application access to each remote memory based on the application's remote memory access data, and determine the remote memory with higher access frequency as the target remote memory for swapping.

[0080] S260, Perform memory swapping processing on the target swap local memory and the target swap remote memory.

[0081] In an optional embodiment of the present invention, the step of filtering the target swapped remote memory according to the access frequency of the remote memory may include: filtering memory blocks of remote memory whose access frequency exceeds a set access frequency threshold as candidate swapped remote memory; if it is determined that the number of candidate swapped remote memory is less than or equal to the number of target swapped local memory, filtering all the candidate swapped remote memory as the target swapped remote memory; if it is determined that the number of candidate swapped remote memory is greater than the number of target swapped local memory, filtering a portion of the target swapped remote memory from the candidate swapped remote memory.

[0082] Among them, the alternative remote memory for swapping can be the remote memory with high access frequency that has been initially screened, and can be further used as a benchmark to screen the target remote memory for swapping.

[0083] Specifically, memory blocks of remote memory accessed more frequently than a set access frequency threshold can be selected as candidate remote memory for swapping. After selecting candidate remote memory, it can be first determined whether the number of candidate remote memory blocks meets the conditions for memory swapping. If the number of candidate remote memory blocks is less than or equal to the number of target local memory blocks, it indicates that the number of target local memory blocks is sufficient, and all candidate remote memory blocks can be selected as target remote memory blocks. After swapping the target remote memory blocks with the target local memory blocks, there may be surplus target local memory blocks. If the number of candidate remote memory blocks is greater than the number of target local memory blocks, it indicates that the number of target local memory blocks is insufficient, and a portion of the target remote memory blocks can be selected from the candidate remote memory blocks. Specifically, the number of target remote memory blocks selected from the candidate remote memory blocks can be the same as the number of target local memory blocks.

[0084] Understandably, after selecting a portion of the target swap remote memory from the candidate swap remote memory, the remaining candidate swap remote memory can directly participate in the next memory migration process. That is, as long as target swap local memory is continuously selected, the remaining candidate swap remote memory can be swapped with the continuously selected target swap local memory, thereby avoiding repeated selection and location processes for target swap remote memory, improving the efficiency of memory swapping, and further optimizing memory access performance.

[0085] In an optional embodiment of the present invention, selecting a portion of the target swap remote memory from the candidate swap remote memory may include: calculating the memory swap benefit of each candidate swap remote memory based on the memory access association information of each candidate swap remote memory; sorting the candidate swap remote memory according to the order of the memory swap benefits; and selecting the candidate swap remote memory of the target swap local memory quantity from each candidate swap remote memory as the target swap remote memory based on the sorting result of the candidate swap remote memory.

[0086] Among them, the benefit of memory swapping can be the improvement in memory access performance after memory swapping.

[0087] Specifically, the memory manager can obtain memory access association information for each candidate remote memory for swapping, and comprehensively analyze the specific memory access information related to the impact of each candidate remote memory on memory access benefits during the memory swapping process, in order to determine the memory swapping benefits that each candidate remote memory can generate when swapping with local memory. Furthermore, the memory manager can sort the candidate remote memories in descending or ascending order of memory swapping benefits, and select the candidate remote memory with the same number of local memories as the target remote memory based on the sorting result. It can be understood that the candidate remote memory with the same number of local memories as the target remote memory is the one with the highest memory swapping benefit among all candidate remote memories.

[0088] In an optional embodiment of the present invention, the memory access association information may include at least one of memory block access time information, access frequency information, and memory swapping jitter information; the step of calculating the memory swapping benefit of each of the candidate remote memory based on the memory access association information of each candidate remote memory may include: calculating a positive swapping benefit evaluation value of each candidate remote memory based on the access time information and / or access frequency information of each candidate remote memory; calculating a negative swapping benefit evaluation value of each candidate remote memory based on the memory swapping jitter information of each candidate remote memory; and calculating the memory swapping benefit of each candidate remote memory based on the positive swapping benefit evaluation value and the negative swapping benefit evaluation value of each candidate remote memory.

[0089] Among them, memory swapping jitter information reflects the frequency of memory swapping. The positive swapping benefit assessment value can be an evaluation of the positive benefits that memory swapping can generate. The negative swapping benefit assessment value can be an evaluation of the negative benefits that memory swapping can generate. A positive benefit means that it can improve memory access performance, and a negative benefit means that it can lead to a decrease in memory access performance. Optionally, the positive swapping benefit assessment value can be a positive value greater than 0, and the negative swapping benefit assessment value can be a negative value less than 0.

[0090] Considering that different types of memory access association information can be used to evaluate the memory swapping benefits of different types, when calculating the memory swapping benefits of each candidate remote memory, the memory manager can calculate the positive swapping benefit assessment value of each candidate remote memory based on its access time information and / or access frequency information. For example, the later the access time information in the candidate remote memory, the larger the calculated positive swapping benefit assessment value; the higher the access frequency in the candidate remote memory, the larger the calculated positive swapping benefit assessment value. Alternatively, the memory manager can also determine the weight values ​​of access time information and access frequency information, and calculate the positive swapping benefit assessment value of each memory block in the candidate remote memory based on the access time information, access frequency information, and corresponding weight values.

[0091] The memory swapping jitter information in memory access association information reflects the frequency of memory swapping. Generally, the higher the frequency of memory swapping, the greater the negative impact on memory access performance. Therefore, the memory manager can also calculate the negative swapping benefit assessment value of each candidate remote memory based on the memory swapping jitter information. For example, the most recent memory swapping time of the candidate remote memory can be determined based on the memory swapping jitter information. The closer the most recent memory swapping time of the candidate remote memory is to the current system time, the larger the absolute value of the negative swapping benefit assessment value of that candidate remote memory. For example, if the most recent memory swapping time of candidate remote memory 1 is 13:00 on February 2, 2025, and the most recent memory swapping time of candidate remote memory 2 is 19:00 on February 2, 2025, then the negative swapping benefit assessment value of candidate remote memory 1 may be -5, and the negative swapping benefit assessment value of candidate remote memory 2 may be -10.

[0092] Accordingly, after calculating the positive and negative exchange benefit assessment values ​​for each candidate remote memory, the positive and negative exchange benefit assessment values ​​for each candidate remote memory can be summed to obtain the final exchange benefit assessment value as the memory exchange benefit of each candidate remote memory.

[0093] In an optional embodiment of the present invention, the memory access association information includes at least one of memory block access time information, access frequency information, and memory swapping jitter information; the step of calculating the memory swapping benefit of each of the candidate remote memory based on the memory access association information of each candidate remote memory may include: inputting the access time information, access frequency information, and memory swapping jitter information of each candidate remote memory into a memory swapping benefit evaluation model, so as to calculate the memory swapping benefit of each candidate remote memory through the memory swapping benefit evaluation model; wherein, the memory swapping benefit evaluation model is pre-trained based on sample data of the memory access association information.

[0094] Among them, the memory swapping benefit evaluation model can be an evaluation model constructed through network models in the field of artificial intelligence, used to evaluate the memory swapping benefit of calculating alternative remote memory swaps.

[0095] To further improve the intelligence and accuracy of the memory swapping benefit calculation process, a memory swapping benefit evaluation model can be pre-trained on a specific type of network model (such as an existing actual network topology or a large model) using sample data of memory access correlation information. Correspondingly, the memory manager can call the memory swapping benefit evaluation model and input the access time information, access frequency information, and memory swapping jitter information of each candidate remote memory as input data. The model will then automatically calculate the memory swapping benefit of each candidate remote memory based on the input access time information, access frequency information, and memory swapping jitter information.

[0096] Optionally, application priority can be considered when selecting a target swap remote memory from among the alternative swap remote memory options, thereby improving the quality and flexibility of business processing. Specifically, the memory manager can determine the priority of the applications accessing the alternative swap remote memory options; the higher the priority of an application, the greater the probability that the alternative swap remote memory accessed by that application will be selected as the target swap remote memory option.

[0097] In one example Figure 4 This is a schematic diagram illustrating the effect of an initial memory allocation state provided in an embodiment of the present invention. Figure 5 This is a schematic diagram illustrating the effect of prioritizing the allocation of local memory to applications, provided by an embodiment of the present invention. Figure 6 This is a schematic diagram illustrating the effect of allocating remote memory to an application when local memory is insufficient, as provided in an embodiment of the present invention. In a specific example, such as... Figure 4As shown, during system startup, the memory manager of each CPU is initialized, and the local and remote memory states (idle, allocated) of all nodes are recorded by the memory manager. One CPU can run one memory manager. Applications on each kernel node within the CPU can call the memory manager's memory management logic to allocate and manage local and remote memory. Similarly, each kernel node within the CPU can execute the memory manager's memory management logic to allocate and manage local and remote memory. Local and remote memory have corresponding physical addresses, and can also be allocated virtual addresses through the memory manager.

[0098] like Figure 5 As shown, applications run on kernel nodes. When an application requests memory, it invokes the memory manager to perform the memory allocation process. Specifically, the memory manager identifies the kernel location where the application resides, thus distinguishing between local and remote memory for that application and determining the specific memory allocation strategy for that application. For example, assuming an application on Die0 of CPU0 initiates a memory request, the memory manager can determine that Die0 is the application's local kernel node, and classify the memory directly managed by Die0 as local memory, while the memory of other nodes accessible to Die0 via the network is considered remote memory. Furthermore, the memory manager prioritizes allocating local memory to applications based on pre-configured or real-time configured memory block sizes (such as 2M, 4M, 16M, ..., 2G, etc.). Each memory block can be uniquely identified by a node identifier and a memory block identifier. For example, in the memory block "00001:000N", "00001" is the identifier of the kernel node, "0000N" is the identifier of the memory block, and "00001:000N" can represent the "000N"th memory block of the kernel node "00001". Figure 6 As shown, when local memory is insufficient, the memory manager selects a remote memory node with lower latency for allocation based on the current system state and memory usage.

[0099] Figure 7 This is a schematic diagram of a memory allocation process provided in an embodiment of the present invention. Figure 8 This is a schematic diagram illustrating the effect of local and remote memory swapping according to an embodiment of the present invention. Figure 9 This is a schematic diagram of a memory access and swapping process provided by an embodiment of the present invention. In a specific example, such as... Figure 7As shown, during the memory allocation process for applications, the memory manager can query the free memory card information of memory nodes. If it determines that local memory exists for an application, it prioritizes allocating local memory resources to that application. If the memory manager determines that local memory does not contain free memory blocks, but there is remaining memory in the already allocated memory blocks, it can allocate the remaining memory from the allocated memory blocks to the application. For example, it can allocate the remaining memory in memory block 1 allocated to application 1 to application 2. If local memory is insufficient, the memory manager can further determine whether there are free memory blocks in remote memory. If there are free memory blocks in remote memory, it can allocate the entire memory block of remote memory to the application. If there are no free memory blocks in remote memory, it can allocate the remaining memory from the already allocated memory blocks in remote memory to the application. After memory (including local and remote memory) allocation is completed, the free memory card information of the memory nodes is updated in real time, and the allocated memory block information is recorded in the virtual memory block mapping table (vblock mapping table).

[0100] The free memory information for memory nodes can be recorded in the `free_list` field, which stores the free information for each memory block. Specifically, the `free_list` field can be a pointer to the head of a linked list of free memory within a memory block. For example, ... Figure 7 As shown, "0001|0001|0x001" in the free memory card information of memory nodes indicates that the address of the head pointer of the free memory list for memory block 0001 of node 0001 is "0x001". Thus, by using the size of each memory block and the head pointer of the free memory list, the existence of free memory can be determined. The vblock mapping table consists of vblock (representing virtual memory block) identifiers, node nodes, and memory blocks, establishing a mapping relationship between virtual memory and physical memory.

[0101] The CPU can also be configured with a memory access monitoring module, which can run independently or be integrated into the memory manager; this embodiment of the invention does not impose any limitations on this. Figure 7 , Figure 8 and Figure 9 As shown, the memory access monitoring module can dynamically monitor memory access patterns in real time. When frequent remote memory access is detected, a memory migration operation is triggered to migrate the frequently accessed remote memory data to local memory, thereby achieving the exchange between local and remote memory and improving access efficiency. Figure 7 , Figure 8 and Figure 9As shown, the memory access monitoring module detects frequent access to memory blocks 00002:0003 in remote memory 1 and 00003:0003 in remote memory 2. Therefore, it identifies these memory blocks as target remote memory for swapping. Further, the memory access monitoring module queries the memory block access information table, which records related information about memory accesses, such as the most recent access time recorded by the LRU (Least Recently Used) field, and / or the access frequency of the memory block recorded by the access field. Accordingly, based on the access time and / or access frequency information of the memory blocks, the memory access monitoring module can identify memory blocks 00001:0004 and 00001:000N in local memory as target local memory for swapping. Accordingly, the memory manager can swap memory blocks 00001:0004 with memory blocks 00002:0003, and swap memory blocks 00001:000N with memory blocks 00003:0003. After the memory swap is complete, the virtual memory identifiers of each memory block in the vblock mapping table are updated; that is, the virtual memory identifier of memory block 00001:0004 is updated to 0004, the virtual memory identifier of memory block 00001:000N is updated to 0005, the virtual memory identifier of memory block 00002:0003 is updated to 0002, and the virtual memory identifier of memory block 00003:0003 is updated to 0003.

[0102] The above technical solution dynamically monitors memory access patterns. When frequent remote memory accesses are detected, it automatically adjusts the memory allocation strategy, migrating some frequently accessed remote memory data to local memory to improve memory access efficiency. The memory migration mechanism of this embodiment not only considers access latency and frequency but also introduces the concepts of temporal locality and spatial locality. For data with temporal locality—that is, memory blocks frequently accessed within a short period—it prioritizes migrating them to local memory. Simultaneously, memory migration is performed at the memory block granularity during memory swapping, satisfying data spatial locality—that is, data continuously distributed in memory—thereby reducing the latency of fragmented memory access and further improving memory access performance.

[0103] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data comply with the relevant laws, regulations and standards of the relevant regions.

[0104] It should be noted that any arrangement or combination of the technical features in the above embodiments also falls within the protection scope of this invention.

[0105] Figure 10 This is a schematic diagram of a memory access optimization device provided in an embodiment of the present invention, as shown below. Figure 10 As shown, the device includes: a remote memory access data determination module 310, a target local memory swapping determination module 320, a target remote memory swapping determination module 330, and a memory swapping processing module 340, wherein:

[0106] The remote memory access data determination module 310 is used to monitor the memory access data of the application in real time and determine the remote memory access data of the application based on the memory access data of the application.

[0107] The target swap local memory determination module 320 is used to determine the target swap local memory from the local memory when it is determined that the remote memory access data of the application satisfies the memory swapping conditions.

[0108] The target swap remote memory determination module 330 is used to determine the target swap remote memory based on the remote memory access data of the application.

[0109] The memory swapping processing module 340 is used to perform memory swapping processing on the target swapping local memory and the target swapping remote memory.

[0110] This invention, through real-time dynamic monitoring of application memory access data, determines the application's remote memory access data based on this data. When the application's remote memory access data satisfies the memory swapping conditions, a target local swap memory is determined from local memory, and a target remote swap memory is determined based on the application's remote memory access data. Then, memory swapping is performed between the target local swap memory and the target remote swap memory. This technical solution, by switching the target remote swap memory accessed by the application that meets the memory swapping conditions to the target local swap memory, can improve the access speed of the memory data corresponding to the target remote swap memory. It solves the problem of inefficient memory management in existing memory access methods, enabling efficient memory management in high memory demand scenarios, reducing memory access latency, thereby improving memory access efficiency and ultimately enhancing the overall system performance.

[0111] Optionally, the target swap local memory determination module 320 is further configured to: determine the access frequency of the application to each remote memory based on the remote memory access data of the application; and determine that the remote memory access data of the application satisfies the memory swapping conditions if it is determined that the access frequency of the application to the target remote memory exceeds a set access frequency threshold.

[0112] Optionally, the target swap local memory determination module 320 is further configured to: determine the access time information and / or access frequency information of each memory block in the local memory based on the memory access association information of the local memory; and select at least one target swap local memory from each memory block in the local memory based on the access time information and / or access frequency information of each memory block in the local memory.

[0113] Optionally, the target swap local memory determination module 320 is further configured to: select the memory block with the earliest access time information in the local memory as the target swap local memory; select the memory block with the lowest access frequency information in the local memory as the target swap local memory; and / or, determine the weight values ​​of the access time information and the access frequency information, calculate the swap benefit evaluation value of each memory block in the local memory based on the access time information, access frequency information and corresponding weight values ​​of each memory block in the local memory, and select the target swap local memory based on the swap benefit evaluation value of each memory block in the local memory.

[0114] Optionally, the target swap remote memory determination module 330 is further configured to: determine the access frequency of the application accessing each remote memory based on the application's remote memory access data; and filter the target swap remote memory based on the access frequency of the remote memory.

[0115] Optionally, the target swap remote memory determination module 330 is further configured to: filter memory blocks of remote memory whose access frequency exceeds a set access frequency threshold as candidate swap remote memory; if the number of candidate swap remote memory is less than or equal to the number of target swap local memory, filter all candidate swap remote memory as target swap remote memory; if the number of candidate swap remote memory is greater than the number of target swap local memory, filter a portion of the target swap remote memory from the candidate swap remote memory.

[0116] Optionally, the target swap remote memory determination module 330 is further configured to: calculate the memory swapping benefit of each of the candidate swap remote memories based on the memory access association information of each of the candidate swap remote memories; sort the candidate swap remote memories according to the order of the memory swapping benefits, and select the candidate swap remote memories of the target swap local memory quantity from each of the candidate swap remote memories as the target swap remote memory based on the sorting result of the candidate swap remote memories.

[0117] Optionally, the memory access association information includes at least one of memory block access time information, access frequency information, and memory swapping jitter information; the target swapping remote memory determination module 330 is further configured to: calculate the positive swapping benefit evaluation value of each of the candidate swapping remote memories based on the access time information and / or access frequency information of each of the candidate swapping remote memories; calculate the negative swapping benefit evaluation value of each of the candidate swapping remote memories based on the memory swapping jitter information of each of the candidate swapping remote memories; and calculate the memory swapping benefit of each of the candidate swapping remote memories based on the positive swapping benefit evaluation value and the negative swapping benefit evaluation value of each of the candidate swapping remote memories.

[0118] Optionally, the memory access association information includes at least one of memory block access time information, access frequency information, and memory swapping jitter information; the target swapping remote memory determination module 330 is further configured to: input the access time information, access frequency information, and memory swapping jitter information of each of the candidate swapping remote memories into the memory swapping benefit evaluation model, so as to calculate the memory swapping benefit of each of the candidate swapping remote memories through the memory swapping benefit evaluation model; wherein, the memory swapping benefit evaluation model is pre-trained based on the sample data of the memory access association information.

[0119] The memory access optimization apparatus described above can execute the memory access optimization method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method. Technical details not described in detail in this embodiment can be found in the memory access optimization method provided in any embodiment of the present invention.

[0120] Since the memory access optimization apparatus described above is an apparatus capable of executing the memory access optimization method in the embodiments of the present invention, those skilled in the art can understand the specific implementation methods and various variations of the memory access optimization apparatus in this embodiment based on the memory access optimization method described in the embodiments of the present invention. Therefore, how the memory access optimization apparatus implements the memory access optimization method in the embodiments of the present invention will not be described in detail here. Any apparatus used by those skilled in the art to implement the memory access optimization method in the embodiments of the present invention falls within the scope of protection of this application.

[0121] Figure 11 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0122] like Figure 11 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0123] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0124] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as memory access optimization methods.

[0125] Optionally, the memory access optimization method may include: dynamically monitoring the memory access data of the application in real time, and determining the remote memory access data of the application based on the memory access data of the application; if it is determined that the remote memory access data of the application meets the memory swapping conditions, determining the target swapped local memory from the local memory; determining the target swapped remote memory based on the remote memory access data of the application; and performing memory swapping processing on the target swapped local memory and the target swapped remote memory.

[0126] In some embodiments, the memory access optimization method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the memory access optimization method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the memory access optimization method by any other suitable means (e.g., by means of firmware).

[0127] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0128] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0129] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0130] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0131] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0132] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0133] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0134] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A memory access optimization method, characterized in that, include: Real-time dynamic monitoring of application memory access data, and determination of application remote memory access data based on the application's memory access data; If it is determined that the remote memory access data of the application satisfies the memory swapping conditions, the target local memory to be swapped is determined from the local memory; The target remote memory to be swapped is determined based on the remote memory access data of the application. The target local memory and the target remote memory are swapped.

2. The method according to claim 1, characterized in that, Determining that the remote memory access data of the application satisfies the memory swapping conditions includes: The frequency of the application's access to each remote memory is determined based on the application's remote memory access data; If it is determined that the frequency of the application's access to the target remote memory exceeds a set access frequency threshold, then the remote memory access data of the application satisfies the memory swapping condition.

3. The method according to claim 1, characterized in that, Determining the target swap local memory from local memory includes: The access time information and / or access frequency information of each memory block in the local memory are determined based on the memory access association information of the local memory. Based on the access time information and / or access frequency information of each memory block in the local memory, at least one target swap local memory is selected from each memory block in the local memory.

4. The method according to claim 3, characterized in that, The step of selecting at least one target swap local memory from each memory block in the local memory based on the access time information and / or access frequency information of each memory block in the local memory includes: The memory block with the earliest access time information in the local memory is selected as the target swap local memory; Select the memory block with the lowest access frequency information in the local memory as the target swap local memory; and / or The weight values ​​of the access time information and the access frequency information are determined. Based on the access time information, access frequency information and corresponding weight values ​​of each memory block in the local memory, the exchange benefit evaluation value of each memory block in the local memory is calculated. The target exchange local memory is then selected based on the exchange benefit evaluation value of each memory block in the local memory.

5. The method according to claim 1, characterized in that, Determining the target swap remote memory based on the application's remote memory access data includes: The access frequency of the application to each remote memory is determined based on the application's remote memory access data; The target swap remote memory is selected based on the access frequency of the remote memory.

6. The method according to claim 5, characterized in that, The step of filtering the target swap remote memory based on the access frequency of the remote memory includes: Memory blocks of remote memory whose access frequency exceeds a set access frequency threshold are selected as candidate remote memory blocks for swapping. If the number of candidate remote swap memory is less than or equal to the number of target local swap memory, all candidate remote swap memory will be selected as the target remote swap memory. If it is determined that the number of candidate remote swap memory is greater than the number of target local swap memory, a portion of the target remote swap memory is selected from the candidate remote swap memory.

7. The method according to claim 6, characterized in that, Selecting a portion of the target swapped remote memory from the candidate swapped remote memory includes: The memory swapping benefit of each of the candidate remote memory swaps is calculated based on the memory access association information of each of the candidate remote memory swaps. The candidate remote memory is sorted according to the order of the memory swapping benefits, and the target number of candidate remote memory is selected from each candidate remote memory as the target remote memory based on the sorting result.

8. The method according to claim 7, characterized in that, The memory access association information includes at least one of the following: memory block access time information, access frequency information, and memory swap jitter information; The step of calculating the memory swapping benefit of each of the candidate remote memory swaps based on the memory access association information of each candidate remote memory swap includes: Calculate the positive swapping benefit assessment value of each of the candidate remote memory options based on the access time information and / or access frequency information of each of the candidate remote memory options. Calculate the negative swapping benefit assessment value of each of the candidate remote memory swapping options based on the memory swapping jitter information of each of the candidate remote memory swapping options; The memory swapping benefit of each of the candidate remote memory options is calculated based on the positive swapping benefit assessment value and the negative swapping benefit assessment value of each of the candidate remote memory options.

9. The method according to claim 7, characterized in that, The memory access association information includes at least one of the following: memory block access time information, access frequency information, and memory swap jitter information; The step of calculating the memory swapping benefit of each of the candidate remote memory swaps based on the memory access association information of each candidate remote memory swap includes: The access time information, access frequency information, and memory swapping jitter information of each of the candidate remote memory swaps are input into the memory swapping benefit evaluation model, so as to calculate the memory swapping benefit of each of the candidate remote memory swaps through the memory swapping benefit evaluation model; The memory swapping benefit evaluation model is pre-trained based on sample data of the memory access association information.

10. A memory access optimization device, characterized in that, include: The remote memory access data determination module is used to monitor the memory access data of the application in real time and determine the remote memory access data of the application based on the memory access data of the application. The target local memory swapping determination module is used to determine the target local memory swapping from the local memory when it is determined that the remote memory access data of the application satisfies the memory swapping conditions. A target swap remote memory determination module is used to determine the target swap remote memory based on the remote memory access data of the application. The memory swapping module is used to perform memory swapping processing on the target local memory and the target remote memory.

11. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that is executed by the at least one processor to enable the at least one processor to perform the memory access optimization method according to any one of claims 1-9.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the memory access optimization method according to any one of claims 1-9.

13. A computer program product comprising a computer program / instructions, wherein, When the computer program / instruction is executed by the processor, it implements the memory access optimization method according to any one of claims 1-9.