Memory allocation method, electronic equipment and storage medium

By receiving and allocating memory according to the huge page memory parameters and non-huge page memory parameters of the node, the problem of insufficient non-huge page memory caused by the memory module being damaged or pulled out in the multi-node server environment is solved, ensuring the normal operation and memory allocation of the operating system. rationality.

CN118535484APending Publication Date: 2024-08-23ZTE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310197516.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In a server environment with a multi-node NUMA architecture, the existing memory allocation method may cause excessive allocation of huge page memory when the memory module is damaged or removed, resulting in insufficient non-huge page memory available to the system, which in turn causes the operating system to malfunction. run.

Method used

By receiving the huge page memory parameters and non-huge page memory parameters of the target node, it accurately allocates huge page memory and ordinary memory to ensure that the memory allocation ratio of each node is reasonable and avoid the problem of excessive huge page memory allocation.

Benefits of technology

It effectively avoids the problem of insufficient non-huge page memory when the memory module is damaged or pulled out, ensuring the normal operation of the operating system, and optimizes the memory allocation method, providing sufficient non-huge page memory and huge page memory to support high-performance virtual machines. and operating system operation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535484A
    Figure CN118535484A
Patent Text Reader

Abstract

The invention discloses a memory allocation method, electronic equipment and a storage medium, belongs to the technical field of memory management, and is used for ensuring normal operation of an operating system. The method comprises the following steps: receiving a giant page memory parameter corresponding to a target node; and according to the giant page memory parameter, allocating a giant page memory in a to-be-allocated memory of the target node.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of memory management technology, and specifically relates to a memory allocation method, electronic device and storage medium. Background Art

[0002] In Linux systems, applications can significantly improve performance by using huge page memory, especially in cloud environments and virtualization scenarios. The performance of virtual machines using huge page memory is much better than that of virtual machines using non-huge page memory. However, allocating huge page memory in the system will reduce the available memory of the operating system itself.

[0003] Currently, servers basically use the Non Uniform Memory Access (NUMA) architecture, which can be divided into multiple nodes in the environment. Each node may have different or the same amount of memory. When the server is running, high-performance virtual machines need to use the huge page memory in the node, while the operating system process or other processes need to use the non-huge page memory in the node. In the case of multiple nodes, the operating system's huge page memory allocation method is mainly to evenly allocate the amount of huge page memory to each node.

[0004] However, using the existing memory allocation method, when the server memory stick is damaged or individual memory is pulled out, since the memory allocation method has not changed, the number of huge page memory allocations on the node may be too large, resulting in insufficient non-huge page memory available to the system, causing the operating system to fail to run normally. Summary of the invention

[0005] The embodiments of the present application provide a memory allocation method, an electronic device, and a storage medium, which can solve the problem that the operating system cannot run normally due to insufficient non-huge page memory available to the system.

[0006] In a first aspect, an embodiment of the present application provides a method for memory allocation, the method comprising: receiving huge page memory parameters corresponding to a target node; and allocating huge page memory in a to-be-allocated memory of the target node according to the huge page memory parameters.

[0007] In a second aspect, an embodiment of the present application provides a memory allocation device, which includes: a receiving module for receiving huge page memory parameters corresponding to a target node; and an allocation module for allocating huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters.

[0008] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.

[0009] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.

[0010] In an embodiment of the present application, by receiving the huge page memory parameters corresponding to the target node; allocating the huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters, the huge page memory of the target node can be allocated according to the huge page memory parameters corresponding to the target node, thereby ensuring that there will not be too much huge page memory in the target node and ensuring the normal operation of the operating system. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 It is a flowchart of a memory allocation method provided in an embodiment of the present application;

[0012] Figure 2 This is a schematic diagram of node memory allocation provided by an embodiment of the present application;

[0013] Figure 3 It is a flowchart of another memory allocation method provided in an embodiment of the present application;

[0014] Figure 4 It is a structural schematic diagram of a memory allocation device provided in an embodiment of the present application;

