Memory localization method and related equipment thereof

By determining and migrating the remote memory page of memory applications that are not bound to NUMA nodes to the local NUMA node under the multi-NUMA node architecture, the problem of high average time-consuming application access memory is solved, and the performance of accessing memory is improved.

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

Patent Information

Application Number
CN202311142971.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-04
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

Under the multi-NUMA node architecture, the average time-consuming application that does not bind the memory of the NUMA node is high.

Method used

By determining the target container configuration group of the processor bound to the local NUMA node from the running container configuration group, determine the target memory page distributed on the remote NUMA node in the memory page of the target container configuration group, and invoke the kernel-state page migration interface in the user space to migrate the target memory page to the local NUMA node.

Benefits of technology

It improves the performance of application access memory, reduces the average access time of memory, and solves the problem of high time-consuming access to remote memory pages across NUMA nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597434A_ABST
    Figure CN119597434A_ABST
Patent Text Reader

Abstract

The invention relates to a memory localization method and related equipment thereof. The method comprises the following steps: determining a target container configuration group of a processor bound with a local NUMA node from container configuration groups in operation; determining target memory pages distributed on a far-end NUMA node in the memory pages of the target container configuration group; and calling a kernel mode page migration interface in the user space to migrate the target memory page to the local NUMA node. By means of the method and device, the problem that under the architecture of multiple NUMA nodes, the average consumed time for the application program of the memory not bound with the NUMA nodes to access the memory is high is solved, and the memory access performance of the application program is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a memory localization method and related devices. Background Art

[0002] This section is intended to provide a background or context to the embodiments of the invention recited in the claims. No admission is made that the description herein is prior art by its inclusion in this section.

[0003] In a multi-NUMA node architecture, reading remote memory pages across NUMA nodes requires passing through the QPI bus, which takes longer than reading memory pages on a local NUMA node, and the time consumption is positively correlated with the distance between NUMA nodes. Therefore, the distribution of memory pages between NUMA nodes affects the memory access efficiency of the application. When the application is not bound to the memory of the NUMA node, the memory pages of the application may be randomly distributed across NUMA nodes, resulting in a high average time consumption for the application to access the memory. Summary of the invention

[0004] The memory localization method and related devices provided by the embodiments of the present invention at least solve the problem of high average time consumption for an application program of a memory not bound to a NUMA node to access a memory under a multi-NUMA node architecture of the related art.

[0005] A memory localization method, comprising: Determine a target container configuration group bound to a processor of a local NUMA node from the running container configuration groups; Determine a target memory page distributed on a remote NUMA node among the memory pages of the target container configuration group; A kernel-mode page migration interface is called in user space to migrate the target memory page to the local NUMA node.

[0006] In some of the embodiments, before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: When the target container configuration group has been bound to the memory of the local NUMA node, ending the memory localization for the target container configuration group; In a case where the target container configuration group is not bound to the memory of the local NUMA node, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

[0007] In some of the embodiments, before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: Obtaining the policy configuration of the target container configuration group; If the policy configuration is that memory localization is not effective, end the memory localization for the target container configuration group; When the policy is configured so that memory locality is in effect, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

[0008] In some of these embodiments, Determining a target container configuration group of a processor bound to a local NUMA node from a running container configuration group includes: sequentially traversing the target container configuration group of the processor bound to the local NUMA node in the container configuration group running on the local node according to a set time period; Calling a kernel-mode page migration interface in user space to migrate the target memory page to the local NUMA node includes: in the case of traversing to obtain a plurality of the target container configuration groups, migrating the target memory page of the target container configuration group to the local NUMA node relative to the target container configuration group in the order in which the target container configuration groups are traversed.

[0009] In some of the embodiments, before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: Obtaining the proportion of memory pages distributed on the local NUMA node in the memory pages of the target container configuration group; When the proportion is greater than the set threshold, the memory localization for the target container configuration group is terminated, or after waiting for a preset time, the step of returning to execute the step of obtaining the proportion of memory pages distributed on the local NUMA node in the memory pages of the target container configuration group; When the proportion is not greater than the set threshold, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

