Memory management method and apparatus

By adjusting the memory block refresh configuration parameters and CPU zeroing process, the problem of memory release and resource occupation during virtual machine shutdown was solved, achieving fast and low-consumption memory release and zeroing, and reducing the impact on other virtual machines.

CN114579304BActive Publication Date: 2026-03-20ALIBABA (CHINA) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-25
Publication Date
2026-03-20

AI Technical Summary

Technical Problem

In cloud computing scenarios based on virtualization technology, the memory release and clearing process when a virtual machine is shut down consumes a large amount of host machine resources, resulting in a significant impact on other virtual machines. This impact becomes increasingly pronounced as virtual machine memory specifications increase.

Method used

By adjusting the refresh configuration parameters of the memory blocks to be released, especially by using PASR technology to disable and enable the refresh configuration of memory blocks, combined with CPU zeroing, fast memory release and zeroing can be achieved.

Benefits of technology

Large-scale memory release and clearing are completed within milliseconds, reducing contention for other virtual machine resources and avoiding the impact of starting new scheduled virtual machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579304B_ABST
    Figure CN114579304B_ABST
Patent Text Reader

Abstract

The embodiments of the present specification provide a memory management method and device, wherein the memory management method comprises: receiving a memory release request for a target virtual machine; determining at least one to-be-released memory block corresponding to the target virtual machine in response to the memory release request, and determining memory block attribute information corresponding to each to-be-released memory block; determining that a to-be-released memory block with memory block attribute information of a first type is a first to-be-released memory block; and releasing the memory of the first to-be-released memory block by adjusting the refresh configuration parameter of the first to-be-released memory block. Through the method, the release and zero clearing of the memory can be quickly completed by controlling the refresh frequency of the first to-be-released memory block, and the refresh frequency of the to-be-released memory block is adjusted to occupy fewer resources and has less impact on other running virtual machines.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present specification relate to the technical field of computer technology, and particularly relate to a memory management method. BACKGROUND

[0002] In a cloud computing scenario based on a virtualization technology, in order to ensure data security, memory used by a virtual machine needs to be released and cleared when the virtual machine is shut down. In the process of releasing and clearing the memory, the processor computing power and memory bandwidth resources of a host machine need to be occupied. With the rapid development of cloud computing technology, the memory specifications of virtual machines are becoming larger and larger. When a virtual machine is shut down, the time delay and high resource occupation of the corresponding memory release and clearing will have a great impact on other virtual machines that are being used. SUMMARY

[0003] Therefore, the embodiments of the present specification provide a memory management method. One or more embodiments of the present specification also relate to a memory management apparatus, a computing device, a computer-readable storage medium, and a computer program to solve the technical defects in the prior art.

[0004] According to a first aspect of the embodiments of the present specification, a memory management method is provided, comprising:

[0005] receiving a memory release request for a target virtual machine;

[0006] determining at least one to-be-released memory block corresponding to the target virtual machine in response to the memory release request, and determining memory block attribute information corresponding to each to-be-released memory block;

[0007] determining that a to-be-released memory block with the first type of memory block attribute information is a first type of to-be-released memory block, wherein the first type of to-be-released memory block is a complete memory block;

[0008] releasing the memory of the first type of to-be-released memory block by adjusting the refresh configuration parameter of the first type of to-be-released memory block.

[0009] According to a second aspect of the embodiments of the present specification, another memory management method is provided, comprising:

[0010] receiving a memory allocation request for a target virtual machine, wherein the memory allocation request carries to-be-allocated memory information;

[0011] obtaining the number of idle memory blocks and idle memory block attribute information;

[0012] allocating a first type of idle memory block to the target virtual machine according to the to-be-allocated memory information, the number of idle memory blocks, and the idle memory block attribute information, wherein the first type of idle memory block is a complete memory block.

[0013] According to a third aspect of the embodiments of this specification, a memory management apparatus is provided, comprising:

[0014] The receiving module is configured to receive memory release requests for the target virtual machine;

[0015] The response module is configured to determine at least one memory block to be released corresponding to the target virtual machine in response to the memory release request, and to determine memory block attribute information corresponding to each memory block to be released;

[0016] The determination module is configured to determine that memory blocks whose attribute information is of type 1 are memory blocks to be released as type 1 memory blocks to be released, wherein the memory blocks to be released of type 1 are complete memory blocks;

[0017] The release module is configured to release the memory of the first type of memory block to be released by adjusting the refresh configuration parameters of the first type of memory block to be released.

[0018] According to a fourth aspect of the embodiments of this specification, another memory management device is provided, comprising:

[0019] The allocation request receiving module is configured to receive a memory allocation request for a target virtual machine, wherein the memory allocation request carries memory information to be allocated;

[0020] The information acquisition module is configured to acquire the number of free memory blocks and the attribute information of the free memory blocks;

[0021] The allocation module is configured to allocate a first type of free memory block to the target virtual machine based on the memory to be allocated information, the number of free memory blocks, and the attribute information of the free memory blocks, wherein the first type of free memory block is a complete memory block.

[0022] According to a fifth aspect of the embodiments of this specification, a computing device is provided, comprising:

[0023] Memory and processor;

[0024] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the memory management method described above.

[0025] According to a sixth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions that, when executed by a processor, implement the steps of the memory management method described above.

[0026] According to a seventh aspect of the embodiments of the present specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is enabled to perform the steps of the memory management method described above.

[0027] One embodiment of the present specification realizes receiving a memory release request for a target virtual machine; determining at least one to-be-released memory block corresponding to the target virtual machine in response to the memory release request, and determining memory block attribute information corresponding to each to-be-released memory block; determining that the to-be-released memory block with the memory block attribute information being the first type is a first type to-be-released memory block; and releasing the memory of the first type to-be-released memory block by adjusting the refresh configuration parameter of the first type to-be-released memory block. Through the method, the memory can be quickly released and cleared by controlling the refresh frequency of the first type to-be-released memory block, and the refresh frequency of the to-be-released memory block is adjusted to occupy fewer resources and has less impact on other running virtual machines. BRIEF DESCRIPTION OF DRAWINGS

[0028] Figure 1 is a flowchart of a memory management method provided by one embodiment of the present specification;

[0029] Figure 2 is a flowchart of a memory management method provided by another embodiment of the present specification;

[0030] Figure 3 is a process flowchart of a memory management method applied to memory allocation of a virtual machine M provided by one embodiment of the present specification;

[0031] Figure 4 is a process flowchart of a memory management method applied to memory release of a virtual machine M provided by one embodiment of the present specification;

[0032] Figure 5 is a structural schematic diagram of a memory management device provided by one embodiment of the present specification;

[0033] Figure 6 is a structural schematic diagram of a memory management device provided by another embodiment of the present specification;

[0034] Figure 7 is a structural block diagram of a computing device provided by one embodiment of the present specification. DETAILED DESCRIPTION

[0035] In the following description, many specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced in many different ways beyond the specific embodiments described herein, and it is understood that persons having ordinary skill in the art can make similar modifications without departing from the scope of the present specification, so the present specification is not limited to the specific implementations disclosed below.