[0015] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0017] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0018] The memory allocation method, electronic device and storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0019] Figure 1 A memory allocation method provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in the electronic device, and the method includes the following steps:

[0020] Step 102: Receive huge page memory parameters corresponding to the target node.

[0021] In this step, the huge page memory of the target node can be allocated during the operating system startup phase or after the operating system is started, and the specific time for allocating the huge page memory is not specifically limited. When performing memory allocation of the target node, the huge page memory parameters corresponding to the target node can be received. It should be understood that the huge page memory parameters corresponding to the target node can be received during the system startup phase, and the electronic device can save the huge page memory parameters, and then perform memory allocation through the stored huge page memory parameters when memory allocation of the target node is needed. The above-mentioned huge page memory parameters can be pre-configured by the user, that is, before allocating the memory of the target node, the user needs to configure the above-mentioned huge page memory parameters according to the memory allocation method of the pre-deployment plan.

[0022] Step 104: Allocate huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters.

[0023] Specifically, when performing memory allocation of the target node, the memory corresponding to the huge page memory parameter in the target node's memory to be allocated can be allocated as huge page memory according to the huge page memory parameter, that is, the electronic device can parse the huge page memory parameter, determine the number of huge page memories that the target node needs to allocate, and allocate the target node's huge page memory in the memory to be allocated of the target node according to the number of huge page memories that the target node needs to allocate. The above-mentioned huge page memory can be used for high-performance virtual machines or high-performance programs. In addition, the memory other than the huge page memory can be allocated as ordinary memory for the normal operation of the operating system. As an example, assuming that the target node's memory to be allocated is 10 gigabytes (Gigabyte, GB), and the received huge page memory parameter is 6GB, then when performing memory allocation of the target node, 6GB of the target node's 10GB memory can be allocated as huge page memory, then the 4G memory in the target node's memory other than the huge page memory can be allocated as ordinary memory for the normal operation of the operating system.

[0024] The memory allocation method provided by the embodiment of the present invention receives the huge page memory parameters corresponding to the target node; according to the huge page memory parameters, the huge page memory is allocated in the memory to be allocated of the target node, and the memory of the target node can be accurately allocated according to the pre-configured huge page memory parameters for the target node, so as to ensure that the operating system has available memory, optimize the memory allocation method, and optimize the ratio of huge page memory to ordinary memory on the target node, so as to avoid that after the server memory bar is damaged or individual memory is pulled out, the target node huge page memory allocation amount may be too much, resulting in insufficient non-huge page memory available to the system, resulting in the problem that the operating system cannot operate normally, thereby ensuring the normal operation of the operating system.

[0025] In one implementation, before allocating the huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameter, the method further includes:

[0026] Receive non-huge page memory parameters corresponding to the target node; determine non-huge page memory according to the non-huge page memory parameters; and determine memory in the memory of the target node other than the non-huge page memory as the memory to be allocated.

[0027] Specifically, due to the normal operation of the operating system, non-huge page memory (ordinary memory) is required for protection. In the present application, before allocating the huge page memory of the target node according to the huge page memory parameters, the non-huge page memory parameters corresponding to the target node can be received. Similarly, the non-huge page memory parameters can also be pre-configured by the user, that is, before allocating the memory of the target node, the user needs to configure the above non-huge page memory parameters according to the pre-deployed planned memory allocation method.

[0028] The priority of non-huge page memory parameters is higher than that of huge page memory parameters, that is, when receiving non-huge page memory parameters and huge page memory parameters, it is necessary to parse non-huge page memory parameters first, determine the amount of non-huge page memory required to be allocated to the target node, and allocate the non-huge page memory of the target node in the memory of the target node according to the amount of non-huge page memory required to be allocated to the target node. After the non-huge page memory of the target node is allocated, the memory other than the huge page memory in the memory of the target node can be determined as the memory to be allocated, and then the memory corresponding to the huge page memory parameters in the memory to be allocated is allocated as the huge page memory.