[0010] In some of the embodiments, before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: Obtain the time interval between the last memory localization time of the target container configuration group and the current time; If the time interval is not greater than the set interval, the memory localization for the target container configuration group is terminated, or after waiting for a preset time, the step of returning to the step of obtaining the time interval between the last memory localization time of the target container configuration group and the current time is executed; In a case where the time interval is greater than the set interval, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

[0011] In some of the embodiments, determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node includes: The NUMA node to which the target container configuration group is bound to the processor is determined to be a local NUMA node relative to the target container configuration group, and the NUMA node to which the target container configuration group is not bound to the processor is determined to be a remote NUMA node relative to the target container configuration group.

[0012] In some of the embodiments, determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node includes: A target memory page distributed on the remote NUMA node is determined from memory pages corresponding to processes of a preset container in the target container configuration group, wherein the preset container includes an application container.

[0013] In some of the embodiments, the kernel-mode page migration interface is a migrate_pages interface.

[0014] An electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication, wherein the memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the electronic device executes the above-mentioned memory localization method.

[0015] A non-transitory machine-readable medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to cause the computer to perform the above-mentioned memory localization method.

[0016] The memory localization method and related devices provided by the embodiments of the present invention determine the target container configuration group of the processor bound to the local NUMA node from the running container configuration group; determine the target memory page distributed on the remote NUMA node in the memory page of the target container configuration group; call the kernel state page migration interface in the user space to migrate the target memory page to the local NUMA node, thereby solving the problem of high average time consumption for an application program to access a memory device that is not bound to a NUMA node in a multi-NUMA node architecture, and improving the performance of the application program to access the memory.

[0017] The details of one or more embodiments of the invention are set forth in the following drawings and description so that other features, objects, and advantages of the invention are more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other embodiments can be obtained based on these drawings without creative work.

[0019] Figure 1 This is a schematic diagram of memory page distribution of redis on a dual-NUMA node model when the memory pages are not bound in this embodiment.

[0020] Figure 2 This is a comparison chart of the QPS performance of redis in this embodiment when the memory pages are fully locally distributed, the memory pages are randomly distributed, and the memory pages are fully remotely distributed.

[0021] Figure 3 is a flowchart of the memory localization method of this embodiment.

[0022] Figure 4 This is an optional flow chart of the memory localization method of this embodiment.

[0023] Figure 5 Schematic diagram of the structure of the electronic device of this embodiment. DETAILED DESCRIPTION

[0024] Embodiments of the present embodiment will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present embodiment are shown in the accompanying drawings, it should be understood that the present embodiment can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein, which are instead provided for a more thorough and complete understanding of the present embodiment. It should be understood that the drawings and embodiments of the present embodiment are only for exemplary purposes and are not intended to limit the scope of protection of the present embodiment.

[0025] Non-Uniform Memory Access (NUMA) is a multi-processor computer architecture, and also refers to the functions based on this technical architecture. Under the NUMA technical architecture, memory and processors are assigned to different NUMA nodes, and each NUMA node has its own integrated memory controller (IMC). Within the NUMA node, the IMC bus is used for communication between different processors; between NUMA nodes, the Quick Path Interconnect (QPI) is used for communication. The latency of QPI communication is higher than that of the IMC bus, that is, there is a difference in the distance between the processors to access the memory, which is described by DISTANCES. DISTANCES is also called affinity. The processor accesses the memory in the NUMA Node at the fastest speed and with the highest affinity because the distance is the shortest. Affinity can be represented by the value of DISTANCES. The higher the affinity, the smaller the affinity value.

