CN112925606A - Memory management method, device and equipment - Google Patents

Memory management method, device and equipment Download PDF

Info

Publication number
CN112925606A
CN112925606A CN201911244712.7A CN201911244712A CN112925606A CN 112925606 A CN112925606 A CN 112925606A CN 201911244712 A CN201911244712 A CN 201911244712A CN 112925606 A CN112925606 A CN 112925606A
Authority
CN
China
Prior art keywords
memory address
physical memory
virtual machine
page table
host
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911244712.7A
Other languages
Chinese (zh)
Inventor
郭蔚
吴启翾
韩伟东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201911244712.7A priority Critical patent/CN112925606A/en
Publication of CN112925606A publication Critical patent/CN112925606A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Abstract

The application provides a memory management method, a device and equipment, wherein the method comprises the following steps: receiving a capacity reduction request aiming at a virtual machine memory; determining a physical memory address of the virtual machine to be reduced according to the capacity reduction request; and operating the physical memory address of the virtual machine in the access page table so as to forbid accessing the physical memory address of the virtual machine according to the access page table when external equipment accesses the memory of the virtual machine. Through the technical scheme, the coexistence of the device direct-connection technology and the memory expansion technology can be realized.

Description

Memory management method, device and equipment
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method, an apparatus, and a device for memory management.
Background
Virtual machines (Virtual machines) can be simulated on a physical computer by Virtual Machine software, and the Virtual machines can work exactly like real computers, for example, an operating system can be installed, application programs can be installed, network resources can be accessed, and the like. A virtual machine is an application running on a physical computer, but for applications running in a virtual machine, a virtual machine is a real computer.
With the rapid development of virtual machine technology, more and more virtual machine-related technologies are available, and the memory scaling technology and the device pass-through technology are technologies for virtual machine memory. The memory expansion and contraction technology is as follows: the memory of the virtual machine may be released to a host (the physical computer where the virtual machine is located is referred to as a host) for use, or the memory of the host may be used by the virtual machine, so as to implement the scaling of the memory of the virtual machine. The equipment direct connection technology is as follows: the external devices (such as network cards, hard disks and the like) can directly access the memory of the virtual machine, so that data interaction with the virtual machine is avoided, and a data transmission path is shortened.
However, the coexistence of the device pass-through technology and the memory scaling technology cannot be realized at present. If the device pass-through technology is used for the virtual machine memory, the memory scaling technology cannot be used for the virtual machine memory, and if the memory scaling technology is used for the virtual machine memory, the device pass-through technology cannot be used for the virtual machine memory.
Disclosure of Invention
The application provides a memory management method, which comprises the following steps:
receiving a capacity reduction request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be reduced according to the capacity reduction request;
and operating the physical memory address of the virtual machine in the access page table so as to forbid accessing the physical memory address of the virtual machine according to the access page table when external equipment accesses the memory of the virtual machine.
The application provides a memory management method, which comprises the following steps:
receiving a capacity expansion request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be expanded according to the expansion request;
and operating the physical memory address of the virtual machine in the access page table so as to allow the external equipment to access the physical memory address of the virtual machine according to the access page table when the external equipment accesses the memory of the virtual machine.
The application provides a memory management method, which comprises the following steps:
receiving a telescopic request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be stretched according to the stretching request;
and operating the physical memory address of the virtual machine in the access page table so as to prevent the physical memory address of the virtual machine from being accessed according to the access page table or allow the physical memory address of the virtual machine to be accessed according to the access page table when the external equipment accesses the physical memory of the virtual machine.
The application provides a memory management method, which comprises the following steps:
receiving a telescopic request aiming at a host machine memory;
determining a host machine physical memory address required to be stretched according to the stretching request;
and operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
The application provides a memory management method, which comprises the following steps:
receiving a capacity expansion request aiming at a host machine memory;
determining a host machine physical memory address needing capacity expansion according to the capacity expansion request;
and operating the physical memory address of the host machine in the access page table so as to forbid accessing the physical memory address of the host machine according to the access page table when the external equipment accesses the memory of the virtual machine.
The application provides a memory management method, which comprises the following steps:
receiving a capacity reduction request aiming at a host machine memory;
determining a host machine physical memory address needing to be reduced according to the capacity reduction request;
and operating the physical memory address of the host machine in the access page table so as to allow the external equipment to access the physical memory address of the host machine according to the access page table when the external equipment accesses the memory of the virtual machine.
The application provides a memory management device, the device includes:
the receiving module is used for receiving a telescopic request aiming at the memory of the virtual machine;
the determining module is used for determining the physical memory address of the virtual machine to be stretched according to the stretching request;
and the processing module is used for operating the physical memory address of the virtual machine in the access page table so as to prohibit the access to the physical memory address of the virtual machine according to the access page table or permit the access to the physical memory address of the virtual machine according to the access page table when the external equipment accesses the physical memory of the virtual machine.
The application provides a memory management device, the device includes:
the receiving module is used for receiving a telescopic request aiming at the memory of the host machine;
the determining module is used for determining the physical memory address of the host machine needing to be stretched according to the stretching request;
and the processing module is used for operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
The application provides a memory management device, including:
a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs:
receiving a telescopic request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be stretched according to the stretching request;
and operating the physical memory address of the virtual machine in the access page table so as to prevent the physical memory address of the virtual machine from being accessed according to the access page table or allow the physical memory address of the virtual machine to be accessed according to the access page table when the external equipment accesses the physical memory of the virtual machine.
The application provides a memory management device, including:
a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs:
receiving a telescopic request aiming at a host machine memory;
determining a host machine physical memory address required to be stretched according to the stretching request;
and operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
Based on the above technical solutions, in the embodiments of the present application, coexistence of a device pass-through technology and a memory scaling technology can be achieved, that is, when the device pass-through technology is used for a virtual machine memory, the memory scaling technology can also be used for the virtual machine memory, or when the memory scaling technology is used for the virtual machine memory, the device pass-through technology can also be used for the virtual machine memory. The above method can simultaneously achieve the effects of the memory expansion and contraction technology and the effects of the device direct connection technology, for example, the expansion and contraction of the memory of the virtual machine are achieved, the external device can directly access the memory of the virtual machine, the data interaction with the virtual machine is avoided, and the data transmission path is shortened.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments of the present application or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings of the embodiments of the present application.
FIG. 1 is a schematic diagram of an application scenario in an embodiment of the present application;
FIG. 2 is a flow chart illustrating a memory management method according to an embodiment of the present disclosure;
fig. 3 is a schematic flow chart of a memory management method according to another embodiment of the present application;
fig. 4 is a schematic flow chart illustrating a memory management method according to another embodiment of the present application;
fig. 5 is a schematic flow chart of a memory management method according to another embodiment of the present application;
fig. 6 is a schematic structural diagram of a memory management device according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a memory management device according to an embodiment of the present application.
Detailed Description
The terminology used in the embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein is meant to encompass any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used in the embodiments of the present application to describe various information, the information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Depending on the context, moreover, the word "if" as used may be interpreted as "at … …" or "when … …" or "in response to a determination".
Referring to fig. 1, which is a schematic view of an application scenario of the embodiment of the present application, a host 10 (i.e., a physical computer) may include a virtual machine 11, an external device 12, a memory management unit 13, and a virtual machine management unit 14, where 1 virtual machine is taken as an example in fig. 1, and in actual application, the number of virtual machines may be greater than 1.
The virtual machine 11 is an application program running on the host 10, and as for the application program running in the virtual machine 11, the virtual machine 11 is a real computer, and the virtual machine 11 may install an operating system, install the application program, access network resources, and the like, and this embodiment does not limit the functions of the virtual machine 11.
The external device 12 (peripheral for short) is a generic name of an input device and an output device in a computer system, and is an important component of the computer system, such as a network card, various memories (such as a hard disk memory, a removable memory, an optical memory, and the like), a display, a keyboard, a mouse, and the like, and the external device 12 is not limited thereto.
The Memory Management Unit 13 may be an IOMMU (Input Output Memory Management Unit), and the Memory Management Unit 13 can manage an access page table (e.g., a page table) for recording a mapping relationship between a virtual machine physical Memory address and a host machine physical Memory address. When the external device 12 accesses the memory of the virtual machine 11, the external device 12 sends an access request for a physical memory address a of a certain virtual machine to the memory management unit 13, and the memory management unit 13 determines a host physical memory address B corresponding to the physical memory address a of the virtual machine according to the access page table, so that the external device 12 directly accesses the host physical memory address B, and the memory of the virtual machine 11 can be directly accessed.
The virtual machine management unit 14 is configured to implement management of a virtual machine, and the virtual machine management unit 14 may be software for managing the virtual machine, or may be hardware for managing the virtual machine, which is not limited to this. For example, the hypervisor management unit 14 may be a hypervisor, which is a "meta" operating system running in a Virtual environment, and may also be referred to as a VMM (Virtual Machine Monitor).
The memory expansion and contraction technology is as follows: the memory of the virtual machine 11 is released to the host machine 10 for use, or the memory of the host machine 10 is used by the virtual machine 11, so that the memory of the virtual machine is expanded and contracted.
The equipment direct connection technology is as follows: the external device 12 directly accesses the memory of the virtual machine 11, avoids data interaction with the virtual machine 11, and shortens a data transmission path. Specifically, the external device 12 can obtain the virtual machine physical memory address of the virtual machine 11, when the external device 12 needs to access the virtual machine physical memory address a of the virtual machine 11, an access request for the virtual machine physical memory address a may be sent to the memory management unit 13, and the memory management unit 13 determines the host machine physical memory address B corresponding to the virtual machine physical memory address a according to the access page table, so that the external device 12 directly accesses the host machine physical memory address B. In the above process, the external device 12 does not need to send data to the virtual machine 11, but directly accesses the memory of the virtual machine 11, thereby bypassing the trapping of the virtual machine with huge performance cost.
However, the coexistence of the device pass-through technology and the memory scaling technology cannot be realized at present. For example, based on the memory scaling technique, the virtual machine physical memory address a of the virtual machine 11 is released to the host 10 for use, and the external device 12 can access all the memory of the virtual machine 11, so that an access exception occurs when the external device 12 accesses the virtual machine physical memory address a of the virtual machine 11.
In view of the above findings, an embodiment of the present application provides a memory management method, which can implement coexistence of a device pass-through technology and a memory scaling technology, and break through a limitation that the device pass-through technology and the memory scaling technology cannot coexist. In application scenarios such as a hybrid portion of a virtual machine, the memory of the virtual machine can still be extended and retracted on the premise that external devices (such as a network card) are directly connected to the memory of the virtual machine. Wherein, virtual machine mixes the portion and indicates: a plurality of virtual machines are deployed on the same host machine, the virtual machines have different load peak values, the memory of the low-load virtual machine can be reduced in a specific time period, and the released memory is handed to the high-load virtual machine or the host machine for use.
The following describes a memory management method according to an embodiment of the present application with reference to several specific embodiments.
Example 1: referring to fig. 2, a flowchart of a memory management method is shown, where the method may include:
step 201, a capacity reduction request for a virtual machine memory is received.
Step 202, determining the physical memory address of the virtual machine to be reduced according to the reduction request.
Step 203, operating the virtual machine physical memory address in the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is prohibited according to the access page table.
In one example, an un-mapped request for the virtual machine physical memory address may be sent to a memory management unit, which may include the virtual machine physical memory address, to cause the memory management unit to operate on the virtual machine physical memory address in an access page table according to the un-mapped request.
In one example, the operation on the virtual machine physical memory address in the access page table may include, but is not limited to: and deleting the virtual machine physical memory address from the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address can be prohibited because the virtual machine physical memory address does not exist in the access page table. Or, adding a prohibition flag to the virtual machine physical memory address in the access page table, where the prohibition flag is used to indicate that access to the virtual machine physical memory address is prohibited, so that when an external device accesses a virtual machine memory, since the virtual machine physical memory address corresponds to the prohibition flag, access to the virtual machine physical memory address can be prohibited.
In an example, the execution sequence is only an example given for convenience of description, and in practical applications, the execution sequence between steps may also be changed, and the execution sequence is not limited. Moreover, in other embodiments, the steps of the respective methods do not have to be performed in the order shown and described herein, and the methods may include more or less steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Based on the above technical solution, in the embodiment of the present application, coexistence of the device direct connection technology and the memory scaling technology can be achieved, and an effect of the memory scaling technology and an effect of the device direct connection technology can be simultaneously achieved, for example, scaling of a memory of a virtual machine can be achieved, and an external device can directly access the memory of the virtual machine.
Example 2: referring to fig. 3, a flowchart of a memory management method is shown, where the method may include:
step 301, receiving a capacity expansion request for a virtual machine memory.
Step 302, determining the physical memory address of the virtual machine that needs to be expanded according to the expansion request.
Step 303, when the access page table operates the virtual machine physical memory address, so that the external device accesses the virtual machine memory, the access page table allows the virtual machine physical memory address to be accessed.
In one example, after step 302, a host physical memory address can also be determined from the virtual machine physical memory address. Based on this, in step 303, the mapping relationship between the virtual machine physical memory address and the host machine physical memory address may be added to the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is allowed according to the access page table.
In one example, a mapping request may be sent to a memory management unit, where the mapping request may include the virtual machine physical memory address and the host machine physical memory address, so that the memory management unit adds a mapping relationship between the virtual machine physical memory address and the host machine physical memory address in an access page table according to the mapping request. Furthermore, since the access page table includes the mapping relationship between the virtual machine physical memory address and the host machine physical memory address, when the external device accesses the virtual machine memory, the virtual machine physical memory address exists in the access page table, so that the virtual machine physical memory address can be accessed.
In one example, determining the host physical memory address from the virtual machine physical memory address may include, but is not limited to: and determining a virtual memory address according to the virtual machine physical memory address, and determining a host machine physical memory address according to the virtual memory address, wherein the determination mode is not limited.
In an example, the execution sequence is only an example given for convenience of description, and in practical applications, the execution sequence between steps may also be changed, and the execution sequence is not limited. Moreover, in other embodiments, the steps of the respective methods do not have to be performed in the order shown and described herein, and the methods may include more or less steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Based on the above technical solution, in the embodiment of the present application, coexistence of the device direct connection technology and the memory scaling technology can be achieved, and an effect of the memory scaling technology and an effect of the device direct connection technology can be simultaneously achieved, for example, scaling of a memory of a virtual machine can be achieved, and an external device can directly access the memory of the virtual machine.
Example 3: referring to fig. 4, a flowchart of a memory management method is shown, where the method may include:
step 401, receive a scaling request for a virtual machine memory.
Step 402, determining the physical memory address of the virtual machine to be extended according to the extension request.
Step 403, when the access page table operates on the virtual machine physical memory address, so that the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is prohibited according to the access page table, or the access to the virtual machine physical memory address is permitted according to the access page table.
In one example, if the scaling request is used to scale the virtual machine memory, in step 403, the virtual machine physical memory address may be operated in the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is prohibited according to the access page table.
Specifically, the virtual machine physical memory address is deleted from the access page table, so that when the external device accesses the virtual machine memory, since the virtual machine physical memory address does not exist in the access page table, the virtual machine physical memory address can be prohibited from being accessed. Or, adding a prohibition flag to the virtual machine physical memory address in the access page table, where the prohibition flag is used to indicate that access to the virtual machine physical memory address is prohibited, so that when an external device accesses a virtual machine memory, since the virtual machine physical memory address corresponds to the prohibition flag, access to the virtual machine physical memory address can be prohibited.
In one example, if the scaling request is used to expand the virtual machine memory, in step 403, the virtual machine physical memory address may be operated in the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is allowed according to the access page table.
Specifically, the host physical memory address may be determined according to the virtual machine physical memory address, and the mapping relationship between the virtual machine physical memory address and the host physical memory address is added to the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is allowed according to the access page table. Therefore, when the external device accesses the virtual machine memory, the virtual machine physical memory address exists in the access page table, so that the virtual machine physical memory address can be accessed.
In one example, determining the host physical memory address from the virtual machine physical memory address may include, but is not limited to: and determining a virtual memory address according to the virtual machine physical memory address, and determining a host machine physical memory address according to the virtual memory address, wherein the determination mode is not limited.
In an example, the execution sequence is only an example given for convenience of description, and in practical applications, the execution sequence between steps may also be changed, and the execution sequence is not limited. Moreover, in other embodiments, the steps of the respective methods do not have to be performed in the order shown and described herein, and the methods may include more or less steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Based on the above technical solution, in the embodiment of the present application, coexistence of the device direct connection technology and the memory scaling technology can be achieved, and an effect of the memory scaling technology and an effect of the device direct connection technology can be simultaneously achieved, for example, scaling of a memory of a virtual machine can be achieved, and an external device can directly access the memory of the virtual machine.
Example 4: referring to fig. 5, a flowchart of a memory management method is shown, where the method may include:
step 501, the hypervisor receives a scaling request for the virtual machine memory, determines a virtual machine physical memory address to be scaled according to the scaling request, and records the virtual machine physical memory address as a virtual machine physical memory address X.
In this embodiment, management of a virtual machine by a hypervisor (also referred to as a VMM) is taken as an example.
In this embodiment, after the hypervisor receives the scaling request, the scaling request may carry a physical memory address X of the virtual machine that needs to be scaled, and the physical memory address X of the virtual machine is determined according to the scaling request.
Step 502, the hypervisor determines whether the scaling request is used to scale the virtual machine memory or to scale the virtual machine memory. If the scaling request is for scaling the memory of the virtual machine, the scaling request is a scaling request for the memory of the virtual machine, and step 503 is executed. If the scaling request is for expanding the virtual machine memory, the scaling request is an expansion request for the virtual machine memory, and step 504 is executed.
In step 503, the hypervisor deletes the virtual machine physical memory address X from the access page table, that is, deletes the virtual machine physical memory address X from the access page table for the access page table of the memory management unit.
In one example, if the hypervisor is capable of operating on the memory management unit's access page table, the hypervisor deletes the virtual machine physical memory address X directly from the access page table. If the hypervisor cannot operate on the access page table of the memory management unit, the hypervisor sends an unmapped request (unmap request) to the memory management unit, where the unmapped request includes the virtual machine physical memory address X. The memory management unit may delete virtual machine physical memory address X from the access page table upon receiving the unmapped request.
For example, an unmap method based on the extended memory management unit may extend a message type, i.e. an unmapped request, between the hypervisor and the memory management unit. When the hypervisor shrinks the virtual machine physical memory address X, sending an un-mapped request to the memory management unit, wherein the un-mapped request comprises the virtual machine physical memory address X. After receiving the unmapped request, the memory management unit needs to rewrite the access page table (page table), i.e. delete the virtual machine physical memory address X from the access page table. Therefore, the virtual machine physical memory address X does not exist in the access page table, and the external equipment is prevented from accessing the virtual machine physical memory address X.
In the device direct connection process, when an external device needs to access a virtual machine physical memory address A of a virtual machine, an access request aiming at the virtual machine physical memory address A is sent to a memory management unit, and the memory management unit determines a host machine physical memory address B corresponding to the virtual machine physical memory address A according to an access page table, so that the external device directly accesses the host machine physical memory address B. When the external device needs to access the virtual machine physical memory address X of the virtual machine, an access request aiming at the virtual machine physical memory address X is sent to the memory management unit. Since the virtual machine physical memory address X does not exist in the access page table, the memory management unit cannot determine the host machine physical memory address corresponding to the virtual machine physical memory address X, and therefore, the external device is prohibited from accessing the virtual machine physical memory address X. Obviously, the above method can make the external device unable to access the virtual machine physical memory address X, and effectively isolate the virtual machine physical memory address X from the external device.
Illustratively, the page table is accessed to record a mapping relationship between a physical memory address of the virtual machine and a physical memory address of the host machine, where the physical memory address of the virtual machine is the physical memory address of the virtual machine, and the physical memory address of the host machine is the physical memory address of the host machine. For example, the physical memory address of the host is 1-1000, and if 101-. In the operation process of the virtual machine, when the operation is performed on the physical memory address 1 of the virtual machine, the physical memory address 101 of the host is actually operated.
Because the access page table records the mapping relationship between the virtual machine physical memory address and the host machine physical memory address, the memory management unit can determine the host machine physical memory address corresponding to the virtual machine physical memory address according to the access page table, so that the external device directly accesses the host machine physical memory address.
For example, since the access page table records the mapping relationship between the virtual machine physical memory address and the host machine physical memory address, when the virtual machine physical memory address X is deleted from the access page table, the mapping relationship between the virtual machine physical memory address X and the host machine physical memory address may be deleted from the access page table.
Illustratively, the virtual machine physical memory address X may be a virtual machine physical memory address range, such as virtual machine physical memory addresses 1-10. For example, the virtual machine physical memory address X may be a virtual machine physical memory page X, and the virtual machine physical memory page X may include a virtual machine physical memory address interval.
In an example, if the scaling request is used to scale the memory of the virtual machine, the hypervisor may further release the physical memory address X of the virtual machine, and return the physical memory address X of the virtual machine to the host for use, without limitation to the process of scaling the memory of the virtual machine. And ending the memory expansion process.
In the above embodiment, when performing capacity reduction on the virtual machine memory, the unmapped request may be used to synchronize the virtual machine physical memory address X to the memory management unit, so that the memory management unit deletes the virtual machine physical memory address X from the access page table, and such a mechanism enables the memory scaling and the device pass-through to coexist.
To implement the above process, the IOMMU interface may be extended, i.e., a new IOMMU interface (at the host level) is extended, which is used to implement the interaction of hypervisor with the IOMMU (i.e., the memory management unit), such as the above-mentioned unmapped request is based on the message of the IOMMU interface.
Illustratively, based on the unmapped request of the IOMMU interface, the IOVA (Input Output virtual address) region (range) can be dynamically partitioned, and the IOVA corresponds to the virtual machine physical memory address. Assuming the IOVA region is [0x40000, 0x70000], when the unmapped request based on the IOMMU interface includes (0x50000, 0x60000), then the IOVA region may be split into: [0x40000, 0x50000] and [0x60000, 0x70000], and update the access page table accordingly.
In summary, in the context of memory reduction in the virtual machine, based on the unmapped request of the IOMMU interface, the IOVA area can be dynamically partitioned, page table update is accessed, and the IOVA area of the external device is effectively managed.
In step 504, the hypervisor determines a virtual memory address Y according to the virtual machine physical memory address X.
In step 505, the hypervisor determines the host physical memory address Z according to the virtual memory address Y.
In one example, the hypervisor does not record the mapping relationship between the physical memory address of the virtual machine and the physical memory address of the host machine, but records the mapping relationship between the physical memory address of the virtual machine and the virtual memory address and the mapping relationship between the physical memory address of the virtual machine and the physical memory address of the host machine, so that the hypervisor can determine the virtual memory address Y corresponding to the physical memory address X of the virtual machine according to the mapping relationship between the physical memory address of the virtual machine and the virtual memory address. The hypervisor can determine the host physical memory address Z corresponding to the virtual memory address Y according to the mapping relationship between the virtual memory address and the host physical memory address.
Of course, the above-mentioned manner based on the virtual memory address Y is only an example, and the host physical memory address Z corresponding to the virtual machine physical memory address X may also be determined in other manners, which is not limited to this, as long as the host physical memory address Z corresponding to the virtual machine physical memory address X can be determined.
Illustratively, the virtual memory address Y may be a virtual memory address of a hypervisor process.
In step 506, the hypervisor adds the mapping relationship between the virtual machine physical memory address X and the host machine physical memory address Z in the access page table, that is, adds the mapping relationship between the virtual machine physical memory address X and the host machine physical memory address Z in the access page table for the access page table of the memory management unit.
In one example, if the hypervisor is capable of operating on the page table of the memory management unit, the hypervisor directly adds the mapping relationship between the virtual machine physical memory address X and the host machine physical memory address Z in the page table. If the hypervisor cannot operate the access page table of the memory management unit, the hypervisor sends a mapping request (map request) to the memory management unit, where the mapping request includes a virtual machine physical memory address X and a host machine physical memory address Z. After receiving the mapping request, the memory management unit adds a mapping relation between the virtual machine physical memory address X and the host machine physical memory address Z in the access page table.
For example, based on the map method of the memory management unit extension, a message type, i.e. a mapping request, may be extended between the hypervisor and the memory management unit. When the hypervisor expands the virtual machine physical memory address X, a mapping request is sent to the memory management unit, wherein the mapping request comprises the virtual machine physical memory address X and a host machine physical memory address Z. After receiving the mapping request, the memory management unit needs to rewrite an access page table (page table), that is, add a mapping relationship between a virtual machine physical memory address X and a host machine physical memory address Z in the access page table. In this way, the virtual machine physical memory address X and the host machine physical memory address Z exist in the access page table, enabling the external device to access the virtual machine physical memory address X.
In the device direct connection process, when the external device needs to access the virtual machine physical memory address X of the virtual machine, an access request aiming at the virtual machine physical memory address X is sent to the memory management unit. Because the virtual machine physical memory address X exists in the access page table, the memory management unit can determine the host machine physical memory address Z corresponding to the virtual machine physical memory address X, so that the external device directly accesses the host machine physical memory address Z. Obviously, the above manner enables the external device to access the virtual machine physical memory address X.
Illustratively, the virtual machine physical memory address X may be a virtual machine physical memory address range, such as virtual machine physical memory addresses 1-10. For example, the virtual machine physical memory address X may be a virtual machine physical memory page X, and the virtual machine physical memory page X may include a virtual machine physical memory address interval. Similarly, the host physical memory address Z corresponding to the virtual machine physical memory address X is also a host physical memory address interval, for example, the host physical memory addresses 101-110 corresponding to the virtual machine physical memory addresses 1-10.
In an example, if the scaling request is used to expand the memory of the virtual machine, the hypervisor may also allocate the physical memory address X of the virtual machine to the virtual machine for use, and thus, the memory scaling process is ended.
In the above embodiment, when the virtual machine memory is expanded, the hypervisor may synchronize the mapping relationship between the virtual machine physical memory address X and the host machine physical memory address Z to the memory management unit by using the mapping request, so that the memory management unit adds the mapping relationship between the virtual machine physical memory address X and the host machine physical memory address Z in the access page table, and such a mechanism enables the memory expansion and the device pass-through to coexist.
To implement the above process, the IOMMU interface may be extended, i.e., a new IOMMU interface (at the host level) is extended, and the IOMMU interface is used to implement interaction between hypervisor and IOMMU (i.e., memory management unit), such as the mapping request is based on the IOMMU interface message.
Illustratively, the scattered IOVA regions (which may also be referred to as DMA regions) may be dynamically merged based on the mapping requests of the IOMMU interface. Assuming that the IOVA regions are [0x40000, 0x50000] and [0x60000, 0x70000], when the mapping request based on the IOMMU interface includes (0x50000, 0x60000), the IOVA regions may be merged into [0x40000, 0x70000] and the access page table is updated accordingly.
In summary, in the virtual machine memory expansion scenario, based on the mapping request of the IOMMU interface, the IOVA region can be merged, so that the page table is accessed for updating, and the IOVA region of the external device is effectively managed. And the fragments of the IOVA area are reduced by bringing the physical memory address released by the host machine into the IOMMU management again.
In one example, the hypervisor may be QEMU (i.e., virtualization emulator) for a virtualization solution for KVM (Keyboard Video Mouse). For the memory scaling technology of the balloon virtual machine, the scaling request may be a balloon scaling request. Of course, the QEMU and balloon scaling requests are also only an example, and are not limited thereto.
In an example, the execution sequence is only an example given for convenience of description, and in practical applications, the execution sequence between steps may also be changed, and the execution sequence is not limited. Moreover, in other embodiments, the steps of the respective methods do not have to be performed in the order shown and described herein, and the methods may include more or less steps than those described herein. Moreover, a single step described in this specification may be broken down into multiple steps for description in other embodiments; multiple steps described in this specification may be combined into a single step in other embodiments.
Based on the above technical solution, in the embodiment of the present application, coexistence of the device direct connection technology and the memory scaling technology can be achieved, and an effect of the memory scaling technology and an effect of the device direct connection technology can be simultaneously achieved, for example, scaling of a memory of a virtual machine can be achieved, and an external device can directly access the memory of the virtual machine.
In the above embodiments, the scaling request, the capacity expansion request, and the capacity reduction request are for the virtual machine memory, and the capacity reduction request for the virtual machine memory refers to releasing the virtual machine memory to the host, that is, when the external device accesses the virtual machine memory, access to the physical memory address of the virtual machine that is being reduced is prohibited. The capacity expansion request for the memory of the virtual machine refers to providing the memory of the host machine to the virtual machine, that is, when the external device accesses the memory of the virtual machine, the physical memory address of the virtual machine which is subjected to capacity expansion is allowed to be accessed.
In another possible implementation, the expansion request, the capacity expansion request, and the capacity reduction request may also be for a host machine memory, and the capacity expansion request for the host machine memory refers to releasing the virtual machine memory to the host machine, that is, increasing the host machine memory, that is, when the external device accesses the virtual machine memory, the external device prohibits access to the expanded host machine physical memory address (the host machine physical memory address is released from the virtual machine memory, and therefore, when the external device accesses the virtual machine memory, the external device prohibits access).
In addition, the capacity reduction request for the host machine memory refers to providing the host machine memory to the virtual machine, that is, reducing the host machine memory to the virtual machine, that is, when the external device accesses the virtual machine memory, allowing access to the physical memory address of the reduced host machine (the physical memory address of the host machine is provided to the virtual machine memory, so that the external device allows access when accessing the virtual machine memory).
The following describes a process for the host memory with reference to several embodiments.
Example 5: the memory management method of the embodiment of the application can be realized by adopting the following steps:
step a1, receiving a capacity expansion request aiming at the memory of the host machine.
Step a2, determining the host physical memory address to be expanded according to the expansion request.
Step a3, operating the host physical memory address in the access page table, so that when the external device accesses the virtual machine memory, the access to the host physical memory address is prohibited according to the access page table.
In one example, an unmapped request for the host physical memory address may be sent to a memory management unit, where the unmapped request may include the host physical memory address, so that the memory management unit operates on the host physical memory address in an access page table according to the unmapped request.
In one example, the operation on the host physical memory address in the access page table may include, but is not limited to: and deleting the host machine physical memory address from the access page table, so that when the external equipment accesses the virtual machine memory, the access to the host machine physical memory address can be forbidden because the host machine physical memory address does not exist in the access page table. Or adding a prohibition flag to the host physical memory address in the access page table, where the prohibition flag is used to indicate that access to the host physical memory address is prohibited, so that when an external device accesses a virtual machine memory, since the host physical memory address corresponds to the prohibition flag, access to the host physical memory address can be prohibited.
Example 6: the memory management method of the embodiment of the application can be realized by adopting the following steps:
and b1, receiving a capacity reduction request aiming at the host machine memory.
And b2, determining the host machine physical memory address needing to be reduced according to the reduction request.
And b3, operating the host machine physical memory address in the access page table, so that when the external device accesses the virtual machine memory, the access page table allows the access to the host machine physical memory address.
In one example, after step b2, the virtual machine physical memory address can also be determined according to the host machine physical memory address. Based on this, in step b3, the mapping relationship between the host physical memory address and the virtual machine physical memory address may be added to the access page table, so that when an external device accesses the virtual machine memory, the host physical memory address is allowed to be accessed according to the access page table.
In one example, a mapping request may be sent to a memory management unit, where the mapping request may include the virtual machine physical memory address and the host machine physical memory address, so that the memory management unit adds a mapping relationship between the virtual machine physical memory address and the host machine physical memory address in an access page table according to the mapping request. Furthermore, since the access page table includes the mapping relationship between the virtual machine physical memory address and the host machine physical memory address, when the external device accesses the virtual machine memory, the host machine physical memory address exists in the access page table, so that the host machine physical memory address can be accessed.
In one example, determining the virtual machine physical memory address according to the host machine physical memory address may include, but is not limited to: and determining a virtual memory address according to the host machine physical memory address, and determining a virtual machine physical memory address according to the virtual memory address, wherein the determination mode is not limited.
Example 7: the memory management method of the embodiment of the application can be realized by adopting the following steps:
and c1, receiving a scaling request aiming at the memory of the host machine.
And c2, determining the host machine physical memory address required to be stretched according to the stretching request.
And c3, operating the host physical memory address in the access page table, so that when the external device accesses the virtual machine memory, the access to the host physical memory address is prohibited according to the access page table, or the access to the host physical memory address is permitted according to the access page table.
In one example, if the scaling request is for the host memory, in step c3, the host physical memory address may be operated in the access page table, so that when the external device accesses the virtual machine memory, the access to the host physical memory address is prohibited according to the access page table.
Specifically, the host physical memory address is deleted from the access page table, so that when the external device accesses the virtual machine memory, the access to the host physical memory address can be prohibited because the host physical memory address does not exist in the access page table. Or adding a prohibition flag to the host physical memory address in the access page table, where the prohibition flag is used to indicate that access to the host physical memory address is prohibited, so that when an external device accesses a virtual machine memory, since the host physical memory address corresponds to the prohibition flag, access to the host physical memory address can be prohibited.
In one example, if the scaling request is for the host memory, then in step c3, the host physical memory address may be operated on in the access page table, so that when the external device accesses the virtual machine memory, the access to the host physical memory address is allowed according to the access page table.
Specifically, the physical memory address of the virtual machine may be determined according to the physical memory address of the host, and the mapping relationship between the physical memory address of the virtual machine and the physical memory address of the host is added to the access page table, so that when the external device accesses the physical memory of the virtual machine, the physical memory address of the host is allowed to be accessed according to the access page table. Therefore, when the external device accesses the virtual machine memory, the host machine physical memory address exists in the access page table, so that the host machine physical memory address can be accessed.
In one example, determining the virtual machine physical memory address from the host machine physical memory address may include, but is not limited to: and determining a virtual memory address according to the host machine physical memory address, and determining a virtual machine physical memory address according to the virtual memory address, wherein the determination mode is not limited.
For example, the implementation processes of embodiments 5 to 7 are similar to those of embodiments 1 to 4, except that the expansion request, and the contraction request are for a host machine memory, but not for a virtual machine memory, the expansion request for the host machine memory corresponds to the contraction request for the virtual machine memory, and the contraction request for the host machine memory corresponds to the expansion request for the virtual machine memory, and details are not repeated here.
Based on the same application concept as the method described above, an embodiment of the present application further provides a memory management device, as shown in fig. 6, which is a structural diagram of the memory management device, where the memory management device includes:
a receiving module 61, configured to receive a scaling request for a virtual machine memory;
a determining module 62, configured to determine, according to the scaling request, a physical memory address of the virtual machine that needs to be scaled;
the processing module 63 is configured to operate the virtual machine physical memory address in the access page table, so that when the external device accesses the virtual machine memory, the access to the virtual machine physical memory address is prohibited according to the access page table, or the access to the virtual machine physical memory address is permitted according to the access page table.
If the scaling request is used to perform the capacity reduction on the virtual machine memory, the processing module 63 operates the virtual machine physical memory address in the access page table, so as to prohibit the access to the virtual machine physical memory address according to the access page table, and specifically is configured to: deleting the virtual machine physical memory address from the access page table; or adding a prohibition mark for the virtual machine physical memory address in the access page table, where the prohibition mark is used to indicate that access to the virtual machine physical memory address is prohibited.
If the scaling request is used to perform the capacity reduction on the virtual machine memory, the processing module 63 is specifically configured to, when the processing module accesses the page table to operate the virtual machine physical memory address: sending an un-mapping request aiming at the physical memory address of the virtual machine to a memory management unit so that the memory management unit operates the physical memory address of the virtual machine in an access page table according to the un-mapping request.
If the expansion request is used to expand the virtual machine memory, the processing module 63 operates the virtual machine physical memory address in the access page table, so as to allow access to the virtual machine physical memory address according to the access page table, and specifically is configured to: and determining a host machine physical memory address according to the virtual machine physical memory address, and adding a mapping relation between the virtual machine physical memory address and the host machine physical memory address in the access page table so as to allow the virtual machine physical memory address to be accessed according to the access page table.
If the scaling request is used to expand the memory of the virtual machine, the processing module 63 is specifically configured to, when adding the mapping relationship between the physical memory address of the virtual machine and the physical memory address of the host machine to the access page table: sending a mapping request to a memory management unit, wherein the mapping request comprises the virtual machine physical memory address and the host machine physical memory address, so that the memory management unit adds the mapping relation between the virtual machine physical memory address and the host machine physical memory address in an access page table according to the mapping request.
In one example, when determining the host physical memory address according to the virtual machine physical memory address, the processing module 63 is specifically configured to: determining a virtual memory address according to the physical memory address of the virtual machine; and determining the physical memory address of the host machine according to the virtual memory address.
Based on the same application concept as the method, an embodiment of the present application further provides a memory management device, including: a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions being capable of implementing the method described above.
For example, the processor, when executing the computer instructions, performs the following:
receiving a telescopic request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be stretched according to the stretching request;
and operating the physical memory address of the virtual machine in the access page table so as to prevent the physical memory address of the virtual machine from being accessed according to the access page table or allow the physical memory address of the virtual machine to be accessed according to the access page table when the external equipment accesses the physical memory of the virtual machine.
The embodiment of the application also provides a machine-readable storage medium, wherein a plurality of computer instructions are stored on the machine-readable storage medium; the computer instructions when executed perform the following:
receiving a telescopic request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be stretched according to the stretching request;
and operating the physical memory address of the virtual machine in the access page table so as to prevent the physical memory address of the virtual machine from being accessed according to the access page table or allow the physical memory address of the virtual machine to be accessed according to the access page table when the external equipment accesses the physical memory of the virtual machine.
Based on the same application concept as the method, an embodiment of the present application further provides a memory management device, where the memory management device includes: the receiving module is used for receiving a telescopic request aiming at the memory of the host machine;
the determining module is used for determining the physical memory address of the host machine needing to be stretched according to the stretching request;
and the processing module is used for operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
For example, if the scaling request is used to expand the host memory, the processing module operates the host physical memory address in the access page table to prohibit access to the host physical memory address according to the access page table, and specifically is configured to: deleting the host physical memory address from the page table; or adding a prohibition tag for the host machine physical memory address in the access page table, where the prohibition tag is used to indicate that access to the host machine physical memory address is prohibited.
If the scaling request is used for scaling the host memory, the processing module operates the host physical memory address in the page table for access, so as to allow access to the host physical memory address according to the page table for access, and is specifically configured to: and determining a physical memory address of a virtual machine according to the physical memory address of the host machine, and adding a mapping relation between the physical memory address of the host machine and the physical memory address of the virtual machine in the access page table.
The processing module is specifically configured to, when determining the physical memory address of the virtual machine according to the physical memory address of the host machine: determining a virtual memory address according to the host machine physical memory address; and determining the physical memory address of the virtual machine according to the virtual memory address.
Based on the same application concept as the method, an embodiment of the present application further provides a memory management device, including: a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions being capable of implementing the method described above.
For example, the processor, when executing the computer instructions, performs the following:
receiving a telescopic request aiming at a host machine memory;
determining a host machine physical memory address required to be stretched according to the stretching request;
and operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
The embodiment of the application also provides a machine-readable storage medium, wherein a plurality of computer instructions are stored on the machine-readable storage medium; the computer instructions when executed perform the following:
receiving a telescopic request aiming at a host machine memory;
determining a host machine physical memory address required to be stretched according to the stretching request;
and operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
Referring to fig. 7, which is a structural diagram of a memory management device provided in the embodiment of the present application, the memory management device 70 may include: a processor 71, a network interface 72, a bus 73, and a memory 74. The memory 74 may be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as executable instructions, data, and the like. For example, the memory 74 may be: RAM (random Access Memory), volatile Memory, non-volatile Memory, flash Memory, a storage drive (e.g., a hard drive), a solid state drive, any type of storage disk (e.g., a compact disk, a dvd, etc.).
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Furthermore, these computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (21)