[0029] As an example, assuming that the memory of the target node is 20 GB, the received non-huge page memory parameter is 11 GB, and the received huge page memory parameter is 6 GB, then when allocating memory, 11 GB of the 20 GB memory corresponding to the target node needs to be allocated as non-huge page memory, and 9 GB of memory other than the non-huge page memory needs to be determined as memory to be allocated. Then, according to the huge page memory parameter, 6 GB of the 9 GB of memory to be allocated needs to be allocated as huge page memory.

[0030] In this way, before allocating huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters, the non-huge page memory parameters corresponding to the target node are received; the non-huge page memory is determined according to the non-huge page memory parameters; the memory other than the huge page memory in the memory of the target node is determined as the to-be-allocated memory, and the non-huge page memory (ordinary memory) for the normal operation of the operating system can be reserved in advance, thereby ensuring the normal operation of the operating system.

[0031] In one implementation, when only the non-huge page memory parameters corresponding to the target node are received and the huge page memory parameters corresponding to the target node are not received, the non-huge page memory corresponding to the target node can be allocated only according to the non-huge page memory parameters corresponding to the target node, and the memory of the target node other than the huge page memory is determined as the memory to be allocated. When allocating the huge page memory parameters corresponding to the target node, the huge page memory of the target node can be allocated in the memory to be allocated according to the system default policy. In addition, when the target node has been allocated with huge page memory, it is not necessary to allocate the huge page memory of the target node according to the system default policy. In this way, non-huge page memory (ordinary memory) for normal operation of the operating system can be reserved in advance, ensuring the normal operation of the operating system.

[0032] In one implementation, allocating huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameter includes:

[0033] When the memory to be allocated of the target node is less than or equal to the memory corresponding to the huge page memory parameter, the memory to be allocated of the target node is allocated as the huge page memory.

[0034] Specifically, when allocating the huge page memory of the target node according to the huge page memory parameter corresponding to the target node, if the target node's to-be-allocated memory is less than or equal to the huge page memory parameter, all of the to-be-allocated memory can be allocated as huge page memory. In this way, when allocating the huge page memory of the target node, it is possible to ensure that the required huge page memory is provided as much as possible.

[0035] In one implementation, after allocating the to-be-allocated memory as the huge page memory, the method further includes:

[0036] Finish allocating hugepage memory for the target node.

[0037] Specifically, if the target node's to-be-allocated memory is less than or equal to the huge page memory parameter, after allocating the to-be-allocated memory as the huge page memory, the huge page memory allocation of the target node can be terminated to ensure that the huge page memory allocated to the target node is less than or equal to the to-be-allocated memory, thereby avoiding the additional use of other nodes' memory for the target node's huge page memory allocation.

[0038] In one implementation, after allocating the huge page memory of the target node, the method further includes:

[0039] Receive huge page memory parameters corresponding to other nodes except the target node; traverse the other nodes, and allocate the huge page memory corresponding to the other nodes in the to-be-allocated memory corresponding to the other nodes according to the huge page memory parameters corresponding to the other nodes.

[0040] Specifically, a server environment using the NUMA architecture usually includes multiple nodes, so after the huge page memory of the target node is allocated, the memory of other nodes can continue to be allocated. When receiving the huge page memory parameters of the target node, the huge page memory parameters of other nodes other than the target node can be received at the same time. The memory allocation method of other nodes is the same as the memory allocation method of the target node. Specifically, other nodes can be traversed, and according to the huge page memory parameters corresponding to other nodes, in the memory to be allocated corresponding to other nodes, the memory corresponding to the huge page memory parameters is allocated as huge page memory. It should be understood that when non-huge page memory parameters corresponding to other nodes are received, before allocating the huge page memory corresponding to other nodes according to the huge page memory parameters corresponding to other nodes, it is also necessary to preferentially allocate the non-huge page memory of other nodes according to the non-huge page memory parameters corresponding to other nodes, and then determine the memory corresponding to other nodes except the huge page memory as the memory to be allocated of other nodes.