[0026] A container configuration group refers to multiple containers configured as a group. A container configuration group is also called a Pod. Each Pod contains multiple containers. Under the NUMA technology architecture, a container configuration group (i.e., a Pod) or a container can configure the cpuset.cpus file under cgroups to restrict the processes involved in these Pods or containers to be affinity only with the processors (CPUs) of some NUMA nodes, that is, they can only run on this group of processors, which is called processor binding of the Pod or container. Similarly, a Pod or a container can configure the cpuset.mems file under cgroups to restrict the subsequent newly written memory pages of the processes involved in these Pods or containers to be distributed only on the memory devices of some NUMA nodes, which is called memory binding of the Pod or container. Among them, the processing of the existing memory depends on the configuration of cpuset.memory_migrate.

[0027] In the embodiments of the present application, local and remote are relative concepts. For example, local memory and remote memory, where local memory refers to the memory distributed in the NUMA node where the processor is located, and remote memory refers to the memory distributed outside the NUMA node where the processor is located. For another example, local NUMA nodes and remote NUMA nodes are relative to Pods or containers. For any Pod or container, the NUMA node where the processor running the Pod or container is located is generally referred to as the local NUMA node relative to the Pod or container; after the Pod or container processor is bound, the Pod or container can only run on the bound processor, that is, on the NUMA node where the bound processor is located, therefore, the NUMA node where the processor bound to the Pod or container is located is also the local NUMA node relative to the Pod or container, and other NUMA nodes except the local NUMA node are remote NUMA nodes relative to the Pod or container.

[0028] In a multi-NUMA node architecture, when a process reads remote memory across NUMA nodes (the memory and processor are in different NUMA nodes), it needs to go through the QPI bus. Compared with local memory (the memory and processor are in the same NUMA node), memory access takes longer. The distribution of remote memory will reduce the local memory access hit of the application, affecting the memory access performance of the application (especially memory-intensive container applications, such as redis).

[0029] Take the memory-intensive application Redis as an example. When Redis is CPU-affinitized, the NUMA node may be switched during the process. That is, the memory pages generated by the process are switched to the memory of the remote NUMA node. In this case, the distribution of memory pages is as follows when testing on a dual-NUMA node model: Figure 1 As shown in the figure, some memory pages are distributed on remote NUMA nodes. Compared with the random distribution of memory pages and the full remote distribution, the performance of the queries per second (QPS) of the redis server in the stress test is as follows: Figure 2 As shown in the figure, the increases are 10.52% and 26.12% respectively.

[0030] In some processor load-aware scheduling technologies, the Pod is bound to one or more processors by modifying the cgroups configuration, and then the Pod's memory page is also bound to the memory of the NUMA node where the processor is located, and the cpuset.memory_migrate configuration is set to 1. With the above configuration, the Pod's process is only affinity to the bound CPU, and new memory pages are only written on the specified NUMA. When a new Pod is bound to memory, or a bound Pod is rebound to a new NUMA, the migration of the existing memory will be triggered to meet the memory binding rules. Although the above method is relatively simple and there is no need to migrate the memory multiple times after binding, it is not flexible enough. When binding the CPU, the memory usage of the corresponding NUMA node is not considered. When memory-intensive applications are concentrated on the same NUMA node, the memory distribution of the entire machine is uneven, and the memory water level of the entire machine is low.

[0031] On the basis of the above, some processor load-aware scheduling technologies consider both processor and memory resources when binding Pods, and consider the memory distribution of the current machine when binding processors, and select NUMA nodes with relatively idle processors and memory for binding. This method reduces the probability of uneven memory distribution on the entire machine because it considers the current memory distribution when binding, but it cannot completely solve the problem of uneven memory distribution caused by memory emergencies.

[0032] In the case of storage hardware damage, hot-plugging of memory, etc., kernel-state memory migration behavior will be triggered. In order to improve the local memory hit rate of the task, that is, to increase the proportion of local memory pages, the kernel state will also regularly perform memory balancing through the kernel-state page migration interface migrate_pages. Kernel-state memory balancing is divided into two situations: when most of the task's memory is remote memory, that is, it is not on the same NUMA node as the processor currently executing the task, the actual object of memory balancing is not memory, but the task is migrated to the CPU of the NUMA node where most of the memory is located; when most of the task's memory is local memory, that is, it is on the same NUMA node as the processor currently executing the task, the memory pages on other remote NUMA nodes will be migrated to the local NUMA node. It can be seen that in the first case above, processor drift will occur. Therefore, kernel-state memory balancing is closed for the situation where the task is bound to the processor, that is, for the Pod or container bound to the processor (for example, the Pod or container that uses functions such as processor load-aware scheduling), the kernel-state memory balancing function cannot be triggered.