[0036] The terminology used in this disclosure, one or more embodiments of the present specification, is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in this disclosure and the appended claims herein, the singular forms "a," "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "and / or," as used in this disclosure, refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0037] It will be understood that, although the terms first, second, etc. can be employed in this disclosure, one or more embodiments of the present specification, to describe various information, these information should not be limited to these terms. These terms are only used to differentiate one piece of information from another piece of information of the same type. For example, a first can also be referred to as a second, and similarly, a second can also be referred to as a first, without departing from the scope of one or more embodiments of the present specification. Depending on the context, the word "if' as used herein can be interpreted to mean "when" or "in response to determining".

[0038] First, the noun terms related to one or more embodiments of the present specification are explained.

[0039] RAM: (Random access memory) Dynamic random access memory, also known as memory.

[0040] Bank: (Storage sub-blocks in memory chips, each sub-block has multiple word lines, and each word line connects multiple data storage units. For example, an 8G memory, if there are 8 banks, then the size of each bank is 1G, and the banks on a memory share an IO of the memory. The read and write in each bank can be processed in parallel.

[0041] Refresh: Memory needs to be refreshed periodically (within a few milliseconds), otherwise the data saved in the memory will be lost.

[0042] Partial array self refresh: (Partial Array SelfRefresh, PASR), a memory controller technology, which can configure the self-refresh parameters of each storage sub-block, and can completely independently refresh the memory sub-block.

[0043] PASR memory controller driver: running in the operating system kernel, providing access to the control registers in the memory controller to dynamically adjust the refresh settings of the memory block.

[0044] In a cloud computing scenario based on a virtualization technology, in order to ensure data security, the memory used by a virtual machine needs to be zeroed by a hypervisor when the virtual machine is shut down. The memory zeroing needs to occupy a large amount of CPU computing power and memory bandwidth resources of a host computer. With the development of cloud computing technology, the memory specification of the virtual machine is becoming larger and larger, and a single zeroing needs a longer time delay and a higher resource occupation. Therefore, the memory zeroing operation of a large-specification virtual machine when the virtual machine is shut down will have an increasingly greater impact on other virtual machines being used, such as the problem of new virtual machine scheduling failure caused by memory not being released, and the problem of resource contention between the zeroing task of the host computer and other virtual machines. Therefore, how to efficiently and low-consumption zero the memory is becoming more and more important.

[0045] In the present specification, a memory management method is provided, and the present specification also relates to a memory management device, a computing device, a computer readable storage medium, and a computer program, which are described in detail one by one in the following embodiments.

[0046] Referring to Figure 1 , Figure 1 A flowchart of a memory management method according to one embodiment of the present specification is shown, which specifically includes the following steps.

[0047] Step 102: receiving a memory release request for a target virtual machine.

[0048] The target virtual machine specifically refers to a virtual machine that needs to perform memory release zeroing. The virtual machine runs in a host computer and occupies CPU, memory and other resources of the host computer. The memory release request specifically refers to a request for releasing and zeroing the memory occupied by the target virtual machine. The memory occupied by the virtual machine is released, specifically referring to zeroing the memory occupied by the virtual machine.

[0049] In actual application, when a virtual machine is shut down, the host computer memory occupied by the virtual machine needs to be zeroed. The virtual machine is the target virtual machine, and the memory release request is triggered when the shutdown request is received.

[0050] In a specific embodiment provided in the present specification, taking 16G of memory of a host computer as an example, four virtual machines, namely virtual machine 1, virtual machine 2, virtual machine 3 and virtual machine 4, are running. At this time, virtual machine 3 is shut down. Virtual machine 3 is the target virtual machine, and the memory release request for the host computer memory occupied by virtual machine 3 is triggered.

[0051] Step 104: in response to the memory release request, determining at least one to-be-released memory block corresponding to the target virtual machine, and determining memory block attribute information corresponding to each to-be-released memory block.

[0052] Wherein, the memory block is Bank, and Bank is a storage sub-block on the memory. If a memory is 8G and has 8 Banks, then one Bank is 1G.

[0053] In actual application, when a virtual machine runs in a host, it occupies the memory and CPU resources of the host. For example, a virtual machine needs 4G memory for normal running, and 4G memory resources need to be allocated from the host for the virtual machine. Further, the 4G memory resources are distributed in Banks on the host memory. When the shutdown processing of the virtual machine is performed, the 4G memory resources occupied by the virtual machine need to be released, that is, the Banks corresponding to the 4G memory need to be released. The Banks corresponding to the 4G memory are the memory blocks to be released. Since the memory specification of the virtual machine is getting larger and larger, the Banks occupied by the virtual machine on the host memory are also getting more and more. Specifically, the number of memory blocks corresponding to one virtual machine is subject to actual application.

[0054] In a specific embodiment provided in the specification, the above example is followed. The memory of the host has 16G, and there are 16 memory blocks (Banks) in total. The memory capacity of each Bank is 1G. Virtual machine 3 occupies 4G memory. According to the memory release request, it is determined that the 5 Banks corresponding to virtual machine 3 are Bank 3, Bank 4, Bank 5, Bank 6, and Bank 7.

[0055] In actual application, each memory block corresponds to an address decoder and a column address decoder. Each memory block corresponds to a corresponding physical address. In simple terms, for an 8G memory, there are 8 memory blocks. The physical address corresponding to memory block 1 is 1-1G. The physical address corresponding to memory block 2 is 1G-2G, and so on. Therefore, the corresponding memory block can be determined according to the corresponding physical address. Based on this, in response to the memory release request, at least one memory block to be released corresponding to the target virtual machine is determined, which includes:

[0056] In response to the memory release request, the virtual machine physical address interval corresponding to the target virtual machine is determined.

[0057] The memory block corresponding to the virtual machine physical address interval is determined as the memory block to be released.

[0058] After receiving the memory release request, the virtual machine physical address interval corresponding to the target virtual machine can be determined. The virtual machine physical address interval specifically refers to the physical address range occupied by the target virtual machine when it runs. When the virtual machine starts, the virtual machine physical address interval is allocated to the virtual machine according to the use of the memory of the host. Correspondingly, when the memory release request is received, the virtual machine physical address interval corresponding to the target virtual machine can be determined. According to the virtual machine physical address interval, the corresponding memory block can be determined as the memory block to be released.

[0059] It should be noted that in actual application, due to different application environments, the virtual machine physical address interval corresponding to the target virtual machine can be multiple, that is, one target virtual machine corresponds to multiple virtual machine physical address intervals, for example, a certain virtual machine corresponds to virtual machine physical address intervals of 0-140M, 895M-1348M, 1972M-3451M, and so on, thus each virtual machine physical address interval can correspond to one or more memory blocks. Thus, at least one to-be-released memory block can be determined according to the virtual machine physical address interval.

[0060] After the at least one to-be-released memory block is determined, the memory block attribute information of each to-be-released memory block can be determined. In the embodiments provided in the specification, the attribute information of the memory block is used to express whether the to-be-released memory block belongs to the exclusive use of the target virtual machine. For example, if only the target virtual machine runs on a certain memory block, the attribute information of the memory block is of a first type, and if other virtual machines run on a certain memory block in addition to the target virtual machine, the memory block attribute information of the memory block is of a second type.

[0061] Specifically, the memory block attribute information corresponding to each to-be-released memory block is determined, comprising:

[0062] determining a target to-be-released memory block in the at least one to-be-released memory block;

[0063] determining a memory block physical address interval of the target to-be-released memory block;

[0064] judging whether there is a memory block physical address not belonging to the virtual machine physical address interval in the memory block physical address interval;

[0065] if not, determining that the memory block attribute information of the target to-be-released memory block is of the first type;

[0066] if yes, determining that the memory block attribute information of the target to-be-released memory block is of the second type.

[0067] In actual application, there is at least one to-be-released memory block, and each to-be-released memory block needs to be judged to determine the memory block attribute information of the to-be-released memory block. At this time, the to-be-released memory block being determined for the memory block attribute information is a target to-be-released memory block.

[0068] After the target to-be-released memory block is determined, the memory block physical address interval of the target to-be-released memory block can be determined. The memory block physical address interval specifically refers to the interval between the starting physical address and the ending physical address of the target to-be-released memory block, and the memory block physical address interval is continuous.

[0069] After the memory block physical range of the target to-be-released memory block is obtained, it is judged whether there is a memory block physical address not belonging to the virtual machine physical address range in the memory block physical address range. If not, it is indicated that only the target virtual machine runs in the target to-be-released memory block, and the memory block attribute information of the target to-be-released memory block is of the first type. If yes, it is indicated that not only the target virtual machine but also other virtual machines run in the target to-be-released memory block, and it can be determined that the memory block attribute information of the target to-be-released memory block is of the second type.

[0070] In a specific embodiment provided in the present specification, the above example is followed. The virtual machine 3 corresponds to five Banks, which are Bank 3, Bank 4, Bank 5, Bank 6 and Bank 7. The virtual machine physical address range of the virtual machine 3 is “add3700-add4000, add4000-add5000, add5000-add6000, add6000-add7000, add7200-add7800”. The memory block physical address range of the Bank 3 is add3000-add4000. The memory block physical address range of the Bank 4 is add4000-add5000. The memory block physical address range of the Bank 5 is add5000-add6000. The memory block physical address range of the Bank 6 is add6000-add7000. The memory block physical address range of the Bank 7 is add7000-add8000.

[0071] Taking the Bank 3 as the target to-be-released memory block, in the Bank 3, the memory block physical address of add3000-add3700 does not belong to the virtual machine physical address range. Therefore, the memory block attribute information of the Bank 3 is of the second type. Taking the Bank 4 as the target to-be-released memory block, in the Bank 4, add4000-add5000 are all the virtual machine physical address range corresponding to the virtual machine 3. Therefore, the memory block attribute information of the Bank 4 is of the first type. In the same way, the memory block attribute information of the Bank 3 is of the second type, the memory block attribute information of the Bank 4 is of the first type, the memory block attribute information of the Bank 5 is of the first type, the memory block attribute information of the Bank 6 is of the first type, and the memory block attribute information of the Bank 7 is of the second type.

[0072] Step 106: determining the to-be-released memory block with the memory block attribute information of the first type as the first type to-be-released memory block.

[0073] After the memory block attribute information is determined, each to-be-released memory block can be classified according to the memory block attribute information. Correspondingly, the to-be-released memory block with the memory block attribute information of the first type is a first-class to-be-released memory block, and the to-be-released memory block with the memory block attribute information of the second type is a second-class to-be-released memory block. Different memory release strategies can be used for different types of to-be-released memory blocks. Specifically, the first-class to-be-released memory block is a complete memory block, and the second-class to-be-released memory block is a shared memory block.

[0074] In a specific embodiment provided in the present specification, using the above example, Bank4, Bank5, and Bank6 are first-class to-be-released memory blocks, and Bank3 and Bank7 are second-class to-be-released memory blocks.

[0075] Step 108: Releasing the memory of the first-class to-be-released memory block by adjusting the refresh configuration parameter of the first-class to-be-released memory block.

[0076] The first-class to-be-released memory block can be released and cleared by using a first memory release strategy, that is, by adjusting the refresh configuration parameter of the first-class to-be-released memory block to release and clear the memory of the first-class to-be-released memory block.

[0077] PASR (Partial Array SelfRefresh) is a memory control technology that can configure the self-refresh time of each memory block and completely independently control each memory block. The memory block needs to be refreshed periodically (within several milliseconds), and if it is not refreshed within the period, the data of the memory block will be lost.

[0078] Based on this principle, after the first-class to-be-released memory block is determined, the memory of the first-class to-be-released memory block can be released and cleared by adjusting the refresh configuration parameter of the first-class to-be-released memory block.

[0079] Specifically, the memory of the first-class to-be-released memory block is released by adjusting the refresh configuration parameter of the first-class to-be-released memory block, including:

[0080] setting the refresh configuration parameter of the first-class to-be-released memory block to be disabled, and counting the disabled duration;

[0081] In a case where the disabled duration is greater than a preset threshold, the refresh configuration parameter of the first-class to-be-released memory block is set to be enabled, wherein the preset threshold is a data retention duration of the memory block.

[0082] In actual application, the refresh configuration parameter of the first type of memory block to be released is set to be forbidden by PASR technology, i.e. no refresh, and the disabled time is counted. When the disabled time exceeds the valid keeping time of the data in the memory (i.e. the periodicity mentioned above), the refresh configuration parameter of the memory block is set to be enabled, and thus the memory of the first type of memory block to be released is released and cleared.

[0083] In the specific embodiment provided in the present specification, the above example is followed, Bank4, Bank5 and Bank6 are the first type of memory block to be released, the data keeping time of each Bank is 50 milliseconds, the memory controller driver is called, the refresh configuration parameter of Bank4, Bank5 and Bank6 is set to be disabled by PASR, which is adjusted to be not refreshed, and the disabled time is counted. When the disabled time exceeds 50 milliseconds, the refresh configuration parameter of Bank4, Bank5 and Bank6 is set to be enabled, which is adjusted to be refreshed. Thus, the memory of Bank4, Bank5 and Bank6 is released and cleared.

[0084] In actual application, there is also a part of memory block attribute information of the second type. The processing of the memory block attribute information of the second type includes:

[0085] The memory block to be released with the memory block attribute information of the second type is determined to be the second type of memory block to be released;

[0086] The corresponding to-be-released physical address interval of each second type of memory block to be released is obtained;

[0087] The memory of each to-be-released physical address interval is cleared.

[0088] The memory block to be released with the memory block attribute information of the second type is determined to be the second type of memory block to be released, and then the corresponding to-be-released physical address interval of each second type of memory block to be released is obtained. The to-be-released physical address interval specifically refers to the physical address interval occupied by the target virtual machine in the second type of memory block to be released.

[0089] After the to-be-released physical address interval is obtained, the memory in the interval can be cleared. Specifically, the Hypervisor runs the code, and the CPU writes 0 to each to-be-released physical address to release and clear the to-be-released physical address.

[0090] The above is the memory release request of the target virtual machine when it is shut down. In actual application, in order to apply the above embodiments provided in the present specification, preferably, the same memory block is allocated to the target virtual machine. Specifically, before receiving the memory release request of the target virtual machine, the method further includes S1002-S1006:

[0091] S1002, receiving a memory allocation request for a target virtual machine, wherein the memory allocation request carries to-be-allocated memory information.

[0092] The memory allocation request specifically refers to a request for allocating memory for a target virtual machine. In actual application, a virtual machine needs to be started in a host, and memory needs to be allocated for the virtual machine for starting use. Based on this, the started virtual machine is the target virtual machine, and the memory allocation request is a request for allocating memory for the target virtual machine. In actual application, to-be-allocated memory information is carried in the memory allocation request. The to-be-allocated memory information can specifically be the memory size required by the target virtual machine.

[0093] In a specific embodiment provided in the specification, taking starting a virtual machine m as an example, a memory allocation request for the virtual machine m is received, and to-be-allocated memory information of the virtual machine m is 2G carried in the memory allocation request.

[0094] S1004, obtaining the number of idle memory blocks and idle memory block attribute information.

[0095] The number of idle memory blocks specifically refers to how many memory blocks are completely idle under the current use of the host, that is, the number of unused memory blocks of the host. The idle memory block attribute information specifically refers to the memory block capacity, physical address range, etc. of each unused idle memory block.

[0096] In a specific embodiment provided in the specification, following the above example, the number of idle memory blocks of the host is obtained as 3 blocks, and the size of each memory block is 512M. The physical address range of memory block 1 is add1024-add1536, the physical address range of memory block 2 is add1536-add2048, and the physical address range of memory block 3 is add2048-add2560.

[0097] S1006, allocating a first type of idle memory block for the target virtual machine according to the to-be-allocated memory information, the number of idle memory blocks, and the idle memory block attribute information.

[0098] The first type of idle memory block specifically refers to an entire block of continuous memory block allocated for the target virtual machine. The first type of idle memory block needs to be determined according to the to-be-allocated memory information, the number of idle memory blocks, and the idle memory attribute information.

[0099] Specifically, allocating a first type of idle memory block for the target virtual machine according to the to-be-allocated memory information, the number of idle memory blocks, and the idle memory block attribute information includes:

[0100] The number of pre-allocated free memory blocks is determined based on the unallocated memory information and the free memory block attribute information.

[0101] The first type of free memory blocks are allocated to the target virtual machine based on the number of pre-allocated free memory blocks and the number of free memory blocks.

[0102] In practical applications, the number of pre-allocated free memory blocks is determined based on the information of the memory to be allocated and the attribute information of the free memory blocks. In a host machine, the memory specifications are the same and the memory block attribute information is also the same. For example, for an 8G memory, there are 8 memory blocks, and the size of each memory block is 1G; for a 4G memory, there are 8 memory blocks, and the size of each memory block is 512M.

[0103] After determining the attribute information of the free memory blocks, the number of pre-allocated free memory blocks can be determined by combining it with the information of the memory to be allocated. For example, if the information of the memory to be allocated is 4G and the attribute information of the free memory blocks is 1G, then the number of pre-allocated free memory blocks is 4; if the information of the memory to be allocated is 3G and the attribute information of the free memory blocks is 512M, then the number of pre-allocated free memory blocks is 6.

[0104] After determining the number of pre-allocated free memory blocks, the first type of free memory blocks can be allocated to the target virtual machine based on the number of pre-allocated free memory blocks and the number of free memory blocks. Specifically, allocating the first type of free memory blocks to the target virtual machine based on the number of pre-allocated free memory blocks and the number of free memory blocks includes:

[0105] If the number of pre-allocated free memory blocks is less than or equal to the number of free memory blocks, a first type of free memory block is allocated to the target virtual machine according to the number of pre-allocated free memory blocks.

[0106] If the number of pre-allocated free memory blocks is greater than the number of free memory blocks, then free memory blocks of the first type are allocated to the target virtual machine according to the number of free memory blocks.

[0107] In practical applications, the first type of free memory blocks are allocated to the target virtual machine based on the relationship between the number of pre-allocated free memory blocks and the number of free memory blocks. When the number of pre-allocated free memory blocks is less than or equal to the number of free memory blocks, the first type of free memory blocks are allocated to the target virtual machine based on the number of pre-allocated free memory blocks; otherwise, the first type of free memory blocks are allocated to the target virtual machine based on the number of free memory blocks.

[0108] For example, if the pre-allocated free memory block quantity is 4 and the free memory block quantity is 5, the first type of free memory block is 4, and 4 first type of free memory blocks are allocated to the target virtual machine. If the pre-allocated free memory block quantity is 6 and the free memory block quantity is 5, the first type of free memory block is 5, and 5 first type of free memory blocks are allocated to the target virtual machine.

[0109] In practical applications, the memory required by the target virtual machine cannot be allocated by the free memory blocks, or the quantity of the free memory blocks is insufficient, and in this case, the non-free memory blocks also need to be allocated to the target virtual machine. Specifically, after the first type of free memory blocks are allocated to the target virtual machine according to the pre-allocated free memory block quantity and the free memory block quantity, the method further comprises:

[0110] The unallocated memory information is determined according to the to-be-allocated memory information and the first type of free memory block.

[0111] In the case that the unallocated memory information is not empty, the second type of memory block is allocated to the target virtual machine according to the unallocated memory information.

[0112] The unallocated memory information specifically refers to the remaining memory information in the to-be-allocated memory information after the first type of free memory block is allocated. For example, the to-be-allocated memory information is 3.2G memory, and the memory block attribute information is 1G. The first type of free memory block is 3, and the memory information that can be allocated is 3G, and the unallocated memory information is 0.2G. If the to-be-allocated memory information is 4G, the memory block attribute information is 1G, and the first type of free memory block is 4, the virtual machine can occupy 4 first type of free memory blocks, and the unallocated memory information is empty. If the to-be-allocated memory information is 4G, the memory block attribute information is 1G, and the first type of free memory block is 3, the unallocated memory information of the virtual machine is 1G.

[0113] When the unallocated memory information is empty, it means that the memory resources required by the virtual machine have been allocated and completed, and no additional memory block needs to be allocated.

[0114] When the unallocated memory information is not empty, it means that there is no free memory block in the host machine or the free memory block cannot be allocated to the virtual machine, and in this case, the second type of memory block needs to be allocated to the target virtual machine according to the unallocated memory information. In the embodiments provided in the specification, the second type of memory block specifically refers to the memory block that has been allocated with the memory of other virtual machines. For example, the memory capacity of a certain memory block is 1G, of which 512M is allocated to virtual machine 1, and 512M is free, and the memory block is the second type of memory block.

[0115] In the specific embodiment provided in the specification, after determining the unallocated memory information, a second type of memory block is allocated to the target virtual machine according to the unallocated memory information. For example, if the unallocated memory information is 0.2G and the memory block attribute information is 1G, allocating a complete free memory block to the virtual machine will cause resource waste. In order to reduce resource waste, 0.2G of space can be allocated to the virtual machine in the second type of memory block that has been used.

[0116] The memory management method provided in the specification receives a memory release request for a target virtual machine; determines at least one to-be-released memory block corresponding to the target virtual machine in response to the memory release request, and determines memory block attribute information corresponding to each to-be-released memory block; determines that the to-be-released memory block with the memory block attribute information being the first type is a first type of to-be-released memory block; and releases the memory of the first type of to-be-released memory block by adjusting the refresh configuration parameter of the first type of to-be-released memory block. The memory management method provided in the specification can quickly complete large-scale memory release and zeroization within milliseconds by adjusting the refresh configuration parameter of the memory block, greatly reducing the contention for resources and avoiding the occupation of resources by newly scheduled virtual machines and the influence on the start of the newly scheduled virtual machine. By modifying the memory release mechanism, the zeroization of the continuous and complete memory block is quickly completed by adjusting the refresh configuration parameter.

[0117] In addition, when the virtual machine is allocated, a complete and continuous memory block is preferentially allocated for the virtual machine to use, so that the modified refresh configuration parameter of the memory is used to quickly and completely zeroize the memory in subsequent memory release.

[0118] Referring to FIG. 1, a memory management system is shown, which comprises a memory management module 100 and a memory management module 200. Figure 2 , Figure 2 A flowchart of a memory management method provided according to another embodiment of the specification is shown, which specifically comprises the following steps:

[0119] Step 202: receiving a memory allocation request for a target virtual machine, wherein the memory allocation request carries to-be-allocated memory information.

[0120] Step 204: obtaining the number of free memory blocks and the attribute information of the free memory blocks.

[0121] Step 206: allocating a first type of free memory block to the target virtual machine according to the to-be-allocated memory information, the number of free memory blocks, and the attribute information of the free memory blocks.

[0122] Optionally, allocating a first type of free memory block to the target virtual machine according to the to-be-allocated memory information, the number of free memory blocks, and the attribute information of the free memory blocks comprises:

[0123] determining a pre-allocated free memory block quantity according to the to-be-allocated memory information and the free memory block attribute information;

[0124] allocating first-type free memory blocks for the target virtual machine according to the pre-allocated free memory block quantity and the free memory block quantity.

[0125] Optionally, the step of allocating first-type free memory blocks for the target virtual machine according to the pre-allocated free memory block quantity and the free memory block quantity comprises the following steps.

[0126] in a case where the pre-allocated free memory block quantity is less than or equal to the free memory block quantity, allocating first-type free memory blocks for the target virtual machine according to the pre-allocated free memory block quantity;

[0127] in a case where the pre-allocated free memory block quantity is greater than the free memory block quantity, allocating first-type free memory blocks for the target virtual machine according to the free memory block quantity.

[0128] Optionally, after the step of allocating first-type free memory blocks for the target virtual machine according to the pre-allocated free memory block quantity and the free memory block quantity, the method further comprises the following steps.

[0129] determining un-allocated memory information according to the to-be-allocated memory information and the first-type free memory blocks;

[0130] in a case where the un-allocated memory information is not empty, allocating second-type memory blocks for the target virtual machine according to the un-allocated memory information.

[0131] It should be noted that the memory management method provided by the embodiments of the present disclosure is consistent with the method of the above-mentioned embodiments S1002-S1006. For specific explanations of steps 202 to 206, refer to the detailed descriptions of steps S1002-S1006 in the foregoing embodiments, which will not be repeated here.

[0132] The memory management method provided by the embodiments of the present disclosure is suitable for preferentially allocating complete and continuous memory blocks to virtual machines when allocating memory for target virtual machines. This facilitates the use of modified memory refresh configuration parameters to quickly and completely clear memory in subsequent memory release.

[0133] The following describes the memory management method provided by the embodiments of the present disclosure in conjunction with the accompanying drawings. Figure 3 The memory management method provided by the embodiments of the present disclosure is suitable for preferentially allocating complete and continuous memory blocks to virtual machines when allocating memory for target virtual machines. This facilitates the use of modified memory refresh configuration parameters to quickly and completely clear memory in subsequent memory release. Figure 3 FIG. 1 shows a flowchart of a processing procedure of a memory management method according to an embodiment of the present disclosure, which specifically comprises the following steps.

[0134] Step 302: starting the virtual machine.

[0135] In the embodiments provided in the present specification, the virtual machine M is started in the host.

[0136] Step 304: applying for memory.

[0137] In the embodiments provided in the present specification, the host is applied for memory for the virtual machine M.

[0138] Step 306: judging whether the memory exceeds the size of a single memory block.

[0139] In the embodiments provided in the present specification, it is judged whether the size of the applied memory exceeds the size of a single memory block. If the size of the applied memory exceeds the size of a single memory block, step 308 is executed, otherwise, step 310 is executed.

[0140] Step 308: determining the free memory block and allocating memory.

[0141] In the embodiments provided in the present specification, the free memory block is determined in the host, and the free memory block is allocated to the virtual machine M, while the size of the memory not allocated to the virtual machine is monitored. If the free memory block can be allocated to the virtual machine M exactly and there is no remaining, step 312 is executed, and the memory allocation is completed. If there is remaining memory not allocated to the virtual machine M and the remaining memory is less than a memory block, step 310 is executed.

[0142] Step 310: determining the second type of memory block and allocating memory.

[0143] In the embodiments provided in the present specification, the second type of memory block is determined, and the free memory in the second type of memory block is allocated to the virtual machine M.

[0144] Step 312: completing the memory allocation.

[0145] In the embodiments provided in the present specification, when the memory required by the virtual machine M is all allocated, the memory allocation of the virtual machine M is completed.

[0146] The memory management method provided in the embodiments of the present specification is suitable for preferentially allocating the complete continuous memory block to the virtual machine when allocating memory for the target virtual machine. It is convenient to use the refresh configuration parameter for modifying the memory to quickly and completely clear the memory in the subsequent memory release.

[0147] The following will be described in detail with reference to the accompanying drawings. Figure 4 The memory management method provided in the present specification will be further described by taking the application of the memory management method in the memory release and zero clearing of the virtual machine M as an example. In the embodiments provided in the present specification, Figure 4A process flow chart of a memory management method provided by an embodiment of the present specification is shown, and specifically includes the following steps.

[0148] Step 402: Close the virtual machine.

[0149] In the embodiments provided by the present specification, the virtual machine M is closed in the host.

[0150] Step 404: Apply for releasing the memory.

[0151] In the embodiments provided by the present specification, the memory occupied by the virtual machine M is applied for releasing.

[0152] Step 406: Determine whether it is a first type of to-be-released memory block.

[0153] In the embodiments provided by the present specification, it is determined whether the memory block occupied by the virtual machine M is a first type of to-be-released memory block. If yes, steps 410-414 are executed, and if no, step 408 is executed.

[0154] Step 408: CPU zero.

[0155] In the embodiments provided by the present specification, for the second type of to-be-released memory block, the memory release zero processing is completed by using the CPU to write 0 into the memory address.

[0156] Step 410: Call the PASR memory controller driver to adjust the refresh configuration parameter of the first type of to-be-released memory block to be disabled.

[0157] In the embodiments provided by the present specification, the PASR memory controller driver is called to adjust the refresh configuration parameter of the first type of to-be-released memory block to be disabled, and the disabled duration is counted.

[0158] Step 412: Wait for T milliseconds.

[0159] In the embodiments provided by the present specification, T milliseconds is the duration for which the memory block saves data, and when T milliseconds is exceeded, the data saved in the memory block will be lost.

[0160] Step 414: Call the PASR memory controller driver to adjust the refresh configuration parameter of the first type of to-be-released memory block to be enabled.

[0161] In the embodiments provided by the present specification, when the disabled duration exceeds T milliseconds, the PASR memory controller driver is called to adjust the refresh configuration parameter of the first type of to-be-released memory block to be enabled.

[0162] Step 416: Memory release is completed.

[0163] In the embodiments provided by the present specification, at this point, the memory release of the virtual machine M is completed.

[0164] The memory management method provided in the specification receives a memory release request for a target virtual machine; determines at least one to-be-released memory block corresponding to the target virtual machine in response to the memory release request, and determines memory block attribute information corresponding to each to-be-released memory block; determines that a to-be-released memory block with the memory block attribute information being of a first type is a first type to-be-released memory block; and releases the memory of the first type to-be-released memory block by adjusting a refresh configuration parameter of the first type to-be-released memory block. The memory management method provided in the specification can quickly complete large-scale memory release and zeroization within a millisecond level time by adjusting the refresh configuration parameter of the memory block, greatly reduces the contention for resources, avoids the preemption of resources by a newly scheduled virtual machine, and affects the start of the newly scheduled virtual machine. By modifying the memory release mechanism, for a continuous and complete memory block, the zeroization is quickly completed by adjusting the refresh configuration parameter.

[0165] Corresponding to the method embodiments described above, the specification also provides memory management device embodiments, Figure 5 A structural schematic diagram of a memory management device provided in an embodiment of the specification is shown. As shown in the figure, Figure 5 The device includes:

[0166] The receiving module 502 is configured to receive a memory release request for a target virtual machine;

[0167] The response module 504 is configured to determine at least one to-be-released memory block corresponding to the target virtual machine in response to the memory release request, and determine memory block attribute information corresponding to each to-be-released memory block;

[0168] The determination module 506 is configured to determine that a to-be-released memory block with the memory block attribute information being of a first type is a first type to-be-released memory block, wherein the first type to-be-released memory block is a complete memory block;

[0169] The release module 508 is configured to release the memory of the first type to-be-released memory block by adjusting a refresh configuration parameter of the first type to-be-released memory block.

[0170] Optionally, the release module 508 is further configured to:

[0171] set the refresh configuration parameter of the first type to-be-released memory block to be disabled, and count a disabled duration;

[0172] set the refresh configuration parameter of the first type to-be-released memory block to be enabled in a case where the disabled duration is greater than a preset threshold, wherein the preset threshold is a data retention duration of the memory block for retaining data.

[0173] Optionally, the response module 504 is further configured to:

[0174] determine the virtual machine physical address interval corresponding to the target virtual machine according to the memory release request;

[0175] determine the memory block corresponding to the virtual machine physical address interval as a to-be-released memory block.

[0176] Optionally, the determination module 506 is further configured to:

[0177] determine a target to-be-released memory block in the at least one to-be-released memory block;

[0178] determine the memory block physical address interval of the target to-be-released memory block;

[0179] determine whether there is a memory block physical address not belonging to the virtual machine physical address interval in the memory block physical address interval;

[0180] if not, determine the memory block attribute information of the target to-be-released memory block as a first type;

[0181] if yes, determine the memory block attribute information of the target to-be-released memory block as a second type.

[0182] Optionally, the apparatus further comprises:

[0183] the determination module 506 is further configured to determine the to-be-released memory block with the memory block attribute information of the second type as a second type to-be-released memory block, wherein the to-be-released memory block of the second type is a shared memory block;

[0184] an address obtaining module configured to obtain a to-be-released physical address interval corresponding to each second type to-be-released memory block;

[0185] a zeroing module configured to zero the memory of each to-be-released physical address interval.

[0186] Optionally, the apparatus further comprises:

[0187] an allocation request receiving module configured to receive a memory allocation request for a target virtual machine, wherein the memory allocation request carries to-be-allocated memory information;

[0188] an information obtaining module configured to obtain the number of idle memory blocks and idle memory block attribute information;

[0189] an allocation module configured to allocate a first type idle memory block for the target virtual machine according to the to-be-allocated memory information, the number of idle memory blocks, and the idle memory block attribute information.

[0190] Optionally, the allocation module is further configured to:

[0191] determine a pre-allocated free memory block quantity according to the to-be-allocated memory information and the free memory block attribute information;

[0192] allocate first-type free memory blocks for the target virtual machine according to the pre-allocated free memory block quantity and the free memory block quantity.

[0193] Optionally, the allocation module is further configured to:

[0194] in a case where the pre-allocated free memory block quantity is less than or equal to the free memory block quantity, allocate first-type free memory blocks for the target virtual machine according to the pre-allocated free memory block quantity;

[0195] in a case where the pre-allocated free memory block quantity is greater than the free memory block quantity, allocate first-type free memory blocks for the target virtual machine according to the free memory block quantity.

[0196] Optionally, the allocation module is further configured to:

[0197] determine un-allocated memory information according to the to-be-allocated memory information and the first-type free memory blocks;

[0198] in a case where the un-allocated memory information is not empty, allocate second-type memory blocks for the target virtual machine according to the un-allocated memory information.

[0199] The memory management apparatus provided in the specification receives a memory release request for a target virtual machine; determines at least one to-be-released memory block corresponding to the target virtual machine and determines memory block attribute information corresponding to each to-be-released memory block in response to the memory release request; determines a first-type to-be-released memory block as a to-be-released memory block with first-type memory block attribute information; and releases the memory of the first-type to-be-released memory block by adjusting a refresh configuration parameter of the first-type to-be-released memory block. The memory management apparatus provided in the specification can quickly complete large-scale memory release and zeroing within a millisecond level of time by adjusting the refresh configuration parameter of the memory block, greatly reducing the contention for resources and avoiding the preemption of resources by newly scheduled virtual machines and the impact on the start of the newly scheduled virtual machines. By modifying the memory release mechanism, the zeroing of the continuous and complete memory block is quickly completed by adjusting the refresh configuration parameter.

[0200] In addition, when the virtual machine is allocated, the complete and continuous memory block is preferentially allocated for the virtual machine to use, which facilitates the quick and complete memory zeroing by modifying the refresh configuration parameter of the memory in subsequent memory release.

[0201] The above is a schematic solution of the memory management device in the embodiment. It should be noted that the technical solution of the memory management device and the technical solution of the memory management method described above belong to the same concept. The details of the technical solution of the memory management device that are not described in detail can be referred to the description of the technical solution of the memory management method.

[0202] Corresponding to the method embodiments described above, the specification also provides memory management device embodiments, Figure 6 The structure of a memory management device provided by another embodiment of the specification is shown in a structural schematic diagram. As shown in the figure, Figure 6 The device comprises:

[0203] The allocation request receiving module 602 is configured to receive a memory allocation request for a target virtual machine, wherein the memory allocation request carries to-be-allocated memory information;

[0204] The information obtaining module 604 is configured to obtain the number of idle memory blocks and the attribute information of the idle memory blocks;

[0205] The allocation module 606 is configured to allocate a first type of idle memory block for the target virtual machine according to the to-be-allocated memory information, the number of idle memory blocks, and the attribute information of the idle memory blocks.

[0206] Optionally, the allocation module 606 is further configured to:

[0207] determine the number of pre-allocated idle memory blocks according to the to-be-allocated memory information and the attribute information of the idle memory blocks;

[0208] allocate a first type of idle memory block for the target virtual machine according to the number of pre-allocated idle memory blocks and the number of idle memory blocks.

[0209] Optionally, the allocation module 606 is further configured to:

[0210] in a case where the number of pre-allocated idle memory blocks is less than or equal to the number of idle memory blocks, allocate a first type of idle memory block for the target virtual machine according to the number of pre-allocated idle memory blocks;

[0211] in a case where the number of pre-allocated idle memory blocks is greater than the number of idle memory blocks, allocate a first type of idle memory block for the target virtual machine according to the number of idle memory blocks.

[0212] Optionally, the allocation module 606 is further configured to:

[0213] determine unallocated memory information according to the to-be-allocated memory information and the first type of idle memory block;

[0214] In the case that the unallocated memory information is not empty, a second type of memory block is allocated to the target virtual machine according to the unallocated memory information.

[0215] The memory management device provided by the embodiments of the present disclosure is suitable for preferentially allocating a complete continuous memory block to a virtual machine when allocating memory to the target virtual machine. The modified memory flushing configuration parameter is used to quickly and completely clear the memory in subsequent memory release.

[0216] The above is a schematic solution of the memory management device of the present embodiment. It should be noted that the technical solution of the memory management device belongs to the same concept as the technical solution of the memory management method described above, and the details of the technical solution of the memory management device that are not described in detail can be referred to the description of the technical solution of the memory management method.

[0217] Figure 7 A structural block diagram of a computing device 700 according to an embodiment of the present disclosure is shown. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 through a bus 730, and a database 750 is used to store data.

[0218] The computing device 700 also includes an access device 740, which enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include the public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 can include one or more of any type of network interface (e.g., network interface card (NIC)), wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a near-field communication (NFC) interface, and the like.

[0219] In an embodiment of the present disclosure, the above-mentioned components of the computing device 700 and other components not shown in the Figure 7 may be connected to each other, for example, through a bus. It should be understood that Figure 7 The structural block diagram of the computing device shown is only for the purpose of example, and is not a limitation on the scope of the present disclosure. Other components can be added or replaced as needed by those skilled in the art.

[0220] The computing device 700 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or PC. The computing device 700 can also be a mobile or stationary server.

[0221] The processor 720 is configured to execute instructions for the data processing method described above. The above is a schematic solution of the computing device according to an embodiment of the present disclosure. It should be noted that the technical solution of the computing device and the technical solution of the memory management method described above belong to the same concept, and the details of the technical solution of the computing device not described in detail can be referred to the description of the technical solution of the memory management method.

[0222] An embodiment of the present disclosure further provides a computer readable storage medium storing computer executable instructions. The computer executable instructions, when executed by a processor, implement the steps of the memory management method described above.

[0223] The above is a schematic solution of the computer readable storage medium according to an embodiment of the present disclosure. It should be noted that the technical solution of the storage medium and the technical solution of the memory management method described above belong to the same concept, and the details of the technical solution of the storage medium not described in detail can be referred to the description of the technical solution of the memory management method.

[0224] An embodiment of the present disclosure further provides a computer program. When the computer program is executed in a computer, the computer program causes the computer to execute the steps of the memory management method described above.

[0225] The above is a schematic solution of the computer program according to an embodiment of the present disclosure. It should be noted that the technical solution of the computer program and the technical solution of the memory management method described above belong to the same concept, and the details of the technical solution of the computer program not described in detail can be referred to the description of the technical solution of the memory management method.

[0226] The above describes specific embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in a different order and still accomplish the desired results. Also, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0227] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate additions or subtractions according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.