[0041] As an example, Figure 2The node memory allocation diagram shown in the figure includes a first node 210, a second node 220 and a third node 230 in the server environment. In the system startup phase or the memory allocation phase, the huge page memory parameters and non-huge page memory parameters corresponding to the first node 210 can be received, the non-huge page memory of the first node 210 is allocated according to the non-huge page memory parameters corresponding to the first node 210, and the huge page memory corresponding to the first node 210 is allocated according to the huge page memory parameters corresponding to the first node 210. Similarly, in the system startup phase or the memory allocation phase, the huge page memory parameters and non-huge page memory parameters corresponding to the second node 220 can be received, the non-huge page memory of the second node 210 is allocated according to the non-huge page memory parameters corresponding to the second node 220, and the huge page memory corresponding to the second node 220 is allocated according to the huge page memory parameters corresponding to the second node 220. Similarly, during the system startup phase or the memory allocation phase, the huge page memory parameters and non-huge page memory parameters corresponding to the third node 230 can be received, and the non-huge page memory of the third node 230 can be allocated according to the non-huge page memory parameters corresponding to the third node 230, and the huge page memory corresponding to the third node 230 can be allocated according to the huge page memory parameters corresponding to the third node 230.

[0042] In this way, it can be ensured that the memory of multiple nodes in the server environment of the NUMA architecture can accurately allocate huge page memory according to the pre-configured huge page memory parameters, or allocate non-huge page memory according to the pre-configured non-huge page memory parameters, thereby ensuring that the operating system has available non-huge page memory, ensuring the normal operation of the operating system, and ensuring that high-performance virtual machines or high-performance programs have available huge page memory.

[0043] In one implementation, the huge page memory allocated to the target node is less than or equal to the memory to be allocated.

[0044] Specifically, the huge page memory allocated to the target node should be less than or equal to the target node's to-be-allocated memory. This ensures that the target node can provide huge page memory as much as possible without using the memory of other nodes, ensuring the normal operation of high-performance programs such as high-performance virtual machines, while ensuring that there is enough non-huge page memory to ensure the normal operation of the operating system.

[0045] In one implementation, the receiving the huge page memory parameters corresponding to the target node includes: receiving the huge page memory parameters through a first interface; or the receiving the non-huge page memory parameters corresponding to the target node includes: receiving the non-huge page memory parameters through a second interface.

[0046] Specifically, before allocating the memory of the target node, a first configuration item can be pre-set through a multi-operating system boot program (GRand Unified Bootloader, GRUB), and the first configuration item can be used as a first interface. The first configuration item can be, for example, an input box for inputting huge page memory parameters. The user inputs the huge page memory parameters through the input box, and the electronic device can receive the huge page memory parameters input by the user through the first configuration item. That is, the first interface can be used to receive the huge page memory parameters input by the user. Optionally, the first interface can also be used only to receive huge page memory parameters, that is, not to receive non-huge page memory parameters.

[0047] Similarly, a second configuration item can be added in advance through a multi-operating system startup program, and the second configuration item can be used as a second interface. The second configuration item can be, for example, an input box for inputting non-huge page memory parameters. The user inputs the non-huge page memory parameters through the input box, and the electronic device can receive the non-huge page memory parameters input by the user through the second configuration item. That is, the second interface can be used to receive the non-huge page memory parameters input by the user. Optionally, the second interface can also be used only to receive non-huge page memory parameters, that is, not to receive huge page memory parameters.

[0048] As an example, assuming that the huge page memory parameter entered by the user in the first configuration item is 6G, and the non-huge page memory parameter entered in the second configuration item is 3G. The electronic device can receive the huge page memory parameter through the first configuration item to determine that the huge page memory that needs to be allocated to the target node is 6G, and can receive the non-huge page memory parameter through the second configuration item to determine that the non-huge page memory that needs to be allocated to the target node is 3G.

[0049] Therefore, the embodiment of the present application realizes that the huge page memory parameters and non-huge page memory parameters can be actively configured by the user, thereby ensuring that the huge page memory or non-huge page memory of the target node can be allocated according to actual needs, ensuring the normal operation of high-performance programs such as the operating system and high-performance virtual machines, and avoiding the problem that when the server memory bar is damaged or individual memory is pulled out, the target node huge page memory allocation may be too large, resulting in insufficient non-huge page memory available to the system, causing the operating system to be unable to operate normally.