[0033] To solve the problem of high time consumption in accessing memory when a processor of a NUMA node is bound and memory pages are migrated to a container configuration group of a remote NUMA node, this embodiment provides a memory localization method. Figure 3 is a flowchart of the memory localization method of this embodiment, such as Figure 3 As shown, the process includes the following steps: Step S301: determining a target container configuration group bound to a processor of a local NUMA node from the running container configuration groups.

[0034] Step S302: determine a target memory page distributed on a remote NUMA node among memory pages of the target container configuration group.

[0035] Step S303: calling a kernel-mode page migration interface in the user space to migrate the target memory page to the local NUMA node.

[0036] One or more application containers are running in the above container configuration group, and each application instance includes multiple processes, and the memory pages generated by the processes are stored in the memory of the NUMA node. The above steps realize the localization of the target memory page on the remote NUMA node by calling the page migration interface provided by the kernel state in the user space (also called user state, relative to the kernel (OS) state) for the target container configuration group of the processor bound to the NUMA node, thereby increasing the proportion of the memory page of the target container configuration group distributed on the local NUMA node, and the target container configuration group can have a greater probability of hitting the memory of the local NUMA node when accessing the memory page, thereby reducing the average access time of the memory. At the same time, the memory localization method provided in the above steps also effectively supplements the memory balancing method provided by the kernel state. In a multi-NUMA node computing system that applies the kernel state memory balancing method, it is ensured that the container configuration group bound to the processor and the unbound processor can increase the proportion of local memory pages, thereby improving the performance of accessing the memory.

[0037] In some of the embodiments, the cpuset.cpus file under cgroups is queried to determine whether the container configuration group is bound to the processor of the NUMA node, and to obtain the identification information of the NUMA node where the container configuration group is bound to the processor. The NUMA node where the container configuration group is bound to the processor is the local NUMA node relative to the container configuration group.

[0038] In some of the embodiments, after memory localization is performed, since the memory page of the container configuration group of the memory device that is not bound to the NUMA node will be migrated to the remote NUMA node again in many cases, the above-mentioned memory localization method can be run according to a set time period. When the set time period arrives, all the container configuration groups in operation are traversed one by one in a certain order (such as the alphabetical order of the identifiers of the container configuration groups, the order of the storage space occupied by the container configuration groups, the order of the processor memory resource size occupied by the container configuration groups, or a random order, etc.), and memory localization processing is performed on one or more container configuration groups obtained by the traversal. In the case of traversing to obtain multiple target container configuration groups, when performing target memory page migration, the target memory page of each target container configuration group will also be migrated to the local NUMA node relative to the target container configuration group in the order in which the target container configuration groups are traversed.

[0039] In some embodiments, before step S302, the memory localization method further includes: when the target container configuration group has bound the memory of the local NUMA node, ending the memory localization for the target container configuration group; when the target container configuration group has not bound the memory of the local NUMA node, executing step S302. In the above steps, it can be determined whether the target container configuration group is bound to the memory of the NUMA node by querying the cpuset.mems file under cgroups.

[0040] On the one hand, the migration of memory pages has overhead, so the policy of configuring memory localization for container configuration groups can more reasonably control the container configuration groups that need to be memory localized to avoid unexpected overhead or avoid service performance degradation caused by excessive memory page migration overhead. On the other hand, in the scenario of mixed deployment of container configuration groups with online and offline tasks (referred to as the online and offline mixed deployment), different tasks have different priorities. For example, the priority of online tasks is generally higher than that of offline tasks, and the reduced memory access performance of offline tasks has less impact on the service than that of online tasks. Therefore, timely memory localization of container configuration groups that execute online tasks helps improve service quality.