1. A memory management method, the method comprising:
receiving a capacity reduction request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be reduced according to the capacity reduction request;
and operating the physical memory address of the virtual machine in the access page table so as to forbid accessing the physical memory address of the virtual machine according to the access page table when external equipment accesses the memory of the virtual machine.
2. The method of claim 1,
the operating the virtual machine physical memory address in the access page table includes:
sending an un-mapping request aiming at the virtual machine physical memory address to a memory management unit so that the memory management unit operates the virtual machine physical memory address in an access page table according to the un-mapping request.
3. The method according to claim 1 or 2,
the operating the virtual machine physical memory address in the access page table includes:
deleting the virtual machine physical memory address from the access page table; alternatively, the first and second electrodes may be,
adding a prohibition mark for the virtual machine physical memory address in the access page table, wherein the prohibition mark is used for indicating that the access to the virtual machine physical memory address is prohibited.
4. A memory management method, the method comprising:
receiving a capacity expansion request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be expanded according to the expansion request;
and operating the physical memory address of the virtual machine in the access page table so as to allow the external equipment to access the physical memory address of the virtual machine according to the access page table when the external equipment accesses the memory of the virtual machine.
5. The method of claim 4,
after determining the physical memory address of the virtual machine that needs to be expanded according to the expansion request, the method further includes: determining a host machine physical memory address according to the virtual machine physical memory address;
the operating the virtual machine physical memory address in the access page table includes: and adding the mapping relation between the physical memory address of the virtual machine and the physical memory address of the host machine in an access page table.
6. The method of claim 5, wherein adding the mapping relationship between the virtual machine physical memory address and the host machine physical memory address in the page table comprises:
sending a mapping request to a memory management unit, wherein the mapping request comprises the virtual machine physical memory address and the host machine physical memory address, so that the memory management unit adds the mapping relation between the virtual machine physical memory address and the host machine physical memory address in an access page table according to the mapping request.
7. The method of claim 5,
the determining a host machine physical memory address according to the virtual machine physical memory address includes:
determining a virtual memory address according to the physical memory address of the virtual machine;
and determining the physical memory address of the host machine according to the virtual memory address.
8. A memory management method, the method comprising:
receiving a telescopic request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be stretched according to the stretching request;
and operating the physical memory address of the virtual machine in the access page table so as to prevent the physical memory address of the virtual machine from being accessed according to the access page table or allow the physical memory address of the virtual machine to be accessed according to the access page table when the external equipment accesses the physical memory of the virtual machine.
9. The method of claim 8, wherein if the scaling request is for scaling virtual machine memory, operating the virtual machine physical memory address in an access page table to prohibit access to the virtual machine physical memory address according to the access page table, specifically comprising:
deleting the virtual machine physical memory address from the access page table; alternatively, the first and second electrodes may be,
adding a prohibition mark for the virtual machine physical memory address in the access page table, wherein the prohibition mark is used for indicating that the access to the virtual machine physical memory address is prohibited.
10. The method of claim 8, wherein if the shrink request is for expanding virtual machine memory, operating the virtual machine physical memory address in an access page table to allow access to the virtual machine physical memory address according to the access page table comprises:
and determining a host machine physical memory address according to the virtual machine physical memory address, and adding a mapping relation between the virtual machine physical memory address and the host machine physical memory address in the access page table.
11. The method of claim 10,
the determining a host machine physical memory address according to the virtual machine physical memory address includes:
determining a virtual memory address according to the physical memory address of the virtual machine;
and determining the physical memory address of the host machine according to the virtual memory address.
12. A memory management method, the method comprising:
receiving a telescopic request aiming at a host machine memory;
determining a host machine physical memory address required to be stretched according to the stretching request;
and operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
13. The method of claim 12, wherein if the scaling request is for host memory expansion, operating the host physical memory address in a page table for access to prohibit access to the host physical memory address according to the page table for access, comprises:
deleting the host physical memory address from the page table; alternatively, the first and second electrodes may be,
adding a prohibition mark for the host machine physical memory address in the access page table, wherein the prohibition mark is used for indicating that the access to the host machine physical memory address is prohibited.
14. The method of claim 12, wherein if the scaling request is for scaling host memory, operating on the host physical memory address in a page table for access to allow access to the host physical memory address according to the page table for access, comprises:
and determining a physical memory address of a virtual machine according to the physical memory address of the host machine, and adding a mapping relation between the physical memory address of the host machine and the physical memory address of the virtual machine in the access page table.
15. The method of claim 14,
the determining the physical memory address of the virtual machine according to the physical memory address of the host machine comprises:
determining a virtual memory address according to the host machine physical memory address;
and determining the physical memory address of the virtual machine according to the virtual memory address.
16. A memory management method, the method comprising:
receiving a capacity expansion request aiming at a host machine memory;
determining a host machine physical memory address needing capacity expansion according to the capacity expansion request;
and operating the physical memory address of the host machine in the access page table so as to forbid accessing the physical memory address of the host machine according to the access page table when the external equipment accesses the memory of the virtual machine.
17. A memory management method, the method comprising:
receiving a capacity reduction request aiming at a host machine memory;
determining a host machine physical memory address needing to be reduced according to the capacity reduction request;
and operating the physical memory address of the host machine in the access page table so as to allow the external equipment to access the physical memory address of the host machine according to the access page table when the external equipment accesses the memory of the virtual machine.
18. A memory management device, the device comprising:
the receiving module is used for receiving a telescopic request aiming at the memory of the virtual machine;
the determining module is used for determining the physical memory address of the virtual machine to be stretched according to the stretching request;
and the processing module is used for operating the physical memory address of the virtual machine in the access page table so as to prohibit the access to the physical memory address of the virtual machine according to the access page table or permit the access to the physical memory address of the virtual machine according to the access page table when the external equipment accesses the physical memory of the virtual machine.
19. A memory management device, the device comprising:
the receiving module is used for receiving a telescopic request aiming at the memory of the host machine;
the determining module is used for determining the physical memory address of the host machine needing to be stretched according to the stretching request;
and the processing module is used for operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
20. A memory management device, comprising:
a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs:
receiving a telescopic request aiming at a virtual machine memory;
determining a physical memory address of the virtual machine to be stretched according to the stretching request;
and operating the physical memory address of the virtual machine in the access page table so as to prevent the physical memory address of the virtual machine from being accessed according to the access page table or allow the physical memory address of the virtual machine to be accessed according to the access page table when the external equipment accesses the physical memory of the virtual machine.
21. A memory management device, comprising:
a processor and a machine-readable storage medium having stored thereon a plurality of computer instructions, the processor when executing the computer instructions performs:
receiving a telescopic request aiming at a host machine memory;
determining a host machine physical memory address required to be stretched according to the stretching request;
and operating the physical memory address of the host machine in the access page table so as to prevent the physical memory address of the host machine from being accessed according to the access page table or allow the physical memory address of the host machine to be accessed according to the access page table when the external equipment accesses the memory of the virtual machine.
CN201911244712.7A 2019-12-06 2019-12-06 Memory management method, device and equipment Pending CN112925606A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911244712.7A CN112925606A (en) 2019-12-06 2019-12-06 Memory management method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911244712.7A CN112925606A (en) 2019-12-06 2019-12-06 Memory management method, device and equipment