[0228] It should be noted that for the foregoing method embodiments, the description is made for the sake of brevity, and therefore, each of the method embodiments can include additional steps as appropriate to the alternate embodiments and vice versa, some of which have been discussed above. It is also noted that while the method embodiments have been described as a single process, the process can be separated into a number of processes for different aspects, each of which, and

[0229] In the above embodiments, the description of each embodiment is focused on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0230] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. The alternative embodiments do not describe all the details and limit the invention to the specific embodiments described. Obviously, according to the content of the embodiments of the present specification, many modifications and changes can be made. The present specification selects and describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present specification, so that those skilled in the art can well understand and use the present specification. The present specification is limited by the claims and their entire scope and equivalents.

Claims

1. A memory management method, comprising: Receive memory release requests for the target virtual machine; In response to the memory release request, at least one memory block to be released corresponding to the target virtual machine is determined, and memory block attribute information corresponding to each memory block to be released is determined, including: determining the physical address range of each memory block to be released, determining whether there is a memory block physical address in the physical address range that does not belong to the physical address range of the target virtual machine, if not, the memory block to be released is of the first type, if yes, the memory block to be released is of the second type, wherein the physical address range of the memory block refers to the range between the start physical address and the end physical address of the memory block to be released, and the memory block attribute information is used to describe whether the memory block to be released belongs exclusively to the target virtual machine; The memory block whose attribute information is of type 1 is identified as a memory block to be released as a type 1 memory block to be released, wherein the memory block to be released of type 1 is a complete memory block; The memory of the first type of memory block to be released is released by adjusting the refresh configuration parameters of the first type of memory block to be released; The method further includes: determining that the memory block attribute information is a second type of memory block to be released, and completing the memory release and clearing process by writing zeros to the memory address, wherein the second type of memory block to be released is a shared memory block.