[0041] For example, in some of the embodiments, the user marks the quality of service (QoS) priority of the task, or the system determines the priority of the task by identifying the task type. After the priority of the task is obtained by the predetermined component, the component will automatically configure the memory localization policy of the container configuration group that executes the task according to the priority. Among them, the memory localization policy of the container configuration group that executes the high-priority task is configured to be valid, and the memory localization policy of the container configuration group that executes the low-priority task is configured to be invalid (none), so that the high-priority task can obtain a better quality of service (QoS). For the user, the direct configuration of the policy of the container configuration group is avoided, and only the tasks need to be concerned about which tasks need to obtain a better quality of service. In the above embodiment, the memory localization policy of the container configuration group is initially configured to be invalid (none).

[0042] In some of the embodiments, before step S302, the policy configuration of the target container configuration group is obtained; wherein, if the policy configuration is that memory localization is not effective, the memory localization for the target container configuration group is terminated, and if the policy configuration is that memory localization is effective, step S302 is executed.

[0043] As mentioned above, memory page migration will occupy system overhead, so the frequency of memory page migration should be controlled to a level that does not significantly affect service performance. To this end, in this embodiment, the frequency of memory page migration can also be controlled in two aspects.

[0044] On the one hand, the proportion of memory pages distributed on the local NUMA node in the memory pages of the target container configuration group can be obtained; if the proportion is greater than the set threshold, the memory localization for the target container configuration group is terminated, or the proportion of memory pages distributed on the local NUMA node in the memory pages of the target container configuration group is obtained again after waiting for a preset time. If the proportion is not greater than the set threshold, step S302 is executed.

[0045] On the other hand, the time interval between the last memory localization time of the target container configuration group and the current time can be obtained; if the time interval is not greater than the set interval, the memory localization for the target container configuration group is terminated, or the time interval between the last memory localization time of the target container configuration group and the current time is obtained again after waiting for a preset time. If the time interval is greater than the set interval, step S302 is executed.

[0046] In some embodiments, determining the target memory pages distributed on the remote NUMA nodes in the memory pages of the target container configuration group includes: determining the NUMA node to which the target container configuration group is bound to the processor as the local NUMA node relative to the target container configuration group, and determining the NUMA node to which the target container configuration group is not bound to the processor as the remote NUMA node relative to the target container configuration group. Then, the memory pages of the target container configuration group distributed on the above remote NUMA nodes are the target memory pages, that is, the remote memory pages; and the memory pages of the target container configuration group distributed on the local NUMA nodes are the local memory pages.

[0047] The container configuration group includes task-related containers and task-independent containers. For example, the application container is a task-related container, while the init container is a container related to the startup of the container configuration group and has nothing to do with the task. The process without task-independent containers does not affect the execution efficiency of the task. Therefore, in some embodiments, when determining the target memory pages distributed on the remote NUMA nodes in the memory pages of the target container configuration group, the memory pages corresponding to these task-independent containers are also excluded. For example, the target memory pages distributed on the remote NUMA nodes are determined from the memory pages corresponding to the processes of the preset containers in the target container configuration group, and the preset containers include application containers.

[0048] In the above embodiment, the kernel-mode page migration interface is called in the user space through the migratepages instruction, and the kernel-mode page migration interface is specifically the migrate_pages interface. The migratepages instruction actually calls the kernel function migrate_pages, which can ensure data security (first ensure successful copying of the page copy and then remapping), and is also BestEffort (migration is carried out in batches, and if the target NUMA memory is insufficient during the period, the migration will be stopped, but no error will be thrown). If migrate_pages does not throw an error, the memory localization is successful, the local memory page ratio is calculated again, and the relevant information before and after localization is displayed. If migrate_pages throws an error, the memory localization fails. Migrate_pages itself ensures data security, and displays the cause of failure and the specific failed process ID.