Publications (1)

Publication Number Publication Date
CN112925606A true CN112925606A (en) 2021-06-08

Family

ID=76161934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911244712.7A Pending CN112925606A (en) 2019-12-06 2019-12-06 Memory management method, device and equipment

Country Status (1)

Country Link
CN (1) CN112925606A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434371A (en) * 2021-08-26 2021-09-24 阿里云计算有限公司 Acquisition method of memory access information, computing equipment and storage medium
CN116150740A (en) * 2023-04-17 2023-05-23 杭州鸿钧微电子科技有限公司 Resource isolation method and device, chip system and electronic equipment
WO2023155694A1 (en) * 2022-02-18 2023-08-24 阿里云计算有限公司 Memory paging method and system, and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017143718A1 (en) * 2016-02-26 2017-08-31 成都赫尔墨斯科技有限公司 Cloud rendering system, server, and method
CN110008692A (en) * 2019-03-22 2019-07-12 联想(北京)有限公司 A kind of information processing method, device and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017143718A1 (en) * 2016-02-26 2017-08-31 成都赫尔墨斯科技有限公司 Cloud rendering system, server, and method
CN110008692A (en) * 2019-03-22 2019-07-12 联想(北京)有限公司 A kind of information processing method, device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
INTROSPECTION OF VIRTUAL MACHINE MEMORY RESOURCE IN THE VIRTUALIZED SYSTEMS: "Introspection of Virtual Machine Memory Resource in the Virtualized Systems", IEEE, 4 April 2019 (2019-04-04) *
陈昊罡;汪小林;王振林;张彬彬;罗英伟;李晓明;: "DMM:虚拟机的动态内存映射模型", 中国科学:信息科学, no. 12, 15 December 2010 (2010-12-15) *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113434371A (en) * 2021-08-26 2021-09-24 阿里云计算有限公司 Acquisition method of memory access information, computing equipment and storage medium
CN113434371B (en) * 2021-08-26 2022-01-25 阿里云计算有限公司 Acquisition method of memory access information, computing equipment and storage medium
WO2023155694A1 (en) * 2022-02-18 2023-08-24 阿里云计算有限公司 Memory paging method and system, and storage medium
CN116150740A (en) * 2023-04-17 2023-05-23 杭州鸿钧微电子科技有限公司 Resource isolation method and device, chip system and electronic equipment
CN116150740B (en) * 2023-04-17 2023-12-12 杭州鸿钧微电子科技有限公司 Resource isolation method and device, chip system and electronic equipment