2. The memory management method as described in claim 1, wherein releasing the memory of the first type of memory block to be released by adjusting the refresh configuration parameters of the first type of memory block to be released includes: Set the refresh configuration parameters of the first type of memory blocks to be released to disabled, and count the duration of the disabled period; If the duration of the disablement exceeds a preset threshold, the refresh configuration parameter of the first type of memory block to be released is set to enabled, wherein the preset threshold is the data retention duration for the memory block.

3. The memory management method as described in claim 1, wherein in response to the memory release request, at least one memory block to be released corresponding to the target virtual machine is determined, comprising: In response to the memory release request, the physical address range of the virtual machine corresponding to the target virtual machine is determined; The memory block corresponding to the virtual machine's physical address range is determined to be the memory block to be released.

4. The memory management method as described in claim 3, wherein determining the memory block attribute information corresponding to each memory block to be released includes: Determine the target memory block to be released among the at least one memory block to be released; Determine the physical address range of the target memory block to be released; Determine whether there is a memory block physical address in the memory block physical address range that does not belong to the virtual machine physical address range; If not, then the memory block attribute information of the target memory block to be released is determined to be of the first type; If so, the memory block attribute information of the target memory block to be released is determined to be of the second type.

5. The memory management method as described in claim 1, further comprising: The memory block attribute information is determined to be of type 2 and the memory block to be released is classified as a type 2 memory block to be released. Among them, the type 2 memory block to be released is a shared memory block. Obtain the physical address range to be released corresponding to each type 2 memory block to be released; Clear the memory of each physical address range to be released.