[0049] Figure 4 is an optional flow chart of the memory localization method of this embodiment, such as Figure 4 As shown, the memory localization method includes the following steps: Step S401, sequentially process the Pods on all nodes, and skip the Pod if there is no CPU binding.

[0050] Step S402, check whether the Pod is configured with a policy related to memory localization. If the policy is none (default), skip the Pod.

[0051] Step S403, analyze the memory distribution of the Pod on each NUMA node, calculate the current local memory page ratio, and if it is greater than the trigger threshold, skip the Pod; otherwise, detect the time difference from the last memory localization of the Pod, and if it is less than the threshold, do not perform memory localization for the time being.

[0052] Step S404: Analyze the IDs of the local NUMA node and the remote NUMA node through the CPU binding result, and the migration direction of the memory is from remote to local.

[0053] Step S405: If there is no remote NUMA node, that is, the task has CPU affinity for all NUMA nodes, then the Pod is skipped.

[0054] Step S406, obtain the IDs of all processes of the app container in the Pod, and skip the remaining containers, such as the init container.

[0055] Step S407, in user mode, sequentially migrate the memory pages of the process in step S406 through the migratepages instruction.

[0056] The above-mentioned embodiments of the present application migrate memory pages on the remote NUMA node of the bound core application to the local NUMA node in a data-safe manner, improve the local memory access hit rate, and provide better memory access performance for memory-intensive workloads. In addition, the above-mentioned embodiments of the present application do not need to bind the container configuration group to the memory of the NUMA node, and the use of the entire machine memory is more flexible, which can improve the memory usage level of the entire machine and effectively reduce the risk of application memory overflow (OOM) or unschedulable due to uneven memory.

[0057] In the test, taking the dual-NUMA node model running redis as an example, based on the CPU core binding, after memory localization, redis can improve the latency performance by about 2~10% and the throughput performance by 2~13% in the stress test. For large-scale memory-intensive applications, especially those with more than 32GB, the latency reduction and throughput improvement are more significant.

[0058] An embodiment of the present invention further provides an electronic device, comprising: at least one processor; and a memory in communication with the at least one processor. The memory stores a computer program executable by the at least one processor, and when the at least one processor executes the computer program, the electronic device executes the memory localization method of the embodiment of the present invention.

[0059] An embodiment of the present invention further provides a non-transitory machine-readable medium storing a computer program, wherein the computer program, when executed by a processor of a computer, is used to enable the computer to execute the memory localization method of the embodiment of the present invention.

[0060] refer to Figure 5 , a block diagram of an electronic device that can be used as a server or client of an embodiment of the present invention will now be described, which is an example of a hardware device that can be applied to various aspects of the present invention. Electronic devices are intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.

[0061] like Figure 5 As shown, the electronic device includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 to a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device can also be stored. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0062] Multiple components in the electronic device are connected to the I / O interface 505, including: an input unit 506, an output unit 507, a storage unit 508, and a communication unit 509. The input unit 506 can be any type of device that can input information to the electronic device, and the input unit 506 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device. The output unit 507 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 508 can include but is not limited to a disk, an optical disk. The communication unit 509 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and can include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.

[0063] The computing unit 501 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a CPU, a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 501 performs the various methods and processes described above. For example, in some embodiments, the method embodiments of the present invention may be implemented as a computer program, which is tangibly contained in a machine-readable medium, such as a storage unit 508. In some embodiments, part or all of the computer program may be loaded and / or installed on an electronic device via a ROM 502 and / or a communication unit 509. In some embodiments, the computing unit 501 may be configured to perform the above-described method in any other appropriate manner (e.g., by means of firmware).

[0064] The computer programs for implementing the methods of the embodiments 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 or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer programs are executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer programs may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0065] In the context of an embodiment of the present invention, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable signal medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0066] It should be noted that the term "including" and its variations used in the embodiments of the present invention are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". The modifications of "one" and "multiple" mentioned in the embodiments of the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless the context clearly indicates otherwise, it should be understood as "one or more".

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