[0050] In one implementation, the huge page memory parameter is the value of the huge page memory or the percentage of the huge page memory in the memory to be allocated; or the non-huge page memory parameter is the value of the non-huge page memory or the percentage of the huge page memory in the memory of the target node.

[0051] Specifically, the huge page memory parameter may be a specific huge page memory value, for example, the huge page memory parameter may be 10GB. The huge page memory parameter may also be a percentage of the huge page memory in the memory to be allocated, for example, if the huge page memory parameter is 10%, when allocating huge page memory in the memory to be allocated, 10% of the memory to be allocated may be allocated as huge page memory.

[0052] In addition, the non-huge page memory parameter can be a specific non-huge page memory value, for example, the non-huge page memory parameter can be 5GB. The non-huge page memory parameter can also be the percentage of non-huge page memory in the target node's memory. For example, if the non-huge page memory parameter is 20%, 20% of the target node's memory can be allocated as non-huge page memory. In this way, the diversification of the expression forms of the huge page memory parameter or the non-huge page memory parameter can be ensured. The huge page memory parameter or the non-huge page memory parameter can also be a parameter in other forms. The form of the huge page memory parameter or the non-huge page memory parameter is not specifically limited here.

[0053] Figure 3 A flow chart showing another memory allocation method provided by an embodiment of the present application is shown as follows: Figure 3 As shown, the memory allocation method includes the following steps:

[0054] Step 302: configure non-huge page memory parameters and / or huge page memory parameters corresponding to each node.

[0055] Specifically, before allocating the memory of the target node, a first configuration item can be added in advance through a multi-operating system boot program (GRandUnified Bootloader, GRUB), and the first configuration item is used as the first interface. The first configuration item can be an input box for inputting huge page memory parameters. In this way, the user can input huge page memory parameters in the first configuration item.

[0056] Specifically, a second configuration item may be added in advance through a multi-operating system startup program, and the second configuration item may be used as a second interface. The first configuration item may be an input box for inputting non-huge page memory parameters. In this way, the user may input non-huge page memory parameters in the second configuration item.

[0057] Step 304: Receive non-huge page memory parameters and / or huge page memory parameters corresponding to each node.

[0058] The electronic device may receive the huge page memory parameter corresponding to the target node through the first interface.

[0059] The electronic device may receive the non-huge page memory parameters corresponding to the target node through the second interface.

[0060] Step 306: Whether non-huge page memory parameters are received.

[0061] Specifically, each node is traversed, and if the corresponding non-huge page memory parameter is received, step 308 is executed; if the corresponding non-huge page memory parameter is not received, step 310 is executed.

[0062] Step 308: Allocate non-huge page memory according to the non-huge page memory parameters.

[0063] Specifically, traverse each node, and if the corresponding non-huge page memory parameters are received, the memory corresponding to the non-huge page memory parameters in the memory of the target node can be allocated as non-huge page memory according to the non-huge page memory parameters, that is, the electronic device can parse the non-huge page memory parameters, determine the amount of non-huge page memory that needs to be allocated to the target node, and allocate the non-huge page memory of the target node according to the amount of non-huge page memory that needs to be allocated to the target node; execute step 310.

[0064] Step 310: Whether huge page memory parameters are received.

[0065] Specifically, each node is traversed, and if the corresponding huge page memory parameter is received, step 312 is executed; if the corresponding huge page memory parameter is not received, step 314 is executed.

[0066] Step 312: Allocate huge page memory according to huge page memory parameters.