6. The memory management method as described in claim 1, further comprising, before receiving a memory release request for the target virtual machine: Receive a memory allocation request for a target virtual machine, wherein the memory allocation request carries memory information to be allocated; Get the number of free memory blocks and their attribute information; The first type of free memory block is allocated to the target virtual machine based on the memory to be allocated information, the number of free memory blocks, and the attribute information of the free memory blocks.

7. A memory management method, comprising: Receive a memory allocation request for a target virtual machine, wherein the memory allocation request carries memory information to be allocated; Get the number of free memory blocks and their attribute information; Based on the unallocated memory information, the number of free memory blocks, and the free memory block attribute information, a first type of free memory block is allocated to the target virtual machine, wherein the first type of free memory block is a complete memory block; when the unallocated memory information is not empty, a second type of memory block is allocated to the target virtual machine based on the unallocated memory information, wherein the unallocated memory information refers to the memory information remaining after the first type of free memory block has been allocated in the unallocated memory information, and the second type of memory block refers to the memory block that has been allocated memory by other virtual machines. When the target virtual machine releases memory, at least one memory block to be released corresponding to the target virtual machine is determined, and the memory block attribute information corresponding to each memory block to be released is determined. Determining the memory block attribute information corresponding to each memory block to be released includes: determining the memory block physical address range of each memory block to be released, and determining whether there is a memory block physical address in the memory block physical address range that does not belong to the physical address range of the target virtual machine. If not, the memory block to be released is of the first type; if yes, the memory block to be released is of the second type. The memory block physical address range refers to the range between the start physical address and the end physical address of the memory block to be released.

8. The memory management method as described in claim 7, wherein the method allocates a first type of free memory block to the target virtual machine based on the memory to be allocated information, the number of free memory blocks, and the attribute information of the free memory blocks, comprising: The number of pre-allocated free memory blocks is determined based on the unallocated memory information and the free memory block attribute information. The first type of free memory blocks are allocated to the target virtual machine based on the number of pre-allocated free memory blocks and the number of free memory blocks.

9. The memory management method as described in claim 8, wherein the method allocates a first type of free memory block to the target virtual machine according to the number of pre-allocated free memory blocks and the number of free memory blocks, comprising: If the number of pre-allocated free memory blocks is less than or equal to the number of free memory blocks, a first type of free memory block is allocated to the target virtual machine according to the number of pre-allocated free memory blocks. If the number of pre-allocated free memory blocks is greater than the number of free memory blocks, then free memory blocks of the first type are allocated to the target virtual machine according to the number of free memory blocks.

10. The memory management method of claim 8, further comprising, after allocating a first type of free memory block to the target virtual machine according to the number of pre-allocated free memory blocks and the number of free memory blocks: Unallocated memory information is determined based on the unallocated memory information and the free memory blocks of the first type; If the unallocated memory information is not empty, allocate a second type of memory block to the target virtual machine based on the unallocated memory information.

11. A memory management device, comprising: The receiving module is configured to receive memory release requests for the target virtual machine; The response module is configured to, in response to the memory release request, determine at least one memory block to be released corresponding to the target virtual machine, and determine memory block attribute information corresponding to each memory block to be released, including: determining the physical address range of each memory block to be released, determining whether there is a memory block physical address in the physical address range that does not belong to the physical address range of the target virtual machine, if not, then the memory block to be released is of type 1, if yes, then the memory block to be released is of type 2, wherein the physical address range of the memory block refers to the range between the start physical address and the end physical address of the memory block to be released, and the memory block attribute information is used to describe whether the memory block to be released is exclusively owned by the target virtual machine; The determination module is configured to determine that memory blocks whose attribute information is of type 1 are memory blocks to be released as type 1 memory blocks to be released, wherein the memory blocks to be released of type 1 are complete memory blocks; The release module is configured to release the memory of the first type of memory block to be released by adjusting the refresh configuration parameters of the first type of memory block to be released; The release module is further configured to determine that the memory block attribute information is a second type of memory block to be released, and to complete the memory release and clearing process by writing zeros to the memory address. The second type of memory block to be released is a shared memory block.

12. A memory management device, comprising: The allocation request receiving module is configured to receive a memory allocation request for a target virtual machine, wherein the memory allocation request carries memory information to be allocated; The information acquisition module is configured to acquire the number of free memory blocks and the attribute information of the free memory blocks; The allocation module is configured to allocate a first type of free memory block to the target virtual machine based on the unallocated memory information, the number of free memory blocks, and the attribute information of the free memory blocks, wherein the first type of free memory block is a complete memory block; when the unallocated memory information is not empty, it allocates a second type of memory block to the target virtual machine based on the unallocated memory information, wherein the unallocated memory information refers to the memory information remaining after the first type of free memory block has been allocated in the unallocated memory information, and the second type of memory block refers to a memory block that has been allocated memory to other virtual machines, and the memory is released by the target virtual machine. In this case, at least one memory block to be released corresponding to the target virtual machine is determined, and the memory block attribute information corresponding to each memory block to be released is determined. The determination of the memory block attribute information corresponding to each memory block to be released includes: determining the physical address range of the memory block to be released, and determining whether there is a memory block physical address in the physical address range that does not belong to the physical address range of the target virtual machine. If not, the memory block to be released is of the first type; if yes, the memory block to be released is of the second type. The physical address range of the memory block refers to the range between the start physical address and the end physical address of the memory block to be released.

13. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the memory management method according to any one of claims 1 to 6 or 7 to 10.

14. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the memory management method according to any one of claims 1 to 6 or 7 to 10.

Citation Information

Patent Citations

  • Method and device for data storage

    CN102446139A

  • Data storage method and device

    CN104598390A

  • Memory allocation method and apparatus

    CN106445835A

  • Memory management method, system and device and readable storage medium

    CN113010453A

  • Data clearing methods and computer systems utilizing the same

    US20060288154A1