[0068] The various steps described in the method implementation methods provided in the embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method implementation methods may include additional steps and / or omit the steps shown. The scope of protection of the present invention is not limited in this respect.

[0069] The term "embodiment" in this specification refers to specific features, structures or characteristics described in conjunction with the embodiment that can be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive with other embodiments and is independent or optional. The various embodiments in this specification are described in a related manner, and the same or similar parts between the various embodiments refer to each other. In particular, for the device, equipment, and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts refer to the partial description of the method embodiment.

[0070] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of patent protection. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the attached claims.

Claims

1. A memory localization method, comprising: Determine a target container configuration group bound to a processor of a local NUMA node from the running container configuration groups; Determine a target memory page distributed on a remote NUMA node among the memory pages of the target container configuration group; A kernel-mode page migration interface is called in user space to migrate the target memory page to the local NUMA node.

2. The method according to claim 1, wherein: Before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: When the target container configuration group has been bound to the memory of the local NUMA node, ending the memory localization for the target container configuration group; In a case where the target container configuration group is not bound to the memory of the local NUMA node, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

3. The method according to claim 1, wherein: Before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: Obtaining the policy configuration of the target container configuration group; If the policy configuration is that memory localization is not effective, end the memory localization for the target container configuration group; When the policy is configured so that memory locality is in effect, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

4. The method according to claim 1, wherein: Determining a target container configuration group of a processor bound to a local NUMA node from a running container configuration group includes: sequentially traversing the target container configuration group of the processor bound to the local NUMA node in the container configuration group running on the local node according to a set time period; Calling a kernel-mode page migration interface in user space to migrate the target memory page to the local NUMA node includes: in the case of traversing to obtain a plurality of the target container configuration groups, migrating the target memory page of the target container configuration group to the local NUMA node relative to the target container configuration group in the order in which the target container configuration groups are traversed.

5. The method according to claim 1, wherein: Before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: Obtaining the proportion of memory pages distributed on the local NUMA node in the memory pages of the target container configuration group; When the proportion is greater than the set threshold, the memory localization for the target container configuration group is terminated, or after waiting for a preset time, the step of returning to execute the step of obtaining the proportion of memory pages distributed on the local NUMA node in the memory pages of the target container configuration group; When the proportion is not greater than the set threshold, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

6. The method according to claim 1, wherein: Before determining the target memory pages in the target container configuration group that are distributed on the remote NUMA node, the method further includes: Obtain the time interval between the last memory localization time of the target container configuration group and the current time; If the time interval is not greater than the set interval, the memory localization for the target container configuration group is terminated, or after waiting for a preset time, the step of returning to the step of obtaining the time interval between the last memory localization time of the target container configuration group and the current time is executed; In a case where the time interval is greater than the set interval, a step of determining target memory pages distributed on a remote NUMA node among the memory pages of the target container configuration group is performed.

7. The method according to claim 1, wherein: Determining the target memory pages distributed on the remote NUMA node among the memory pages of the target container configuration group includes: The NUMA node to which the target container configuration group is bound to the processor is determined to be a local NUMA node relative to the target container configuration group, and the NUMA node to which the target container configuration group is not bound to the processor is determined to be a remote NUMA node relative to the target container configuration group.

8. The method according to claim 1, wherein: Determining the target memory pages distributed on the remote NUMA node among the memory pages of the target container configuration group includes: A target memory page distributed on the remote NUMA node is determined from memory pages corresponding to processes of a preset container in the target container configuration group, wherein the preset container includes an application container.

9. The method according to claim 1, wherein: The kernel-mode page migration interface is the migrate_pages interface.

10. An electronic device comprising: at least one processor; And a memory communicatively connected to at least one processor, the memory storing a computer program executable by the at least one processor, the computer program being used to enable an electronic device to perform the memory localization method described in any one of claims 1 to 9 when executed by the at least one processor.

11. A non-transitory machine-readable medium storing a computer program, wherein: When the computer program is executed by a processor of a computer, it is used to make the computer execute the memory localization method according to any one of claims 1 to 9.