[0067] Specifically, traverse each node, if the huge page memory parameter corresponding to the target node is received, the memory corresponding to the huge page memory parameter in the to-be-allocated memory of the target node can be allocated as the huge page memory according to the huge page memory parameter, that is, the electronic device can determine the amount of huge page memory that needs to be allocated to the target node according to the huge page memory parameter, and allocate the huge page memory of the target node in the to-be-allocated memory of the target node according to the amount of huge page memory that needs to be allocated to the target node. In addition, if the to-be-allocated memory of the node is less than or equal to the huge page memory parameter, after allocating the to-be-allocated memory as the huge page memory, the allocation of the huge page memory of the target node can be ended, ensuring that the huge page memory allocated to the target node is less than or equal to the to-be-allocated memory, avoiding the additional use of the memory of other nodes for the huge page memory allocation of the target node; execute step 316.

[0068] Step 314: Allocate huge page memory according to the default policy.

[0069] Specifically, when no huge page memory parameter is received, huge page memory is allocated in the to-be-allocated memory corresponding to each node according to the system default policy; and step 316 is executed.

[0070] Step 316: End memory allocation.

[0071] End up allocating memory for each node.

[0072] Through the method for allocating memory provided in the embodiment of the present application, the memory of the target node can be accurately allocated for each node according to the pre-configured huge page memory parameters or non-huge page memory parameters, ensuring that the operating system has available memory, optimizing the memory allocation method, and optimizing the ratio of huge page memory to ordinary memory on the target node. This avoids the problem that too many huge page memory are allocated to the target node after the server memory bar is damaged or individual memory is pulled out, resulting in insufficient non-huge page memory available to the system, causing the operating system to fail to operate normally, thereby ensuring the normal operation of the operating system.

[0073] It should be noted that the execution subject of the memory allocation method provided in the embodiment of the present application can be a memory allocation device, or a control module in the memory allocation device for executing the memory allocation method. In the embodiment of the present application, the memory allocation device provided in the embodiment of the present application is described by taking the memory allocation device executing the memory allocation method as an example.

[0074] Figure 4 Schematic diagram of the structure of a memory allocation device according to an embodiment of the present invention. Figure 4 As shown, the memory allocation device 400 includes: a receiving module 410 and an allocation module 420.

[0075] The receiving module 410 is used to receive huge page memory parameters corresponding to the target node; and the allocating module 420 is used to allocate huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters.

[0076] In one implementation, the receiving module 410 is also used to receive non-huge page memory parameters corresponding to the target node; determine the non-huge page memory based on the non-huge page memory parameters; and determine the memory of the target node other than the non-huge page memory as the memory to be allocated.

[0077] In one implementation, the allocation module 420 is used to allocate the memory to be allocated of the target node as the huge page memory when the memory to be allocated of the target node is less than or equal to the memory corresponding to the huge page memory parameter.

[0078] In one implementation, the allocation module 420 is used to end the allocation of the huge page memory of the target node.

[0079] In one implementation, the allocation module 420 receives huge page memory parameters corresponding to other nodes except the target node; traverses the other nodes, and allocates the huge page memory corresponding to the other nodes in the to-be-allocated memory corresponding to the other nodes according to the huge page memory parameters corresponding to the other nodes.

[0080] In one implementation, the huge page memory allocated to the target node is less than or equal to the memory to be allocated.

[0081] In one implementation, the receiving module 410 is configured to receive the huge page memory parameter through a first interface; or receive the non-huge page memory parameter through a second interface.

[0082] In one implementation, the huge page memory parameter is the value of the huge page memory or the percentage of the huge page memory in the memory to be allocated; or the non-huge page memory parameter is the value of the non-huge page memory or the percentage of the huge page memory in the memory of the target node.

[0083] In one implementation, the huge page memory parameters and the non-huge page memory parameters are carried in the same configuration information.

[0084] The memory allocation device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0085] The memory allocation device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0086] The memory allocation device provided in the embodiment of the present application can achieve Figures 1 to 3 To avoid repetition, the various processes implemented by the method embodiment are not described here.

[0087] Alternatively, if Figure 5As shown, an embodiment of the present application further provides an electronic device 500, including a processor 501 and a memory 502, wherein the memory 502 stores a program or instruction that can be executed on the processor 501, and when the program or instruction is executed by the processor 501, it implements: receiving huge page memory parameters corresponding to the target node; allocating huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters.

[0088] In one implementation, before allocating huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters, non-huge page memory parameters corresponding to the target node are received; non-huge page memory is determined according to the non-huge page memory parameters; and memory in the memory of the target node other than the non-huge page memory is determined as the to-be-allocated memory.

[0089] In one implementation, when the memory to be allocated of the target node is less than or equal to the memory corresponding to the huge page memory parameter, the memory to be allocated of the target node is allocated as the huge page memory.

[0090] In one implementation, after the memory to be allocated is allocated as the huge page memory, the allocation of the huge page memory of the target node is terminated.

[0091] In one implementation, after allocating the huge page memory of the target node is completed, it also includes: receiving huge page memory parameters corresponding to other nodes except the target node; traversing the other nodes, and allocating the huge page memory corresponding to the other nodes in the to-be-allocated memory corresponding to the other nodes according to the huge page memory parameters corresponding to the other nodes.

[0092] In one implementation, the huge page memory allocated to the target node is less than or equal to the memory to be allocated.

[0093] In one implementation, the huge page memory parameter is received through a first interface; or the non-huge page memory parameter is received through a second interface.

[0094] In one implementation, the huge page memory parameter is the value of the huge page memory or the percentage of the huge page memory in the memory to be allocated; or the non-huge page memory parameter is the value of the non-huge page memory or the percentage of the huge page memory in the memory of the target node.

[0095] In one implementation, the huge page memory parameters and the non-huge page memory parameters are carried in the same configuration information.

[0096] The specific execution steps can refer to the various steps of the above-mentioned memory allocation method embodiment, and can achieve the same technical effect. To avoid repetition, they will not be repeated here.

[0097] It should be noted that the electronic devices in the embodiments of the present application include: servers, terminals, or other devices except terminals.

[0098] The above electronic device structure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured with a display panel in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0099] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM).

[0100] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.

[0101] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned memory allocation method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0102] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as ROM, RAM, magnetic disk or optical disk.

[0103] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0104] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0105] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for memory allocation, characterized in that: include: Receive the huge page memory parameters corresponding to the target node; Allocate huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameters.

2. The method according to claim 1, characterized in that Before allocating the huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameter, the method further includes: Receive non-huge page memory parameters corresponding to the target node; Determining non-huge page memory according to the non-huge page memory parameter; The memory of the target node other than the non-huge page memory is determined as the memory to be allocated.

3. The method according to claim 1, characterized in that Allocating huge page memory in the to-be-allocated memory of the target node according to the huge page memory parameter includes: When the memory to be allocated of the target node is less than or equal to the memory corresponding to the huge page memory parameter, the memory to be allocated of the target node is allocated as the huge page memory.

4. The method according to claim 3, characterized in that After allocating the memory to be allocated as the huge page memory, the method further includes: Finish allocating hugepage memory for the target node.

5. The method according to claim 4, characterized in that After allocating the huge page memory of the target node, the method further includes: Receive huge page memory parameters corresponding to other nodes except the target node; The other nodes are traversed, and according to the huge page memory parameters corresponding to the other nodes, the huge page memory corresponding to the other nodes is allocated in the to-be-allocated memory corresponding to the other nodes.

6. The method according to claim 2, characterized in that The huge page memory allocated to the target node is less than or equal to the memory to be allocated.

7. The method according to claim 2, characterized in that The huge page memory parameters corresponding to the receiving target node include: Receiving the huge page memory parameter via a first interface; or The non-huge page memory parameters corresponding to the receiving target node include: The non-huge page memory parameters are received via a second interface.

8. The method according to claim 2, characterized in that: The huge page memory parameter is a value of the huge page memory or a percentage of the huge page memory to be allocated memory; or The non-huge page memory parameter is a value of the non-huge page memory or a percentage of the huge page memory in the memory of the target node.

9. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method for memory allocation as described in any one of claims 1 to 8.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or instruction, and when the program or instruction is executed by a processor, the steps of the memory allocation method according to any one of claims 1 to 8 are implemented.