Similar Documents

Publication Publication Date Title
EP2840495B1 (en) Container-based processing method and apparatus
US9298377B2 (en) Techniques for reducing read I/O latency in virtual machines
EP1734444A2 (en) Exchanging data between a guest operating system and a control operating system via memory mapped I/O
US8135899B1 (en) Expansion of virtualized physical memory of virtual machine
CN112925606A (en) Memory management method, device and equipment
CN111949605A (en) Method, apparatus and computer program product for implementing a file system
US9983826B2 (en) Data storage device deferred secure delete
CN114327777B (en) Method and device for determining global page directory, electronic equipment and storage medium
CN113204407A (en) Memory over-allocation management method and device
CN112231007A (en) Device driving method based on user mode and kernel mode driving cooperative processing framework
US11734430B2 (en) Configuration of a memory controller for copy-on-write with a resource controller
CN113157347A (en) Automatic probe deployment method, electronic device and storage medium
CN104685443A (en) Pinning boot data for faster boot
US20180157605A1 (en) Configuration of a memory controller for copy-on-write
CN103229150A (en) Data control method and system
US10901914B2 (en) Method for writing multiple copies into storage device, and storage device
US20120284478A1 (en) Managing storage extents and the obtaining of storage blocks within the extents
CN113032088B (en) Dirty page recording method, device, electronic equipment and computer readable medium
KR20070090418A (en) Method and system for providing context switch using multiple register file
CN111666036B (en) Method, device and system for migrating data
US9418175B2 (en) Enumeration of a concurrent data structure
CN113342270A (en) Volume unloading method and device and electronic equipment
CN112148486A (en) Memory page management method, device and equipment and readable storage medium
CN106547619B (en) Multi-user storage management method and system
CN111435285B (en) Data writing method and device for storage volume, electronic equipment and machine-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination