US20190065267A1 - Free page hinting with multiple page sizes - Google Patents

Free page hinting with multiple page sizes Download PDF

Info

Publication number
US20190065267A1
US20190065267A1 US15/692,346 US201715692346A US2019065267A1 US 20190065267 A1 US20190065267 A1 US 20190065267A1 US 201715692346 A US201715692346 A US 201715692346A US 2019065267 A1 US2019065267 A1 US 2019065267A1
Authority
US
United States
Prior art keywords
hypervisor
memory page
memory
guest
operating system
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.)
Granted
Application number
US15/692,346
Other versions
US10956216B2 (en
Inventor
Henri Han Van Riel
Michael Tsirkin
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.)
Red Hat Inc
Original Assignee
Red Hat Inc
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 Red Hat Inc filed Critical Red Hat Inc
Priority to US15/692,346 priority Critical patent/US10956216B2/en
Assigned to RED HAT, INC. reassignment RED HAT, INC. ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: TSIRKIN, MICHAEL, VAN RIEL, HENRI HAN
Publication of US20190065267A1 publication Critical patent/US20190065267A1/en
Assigned to RED HAT, INC. reassignment RED HAT, INC. CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE ADDRESS PREVIOUSLY RECORDED AT REEL: 043465 FRAME: 0543. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT. Assignors: TSIRKIN, MICHAEL, VAN RIEL, HENRI HAN
Application granted granted Critical
Publication of US10956216B2 publication Critical patent/US10956216B2/en
Active legal-status Critical Current
Adjusted expiration legal-status Critical

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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • 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
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0882Page mode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0884Parallel mode, e.g. in parallel with main memory or CPU
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/109Address translation for multiple virtual address spaces, e.g. segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/0284Multiple user address space allocation, e.g. using different base addresses
    • 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/45579I/O management, e.g. providing access to device drivers or storage
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement
    • G06F2212/1024Latency reduction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/15Use in a specific computing environment
    • G06F2212/151Emulated environment, e.g. virtual machine
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/65Details of virtual memory and virtual address translation
    • G06F2212/652Page size control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/65Details of virtual memory and virtual address translation
    • G06F2212/657Virtual address space management

Definitions

  • the present disclosure is generally related to virtualized computer systems, and more particularly, to memory allocation in virtualized computer systems.
  • Virtualization allows multiplexing of an underlying host machine between different virtual machines.
  • the host machine allocates a certain amount of its resources to each of the virtual machines.
  • Each virtual machine is then able to use the allocated resources to execute applications, including operating systems (referred to as guest operating systems).
  • An executable layer that provides the virtualization is commonly referred to as a hypervisor (also known as a virtual machine monitor (VMM)).
  • the hypervisor emulates the underlying hardware of the host computer, making the use of the virtual machine transparent to the guest operating system and the user of the computer.
  • a host machine can accommodate more virtual machines than the size of its physical memory allows. Using virtual memory techniques, the host machine can give each virtual machine the impression that it has a contiguous address space, while in fact the memory used by the virtual machine may be physically fragmented and even overflow to disk storage.
  • the host machine needs to free up memory, it selects memory pages that have been assigned to virtual machines, and pages out the contents of those memory pages to disk storage.
  • the host machine attempts to access those memory pages, the host machine pages in the content of the memory page by reading the content stored in disk storage and writing the content back to memory. Paging out and paging in memory pages requires input/output (I/O) operations, which can cause significant delay for the virtual machine.
  • I/O input/output
  • FIG. 1 depicts a high-level block diagram of an example computer system architecture, in accordance with one or more aspects of the present disclosure
  • FIG. 2 depicts a block diagram of an example guest operating system that implements memory page hinting that takes into account multiple different page sizes, in accordance with one or more aspects of the present disclosure
  • FIG. 3 depicts a block diagram of an example hypervisor that implements memory page hinting that takes into account multiple different page sizes, in accordance with one or more aspects of the present disclosure
  • FIG. 4 depicts a flow diagram of an example method executed by a guest operating system to provide memory page hinting, in accordance with one or more aspects of the present disclosure
  • FIG. 5 depicts a flow diagram of an example method executed by a hypervisor to use memory page hints, in accordance with one or more aspects of the present disclosure
  • FIG. 6 depicts a block diagram of an example computer system in accordance with one or more aspects of the present disclosure
  • FIG. 7 depicts a block diagram of another example computer system in accordance with one or more aspects of the present disclosure.
  • FIG. 8 depicts a flow diagram of another example method executed by a guest operating system to provide memory page hinting, in accordance with one or more aspects of the present disclosure
  • FIG. 9 depicts a flow diagram of another example method executed by a hypervisor to use memory page hinting, in accordance with one or more aspects of the present disclosure
  • FIG. 10 depicts a block diagram of an illustrative computing device operating in accordance with the examples of the present disclosure.
  • a hypervisor and a guest operating system may both include storage management functionality that implements a caching mechanism across different storage devices.
  • the caching mechanism may involve memory pages that are paged to or from a persistent storage.
  • the hypervisor and guest operating systems may function separately and a hypervisor may allocate storage to a virtual machine but may be unaware of which portions of storage are in use by a guest operating system executing on the virtual machine.
  • Knowledge of the guest operating system's use of the storage may be beneficial to a hypervisor managing memory because portions of storage that have been released by the guest operating system may be reused by the hypervisor without the overhead of copying the data to and from persistent storage (e.g., page swapping).
  • Virtualized computer systems have evolved to share information about the use of memory between the guest operating system and the hypervisor.
  • a guest operating system may share memory use information with the hypervisor by transmitting messages that identify particular guest memory pages that are not being used by the guest operating system.
  • the hypervisor may store the memory use information and subsequently access the memory use information when determining a portion of memory to evict.
  • the guest operating system and the hypervisor may use the same size memory pages and when a guest memory page is released it may indicate that a corresponding memory page of the hypervisor is no longer being used by the guest operating system.
  • the guest operating system and the hypervisor may use memory pages that are different sizes.
  • a guest memory page that is no longer in use may not necessarily correspond to memory page of the hypervisor that is no longer in use by the guest operating system. This is because the memory page of the hypervisor may be larger than the guest memory page and another portion of the hypervisor page may still be in use by the guest operating system. Messages that indicate only a portion of a hypervisor's memory page has been released may not be useful if the remaining portion of the hypervisor's memory page remains in use.
  • the technology may be integrated within a guest operating system and the guest operating system may determine that a memory page size of the guest operating system is different from a memory page size of a hypervisor. As the guest operating system releases guest memory pages the guest operating system may add the released guest memory pages to a set of pages. The guest operating system may determine based on the memory page size of the hypervisor whether the set of released guest memory pages fills a memory page of the hypervisor.
  • the guest operating system may avoid (e.g., wait) to send a message to the hypervisor. If the set does fill a memory page of the hypervisor, the guest operating system may provide an indication to the hypervisor that the memory page is available for reuse.
  • the technology may be integrated within a hypervisor.
  • the hypervisor may provide a memory page size of the hypervisor to a guest operating system.
  • the memory page size of the hypervisor may be larger than a memory page size of the guest operating system.
  • the hypervisor may determine that a memory page of the hypervisor comprises a plurality of guest memory pages that have been released by the guest operating system and that the memory page remains allocated to a virtual machine executing the guest operating system.
  • the hypervisor may reallocate a hypervisor memory page that is unused by the guest operating system to avoid having to copy content of the hypervisor memory page to persistent storage (e.g., backing store).
  • persistent storage e.g., backing store
  • aspects of the present disclosure provide technology that enables a guest operating system to detect when the guest memory pages released by a guest operating system occupy an entire memory page of the hypervisor. This may enable the guest operating system to delay informing the hypervisor until a hypervisor memory page is completely released (e.g., unused) by a guest operating system and therefor avoid informing the hypervisor when only a portion of the hypervisor memory page is released. This may reduce the quantity of communications occurring between the guest operating system and the hypervisor, which may reduce the computing resources (e.g., processing power, Input/Output) consumed by virtual machines. Virtual machines that consume less computing resources may enable a host machine to support more virtual machines.
  • computing resources e.g., processing power, Input/Output
  • FIG. 1 depicts an illustrative architecture of computer system 100 , in accordance with an example of the present disclosure. It should be noted that other architectures for computer system 100 are possible, and that the implementation of a computer system utilizing embodiments of the disclosure are not necessarily limited to the specific architecture depicted.
  • Computer system 100 may be a single host machine or multiple host machines arranged in a heterogeneous or homogenous group (e.g., cluster) and may include one or more rack mounted servers, workstations, desktop computers, notebook computers, tablet computers, mobile phones, palm-sized computing devices, personal digital assistants (PDAs), etc. In one example, computer system 100 may be a computing device implemented with x86 hardware.
  • computer system 100 may be a computing device implemented with PowerPC®, SPARC®, or other hardware.
  • computer system 100 may include one or more virtual machines 110 A-C, a hypervisor 120 , hardware devices 130 , and a network 140 .
  • Virtual machines 110 A-C may execute guest executable code that uses an underlying emulation of physical resources.
  • the guest executable code may include one or more guest operating systems 112 A-C that manage guest applications, guest device drivers, other executable code, or a combination thereof.
  • Each of the virtual machines 110 A-C may support hardware emulation, full virtualization, para-virtualization, operating system-level virtualization, or a combination thereof.
  • Virtual machines 110 A-C may have the same or different types of guest operating systems, such as Microsoft® Windows®, Linux®, Solaris®, etc.
  • the virtual machines 110 A-C may execute guest operating systems 112 A-C that manage guest memory 114 A-C respectively.
  • Guest operating systems 112 A-C may include memory management components 111 A-C and page hinting components 113 A-C respectively.
  • Components 111 A-C and 113 A-C may be separate components as shown or may be included into the same component.
  • the features provided by page hinting component may be integrated into the operations performed by memory management component of guest operating system 112 A.
  • Memory management component 111 A-C may manage aspects of guest memory caching, such as the allocation and the release of portions of guest memory 114 A-C.
  • Page hinting components 113 A-C may provide indications to hypervisor 120 of the memory pages that are released, allocated, or a combination thereof.
  • page hinting components 113 A-C may determine the status of hypervisor memory pages by analyzing a set of guest memory pages that have been released. Page hinting components 113 A-C may notify the hypervisor when the set of guest memory pages reaches a threshold (e.g., buffer limit).
  • a threshold e.g., buffer limit
  • Guest memory 114 A-C may be any virtual memory, logical memory, physical memory, other portion of memory, or a combination thereof for storing, organizing, or accessing data.
  • Guest memory 114 A-C may represent the portion of memory that is designated by hypervisor 120 for use by one or more respective virtual machines 110 A-C.
  • Guest memory 114 A-C may be managed by guest operating system 112 A-C and may be segmented into guest memory pages 116 .
  • Guest memory pages 116 may each include a contiguous or non-contiguous sequence of bytes or bits and may have a page size that is the same or different from a memory page size used by hypervisor 120 . As shown in FIG.
  • the page size 115 A of guest memory pages 116 and the page size 115 B of hypervisor memory page 129 A may be different.
  • Each of the page sizes 115 A and 115 B may be a fixed-size, such as a particular integer value (e.g., 4 KB, 2 MB) or may be a variable-size that varies within a range of integer values.
  • Each of the guest memory pages 116 may have a page size that is the same or different from the page size of an adjacent memory page.
  • guest memory pages 116 may be memory blocks of a volatile or non-volatile memory device and may each correspond to an individual memory block, multiple memory blocks, or a portion of a memory block.
  • Page size 115 A may have a standard size (e.g., page size of 4 KB) and page size 115 B may have an enlarged size (e.g., page size of 2 MB), which may be referred to as “huge pages.”
  • Hypervisor memory 126 may be the same or similar to the guest memory but may be managed by hypervisor 120 instead of a guest operating system.
  • Hypervisor memory 126 may include unallocated memory 128 A, memory allocated to guests 128 B, and memory allocated to hypervisor (not shown).
  • the unallocated memory 128 A may be memory pages that have not yet been allocated by hypervisor memory 126 or were previously allocated by hypervisor 120 and have since been deallocated (e.g., freed) by hypervisor 120 .
  • the memory allocated to guests may be the portion of hypervisor memory 126 that has been allocated by hypervisor 120 to virtual machines 110 A-C and corresponds to guest memory 114 A-C.
  • Other portions of hypervisor memory may be allocated for use by hypervisor 120 , a host operating system, hardware device, other module, or a combination thereof.
  • Hypervisor memory 126 may include hypervisor memory pages 129 A-D, which may be in different states. The states may correspond to whether or not the hypervisor memory page has been allocated to a virtual machine and whether the hypervisor memory page is in use or is not in use by the virtual machine it is allocated to.
  • Hypervisor memory page 129 A may represent a memory page that is unallocated and hypervisor memory pages 129 B-D may represent memory pages that have been allocated.
  • Each of hypervisor memory pages 129 B-D may be allocated by hypervisor 120 to a virtual machine but may include a different proportion of the memory page that is in use or not in use by the virtual machine it is allocated to.
  • hypervisor memory page 129 B may be completely unused by the guest virtual machine that it is allocated to.
  • Hypervisor memory page 129 C may be partially in use and partially not in use by a guest virtual machine. Hypervisor memory page 129 D may be fully in use by the virtual machine it is allocated to. As shown in FIG. 1 , hypervisor memory page 129 B may be fully released by guest operating system 112 A and may correspond to released guest memory pages 118 .
  • Released guest memory pages 118 may be any portion of guest memory 114 A that has been released by the guest operating system. Releasing a memory page may involve a guest operating system instructing a virtual machine to execute a release operation that is the same or similar to freeing, deallocating, dereferencing, deleting, removing, other operation, or a combination thereof. In one example, a release operation may be initiated by the guest operating system in response to being notified that a memory page is no longer in use. This may occur when a process managed by the guest operating system makes a system call to the guest operating system to free the memory page.
  • a release operation may be initiated by the guest operating system in response to determining the memory page is no longer in use by a process or thread managed by the guest operating system (e.g., garbage collection).
  • releasing a memory page may result in the memory page being available for reuse by the guest operating system while remaining allocated to the virtual machine.
  • Guest operating systems 112 A-C may use indications 119 A-C to indicate to hypervisor 120 that the memory pages are no longer in use (e.g., released).
  • Indications 119 A-C may include one or more signals for indicating to hypervisor 120 that one or more memory pages of the hypervisor are not in use by the guest operating systems.
  • the signal may be a message, interrupt, notification, exception, trap, other signal, or a combination thereof.
  • Indications 119 A-C may be transmitted from a virtual machine to the hypervisor, from the hypervisor to the virtual machine, or a combination thereof. Indications 119 A-C may occur before, during, or after a guest memory page gets released by the guest operating system.
  • the technology disclosed herein may implement one or more of indication 119 A, indication 119 B, indication 119 C, other indication mechanism, or a combination thereof.
  • Indication 119 A may be a message transmitted from virtual machine 110 A to hypervisor 120 that includes identification data (e.g., identifier) of a memory page of a hypervisor or a range of memory pages of the hypervisor.
  • Indication 119 A may be one of a series of indications and each indication in the series may identify an individual memory page or an individual range of memory pages.
  • Indication 119 A may be transmitted in response to a particular memory page (e.g., hypervisor memory page 129 B) being fully released by a guest virtual machine.
  • each indication 119 A may correspond to a system call, hypercall, other function call, or a combination thereof that is initiated by the guest operating system 112 A.
  • Indication 119 B may a batched message that is similar to indication 119 A and may include multiple memory pages, memory page ranges, or a combination thereof. Batching the memory pages into indication 119 B (e.g., batched message) may be advantageous because it may reduce the communications overhead (e.g., I/O) that occurs between virtual machines 110 B and hypervisor 120 . Indication 119 B may be transmitted from virtual machine 110 B to hypervisor 120 in response to a quantity of released memory pages satisfying (e.g., at, above, or below) one or more threshold quantities.
  • a quantity of released memory pages satisfying (e.g., at, above, or below) one or more threshold quantities.
  • the threshold quantities may be based on a size of the guest or hypervisor memory page and may be a particular quantity of memory pages (e.g., page count) or a quantity of space occupied by the memory pages (e.g., buffer space limit).
  • the threshold quantities may include one or more values that may include integers, percentages, ratios, other values, or a combination thereof.
  • the values may be relative to the size or limit of a guest memory page, hypervisor memory page, physical storage devices, heap, page, buffer, other data structure, or a combination thereof.
  • Indication 119 C may include one or more signals that identify a shared data structure that represents the status of hypervisor memory pages.
  • the shared data structure may indicate to hypervisor 120 which hypervisor memory pages include guest pages that are released, un-released, or a combination thereof.
  • Indication 119 C may include a first signal that may be sent prior to a guest memory page being released and one or more second signals may be sent after one or more memory pages are released.
  • the first signal may be in the form of a message that is transmitted during an initialization of guest operating system 112 C or initialization of a particular memory page management module of guest operating system 112 C.
  • the first signal may include information (e.g., reference, pointer) identifying the shared data structure that represents guest memory 114 C.
  • the respective virtual machine 110 C may update the shared data structure to indicate to hypervisor 120 that one of the hypervisor memory pages is unused by the guest operating system 112 C.
  • Hypervisor 120 may subsequently access the shared data structure after memory pages are released.
  • hypervisor 120 may listen for second signals (e.g., modification events) that indicate the shared data structure was updated.
  • hypervisor 120 may not listen for second signals and may access the shared data structure when hypervisor 120 determines memory pages should be reallocated (e.g., memory page faults exceed a threshold or available memory pages fall below a threshold).
  • the shared data structure may be modified by one or more of the virtual machines and may be accessible to the hypervisor.
  • the shared data structure may be an array (e.g., bitmap), a linked list, other data structure, or a combination thereof.
  • the shared data structure may include an element (e.g., bit, node) for each of the memory pages and the element may indicate whether the memory page is released, un-released, or other state.
  • the shared data structure may be stored in memory page space of the virtual machine.
  • each virtual machine may include a shared data structure in its respective guest memory 114 A-C, which may be accessible to hypervisor 120 .
  • the shared data structure may be stored in hypervisor memory 126 and be accessible to one or more of the virtual machines. In the latter example, there may be a separate shared data structure within hypervisor memory 126 that corresponds to each of the virtual machine 110 A-C or there may be a single shared data structure accessible to the group of virtual machines 110 A-C.
  • Hypervisor 120 may also be known as a virtual machine monitor (VMM) and may provide virtual machines 110 A-C with access to one or more features of hardware device. Hypervisor 120 may manage system resources, including access to hardware devices 130 . In the example shown, hypervisor 120 may run directly on the hardware of computer system 100 (e.g., bare metal hypervisor). In another example, hypervisor 120 may run on or within a host operating system (not shown). Hypervisor 120 may include a page hinting component 122 , a page reallocation component 124 , and hypervisor memory 126 .
  • VMM virtual machine monitor
  • Page hinting component 122 may process memory page hints received from the virtual machines in the form of indications 119 A-C.
  • the memory page hints may indicate which of the hypervisor memory pages associated with a virtual machine are in use or not in use by the virtual machine.
  • a hypervisor may allocate a portion of hypervisor memory 126 for use by a virtual machine and the guest operating system 112 A may manage the allocated portion as shown by guest memory pages 116 .
  • Guest operating system 112 A may be configured to optimize the use of the memory page by allocating portions of the memory pages to guest operating system processes and using the remaining portions as file system cache.
  • guest operating system 112 A may release one or more guest memory pages (e.g., released guest memory pages 118 ) and may transmit indication 119 A to hypervisor 120 when the released guest memory pages fill up an entire hypervisor memory page or multiple entire hypervisor memory pages.
  • guest memory pages e.g., released guest memory pages 118
  • indication 119 A to hypervisor 120 when the released guest memory pages fill up an entire hypervisor memory page or multiple entire hypervisor memory pages.
  • Page reallocation component 124 may interact with page hinting component 122 to identify portions of hypervisor memory 126 that can be reclaimed and used to fulfill requests for additional memory pages. Page reallocation component 124 may analyze data of page hinting component 122 to identify portions of memory that have been allocated to a guest virtual machine but are not in use by the guest virtual machine. This may enable hypervisor 120 to reallocate the hypervisor memory pages without copying the content of the hypervisor memory page to and from a backing store (e.g., paging in/out).
  • a backing store e.g., paging in/out
  • Hardware devices 130 may provide hardware functionality for performing computing tasks.
  • Hardware devices 130 may include one or more physical storage devices 132 , one or more physical processing devices 134 , other computing devices, or a combination thereof.
  • One or more of hardware devices 130 may be split up into multiple separate devices or consolidated into one or more hardware devices. Some of the hardware device shown may be absent from hardware devices 130 and may instead be partially or completely emulated by executable code.
  • Physical storage devices 132 may include any data storage device that is capable of storing digital data and may include volatile or non-volatile data storage. Volatile data storage (e.g., non-persistent storage) may store data for any duration of time but may lose the data after a power cycle or loss of power. Non-volatile data storage (e.g., persistent storage) may store data for any duration of time and may retain the data beyond a power cycle or loss of power.
  • physical storage devices 132 may be physical memory and may include volatile memory devices (e.g., random access memory (RAM)), non-volatile memory devices (e.g., flash memory, NVRAM), and/or other types of memory devices.
  • RAM random access memory
  • non-volatile memory devices e.g., flash memory, NVRAM
  • physical storage devices 132 may include one or more mass storage devices, such as hard drives, solid state drives (SSD)), other data storage devices, or a combination thereof.
  • physical storage devices 132 may include a combination of one or more memory devices, one or more mass storage devices, other data storage devices, or a combination thereof, which may or may not be arranged in a cache hierarchy with multiple levels.
  • Physical processing devices 134 may include one or more processors that are capable of executing the computing tasks discussed above in regards to components 122 and 124 .
  • Physical processing devices 134 may be a single core processor that is capable of executing one instruction at a time (e.g., single pipeline of instructions) or may be a multi-core processor that simultaneously executes multiple instructions.
  • the instructions may encode arithmetic, logical, or I/O operations.
  • physical processing devices 134 may be implemented as a single integrated circuit, two or more integrated circuits, or may be a component of a multi-chip module (e.g., in which individual microprocessor dies are included in a single integrated circuit package and hence share a single socket).
  • a physical processing device may also be referred to as a central processing unit (CPU).
  • CPU central processing unit
  • Network 140 may be a public network (e.g., the internet), a private network (e.g., a local area network (LAN) or wide area network (WAN)), or a combination thereof.
  • network 140 may include a wired or a wireless infrastructure, which may be provided by one or more wireless communications systems, such as a wireless fidelity (WiFi) hotspot connected with the network 140 and/or a wireless carrier system that can be implemented using various data processing equipment, communication towers, etc.
  • WiFi wireless fidelity
  • FIG. 2 is a block diagram illustrating example components and modules of guest operating system 112 A, in accordance with one or more aspects of the present disclosure.
  • Guest operating system 112 A may be the same or similar to guest operating systems 112 A-C of FIG. 1 and may include a memory management component 111 A, a page hinting component 113 A, and a data store 230 .
  • Memory management component 111 A may include a page size detection module 211 , a page allocator module 212 , a memory release detection module 214 , and a guest page set updating module 216 .
  • Page hinting component 113 A may include a threshold analysis module 222 , a page verification module 224 , an indication providing module 226 , and a locking module 228 .
  • More or less components may be included without loss of generality.
  • two or more of the modules may be combined into a single module, or one of the modules may be divided into two or more modules.
  • one or more of the modules may reside on different computing devices (e.g., different server computers, on a single client device, distributed among multiple client devices, etc.).
  • Page size detection module 211 may enable guest operating system 112 A to determine one or more memory page sizes of the guest operating system and one or more memory page sizes of the hypervisor.
  • the memory page sizes of the guest operating system and the hypervisor may be the same, different, or a combination of both.
  • the memory page sizes may be the same and different when a portion of the guest memory uses a page size that is the same as the underlying hypervisor memory and another portion of the guest memory uses page size that is different from the underlying hypervisor memory.
  • Page size detection module 211 may determine based on one or more comparisons when the page size of guest memory is different from the portion of the hypervisor memory that it is allocated from.
  • the page sizes identified by page size detection module 211 may be used by one or more of the modules discussed below to identify a corresponding hypervisor memory page and determine when to provide an indication and to the hypervisor.
  • Page allocator module 212 may enable guest operating system 112 A to allocate portions of memory for use by guest operating system 112 A and may release the portions for reuse when the memory is no longer needed by the guest operating system 112 A.
  • Page allocator module 212 may allocate memory using guest memory pages, which may be contiguous or non-contiguous blocks of virtual memory (e.g., a 4 K-byte block of memory).
  • the memory pages allocated by page allocator module 212 may have been derived from portions of memory designated for use by the guest operating system 112 A by the underlying hypervisor. Releasing memory pages may be the same or similar to the guest operating system freeing memory pages or deallocating memory pages, which may involve dereferencing a memory page and enabling the memory page to be subsequently reused by guest operating system 112 A.
  • Memory release detection module 214 may be integrated with page allocator module 212 and may detect memory pages that have been released by memory management component 111 A of guest operating system 112 A. In one example, detecting the released memory pages may involve receiving or listening for a particular event or signal associated with the release of a memory page. In another example, detecting the released memory pages may involve accessing or monitoring a data structure that includes memory status information. When memory release detection module 214 detects a released memory page, the memory release detection module 214 may indicate the change to guest page set updating module 216 .
  • Guest page set updating module 216 may generate and update a set of memory pages that represents the guest memory pages have been released.
  • the set of guest memory pages may be stored by the guest operating system in data store 230 and may be referred to as a guest set.
  • the guest set may be accessed and modified by the guest operating system and may or may not be accessed (e.g., interpreted or comprehended) by the hypervisor.
  • the guest set may be stored as a data structure that is capable of representing a plurality of guest memory pages and may be the same or similar to guest set 234 A, guest set 234 B, other set structure, or a combination thereof.
  • Guest sets 234 A and 234 B may both include data that enables the guest operating system to track which memory pages or ranges of memory pages have been released.
  • Guest set 234 A may be an example set that includes one or more memory page identifiers 236 A.
  • Each of the memory page identifiers 236 A may be an element of the set that uniquely identify a memory page or a range of memory pages that are in a released state (e.g., allocated and not in use), in a non-released state (e.g., allocated and in use), other state, or a combination thereof.
  • guest set 234 A may include the memory pages that have been released without including memory pages that are in use.
  • guest set 234 A may include memory pages that are released (e.g., unused state) and memory pages that are in a used state along with additional data that indicates the corresponding state of each respective memory page.
  • Memory page identifiers 236 A may include offset data (numeric or non-numeric values), address data (virtual, logical, or physical addresses), length data, link data (e.g., a pointer or link), other data, or a combination thereof.
  • each of the memory page identifiers 236 may include a tuple that is stored as a variable and may have a 32 byte size, 64 byte size, or other size.
  • the tuple may represent one or more memory pages or ranges of memory pages using a combination of values.
  • the combination of values may include multiple separate address values, a single address value and a length value, other values, or a combination thereof.
  • the address values may indicate the start, end, middle, other location, or a combination thereof of a particular guest memory page.
  • the length value may indicate a contiguous length of memory space represented by the tuple. The length may be less than, equal to, or greater than a guest memory page (e.g., page size 115 A), a hypervisor memory page (e.g., page size 115 B), multiple guest or hypervisor memory pages, other size, or a combination thereof.
  • Guest set 234 B is another example set and includes memory page identifiers 236 B that represent each guest memory pages of a virtual machine and not just the memory pages that are in use or are not in use.
  • Each of the memory page identifiers 236 B may correspond to an element of a data structure and may represent a state of a particular memory page.
  • the states may include a released state (e.g., not in use), a non-released state (e.g., in use), other state, or a combination thereof.
  • the data structure may be an n-dimensional array, linked list, other data structure, or a combination thereof.
  • guest set 234 B may be an array of binary elements and the array may be the same or similar to a bitmap.
  • Each of the memory page identifiers 236 B may correspond to one of the binary elements (e.g., bit, flag, marker) and may indicate whether the corresponding guest memory page is in a first state (e.g., released) or in a second state (e.g., unreleased).
  • guest set 234 may be a linked list of elements (e.g., nodes) representing respective guest memory pages.
  • the beginning of the array e.g., first element
  • the location (e.g., position) of an element relative to the first element of the data structure may indicate which memory page is represented by the state of the element.
  • Guest page set updating module 216 may update a guest set using a technique that corresponds to the data structure storing the guest set.
  • guest page set updating module 216 may locate a particular element (e.g. memory page identifier 236 B) that corresponds to the newly released memory page.
  • guest set 234 B may include an element for every memory page of guest memory independent of whether it is released or is still in use.
  • guest page set updating module 216 may update the state of the element to reflect that the memory page is released. This may involve toggling a bit value of an element from false (e.g., 0) to true (e.g., 1) (or vice versa) as shown by bit flag 238 .
  • guest page set updating module 216 may add a newly released memory page to the set by either adding a new element, adjusting an existing element, or a combination thereof. Adding a new element (e.g., memory page identifier 236 A) may involve creating a new element and adding it to guest set 234 A (e.g., appending a new node to a linked list). guest page set updating module 216 may adjust an existing element by modifying an element to add a range or modifying an element to update an existing range to represent an additional memory page. The range may be represented by multiple addresses (e.g., start and end address of a tuple) or by an address and a length (e.g., start address and length value of a tuple).
  • addresses e.g., start and end address of a tuple
  • a length e.g., start address and length value of a tuple
  • Guest page set updating module 216 may determine whether to add, modify, or merge elements by analyzing the location of the newly released memory page relative to one or more memory pages already in the set. Guest page set updating module 216 may compare the multiple locations and add a new element in response to determining the newly released memory page is not adjacent to any memory page within the set. guest page set updating module 216 may modify an existing element in response to determining the newly released memory page is adjacent to at least one memory page within the set the guest page set updating module 216 . A memory page may be adjacent to another memory page when there are no other memory pages between them. guest page set updating module 216 may merge multiple elements of guest set 234 A into a single element when module 216 determines that the multiple elements corresponds to memory pages that are adjacent to one another.
  • the single element may include the multiple adjacent memory pages as a contiguous range of memory pages and may be a newly created element or may be one of the existing elements that has had its range expanded to represent the multiple adjacent memory pages.
  • the merging may occur before, during, or after adding the multiple adjacent memory pages to guest set 234 A and may be the same or similar to consolidating, combining, concatenating, joining, or other action.
  • Page hinting component 113 A may access data generated or detected by memory management component 111 A and propagate some or all of the information to the hypervisor. Page hinting component 113 A may analyze a guest set of released memory pages (e.g., guest set 234 A or 234 B) and determine when and how to provide an indication to the hypervisor. In one example, page hinting component 113 A may avoid providing an indication to the hypervisor each time a guest memory page is released and may wait until the set of released guest pages fill up at least one entire hypervisor memory page before providing the indication to the hypervisor. This may be advantageous because it may reduce the communication overhead (e.g., I/O) that occurs between the guest operating system and hypervisor. In the example, shown in FIG. 2 , page hinting component 113 A may include a threshold analysis module 222 , a page verification module 224 , an indication providing module 226 , and a locking module 228 .
  • a threshold analysis module 222 e.g., a page verification module 224 , an indication providing module
  • Threshold analysis module 222 may analyze the guest set to determine whether the set of memory pages satisfies one or more threshold quantities 232 .
  • One or more of the threshold quantities 232 may be analyzed in view of the size of the set and whether the set of guest pages completely fills one or more hypervisor memory page.
  • Threshold quantities 232 may be based on a particular quantity of pages (e.g., guest pages or hypervisor pages) or a quantity of space occupied by the pages (e.g., buffer space limit).
  • Threshold quantities 232 may have any type of values such as integers, percentages, ratios, other values, or a combination thereof. The values may be relative to the size or limit of the memory, heap, page, set, buffer, other structure, or a combination thereof.
  • Threshold quantities 232 may include a first predetermined threshold quantity and a second predetermined threshold quantity.
  • the first predetermined threshold quantity of threshold quantities 232 may indicate a minimum size (e.g., quantity of hypervisor memory pages) that the set occupies before providing an indication to the hypervisor.
  • the second predetermined threshold quantity will be discussed in more detail below and may relate to an updated quantity of memory pages (e.g., set of verified pages) and may indicate when an indication should be delayed. Once the quantity of memory pages satisfies the first predetermined threshold quantity, the guest operating system 112 A may verify the set using page verification module 224 .
  • Page verification module 224 may analyze the guest memory pages to verify that the memory pages remain unused. As discussed above, the memory pages may be added to the set when they are released by the guest operating system but one or more of the memory pages within the set may be subsequently reused without being removed from the set. In one example, page verification module 224 may analyze memory pages by checking a flag associated with the memory page to ensure that the memory pages are not in use. In another example, page verification module 224 may query functions of the guest operating system, hypervisor, host operating system, hardware device, other module, or a combination thereof to determine whether the memory page is in use. When page verification module 224 determines a memory page is in use it may signal, guest page set updating module 216 to remove the memory page from the set. The memory pages that remain in the set may then be analyzed and processed by indication providing module 226 .
  • Indication providing module 226 may notify the hypervisor of the memory pages that have been released by guest operating system 112 A.
  • indication providing module 226 may indicate one or more hypervisor memory pages that are no longer in use by the guest operating system.
  • indication providing module 226 may indicate one or more guest memory pages that are no longer in use by the guest operating system.
  • Indication providing module 226 may combine (e.g., batch) the identifiers for each of the released memory pages (e.g., guest and/or hypervisor memory pages) in a message and may transmit the message to the hypervisor.
  • transmitting the message to the hypervisor may involve making a call to a programming interface of the hypervisor. The call may be a hypercall, a system call, other type of call, or a combination thereof.
  • Locking module 228 may provide a locking mechanism to inhibit the page allocator module 212 from allocating memory pages while page hinting component 113 A is preparing to provide an indication (e.g., notification) to the hypervisor.
  • the ability to inhibit (e.g., lock, stop, pause, restrict, prohibit) the page allocator module 212 may be useful because it may reduce the possibility that a hypervisor notification can be undermined during the processing phase and indicate that a memory page is released when the memory page is actually in use.
  • locking module 228 may acquire a lock on the page allocator in response to threshold analysis module 222 determining the set of memory pages has satisfied a threshold quantity.
  • the lock may be held while page verification module 224 and indication providing module 226 process the set of guest memory pages.
  • the lock may be released or withdrawn after the indication providing module has transmitted the message or in response to receiving a response from the hypervisor, indicating the message was received and/or processed by the hypervisor. Acquiring the lock and releasing the lock may involve updating a lock indicator 233 .
  • Lock indicator 233 may be any locking data structure that is accessible to guest operating system 112 A and is capable of indicating a lock has been acquired.
  • the locking data structure may include a bit or sequence of bits and may represent two or more states.
  • Lock indicator 233 may include numeric or non-numeric values for indicting or representing the two states.
  • lock indicator 233 may be a bit sequence that includes a counter (e.g., integer counter) that can be accessed by one or more virtual processors managed by guest operating system 112 A.
  • the counter may be a processor counter (e.g., virtual CPU counter), a global counter (e.g., guest OS counter), other counter, or a combination thereof.
  • the processor counter may correspond to a particular virtual processor managed by the guest operating system whereas the global counter may correspond to some or all of the virtual processors managed by the guest operating system.
  • Lock indicator 233 may represent multiple different states that may correspond to the current state of the lock and may also indicate one or more state transitions that may have occurred since the lock was acquired.
  • lock indicator 233 may include a counter and the counter may be updated (e.g., incremented or decremented) by one or more virtual processors to acquire or release a lock on the page allocator module 212 .
  • the counter may be continuously updated (e.g., incremented) to different values and a category of the value, as opposed to the specific value, may determine the state.
  • the category of values may be based on whether the value evaluates to an even number, odd number, prime number, or whether it is or is not divisible my a particular number N, wherein N is any real number (e.g., 3, 4, 5, 6, . . . N).
  • locking module 228 may increment lock indicator 233 to an even number to indicate a lock has been acquired and subsequently increment the lock indicator again to an odd number to indicate the lock has been released (e.g., unlocked).
  • locking module 228 may increment lock indicator 233 to an even number to indicate a lock has been acquired and subsequently decrement the lock indicator to an odd number to indicate the lock has been released (e.g., unlocked).
  • the former example which involves continually updating the lock indicator 233 in the same direction (e.g., incrementing), may be advantageous because it may enable the locking module to detect state transitions and therefore a third state.
  • the third state may indicate that the lock indicator has changed since it was last updated, which may indicate another virtual processor has locked the page allocator and may indicate a race condition has occurred or may be occurring.
  • FIG. 3 is a block diagram illustrating example components and modules of hypervisor 120 , in accordance with one or more aspects of the present disclosure.
  • Hypervisor 120 may be the same or similar to the hypervisor 120 of FIG. 1 and may include a page hinting component 122 , a page reallocation component 124 , and a data store 330 . More or less components may be included without loss of generality. For example, two or more of the components or portions of the components may be combined into a single component, or one of the components may be divided into two or more modules. In one implementation, one or more of the modules may be executed by different processing devices on different computing devices (e.g., different server computers).
  • Page hinting component 122 may process memory page hints received from virtual machines in the form of one or more indications. Page hinting component 122 may process the indications to identify a set of memory pages that have been assigned to a virtual machine but are not being used by the virtual machine. In the example shown in FIG. 1 , page hinting component 122 may include an indication receiving module 312 , an exclusivity detection module 314 , and a guest page set updating module 316 .
  • Indication receiving module 312 may be a portion of hypervisor that receives indications from the virtual machine.
  • the indications may include memory page identification data 332 for identifying one or more hypervisor memory pages or ranges of hypervisor memory pages that contain (e.g., exclusively contain) content released by the guest operating system without content that is in use by the guest operating system.
  • Memory page identification data 332 may include an offset value (numeric or non-numeric value), an address (virtual, logical, or physical address), a pointer, a link, other data, or a combination thereof.
  • the identification data may be a memory page identifier that uniquely identifies a hypervisor memory page.
  • the identification data may be data (e.g., offset value) that may be used by hypervisor 120 to determine a hypervisor memory page identifier of a memory page that includes content released by a respective guest operating system.
  • the identification data may include a reference to a data structure that indicates the one or more hypervisor memory pages that are released (e.g., not in use), non-released (e.g., in use), or a combination thereof.
  • the data structure may be an array (e.g., bitmap), a linked list, other data structure, or a combination thereof.
  • Exclusivity detection module 314 may analyze the memory pages that the virtual machine indicated were released and determine whether the memory pages are in use by any other computing entity.
  • the other computing entity may be another virtual machine, the hypervisor, a host operating system, a hardware device, any executable code (e.g., process, thread, or computing stream), or a combination thereof.
  • a particular hypervisor memory page may be assigned to one or more computing entities. When a memory page is assigned to multiple computing entities, the computing entities may share the memory page and neither may have exclusive use of the memory page. Therefore, when one of the computing entities releases the memory page the hypervisor may not reuse the memory page because the memory page may still be in use by another computing entity.
  • the memory page is assigned to a single computing entity and is in not in use by another computing entity the memory page is referred to as being exclusively used by the single computing entity. Therefore, when the single computing entity (e.g., virtual machine) releases the memory page it may be reallocated by the hypervisor for use by another computing entity.
  • the single computing entity e.g., virtual machine
  • Exclusivity detection module 314 may analyze the released memory page to verify that the released memory page is exclusively assigned to a single virtual machine. Verifying that a memory page is exclusively assigned to a virtual machine may involve determining whether any other virtual machine is using (e.g., modifying, accessing, or has been assigned) the memory page. For example, verifying that a memory page is exclusively assigned to the virtual machine may involve determining whether another virtual machine has access to or has been assigned the same memory page.
  • the memory pages may be memory pages and exclusivity detection module 314 may analyze a memory page data structure that identifies which memory pages are assigned to which virtual machines to determine whether a particular memory page is being shared between virtual machines or is being exclusively used by a single virtual machine.
  • Hypervisor page set updating module 316 may update a set of memory pages based on data of indication receiving module 312 and exclusivity detection module 314 .
  • Hypervisor page set updating module 316 may be similar to guest page set updating module 216 but may be executed by the hypervisor and may store the information in a hypervisor set (e.g., 334 A or 334 B) as opposed to a guest set (e.g., 234 A or 234 B).
  • the hypervisor set may be updated by the hypervisor to reflect the memory pages that are allocated to a virtual machine but remain unused by the virtual machine.
  • the set may be accessed and modified by the hypervisor and may or may not be accessible by a guest operating system. Updating the set may involve the same procedure discussed above in regards to guest page set updating module 216 .
  • updating the set may involve adding a memory page to the set or removing memory pages from the set depending on whether the memory pages are available to be reallocated by the hypervisor.
  • the memory pages may be particular guest memory pages, hypervisor memory pages, other memory pages, or a combination thereof.
  • hypervisor page set updating module 316 may add a memory page to the set of memory pages in response to receiving an indication that the memory page includes content released by a guest operating system and is exclusively accessed by a single virtual machine.
  • hypervisor page set updating module 316 may add a released memory page to the set of memory pages in response to determining that the memory page is shared by multiple virtual machines and was released by each of the respective virtual machines.
  • the set of memory pages may be represented by a data structure such as hypervisor set 334 A or hypervisor set 334 B.
  • Hypervisor sets 334 A and 334 B may be the same or similar to respective guest sets 234 A and 234 B and may include data that enables the hypervisor to track which memory pages or ranges of memory pages have been released by the guest operating system.
  • hypervisor sets 334 A and 334 B may identify hypervisor memory pages that include the content of multiple guest memory pages that have been released by the guest operating system.
  • Hypervisor set 334 A may be an example set that includes one or more memory page identifiers 336 A. Each of the memory page identifiers 336 A may be an element of the set that uniquely identify a memory page or a range of memory pages that is allocated to a virtual machine but may or may not be in use by the virtual machine (e.g., released by guest operating system). In one example, hypervisor set 334 A may include the memory pages that have been released by the guest operating system without including memory pages that are in use by the guest operating system. In another example, hypervisor set 334 A may include memory pages that are not in use (e.g., released) and memory pages that are in use by the guest operating system.
  • Memory page identifiers 336 A may include offset data (numeric or non-numeric values), address data (virtual, logical, or physical addresses), length data, link data (e.g., a pointer or link), other data, or a combination thereof.
  • each of the memory page identifiers 336 A may include a tuple that is stored as a variable and may have a 32 byte size, 64 byte size, or other size.
  • the tuple may represent one or more memory pages or ranges of memory pages (e.g., hypervisor pages or guest pages) using a combination of values.
  • the combination of values may include multiple separate address values, a single address value and a length value, other values, or a combination thereof.
  • the address values may indicate the start, end, middle, other location, or a combination thereof of a particular guest memory page.
  • the length value may indicate a contiguous length of memory space represented by the tuple. The length may be less than, equal to, or greater than a guest memory page (e.g., page size 115 A), a hypervisor memory page (e.g., page size 115 B), multiple guest or hypervisor memory pages, other size, or a combination thereof.
  • Hypervisor set 334 B is another example set and includes one or more memory page identifiers 336 B.
  • Memory page identifiers 336 B may represent either hypervisor memory pages or guest memory pages that include content that is not in use by a virtual machine (e.g., released by guest operating system).
  • Each of the memory page identifiers 336 B may correspond to an element of a data structure and may represent a state of a particular memory page.
  • the states may include a released state (e.g., not in use), a non-released state (e.g., in use), other state, or a combination thereof.
  • the data structure may be an n-dimensional array, linked list, other data structure, or a combination thereof.
  • hypervisor set 334 B may be an array of binary elements and the array may function as a bitmap.
  • Each memory page identifier 336 B may correspond to one of the binary elements (e.g., bit, flag, marker) and may indicate whether the corresponding hypervisor or guest memory page is in a first state (e.g., released) or in a second state (e.g., unreleased).
  • hypervisor set 334 B may be a linked list of elements (e.g., nodes) the nodes representing respective hypervisor or guest memory pages.
  • the beginning of the array (e.g., first element) may correspond to a first memory page in a continuous or non-contiguous sequence of memory pages and the location (e.g., position) of an element relative to the first element of the data structure may indicate which memory page is represented by the state of the element.
  • Page reallocation component 124 may interact with page hinting component 122 to identify portions of the hypervisor's memory that can be allocated (e.g., reallocated) to fulfill requests from virtual. Page reallocation component 124 may analyze data of page hinting component 122 to identify hypervisor memory pages that have been allocated to a virtual machine but are not in use by the virtual machine. For example, a memory page may be allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released). Traditionally, reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page.
  • page reallocation component 124 may be able to detect when a memory page that is allocated to a virtual machine is not in use by the virtual machine.
  • page reallocation component 124 may reallocate (e.g., reuse) the memory page without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to re-access the memory page.
  • page reallocation component 124 may include an allocation request module 322 , a set analysis module 324 , and a page selection module 326 .
  • Allocation request module 322 may receive or access a request from a virtual machine to allocate memory page to the virtual machine.
  • the virtual machine may initiate the request using a variety of different mechanisms.
  • a first mechanism may involve a failed attempt to access a memory page that no longer resides at the designated location in the physical memory page device. This may occur when the memory page is a memory page and the memory page has been evicted.
  • the attempt to access the memory page may generate a page fault, which may be addressed by an underlying memory management module.
  • the page fault may function as the request to allocate memory page.
  • a second mechanism may involve a virtual machine initiating the request using a hypercall.
  • the virtual machine may be executing in a para-virtualized environment and be aware of and able to communicate with the hypervisor using hypercalls.
  • a hypercall may be similar to a system call but may enable a thread executed by the virtual machine to communicate with the hypervisor as opposed to the guest operating system. In one example, the hypercall may be used to implement memory page balloon
  • Memory page ballooning may be a memory page reclamation technique that is used by a hypervisor or host operating system to enable a computer system to take memory from one or more virtual machines and share it with other virtual machines.
  • Memory page ballooning may enable the total amount of memory page resources (e.g., memory pages) occupied by the guest virtual machines to exceed the amount of physical memory page resources (e.g., main memory) available on the computer system.
  • the memory page ballooning may allocate the memory page resources selectively among the virtual machines.
  • the memory page balloon represents the memory page provided to other virtual machines and the process of a virtual machine relinquishing memory page may be referred to as inflating the balloon and the process of acquiring memory page may be referred to as deflating the balloon.
  • Portions of memory page ballooning may be implemented within each of the virtual machines in the form of a driver (e.g., balloon driver) or memory page function (e.g., kernel memory page management module) of the guest operating system.
  • Memory page ballooning may enable multiple virtual machines to share memory page resources amongst one another in a voluntary or involuntary manner.
  • memory page ballooning may be the same or similar to a computer memory reclamation technique known as virtual memory ballooning.
  • Virtual memory ballooning may be used by hypervisor 120 to enable the computer system (e.g., host machine) to retrieve unused memory from certain guest virtual machines.
  • the act of relinquishing memory page may be different than the act of releasing memory page, which is discussed above.
  • Releasing memory page may involve a guest operating system freeing the memory page so that it is unused by the guest operating system even though the memory page remains allocated to the virtual memory executing the guest operating system.
  • a guest operating system that releases memory page may not change the amount of memory page allocated to the virtual machine and may just change the use of the memory page allocated to the virtual machine. Therefore, a guest operating system that releases memory page may enable the total amount of memory page allocated to the virtual machine to remain constant (e.g., approximately the same).
  • Relinquishing memory page may involve the guest operating system identifying a portion of memory page that can be given back to the hypervisor so that the total amount of memory page allocated to the virtual machine changes (e.g., does not remain constant) and either decreases (e.g., balloon inflates) or increases (balloon deflates).
  • Set analysis module 324 may enable hypervisor 120 to analyze the set of memory pages (e.g., set 334 A or 334 B) to identify one or more memory pages that can be reallocated to satisfy the request for additional memory page.
  • Set analysis module 324 may gather data about multiple different aspects of each memory page, such as, the source of the memory page (e.g., associated virtual machine, original owner), the size of the memory page (e.g., standard page or huge page), the location of the memory page (e.g., proximity to other released memory pages), other information, or a combination thereof.
  • Page selection module 326 may access data gathered by set analysis module 324 and may select one or more memory pages that fulfill the request.
  • the selection of a memory page may take into account the amount of memory pages that should be cleared, the locality of the memory pages (e.g., whether they are partially or completely contiguous), the size alignment (e.g., a single huge page is better than multiple standard pages), other aspects, or a combination thereof.
  • Minimizing the memory page that needs to be paged in and out of backing store may be used to prioritize which memory pages are used to fulfill the virtual machine's request.
  • FIGS. 4 and 5 depict flow diagrams for illustrative examples of methods 400 and 500 for memory page hinting, in accordance with one or more aspects of the present disclosure.
  • Method 400 illustrates an example process flow from the perspective of the guest operating system and method 500 is an example process flow from the perspective of a hypervisor.
  • Methods 400 and 500 may be performed by processing devices that may comprise hardware (e.g., circuitry, dedicated logic, programmable logic, microcode, etc.), executable code (such as is run on a general purpose computer system or a dedicated machine), or a combination of both.
  • Methods 400 and 500 and each of their individual functions, routines, subroutines, or operations may be performed by one or more processors of the computer device executing the method.
  • methods 400 and 500 may each be performed by a single processing thread. Alternatively, methods 400 and 500 may be performed by two or more processing threads, each thread executing one or more individual functions, routines, subroutines, or operations of the method. In an illustrative example, the processing threads implementing methods 400 and 500 may be synchronized (e.g., using semaphores, critical sections, and/or other thread synchronization mechanisms). Alternatively, the processes implementing methods 400 and 500 may be executed asynchronously with respect to each other.
  • method 400 may be performed by processing devices of a server device or a client device and may begin at block 402 .
  • the processing device executing a guest operating system may determine that a memory page size of the guest operating system is different from a memory page size of a hypervisor that manages the guest operating system.
  • the processing device may determine the memory page size of the hypervisor by transmitting a request (e.g., hypercall) to the hypervisor and receiving a message back from the hypervisor with data indicating the memory page size.
  • the memory page size received from the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space.
  • the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages.
  • the memory page size of the hypervisor may be smaller than or equal to the memory pages size of the guest operating system and a single guest memory page may be stored within one or more hypervisor memory pages.
  • the processing device executing the guest operating system may add a guest memory page released by the guest operating system to a set of guest memory pages.
  • the set of guest memory pages released by the guest operating system may include one or more tuples and adding the guest memory page to the set may involve adding a tuple to the set or expanding a range of an existing tuple.
  • the guest memory page added to the set may include multiple guest memory pages that have been released by the guest operating system and that remain allocated to a virtual machine executing the guest operating system.
  • the processing device executing the guest operating system may determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page.
  • the determination may involve the guest operating system determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor. This may involve identifying a location (e.g., virtual, logical, or physical address) of one or more of the guest memory pages and comparing it to a location (e.g., virtual, logical, or physical address) of one or more hypervisor memory pages.
  • the guest operating system may base the determination on a hypothesis that the first page of guest memory starts at the beginning of a hypervisor page and may or may not contact the hypervisor to confirm this hypothesis.
  • the guest operating system may then generate a message comprising the location (e.g., address) of the hypervisor memory page as opposed to the location of the guest memory page.
  • the indication may be aligned with the memory page size of the hypervisor as opposed to the memory page size of the guest operating system.
  • the processing device executing the guest operating system may provide an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Providing the indication may be in response to the set of guest memory pages released by the guest operating system filling a hypervisor memory page or filling a predetermined threshold number of hypervisor memory pages. Filling a hypervisor memory page may involve completely filling the entire hypervisor page without having a portion of the hypervisor page in use by any guest operating system.
  • providing the indication to the hypervisor may involve the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier.
  • providing the indication to the hypervisor may involve the guest operating system updating a shared data structure that represents the set of guest memory pages released by the guest operating system, wherein the shared data structure is modifiable by the one or more guest operating system and is accessible to the hypervisor.
  • providing the indication that the hypervisor memory page is available for reuse may enable the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • the hypervisor memory page may be stored on a primary storage device and the persistent storage may include swap space of a secondary storage device. Responsive to completing the operations described herein above with references to block 408 , the method may terminate.
  • method 500 may be performed by processing devices of a server device or a client device and may begin at block 502 .
  • the processing device executing a hypervisor may provide a memory page size of the hypervisor to a guest operating system.
  • the processing device may provide the memory page size by responding to a request received from the guest operating system.
  • the request may be initiated by the guest operating system using a hypercall and the hypervisor may respond with a message that includes data indicating the memory page size.
  • the memory page size of the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space.
  • the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages.
  • the memory page of the hypervisor is filled by guest memory pages released by a single guest operating system.
  • the memory page of the hypervisor may be filled by guest memory pages released by multiple guest operating systems.
  • the processing device executing the hypervisor may determine that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system.
  • the guest memory pages released by the guest operating system may remain allocated to a virtual machine executing the guest operating system.
  • the determination may involve receiving, from the guest operating system, an indication comprising data to determine that one or more of the hypervisor's memory pages comprise content released by the guest operating system.
  • the data may identify at least one hypervisor memory page that includes content released by the guest operating system without including content in use by the guest operating system.
  • the indication may involve a hypercall initiated by the guest operating system after one of the guest memory pages has been released and comprises a memory page identifier.
  • the indication may involve a reference to a shared data structure and be received before the guest memory pages have been released.
  • the shared data structure may represent a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • the processing device executing the hypervisor may reallocate the memory page and avoid copying content of the memory page to persistent storage.
  • the reallocation may be done in response to analyzing a set of hypervisor memory pages that include content that was released by one or more guest operating systems.
  • the set may include hypervisor memory pages that are allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released).
  • reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page.
  • the technology disclosed herein may enable hypervisor 120 to reallocate memory pages in a more efficient manner because the processing device may be able to detect when a hypervisor memory page that is allocated to a virtual machine is not in use by the virtual machine. As a result, a hypervisor memory page may be reallocated (e.g., reused) without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to access the memory page again. Responsive to completing the operations described herein above with references to block 506 , the method may terminate.
  • the processing device executing the hypervisor may add a plurality of memory pages of the hypervisor to a set of allocated and unused memory pages.
  • the set of allocated and unused memory pages may include one or more tuples and adding the plurality of memory pages to the set may alter the one or more tuples.
  • adding memory pages to the set may involve expanding a range of a single tuple to represent the plurality of memory pages.
  • adding the plurality of memory pages to the set may involve adding a plurality of tuples to the set and each of the tuples may correspond to one of the memory pages.
  • the processing device may subsequently select the memory page added to the set of allocated and unused memory and reallocate it to the same or different virtual machine.
  • FIG. 6 depicts a block diagram of a computer system 600 operating in accordance with one or more aspects of the present disclosure.
  • Computer system 600 may be the same or similar to computer system 100 and may include one or more processing devices and one or more memory devices.
  • computer system 600 may include a page size determination module 610 , a guest page set module 620 , a hypervisor page filling detection module 630 , and an indication providing module 640 .
  • Page size determination module 610 may enable the processing device executing a guest operating system to determine that a memory page size of the guest operating system is different from a hypervisor memory page size 652 of a hypervisor that manages the guest operating system.
  • the processing device may determine the memory page size of the hypervisor by transmitting a request (e.g., hypercall) to the hypervisor and receiving a message back from the hypervisor with data indicating the hypervisor memory page size 652 .
  • the hypervisor memory page size 652 received from the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space.
  • the hypervisor memory page size 652 may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In another example, hypervisor memory page size 652 may be smaller than or equal to the memory pages size of the guest operating system and a single guest memory page may be stored within one or more hypervisor memory pages.
  • Guest page set module 620 may enable the processing device executing the guest operating system to add a guest memory page released by the guest operating system to a set of guest memory pages 654 .
  • Set of guest memory pages 654 may include one or more tuples and adding the guest memory page to the set may involve adding a tuple to the set or expanding a range of an existing tuple.
  • the guest memory page added to the set may include multiple guest memory pages that have been released by the guest operating system and that remain allocated to a virtual machine executing the guest operating system.
  • Hypervisor page filling detection module 630 may enable the processing device executing the guest operating system to determine in view of the hypervisor memory page size 652 of the hypervisor that the set of guest memory pages fills a hypervisor memory page. The determination may involve the guest operating system determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor. This may involve identifying a location (e.g., virtual, logical, or physical address) of one or more of the guest memory pages and comparing it to a location (e.g., virtual, logical, or physical address) of one or more hypervisor memory pages.
  • a location e.g., virtual, logical, or physical address
  • the guest operating system may base the determination on a hypothesis that the first page of guest memory starts at the beginning of a hypervisor page and may or may not contact the hypervisor to confirm this hypothesis.
  • the guest operating system may then generate a message comprising the location (e.g., address) of the hypervisor memory page as opposed to the location of the guest memory page.
  • the indication may be aligned with the memory page size of the hypervisor as opposed to the memory page size of the guest operating system.
  • Indication providing module 640 may enable the processing device executing the guest operating system to provide an indication to the hypervisor that the hypervisor memory page is available for reuse. Providing the indication may be in response to the set of guest memory pages released by the guest operating system filling a hypervisor memory page or filling a predetermined threshold number of hypervisor memory pages. Filling a hypervisor memory page may involve completely filling the entire hypervisor page without having a portion of the hypervisor page in use by any guest operating system. In one example, providing the indication to the hypervisor may involve the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier.
  • providing the indication to the hypervisor may involve the guest operating system updating a shared data structure that represents the set of guest memory pages released by the guest operating system, wherein the shared data structure is modifiable by the one or more guest operating system and is accessible to the hypervisor.
  • providing the indication that the hypervisor memory page is available for reuse may enable the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • the hypervisor memory page may be stored on a primary storage device and the persistent storage may include swap space of a secondary storage device.
  • FIG. 7 depicts a block diagram of a computer system 700 operating in accordance with one or more aspects of the present disclosure.
  • Computer system 700 may be the same or similar to computer system 100 and may include one or more processing devices and one or more memory devices.
  • computer system 700 may include a memory page size indication module 710 , a memory page release detection module 720 , and a reallocation module 730 .
  • Memory page size indication module 710 may enable the processing device executing a hypervisor to provide a memory page size of the hypervisor to a guest operating system.
  • the processing device may provide the memory page size by responding to a request received from the guest operating system.
  • the request may be initiated by the guest operating system using a hypercall and the hypervisor may respond with a message that includes data indicating the memory page size.
  • the memory page size of the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space.
  • the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages.
  • the memory page of the hypervisor is filled by guest memory pages released by a single guest operating system.
  • the memory page of the hypervisor may be filled by guest memory pages released by multiple guest operating systems.
  • Memory page release detection module 720 may enable the processing device executing the hypervisor to determine that a hypervisor memory page 752 of the hypervisor comprises a plurality of guest memory pages 754 released by the guest operating system.
  • the guest memory pages 754 released by the guest operating system may remain allocated to a virtual machine executing the guest operating system.
  • the determination may involve receiving, from the guest operating system, an indication comprising data to determine that one or more of the hypervisor's memory pages comprise content released by the guest operating system.
  • the data may identify at least one hypervisor memory page that includes content released by the guest operating system without including content in use by the guest operating system.
  • the indication may involve a hypercall initiated by the guest operating system after one of the guest memory pages has been released and comprises a memory page identifier.
  • the indication may involve a reference to a shared data structure and be received before the guest memory pages have been released.
  • the shared data structure may represent a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • Reallocation module 730 may enable the processing device executing the hypervisor to reallocate the memory page and avoid copying content of the memory page to persistent storage.
  • the reallocation may be done in response to analyzing a set of hypervisor memory pages that include content that was released by one or more guest operating systems.
  • the set may include hypervisor memory pages that are allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released).
  • reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page.
  • hypervisor 120 may reallocate memory pages in a more efficient manner because the processing device may be able to detect when a hypervisor memory page that is allocated to a virtual machine is not in use by the virtual machine.
  • a hypervisor memory page may be reallocated (e.g., reused) without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to access the memory page again.
  • FIGS. 8 and 9 depict flow diagrams for illustrative examples of methods 800 and 900 for memory page hinting, in accordance with one or more aspects of the present disclosure.
  • Method 800 illustrates an example process flow from the perspective of the guest operating system and method 900 is an example process flow from the perspective of a hypervisor.
  • method 800 may be performed by processing devices of a server device or a client device and may begin at block 802 .
  • the processing device executing a guest operating system may receive a memory page size of a hypervisor.
  • the processing device may receive the memory page size of the hypervisor in response to a request (e.g., hypercall) transmitted to the hypervisor.
  • a request e.g., hypercall
  • the memory page size received from the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space.
  • the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages.
  • the memory page size of the hypervisor may be smaller than or equal to the memory pages size of the guest operating system and a single guest memory page may be stored within one or more hypervisor memory pages
  • the processing device executing the guest operating system may determine that the memory page size of the hypervisor is larger than a memory pages size of the guest operating system. This may enable a single hypervisor memory page to include the content of multiple guest memory pages.
  • the hypervisor memory page may be a huge page (e.g., 2 MB) and the guest memory page may be a standard page (e.g., 4 KB).
  • the processing device executing the guest operating system may add a guest memory page released by the guest operating system to a set of guest memory pages.
  • the set of guest memory pages released by the guest operating system may include one or more tuples and adding the guest memory page to the set may involve adding a tuple to the set or expanding a range of an existing tuple.
  • the guest memory page added to the set may include multiple guest memory pages that have been released by the guest operating system and that remain allocated to a virtual machine executing the guest operating system.
  • the processing device executing the guest operating system may determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page.
  • the determination may involve the guest operating system determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor. This may involve identifying a location (e.g., virtual, logical, or physical address) of one or more of the guest memory pages and comparing it to a location (e.g., virtual, logical, or physical address) of one or more hypervisor memory pages.
  • the guest operating system may base the determination on a hypothesis that the first page of guest memory starts at the beginning of a hypervisor page and may or may not contact the hypervisor to confirm this hypothesis.
  • the guest operating system may then generate a message comprising the location (e.g., address) of the hypervisor memory page as opposed to the location of the guest memory page.
  • the indication may be aligned with the memory page size of the hypervisor as opposed to the memory page size of the guest operating system.
  • the processing device executing the guest operating system may provide an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Providing the indication may be in response to the set of guest memory pages released by the guest operating system filling a hypervisor memory page or filling a predetermined threshold number of hypervisor memory pages. Filling a hypervisor memory page may involve completely filling the entire hypervisor page without having a portion of the hypervisor page in use by any guest operating system.
  • providing the indication to the hypervisor may involve the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier.
  • providing the indication to the hypervisor may involve the guest operating system updating a shared data structure that represents the set of guest memory pages released by the guest operating system, wherein the shared data structure is modifiable by the one or more guest operating system and is accessible to the hypervisor.
  • providing the indication that the hypervisor memory page is available for reuse may enable the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • the hypervisor memory page may be stored on a primary storage device and the persistent storage may include swap space of a secondary storage device. Responsive to completing the operations described herein above with references to block 810 , the method may terminate.
  • method 900 may be performed by processing devices of a server device or a client device and may begin at block 902 .
  • the processing device executing a hypervisor may receive a request for a memory page size of the hypervisor.
  • the request may be initiated by a guest operating system and received from a guest operating system managed by the hypervisor.
  • the guest operating system may indianite the request using a hypercall.
  • the processing device executing a hypervisor may transmit a memory page size of the hypervisor to a guest operating system.
  • the processing device may provide the memory page size by responding to a request received from the guest operating system.
  • the request may be initiated by the guest operating system using a hypercall and the hypervisor may respond with a message that includes data indicating the memory page size.
  • the memory page size of the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space.
  • the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages.
  • the memory page of the hypervisor is filled by guest memory pages released by a single guest operating system.
  • the memory page of the hypervisor may be filled by guest memory pages released by multiple guest operating systems.
  • the processing device executing the hypervisor may determine that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system.
  • the guest memory pages released by the guest operating system may remain allocated to a virtual machine executing the guest operating system.
  • the determination may involve receiving, from the guest operating system, an indication comprising data to determine that one or more of the hypervisor's memory pages comprise content released by the guest operating system.
  • the data may identify at least one hypervisor memory page that includes content released by the guest operating system without including content in use by the guest operating system.
  • the indication may involve a hypercall initiated by the guest operating system after one of the guest memory pages has been released and comprises a memory page identifier.
  • the indication may involve a reference to a shared data structure and be received before the guest memory pages have been released.
  • the shared data structure may represent a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • the processing device executing the hypervisor may reallocate the memory page and avoid copying content of the memory page to persistent storage.
  • the reallocation may be done in response to analyzing a set of hypervisor memory pages that include content that was released by one or more guest operating systems.
  • the set may include hypervisor memory pages that are allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released).
  • reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page.
  • the technology disclosed herein may enable hypervisor 120 to reallocate memory pages in a more efficient manner because the processing device may be able to detect when a hypervisor memory page that is allocated to a virtual machine is not in use by the virtual machine. As a result, a hypervisor memory page may be reallocated (e.g., reused) without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to access the memory page again. Responsive to completing the operations described herein above with references to block 908 , the method may terminate.
  • FIG. 10 depicts a block diagram of a computer system operating in accordance with one or more aspects of the present disclosure.
  • computer system 1000 may correspond to computer system 100 of FIG. 1 .
  • the computer system may be included within a data center that supports virtualization. Virtualization within a data center results in a physical system being virtualized using virtual machines to consolidate the data center infrastructure and increase operational efficiencies.
  • a virtual machine (VM) may be a program-based emulation of computer hardware.
  • the VM may operate based on computer architecture and functions of computer hardware resources associated with hard disks or other such memory.
  • the VM may emulate a physical computing environment, but requests for a hard disk or memory may be managed by a virtualization layer of a computing device to translate these requests to the underlying physical computing hardware resources. This type of virtualization results in multiple VMs sharing physical resources.
  • computer system 1000 may be connected (e.g., via a network, such as a Local Area Network (LAN), an intranet, an extranet, or the Internet) to other computer systems.
  • Computer system 1000 may operate in the capacity of a server or a client computer in a client-server environment, or as a peer computer in a peer-to-peer or distributed network environment.
  • Computer system 1000 may be provided by a personal computer (PC), a tablet PC, a set-top box (STB), a Personal Digital Assistant (PDA), a cellular telephone, a web appliance, a server, a network router, switch or bridge, or any device capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that device.
  • PC personal computer
  • PDA Personal Digital Assistant
  • STB set-top box
  • web appliance a web appliance
  • server a server
  • network router switch or bridge
  • any device capable of executing a set of instructions that specify actions to be taken by that device.
  • the computer system 1000 may include a processing device 1002 , a volatile memory 1004 (e.g., random access memory (RAM)), a non-volatile memory 1006 (e.g., read-only memory (ROM) or electrically-erasable programmable ROM (EEPROM)), and a data storage device 1016 , which may communicate with each other via a bus 1008 .
  • a volatile memory 1004 e.g., random access memory (RAM)
  • non-volatile memory 1006 e.g., read-only memory (ROM) or electrically-erasable programmable ROM (EEPROM)
  • EEPROM electrically-erasable programmable ROM
  • Processing device 1002 may be provided by one or more processors such as a general purpose processor (such as, for example, a complex instruction set computing (CISC) microprocessor, a reduced instruction set computing (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, a microprocessor implementing other types of instruction sets, or a microprocessor implementing a combination of types of instruction sets) or a specialized processor (such as, for example, an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), or a network processor).
  • CISC complex instruction set computing
  • RISC reduced instruction set computing
  • VLIW very long instruction word
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • DSP digital signal processor
  • Computer system 1000 may further include a network interface device 1022 .
  • Computer system 1000 also may include a video display unit 1010 (e.g., an LCD), an alphanumeric input device 1012 (e.g., a keyboard), a cursor control device 1014 (e.g., a mouse), and a signal generation device 1020 .
  • a video display unit 1010 e.g., an LCD
  • an alphanumeric input device 1012 e.g., a keyboard
  • a cursor control device 1014 e.g., a mouse
  • signal generation device 1020 e.g., a signal generation device.
  • Data storage device 1016 may include a non-transitory computer-readable storage medium 1024 on which may store instructions 1026 encoding any one or more of the methods or functions described herein, including instructions for implementing methods 300 or 500 and for encoding page hinting component 122 and modules illustrated in FIGS. 1 and 2 .
  • Instructions 1026 may also reside, completely or partially, within volatile memory 1004 and/or within processing device 1002 during execution thereof by computer system 1000 , hence, volatile memory 1004 and processing device 1002 may also constitute machine-readable storage media.
  • While computer-readable storage medium 1024 is shown in the illustrative examples as a single medium, the term “computer-readable storage medium” shall include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of executable instructions.
  • the term “computer-readable storage medium” shall also include any tangible medium that is capable of storing or encoding a set of instructions for execution by a computer that cause the computer to perform any one or more of the methods described herein.
  • the term “computer-readable storage medium” shall include, but not be limited to, solid-state memories, optical media, and magnetic media.
  • Example 1 is a method comprising: determining, by a processing device executing a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; adding, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determining in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and providing an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 2 is the method of example 1, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
  • Example 3 is the method of example 1, wherein providing the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • Example 4 is the method of example 1, further comprising, generating, by the guest operating system, an indication aligned with the memory page size of the hypervisor, wherein the generating comprises: identifying an address of the guest memory page; determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor; and generating a message comprising the address of the hypervisor memory page.
  • Example 5 is the method of example 1, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling the hypervisor memory page.
  • Example 6 is the method of example 1, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling a plurality of hypervisor memory pages, wherein the plurality of hypervisor memory pages satisfies a predetermined threshold.
  • Example 7 is the method of example 1, wherein the set of guest memory pages released by the guest operating system comprises a tuple, and wherein adding the guest memory page to the set comprises expanding a range of the tuple or adding another tuple to the set.
  • Example 8 is method of example 1, where providing the indication to the hypervisor comprises the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier of the hypervisor memory page.
  • Example 9 is the method of example 1, wherein providing the indication to the hypervisor comprises the guest operating system updating a shared data structure that represents a plurality of hypervisor memory pages, wherein the shared data structure is modifiable by the guest operating system and is accessible to the hypervisor.
  • Example 10 is the method of example 1, wherein determining the memory page size of the hypervisor comprises receiving a message from the hypervisor indicating one or more memory page sizes supported by the hypervisor.
  • Example 11 is a method comprising: providing, by a processing device executing a hypervisor, a memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; determining, by the hypervisor, that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; and responsive to the determining, the hypervisor reallocating the memory page and avoiding copying content of the memory page to persistent storage.
  • Example 12 is the method of example 11, wherein the determining comprises receiving, from the guest operating system, an indication identifying one or more memory pages that comprise content released by the guest operating system.
  • Example 13 is the method of example 12, wherein receiving the indication comprises a hypercall initiated by the guest operating system after one of the guest memory pages has been released.
  • Example 14 is the method of example 12, wherein receiving the indication comprises receiving a reference to a shared data structure before the guest memory pages have been released, wherein the shared data structure represents a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • Example 15 is the method of example 11, further comprising: adding, by the hypervisor, a plurality of memory pages of the hypervisor to a set of allocated and unused memory pages, wherein the set of allocated and unused memory pages comprises a tuple; receiving a request to allocate a memory page; and selecting the memory page from the set of allocated and unused memory
  • Example 16 is the method of example 15, wherein adding the plurality of memory pages to the set comprises expanding a range of the tuple to represent the plurality of memory pages.
  • Example 17 is the method of example 15, wherein adding the plurality of memory pages to the set comprises adding a plurality of tuples to the set, wherein one of the plurality of tuples corresponding to one of the plurality of memory pages.
  • Example 18 is the method of example 11, wherein the memory page of the hypervisor is filled by the plurality of guest memory pages released by the guest operating system.
  • Example 19 is the method of example 11, wherein the memory page of the hypervisor is filled by guest memory pages released by a plurality of guest operating systems.
  • Example 20 is a system comprising: a memory; a processing device operatively coupled to the memory, the processing device to: determine by a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; add, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and
  • Example 21 is the system of example 20, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
  • Example 22 is the system of example 20, wherein to provide the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • Example 23 is the system of example 20, wherein the processing device is further to generate, by the guest operating system, an indication aligned with the memory page size of the hypervisor.
  • Example 24 is the system of example 20, wherein to provide the indication is in response to the set of guest memory pages released by the guest operating system filling the hypervisor memory page.
  • Example 25 is a system comprising: a memory; a processing device operatively coupled to the memory, the processing device to: provide, by a hypervisor, a memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; determine, by the hypervisor, that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; and responsive to the determining, the hypervisor reallocating the memory page and avoiding copying content of the memory page to persistent storage.
  • Example 26 is the system of example 25, wherein to determine, the processing device is to receive, from the guest operating system, an indication identifying one or more memory pages that comprise content released by the guest operating system.
  • Example 27 is the system of example 26, wherein to receive the indication, the processing device is to receive a hypercall initiated by the guest operating system after one of the guest memory pages has been released.
  • Example 28 is the system of example 26, wherein to receive the indication, the processing device is to receive a reference to a shared data structure before the guest memory pages have been released, wherein the shared data structure represents a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • Example 29 is the system of example 25, further comprising: add, by the hypervisor, a plurality of memory pages of the hypervisor to a set of allocated and unused memory pages, wherein the set of allocated and unused memory pages comprises a tuple; receive a request to allocate a memory page; and select the memory page from the set of allocated and unused memory
  • Example 30 is a non-transitory machine-readable storage medium storing instructions that cause a processing device to: receive, by a processing device executing a guest operating system, a memory page size of a hypervisor; determine, by the guest operating system, that the memory page size of the hypervisor is larger than a memory page size of the guest operating system; add, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and responsive to the set of guest memory pages filling the hypervisor page, provide an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 31 is a non-transitory machine-readable storage medium storing instructions that cause a processing device to: receive, by a processing device executing a hypervisor, a request for a memory page size of the hypervisor; transmit, by the hypervisor, the memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; determine, by the hypervisor, that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; reallocate, by the hypervisor, the memory page and avoiding copying content of the memory page to persistent storage.
  • Example 32 is an apparatus comprising: means for determining, by a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; means for adding, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; means for determining in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and providing an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 33 is an apparatus comprising: means for providing, by a hypervisor, a memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; means for determining a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; and means for reallocating the memory page and avoiding copying content of the memory page to persistent storage.
  • the methods, components, and features described herein may be implemented by discrete hardware components or may be integrated in the functionality of other hardware components such as ASICS, FPGAs, DSPs or similar devices.
  • the methods, components, and features may be implemented by firmware modules or functional circuitry within hardware devices.
  • the methods, components, and features may be implemented in any combination of hardware devices and computer program components, or in computer programs.
  • terms such as “determining,” “identifying,” “adding,” “providing,” “reallocating,” “generating,” “receiving,” “selecting,” or the like refer to actions and processes performed or implemented by computer systems that manipulates and transforms data represented as physical (electronic) quantities within the computer system registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
  • the terms “first,” “second,” “third,” “fourth,” etc. as used herein are meant as labels to distinguish among different elements and may not have an ordinal meaning according to their numerical designation.
  • Examples described herein also relate to an apparatus for performing the methods described herein.
  • This apparatus may be specially constructed for performing the methods described herein, or it may comprise a general purpose computer system selectively programmed by a computer program stored in the computer system.
  • a computer program may be stored in a computer-readable tangible storage medium.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

Systems and methods for memory page hints that account for multiple page sizes. An example method may comprise: determining, by a processing device executing a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; adding, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determining in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and providing an indication to the hypervisor that the hypervisor memory page is available for reuse.

Description

    TECHNICAL FIELD
  • The present disclosure is generally related to virtualized computer systems, and more particularly, to memory allocation in virtualized computer systems.
  • BACKGROUND
  • Virtualization allows multiplexing of an underlying host machine between different virtual machines. The host machine allocates a certain amount of its resources to each of the virtual machines. Each virtual machine is then able to use the allocated resources to execute applications, including operating systems (referred to as guest operating systems). An executable layer that provides the virtualization is commonly referred to as a hypervisor (also known as a virtual machine monitor (VMM)). The hypervisor emulates the underlying hardware of the host computer, making the use of the virtual machine transparent to the guest operating system and the user of the computer.
  • A host machine can accommodate more virtual machines than the size of its physical memory allows. Using virtual memory techniques, the host machine can give each virtual machine the impression that it has a contiguous address space, while in fact the memory used by the virtual machine may be physically fragmented and even overflow to disk storage. When the host machine needs to free up memory, it selects memory pages that have been assigned to virtual machines, and pages out the contents of those memory pages to disk storage. When the virtual machines attempt to access those memory pages, the host machine pages in the content of the memory page by reading the content stored in disk storage and writing the content back to memory. Paging out and paging in memory pages requires input/output (I/O) operations, which can cause significant delay for the virtual machine.
  • BRIEF DESCRIPTION OF THE DRAWINGS
  • The present disclosure is illustrated by way of examples, and not by way of limitation, and may be more fully understood with references to the following detailed description when considered in connection with the figures, in which:
  • FIG. 1 depicts a high-level block diagram of an example computer system architecture, in accordance with one or more aspects of the present disclosure;
  • FIG. 2 depicts a block diagram of an example guest operating system that implements memory page hinting that takes into account multiple different page sizes, in accordance with one or more aspects of the present disclosure;
  • FIG. 3 depicts a block diagram of an example hypervisor that implements memory page hinting that takes into account multiple different page sizes, in accordance with one or more aspects of the present disclosure;
  • FIG. 4 depicts a flow diagram of an example method executed by a guest operating system to provide memory page hinting, in accordance with one or more aspects of the present disclosure;
  • FIG. 5 depicts a flow diagram of an example method executed by a hypervisor to use memory page hints, in accordance with one or more aspects of the present disclosure;
  • FIG. 6 depicts a block diagram of an example computer system in accordance with one or more aspects of the present disclosure;
  • FIG. 7 depicts a block diagram of another example computer system in accordance with one or more aspects of the present disclosure;
  • FIG. 8 depicts a flow diagram of another example method executed by a guest operating system to provide memory page hinting, in accordance with one or more aspects of the present disclosure;
  • FIG. 9 depicts a flow diagram of another example method executed by a hypervisor to use memory page hinting, in accordance with one or more aspects of the present disclosure;
  • FIG. 10 depicts a block diagram of an illustrative computing device operating in accordance with the examples of the present disclosure.
  • DETAILED DESCRIPTION
  • Many modern virtualized computer systems include overlapping storage management features that manage the same underlying physical storage resources. For example, a hypervisor and a guest operating system may both include storage management functionality that implements a caching mechanism across different storage devices. The caching mechanism may involve memory pages that are paged to or from a persistent storage. The hypervisor and guest operating systems may function separately and a hypervisor may allocate storage to a virtual machine but may be unaware of which portions of storage are in use by a guest operating system executing on the virtual machine. Knowledge of the guest operating system's use of the storage may be beneficial to a hypervisor managing memory because portions of storage that have been released by the guest operating system may be reused by the hypervisor without the overhead of copying the data to and from persistent storage (e.g., page swapping).
  • Virtualized computer systems have evolved to share information about the use of memory between the guest operating system and the hypervisor. For example, a guest operating system may share memory use information with the hypervisor by transmitting messages that identify particular guest memory pages that are not being used by the guest operating system. The hypervisor may store the memory use information and subsequently access the memory use information when determining a portion of memory to evict. In some configurations, the guest operating system and the hypervisor may use the same size memory pages and when a guest memory page is released it may indicate that a corresponding memory page of the hypervisor is no longer being used by the guest operating system. In other configurations, the guest operating system and the hypervisor may use memory pages that are different sizes. In this situation, a guest memory page that is no longer in use may not necessarily correspond to memory page of the hypervisor that is no longer in use by the guest operating system. This is because the memory page of the hypervisor may be larger than the guest memory page and another portion of the hypervisor page may still be in use by the guest operating system. Messages that indicate only a portion of a hypervisor's memory page has been released may not be useful if the remaining portion of the hypervisor's memory page remains in use.
  • Aspects of the present disclosure address the above and other deficiencies by providing technology that aligns the memory use information of guest memory pages with underlying hypervisor memory pages when a virtualized computer system uses multiple memory page sizes. In one example, the technology may be integrated within a guest operating system and the guest operating system may determine that a memory page size of the guest operating system is different from a memory page size of a hypervisor. As the guest operating system releases guest memory pages the guest operating system may add the released guest memory pages to a set of pages. The guest operating system may determine based on the memory page size of the hypervisor whether the set of released guest memory pages fills a memory page of the hypervisor. If the set does not fill a memory page of the hypervisor memory page, the guest operating system may avoid (e.g., wait) to send a message to the hypervisor. If the set does fill a memory page of the hypervisor, the guest operating system may provide an indication to the hypervisor that the memory page is available for reuse. In another example, the technology may be integrated within a hypervisor. The hypervisor may provide a memory page size of the hypervisor to a guest operating system. The memory page size of the hypervisor may be larger than a memory page size of the guest operating system. The hypervisor may determine that a memory page of the hypervisor comprises a plurality of guest memory pages that have been released by the guest operating system and that the memory page remains allocated to a virtual machine executing the guest operating system. When the hypervisor determines it needs to recapture (e.g., evict) memory, the hypervisor may reallocate a hypervisor memory page that is unused by the guest operating system to avoid having to copy content of the hypervisor memory page to persistent storage (e.g., backing store).
  • The systems and methods described herein include technology that enhances the memory management of virtualized computer systems. In particular, aspects of the present disclosure provide technology that enables a guest operating system to detect when the guest memory pages released by a guest operating system occupy an entire memory page of the hypervisor. This may enable the guest operating system to delay informing the hypervisor until a hypervisor memory page is completely released (e.g., unused) by a guest operating system and therefor avoid informing the hypervisor when only a portion of the hypervisor memory page is released. This may reduce the quantity of communications occurring between the guest operating system and the hypervisor, which may reduce the computing resources (e.g., processing power, Input/Output) consumed by virtual machines. Virtual machines that consume less computing resources may enable a host machine to support more virtual machines.
  • Various aspects of the above referenced methods and systems are described in details herein below by way of examples, rather than by way of limitation. The examples provided below discuss a virtualized computer system that has a hypervisor without an underlying host operating system (e.g., bare metal hypervisor), but other examples may include a hypervisor and host operating system (not shown).
  • FIG. 1 depicts an illustrative architecture of computer system 100, in accordance with an example of the present disclosure. It should be noted that other architectures for computer system 100 are possible, and that the implementation of a computer system utilizing embodiments of the disclosure are not necessarily limited to the specific architecture depicted. Computer system 100 may be a single host machine or multiple host machines arranged in a heterogeneous or homogenous group (e.g., cluster) and may include one or more rack mounted servers, workstations, desktop computers, notebook computers, tablet computers, mobile phones, palm-sized computing devices, personal digital assistants (PDAs), etc. In one example, computer system 100 may be a computing device implemented with x86 hardware. In another example, computer system 100 may be a computing device implemented with PowerPC®, SPARC®, or other hardware. In the example shown in FIG. 1, computer system 100 may include one or more virtual machines 110A-C, a hypervisor 120, hardware devices 130, and a network 140.
  • Virtual machines 110A-C may execute guest executable code that uses an underlying emulation of physical resources. The guest executable code may include one or more guest operating systems 112A-C that manage guest applications, guest device drivers, other executable code, or a combination thereof. Each of the virtual machines 110A-C may support hardware emulation, full virtualization, para-virtualization, operating system-level virtualization, or a combination thereof. Virtual machines 110A-C may have the same or different types of guest operating systems, such as Microsoft® Windows®, Linux®, Solaris®, etc. The virtual machines 110A-C may execute guest operating systems 112A-C that manage guest memory 114A-C respectively.
  • Guest operating systems 112A-C may include memory management components 111A-C and page hinting components 113A-C respectively. Components 111A-C and 113A-C may be separate components as shown or may be included into the same component. For example, the features provided by page hinting component may be integrated into the operations performed by memory management component of guest operating system 112A. Memory management component 111A-C may manage aspects of guest memory caching, such as the allocation and the release of portions of guest memory 114A-C. Page hinting components 113A-C may provide indications to hypervisor 120 of the memory pages that are released, allocated, or a combination thereof. In one example, page hinting components 113A-C may determine the status of hypervisor memory pages by analyzing a set of guest memory pages that have been released. Page hinting components 113A-C may notify the hypervisor when the set of guest memory pages reaches a threshold (e.g., buffer limit). The features of memory management component 111A-C and page hinting component 113A-C are discussed in more detail below in regards to the guest operating system of FIG. 2.
  • Guest memory 114A-C may be any virtual memory, logical memory, physical memory, other portion of memory, or a combination thereof for storing, organizing, or accessing data. Guest memory 114A-C may represent the portion of memory that is designated by hypervisor 120 for use by one or more respective virtual machines 110A-C. Guest memory 114A-C may be managed by guest operating system 112A-C and may be segmented into guest memory pages 116. Guest memory pages 116 may each include a contiguous or non-contiguous sequence of bytes or bits and may have a page size that is the same or different from a memory page size used by hypervisor 120. As shown in FIG. 1, the page size 115A of guest memory pages 116 and the page size 115B of hypervisor memory page 129A may be different. Each of the page sizes 115A and 115B may be a fixed-size, such as a particular integer value (e.g., 4 KB, 2 MB) or may be a variable-size that varies within a range of integer values. Each of the guest memory pages 116 may have a page size that is the same or different from the page size of an adjacent memory page. In one example, guest memory pages 116 may be memory blocks of a volatile or non-volatile memory device and may each correspond to an individual memory block, multiple memory blocks, or a portion of a memory block. Page size 115A may have a standard size (e.g., page size of 4 KB) and page size 115B may have an enlarged size (e.g., page size of 2 MB), which may be referred to as “huge pages.”
  • Hypervisor memory 126 may be the same or similar to the guest memory but may be managed by hypervisor 120 instead of a guest operating system. Hypervisor memory 126 may include unallocated memory 128A, memory allocated to guests 128B, and memory allocated to hypervisor (not shown). The unallocated memory 128A may be memory pages that have not yet been allocated by hypervisor memory 126 or were previously allocated by hypervisor 120 and have since been deallocated (e.g., freed) by hypervisor 120. The memory allocated to guests may be the portion of hypervisor memory 126 that has been allocated by hypervisor 120 to virtual machines 110A-C and corresponds to guest memory 114A-C. Other portions of hypervisor memory may be allocated for use by hypervisor 120, a host operating system, hardware device, other module, or a combination thereof.
  • Hypervisor memory 126 may include hypervisor memory pages 129A-D, which may be in different states. The states may correspond to whether or not the hypervisor memory page has been allocated to a virtual machine and whether the hypervisor memory page is in use or is not in use by the virtual machine it is allocated to. Hypervisor memory page 129A may represent a memory page that is unallocated and hypervisor memory pages 129B-D may represent memory pages that have been allocated. Each of hypervisor memory pages 129B-D may be allocated by hypervisor 120 to a virtual machine but may include a different proportion of the memory page that is in use or not in use by the virtual machine it is allocated to. For example, hypervisor memory page 129B may be completely unused by the guest virtual machine that it is allocated to. Hypervisor memory page 129C may be partially in use and partially not in use by a guest virtual machine. Hypervisor memory page 129D may be fully in use by the virtual machine it is allocated to. As shown in FIG. 1, hypervisor memory page 129B may be fully released by guest operating system 112A and may correspond to released guest memory pages 118.
  • Released guest memory pages 118 may be any portion of guest memory 114A that has been released by the guest operating system. Releasing a memory page may involve a guest operating system instructing a virtual machine to execute a release operation that is the same or similar to freeing, deallocating, dereferencing, deleting, removing, other operation, or a combination thereof. In one example, a release operation may be initiated by the guest operating system in response to being notified that a memory page is no longer in use. This may occur when a process managed by the guest operating system makes a system call to the guest operating system to free the memory page. In another example, a release operation may be initiated by the guest operating system in response to determining the memory page is no longer in use by a process or thread managed by the guest operating system (e.g., garbage collection). In either example, releasing a memory page may result in the memory page being available for reuse by the guest operating system while remaining allocated to the virtual machine. Guest operating systems 112A-C may use indications 119A-C to indicate to hypervisor 120 that the memory pages are no longer in use (e.g., released).
  • Indications 119A-C may include one or more signals for indicating to hypervisor 120 that one or more memory pages of the hypervisor are not in use by the guest operating systems. The signal may be a message, interrupt, notification, exception, trap, other signal, or a combination thereof. Indications 119A-C may be transmitted from a virtual machine to the hypervisor, from the hypervisor to the virtual machine, or a combination thereof. Indications 119A-C may occur before, during, or after a guest memory page gets released by the guest operating system. The technology disclosed herein may implement one or more of indication 119A, indication 119B, indication 119C, other indication mechanism, or a combination thereof.
  • Indication 119A may be a message transmitted from virtual machine 110A to hypervisor 120 that includes identification data (e.g., identifier) of a memory page of a hypervisor or a range of memory pages of the hypervisor. Indication 119A may be one of a series of indications and each indication in the series may identify an individual memory page or an individual range of memory pages. Indication 119A may be transmitted in response to a particular memory page (e.g., hypervisor memory page 129B) being fully released by a guest virtual machine. In one example, each indication 119A may correspond to a system call, hypercall, other function call, or a combination thereof that is initiated by the guest operating system 112A.
  • Indication 119B may a batched message that is similar to indication 119A and may include multiple memory pages, memory page ranges, or a combination thereof. Batching the memory pages into indication 119B (e.g., batched message) may be advantageous because it may reduce the communications overhead (e.g., I/O) that occurs between virtual machines 110B and hypervisor 120. Indication 119B may be transmitted from virtual machine 110B to hypervisor 120 in response to a quantity of released memory pages satisfying (e.g., at, above, or below) one or more threshold quantities. The threshold quantities may be based on a size of the guest or hypervisor memory page and may be a particular quantity of memory pages (e.g., page count) or a quantity of space occupied by the memory pages (e.g., buffer space limit). The threshold quantities may include one or more values that may include integers, percentages, ratios, other values, or a combination thereof. The values may be relative to the size or limit of a guest memory page, hypervisor memory page, physical storage devices, heap, page, buffer, other data structure, or a combination thereof.
  • Indication 119C may include one or more signals that identify a shared data structure that represents the status of hypervisor memory pages. The shared data structure may indicate to hypervisor 120 which hypervisor memory pages include guest pages that are released, un-released, or a combination thereof. Indication 119C may include a first signal that may be sent prior to a guest memory page being released and one or more second signals may be sent after one or more memory pages are released. The first signal may be in the form of a message that is transmitted during an initialization of guest operating system 112C or initialization of a particular memory page management module of guest operating system 112C. The first signal may include information (e.g., reference, pointer) identifying the shared data structure that represents guest memory 114C. When the one or more memory pages are released, the respective virtual machine 110C may update the shared data structure to indicate to hypervisor 120 that one of the hypervisor memory pages is unused by the guest operating system 112C. Hypervisor 120 may subsequently access the shared data structure after memory pages are released. In one example, hypervisor 120 may listen for second signals (e.g., modification events) that indicate the shared data structure was updated. In another example, hypervisor 120 may not listen for second signals and may access the shared data structure when hypervisor 120 determines memory pages should be reallocated (e.g., memory page faults exceed a threshold or available memory pages fall below a threshold).
  • The shared data structure may be modified by one or more of the virtual machines and may be accessible to the hypervisor. The shared data structure may be an array (e.g., bitmap), a linked list, other data structure, or a combination thereof. The shared data structure may include an element (e.g., bit, node) for each of the memory pages and the element may indicate whether the memory page is released, un-released, or other state. In one example, the shared data structure may be stored in memory page space of the virtual machine. For example, each virtual machine may include a shared data structure in its respective guest memory 114A-C, which may be accessible to hypervisor 120. In another example, the shared data structure may be stored in hypervisor memory 126 and be accessible to one or more of the virtual machines. In the latter example, there may be a separate shared data structure within hypervisor memory 126 that corresponds to each of the virtual machine 110A-C or there may be a single shared data structure accessible to the group of virtual machines 110A-C.
  • Hypervisor 120 may also be known as a virtual machine monitor (VMM) and may provide virtual machines 110A-C with access to one or more features of hardware device. Hypervisor 120 may manage system resources, including access to hardware devices 130. In the example shown, hypervisor 120 may run directly on the hardware of computer system 100 (e.g., bare metal hypervisor). In another example, hypervisor 120 may run on or within a host operating system (not shown). Hypervisor 120 may include a page hinting component 122, a page reallocation component 124, and hypervisor memory 126.
  • Page hinting component 122 may process memory page hints received from the virtual machines in the form of indications 119A-C. The memory page hints may indicate which of the hypervisor memory pages associated with a virtual machine are in use or not in use by the virtual machine. For example, a hypervisor may allocate a portion of hypervisor memory 126 for use by a virtual machine and the guest operating system 112A may manage the allocated portion as shown by guest memory pages 116. Guest operating system 112A may be configured to optimize the use of the memory page by allocating portions of the memory pages to guest operating system processes and using the remaining portions as file system cache. As guest operating system 112A executes, it may release one or more guest memory pages (e.g., released guest memory pages 118) and may transmit indication 119A to hypervisor 120 when the released guest memory pages fill up an entire hypervisor memory page or multiple entire hypervisor memory pages.
  • Page reallocation component 124 may interact with page hinting component 122 to identify portions of hypervisor memory 126 that can be reclaimed and used to fulfill requests for additional memory pages. Page reallocation component 124 may analyze data of page hinting component 122 to identify portions of memory that have been allocated to a guest virtual machine but are not in use by the guest virtual machine. This may enable hypervisor 120 to reallocate the hypervisor memory pages without copying the content of the hypervisor memory page to and from a backing store (e.g., paging in/out).
  • Hardware devices 130 may provide hardware functionality for performing computing tasks. Hardware devices 130 may include one or more physical storage devices 132, one or more physical processing devices 134, other computing devices, or a combination thereof. One or more of hardware devices 130 may be split up into multiple separate devices or consolidated into one or more hardware devices. Some of the hardware device shown may be absent from hardware devices 130 and may instead be partially or completely emulated by executable code.
  • Physical storage devices 132 may include any data storage device that is capable of storing digital data and may include volatile or non-volatile data storage. Volatile data storage (e.g., non-persistent storage) may store data for any duration of time but may lose the data after a power cycle or loss of power. Non-volatile data storage (e.g., persistent storage) may store data for any duration of time and may retain the data beyond a power cycle or loss of power. In one example, physical storage devices 132 may be physical memory and may include volatile memory devices (e.g., random access memory (RAM)), non-volatile memory devices (e.g., flash memory, NVRAM), and/or other types of memory devices. In another example, physical storage devices 132 may include one or more mass storage devices, such as hard drives, solid state drives (SSD)), other data storage devices, or a combination thereof. In a further example, physical storage devices 132 may include a combination of one or more memory devices, one or more mass storage devices, other data storage devices, or a combination thereof, which may or may not be arranged in a cache hierarchy with multiple levels.
  • Physical processing devices 134 may include one or more processors that are capable of executing the computing tasks discussed above in regards to components 122 and 124. Physical processing devices 134 may be a single core processor that is capable of executing one instruction at a time (e.g., single pipeline of instructions) or may be a multi-core processor that simultaneously executes multiple instructions. The instructions may encode arithmetic, logical, or I/O operations. In one example, physical processing devices 134 may be implemented as a single integrated circuit, two or more integrated circuits, or may be a component of a multi-chip module (e.g., in which individual microprocessor dies are included in a single integrated circuit package and hence share a single socket). A physical processing device may also be referred to as a central processing unit (CPU).
  • Network 140 may be a public network (e.g., the internet), a private network (e.g., a local area network (LAN) or wide area network (WAN)), or a combination thereof. In one example, network 140 may include a wired or a wireless infrastructure, which may be provided by one or more wireless communications systems, such as a wireless fidelity (WiFi) hotspot connected with the network 140 and/or a wireless carrier system that can be implemented using various data processing equipment, communication towers, etc.
  • FIG. 2 is a block diagram illustrating example components and modules of guest operating system 112A, in accordance with one or more aspects of the present disclosure. Guest operating system 112A may be the same or similar to guest operating systems 112A-C of FIG. 1 and may include a memory management component 111A, a page hinting component 113A, and a data store 230. Memory management component 111A may include a page size detection module 211, a page allocator module 212, a memory release detection module 214, and a guest page set updating module 216. Page hinting component 113A may include a threshold analysis module 222, a page verification module 224, an indication providing module 226, and a locking module 228. More or less components may be included without loss of generality. For example, two or more of the modules may be combined into a single module, or one of the modules may be divided into two or more modules. In one implementation, one or more of the modules may reside on different computing devices (e.g., different server computers, on a single client device, distributed among multiple client devices, etc.).
  • Page size detection module 211 may enable guest operating system 112A to determine one or more memory page sizes of the guest operating system and one or more memory page sizes of the hypervisor. The memory page sizes of the guest operating system and the hypervisor may be the same, different, or a combination of both. The memory page sizes may be the same and different when a portion of the guest memory uses a page size that is the same as the underlying hypervisor memory and another portion of the guest memory uses page size that is different from the underlying hypervisor memory. Page size detection module 211 may determine based on one or more comparisons when the page size of guest memory is different from the portion of the hypervisor memory that it is allocated from. The page sizes identified by page size detection module 211 may be used by one or more of the modules discussed below to identify a corresponding hypervisor memory page and determine when to provide an indication and to the hypervisor.
  • Page allocator module 212 may enable guest operating system 112A to allocate portions of memory for use by guest operating system 112A and may release the portions for reuse when the memory is no longer needed by the guest operating system 112A. Page allocator module 212 may allocate memory using guest memory pages, which may be contiguous or non-contiguous blocks of virtual memory (e.g., a 4K-byte block of memory). The memory pages allocated by page allocator module 212 may have been derived from portions of memory designated for use by the guest operating system 112A by the underlying hypervisor. Releasing memory pages may be the same or similar to the guest operating system freeing memory pages or deallocating memory pages, which may involve dereferencing a memory page and enabling the memory page to be subsequently reused by guest operating system 112A.
  • Memory release detection module 214 may be integrated with page allocator module 212 and may detect memory pages that have been released by memory management component 111A of guest operating system 112A. In one example, detecting the released memory pages may involve receiving or listening for a particular event or signal associated with the release of a memory page. In another example, detecting the released memory pages may involve accessing or monitoring a data structure that includes memory status information. When memory release detection module 214 detects a released memory page, the memory release detection module 214 may indicate the change to guest page set updating module 216.
  • Guest page set updating module 216 may generate and update a set of memory pages that represents the guest memory pages have been released. The set of guest memory pages may be stored by the guest operating system in data store 230 and may be referred to as a guest set. The guest set may be accessed and modified by the guest operating system and may or may not be accessed (e.g., interpreted or comprehended) by the hypervisor. The guest set may be stored as a data structure that is capable of representing a plurality of guest memory pages and may be the same or similar to guest set 234A, guest set 234B, other set structure, or a combination thereof. Guest sets 234A and 234B may both include data that enables the guest operating system to track which memory pages or ranges of memory pages have been released.
  • Guest set 234A may be an example set that includes one or more memory page identifiers 236A. Each of the memory page identifiers 236A may be an element of the set that uniquely identify a memory page or a range of memory pages that are in a released state (e.g., allocated and not in use), in a non-released state (e.g., allocated and in use), other state, or a combination thereof. In one example, guest set 234A may include the memory pages that have been released without including memory pages that are in use. In another example, guest set 234A may include memory pages that are released (e.g., unused state) and memory pages that are in a used state along with additional data that indicates the corresponding state of each respective memory page.
  • Memory page identifiers 236A may include offset data (numeric or non-numeric values), address data (virtual, logical, or physical addresses), length data, link data (e.g., a pointer or link), other data, or a combination thereof. In one example, each of the memory page identifiers 236 may include a tuple that is stored as a variable and may have a 32 byte size, 64 byte size, or other size. The tuple may represent one or more memory pages or ranges of memory pages using a combination of values. The combination of values may include multiple separate address values, a single address value and a length value, other values, or a combination thereof. The address values may indicate the start, end, middle, other location, or a combination thereof of a particular guest memory page. The length value may indicate a contiguous length of memory space represented by the tuple. The length may be less than, equal to, or greater than a guest memory page (e.g., page size 115A), a hypervisor memory page (e.g., page size 115B), multiple guest or hypervisor memory pages, other size, or a combination thereof.
  • Guest set 234B is another example set and includes memory page identifiers 236B that represent each guest memory pages of a virtual machine and not just the memory pages that are in use or are not in use. Each of the memory page identifiers 236B may correspond to an element of a data structure and may represent a state of a particular memory page. The states may include a released state (e.g., not in use), a non-released state (e.g., in use), other state, or a combination thereof. The data structure may be an n-dimensional array, linked list, other data structure, or a combination thereof. In one example, guest set 234B may be an array of binary elements and the array may be the same or similar to a bitmap. Each of the memory page identifiers 236B may correspond to one of the binary elements (e.g., bit, flag, marker) and may indicate whether the corresponding guest memory page is in a first state (e.g., released) or in a second state (e.g., unreleased). In another example, guest set 234 may be a linked list of elements (e.g., nodes) representing respective guest memory pages. In either example, the beginning of the array (e.g., first element) may correspond to a first guest memory page in a continuous or non-contiguous sequence of guest memory pages and the location (e.g., position) of an element relative to the first element of the data structure may indicate which memory page is represented by the state of the element.
  • Guest page set updating module 216 may update a guest set using a technique that corresponds to the data structure storing the guest set. When guest set 234B is being used, guest page set updating module 216 may locate a particular element (e.g. memory page identifier 236B) that corresponds to the newly released memory page. As discussed above, guest set 234B may include an element for every memory page of guest memory independent of whether it is released or is still in use. After locating the corresponding element, guest page set updating module 216 may update the state of the element to reflect that the memory page is released. This may involve toggling a bit value of an element from false (e.g., 0) to true (e.g., 1) (or vice versa) as shown by bit flag 238. When guest set 234A is being used, guest page set updating module 216 may add a newly released memory page to the set by either adding a new element, adjusting an existing element, or a combination thereof. Adding a new element (e.g., memory page identifier 236A) may involve creating a new element and adding it to guest set 234A (e.g., appending a new node to a linked list). guest page set updating module 216 may adjust an existing element by modifying an element to add a range or modifying an element to update an existing range to represent an additional memory page. The range may be represented by multiple addresses (e.g., start and end address of a tuple) or by an address and a length (e.g., start address and length value of a tuple).
  • Guest page set updating module 216 may determine whether to add, modify, or merge elements by analyzing the location of the newly released memory page relative to one or more memory pages already in the set. Guest page set updating module 216 may compare the multiple locations and add a new element in response to determining the newly released memory page is not adjacent to any memory page within the set. guest page set updating module 216 may modify an existing element in response to determining the newly released memory page is adjacent to at least one memory page within the set the guest page set updating module 216. A memory page may be adjacent to another memory page when there are no other memory pages between them. guest page set updating module 216 may merge multiple elements of guest set 234A into a single element when module 216 determines that the multiple elements corresponds to memory pages that are adjacent to one another. The single element may include the multiple adjacent memory pages as a contiguous range of memory pages and may be a newly created element or may be one of the existing elements that has had its range expanded to represent the multiple adjacent memory pages. The merging may occur before, during, or after adding the multiple adjacent memory pages to guest set 234A and may be the same or similar to consolidating, combining, concatenating, joining, or other action.
  • Page hinting component 113A may access data generated or detected by memory management component 111A and propagate some or all of the information to the hypervisor. Page hinting component 113A may analyze a guest set of released memory pages (e.g., guest set 234A or 234B) and determine when and how to provide an indication to the hypervisor. In one example, page hinting component 113A may avoid providing an indication to the hypervisor each time a guest memory page is released and may wait until the set of released guest pages fill up at least one entire hypervisor memory page before providing the indication to the hypervisor. This may be advantageous because it may reduce the communication overhead (e.g., I/O) that occurs between the guest operating system and hypervisor. In the example, shown in FIG. 2, page hinting component 113A may include a threshold analysis module 222, a page verification module 224, an indication providing module 226, and a locking module 228.
  • Threshold analysis module 222 may analyze the guest set to determine whether the set of memory pages satisfies one or more threshold quantities 232. One or more of the threshold quantities 232 may be analyzed in view of the size of the set and whether the set of guest pages completely fills one or more hypervisor memory page. Threshold quantities 232 may be based on a particular quantity of pages (e.g., guest pages or hypervisor pages) or a quantity of space occupied by the pages (e.g., buffer space limit). Threshold quantities 232 may have any type of values such as integers, percentages, ratios, other values, or a combination thereof. The values may be relative to the size or limit of the memory, heap, page, set, buffer, other structure, or a combination thereof.
  • Threshold quantities 232 may include a first predetermined threshold quantity and a second predetermined threshold quantity. The first predetermined threshold quantity of threshold quantities 232 may indicate a minimum size (e.g., quantity of hypervisor memory pages) that the set occupies before providing an indication to the hypervisor. The second predetermined threshold quantity will be discussed in more detail below and may relate to an updated quantity of memory pages (e.g., set of verified pages) and may indicate when an indication should be delayed. Once the quantity of memory pages satisfies the first predetermined threshold quantity, the guest operating system 112A may verify the set using page verification module 224.
  • Page verification module 224 may analyze the guest memory pages to verify that the memory pages remain unused. As discussed above, the memory pages may be added to the set when they are released by the guest operating system but one or more of the memory pages within the set may be subsequently reused without being removed from the set. In one example, page verification module 224 may analyze memory pages by checking a flag associated with the memory page to ensure that the memory pages are not in use. In another example, page verification module 224 may query functions of the guest operating system, hypervisor, host operating system, hardware device, other module, or a combination thereof to determine whether the memory page is in use. When page verification module 224 determines a memory page is in use it may signal, guest page set updating module 216 to remove the memory page from the set. The memory pages that remain in the set may then be analyzed and processed by indication providing module 226.
  • Indication providing module 226 may notify the hypervisor of the memory pages that have been released by guest operating system 112A. In one example, indication providing module 226 may indicate one or more hypervisor memory pages that are no longer in use by the guest operating system. In another example, indication providing module 226 may indicate one or more guest memory pages that are no longer in use by the guest operating system. Indication providing module 226 may combine (e.g., batch) the identifiers for each of the released memory pages (e.g., guest and/or hypervisor memory pages) in a message and may transmit the message to the hypervisor. In one example, transmitting the message to the hypervisor may involve making a call to a programming interface of the hypervisor. The call may be a hypercall, a system call, other type of call, or a combination thereof.
  • Locking module 228 may provide a locking mechanism to inhibit the page allocator module 212 from allocating memory pages while page hinting component 113A is preparing to provide an indication (e.g., notification) to the hypervisor. The ability to inhibit (e.g., lock, stop, pause, restrict, prohibit) the page allocator module 212 may be useful because it may reduce the possibility that a hypervisor notification can be undermined during the processing phase and indicate that a memory page is released when the memory page is actually in use. In one example, locking module 228 may acquire a lock on the page allocator in response to threshold analysis module 222 determining the set of memory pages has satisfied a threshold quantity. The lock may be held while page verification module 224 and indication providing module 226 process the set of guest memory pages. The lock may be released or withdrawn after the indication providing module has transmitted the message or in response to receiving a response from the hypervisor, indicating the message was received and/or processed by the hypervisor. Acquiring the lock and releasing the lock may involve updating a lock indicator 233.
  • Lock indicator 233 may be any locking data structure that is accessible to guest operating system 112A and is capable of indicating a lock has been acquired. The locking data structure may include a bit or sequence of bits and may represent two or more states. Lock indicator 233 may include numeric or non-numeric values for indicting or representing the two states. In one example, lock indicator 233 may be a bit sequence that includes a counter (e.g., integer counter) that can be accessed by one or more virtual processors managed by guest operating system 112A. The counter may be a processor counter (e.g., virtual CPU counter), a global counter (e.g., guest OS counter), other counter, or a combination thereof. The processor counter may correspond to a particular virtual processor managed by the guest operating system whereas the global counter may correspond to some or all of the virtual processors managed by the guest operating system.
  • Lock indicator 233 may represent multiple different states that may correspond to the current state of the lock and may also indicate one or more state transitions that may have occurred since the lock was acquired. As discussed above, lock indicator 233 may include a counter and the counter may be updated (e.g., incremented or decremented) by one or more virtual processors to acquire or release a lock on the page allocator module 212. In one example, the counter may be continuously updated (e.g., incremented) to different values and a category of the value, as opposed to the specific value, may determine the state. The category of values may be based on whether the value evaluates to an even number, odd number, prime number, or whether it is or is not divisible my a particular number N, wherein N is any real number (e.g., 3, 4, 5, 6, . . . N).
  • In one example, locking module 228 may increment lock indicator 233 to an even number to indicate a lock has been acquired and subsequently increment the lock indicator again to an odd number to indicate the lock has been released (e.g., unlocked). In another example, locking module 228 may increment lock indicator 233 to an even number to indicate a lock has been acquired and subsequently decrement the lock indicator to an odd number to indicate the lock has been released (e.g., unlocked). The former example, which involves continually updating the lock indicator 233 in the same direction (e.g., incrementing), may be advantageous because it may enable the locking module to detect state transitions and therefore a third state. The third state may indicate that the lock indicator has changed since it was last updated, which may indicate another virtual processor has locked the page allocator and may indicate a race condition has occurred or may be occurring.
  • FIG. 3 is a block diagram illustrating example components and modules of hypervisor 120, in accordance with one or more aspects of the present disclosure. Hypervisor 120 may be the same or similar to the hypervisor 120 of FIG. 1 and may include a page hinting component 122, a page reallocation component 124, and a data store 330. More or less components may be included without loss of generality. For example, two or more of the components or portions of the components may be combined into a single component, or one of the components may be divided into two or more modules. In one implementation, one or more of the modules may be executed by different processing devices on different computing devices (e.g., different server computers).
  • Page hinting component 122 may process memory page hints received from virtual machines in the form of one or more indications. Page hinting component 122 may process the indications to identify a set of memory pages that have been assigned to a virtual machine but are not being used by the virtual machine. In the example shown in FIG. 1, page hinting component 122 may include an indication receiving module 312, an exclusivity detection module 314, and a guest page set updating module 316.
  • Indication receiving module 312 may be a portion of hypervisor that receives indications from the virtual machine. The indications may include memory page identification data 332 for identifying one or more hypervisor memory pages or ranges of hypervisor memory pages that contain (e.g., exclusively contain) content released by the guest operating system without content that is in use by the guest operating system. Memory page identification data 332 may include an offset value (numeric or non-numeric value), an address (virtual, logical, or physical address), a pointer, a link, other data, or a combination thereof. In one example, the identification data may be a memory page identifier that uniquely identifies a hypervisor memory page. The identification data may be data (e.g., offset value) that may be used by hypervisor 120 to determine a hypervisor memory page identifier of a memory page that includes content released by a respective guest operating system. In another example, the identification data may include a reference to a data structure that indicates the one or more hypervisor memory pages that are released (e.g., not in use), non-released (e.g., in use), or a combination thereof. The data structure may be an array (e.g., bitmap), a linked list, other data structure, or a combination thereof.
  • Exclusivity detection module 314 may analyze the memory pages that the virtual machine indicated were released and determine whether the memory pages are in use by any other computing entity. The other computing entity may be another virtual machine, the hypervisor, a host operating system, a hardware device, any executable code (e.g., process, thread, or computing stream), or a combination thereof. A particular hypervisor memory page may be assigned to one or more computing entities. When a memory page is assigned to multiple computing entities, the computing entities may share the memory page and neither may have exclusive use of the memory page. Therefore, when one of the computing entities releases the memory page the hypervisor may not reuse the memory page because the memory page may still be in use by another computing entity. In contrast, if the memory page is assigned to a single computing entity and is in not in use by another computing entity the memory page is referred to as being exclusively used by the single computing entity. Therefore, when the single computing entity (e.g., virtual machine) releases the memory page it may be reallocated by the hypervisor for use by another computing entity.
  • Exclusivity detection module 314 may analyze the released memory page to verify that the released memory page is exclusively assigned to a single virtual machine. Verifying that a memory page is exclusively assigned to a virtual machine may involve determining whether any other virtual machine is using (e.g., modifying, accessing, or has been assigned) the memory page. For example, verifying that a memory page is exclusively assigned to the virtual machine may involve determining whether another virtual machine has access to or has been assigned the same memory page. In one example, the memory pages may be memory pages and exclusivity detection module 314 may analyze a memory page data structure that identifies which memory pages are assigned to which virtual machines to determine whether a particular memory page is being shared between virtual machines or is being exclusively used by a single virtual machine.
  • Hypervisor page set updating module 316 may update a set of memory pages based on data of indication receiving module 312 and exclusivity detection module 314. Hypervisor page set updating module 316 may be similar to guest page set updating module 216 but may be executed by the hypervisor and may store the information in a hypervisor set (e.g., 334A or 334B) as opposed to a guest set (e.g., 234A or 234B). The hypervisor set may be updated by the hypervisor to reflect the memory pages that are allocated to a virtual machine but remain unused by the virtual machine. The set may be accessed and modified by the hypervisor and may or may not be accessible by a guest operating system. Updating the set may involve the same procedure discussed above in regards to guest page set updating module 216. For example, updating the set may involve adding a memory page to the set or removing memory pages from the set depending on whether the memory pages are available to be reallocated by the hypervisor. The memory pages may be particular guest memory pages, hypervisor memory pages, other memory pages, or a combination thereof. In one example, hypervisor page set updating module 316 may add a memory page to the set of memory pages in response to receiving an indication that the memory page includes content released by a guest operating system and is exclusively accessed by a single virtual machine. In another example, hypervisor page set updating module 316 may add a released memory page to the set of memory pages in response to determining that the memory page is shared by multiple virtual machines and was released by each of the respective virtual machines.
  • The set of memory pages may be represented by a data structure such as hypervisor set 334A or hypervisor set 334B. Hypervisor sets 334A and 334B may be the same or similar to respective guest sets 234A and 234B and may include data that enables the hypervisor to track which memory pages or ranges of memory pages have been released by the guest operating system. In one example, hypervisor sets 334A and 334B may identify hypervisor memory pages that include the content of multiple guest memory pages that have been released by the guest operating system.
  • Hypervisor set 334A may be an example set that includes one or more memory page identifiers 336A. Each of the memory page identifiers 336A may be an element of the set that uniquely identify a memory page or a range of memory pages that is allocated to a virtual machine but may or may not be in use by the virtual machine (e.g., released by guest operating system). In one example, hypervisor set 334A may include the memory pages that have been released by the guest operating system without including memory pages that are in use by the guest operating system. In another example, hypervisor set 334A may include memory pages that are not in use (e.g., released) and memory pages that are in use by the guest operating system.
  • Memory page identifiers 336A may include offset data (numeric or non-numeric values), address data (virtual, logical, or physical addresses), length data, link data (e.g., a pointer or link), other data, or a combination thereof. In one example, each of the memory page identifiers 336A may include a tuple that is stored as a variable and may have a 32 byte size, 64 byte size, or other size. The tuple may represent one or more memory pages or ranges of memory pages (e.g., hypervisor pages or guest pages) using a combination of values. The combination of values may include multiple separate address values, a single address value and a length value, other values, or a combination thereof. The address values may indicate the start, end, middle, other location, or a combination thereof of a particular guest memory page. The length value may indicate a contiguous length of memory space represented by the tuple. The length may be less than, equal to, or greater than a guest memory page (e.g., page size 115A), a hypervisor memory page (e.g., page size 115B), multiple guest or hypervisor memory pages, other size, or a combination thereof.
  • Hypervisor set 334B is another example set and includes one or more memory page identifiers 336B. Memory page identifiers 336B may represent either hypervisor memory pages or guest memory pages that include content that is not in use by a virtual machine (e.g., released by guest operating system). Each of the memory page identifiers 336B may correspond to an element of a data structure and may represent a state of a particular memory page. The states may include a released state (e.g., not in use), a non-released state (e.g., in use), other state, or a combination thereof. The data structure may be an n-dimensional array, linked list, other data structure, or a combination thereof. In one example, hypervisor set 334B may be an array of binary elements and the array may function as a bitmap. Each memory page identifier 336B may correspond to one of the binary elements (e.g., bit, flag, marker) and may indicate whether the corresponding hypervisor or guest memory page is in a first state (e.g., released) or in a second state (e.g., unreleased). In another example, hypervisor set 334B may be a linked list of elements (e.g., nodes) the nodes representing respective hypervisor or guest memory pages. In either example, the beginning of the array (e.g., first element) may correspond to a first memory page in a continuous or non-contiguous sequence of memory pages and the location (e.g., position) of an element relative to the first element of the data structure may indicate which memory page is represented by the state of the element.
  • Page reallocation component 124 may interact with page hinting component 122 to identify portions of the hypervisor's memory that can be allocated (e.g., reallocated) to fulfill requests from virtual. Page reallocation component 124 may analyze data of page hinting component 122 to identify hypervisor memory pages that have been allocated to a virtual machine but are not in use by the virtual machine. For example, a memory page may be allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released). Traditionally, reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page. The technology disclosed herein may enable hypervisor 120 to reallocate memory pages in a more efficient manner because page reallocation component 124 may be able to detect when a memory page that is allocated to a virtual machine is not in use by the virtual machine. As a result, page reallocation component 124 may reallocate (e.g., reuse) the memory page without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to re-access the memory page. In the example shown in FIG. 3, page reallocation component 124 may include an allocation request module 322, a set analysis module 324, and a page selection module 326.
  • Allocation request module 322 may receive or access a request from a virtual machine to allocate memory page to the virtual machine. The virtual machine may initiate the request using a variety of different mechanisms. A first mechanism may involve a failed attempt to access a memory page that no longer resides at the designated location in the physical memory page device. This may occur when the memory page is a memory page and the memory page has been evicted. The attempt to access the memory page may generate a page fault, which may be addressed by an underlying memory management module. The page fault may function as the request to allocate memory page. A second mechanism may involve a virtual machine initiating the request using a hypercall. The virtual machine may be executing in a para-virtualized environment and be aware of and able to communicate with the hypervisor using hypercalls. A hypercall may be similar to a system call but may enable a thread executed by the virtual machine to communicate with the hypervisor as opposed to the guest operating system. In one example, the hypercall may be used to implement memory page ballooning.
  • Memory page ballooning may be a memory page reclamation technique that is used by a hypervisor or host operating system to enable a computer system to take memory from one or more virtual machines and share it with other virtual machines. Memory page ballooning may enable the total amount of memory page resources (e.g., memory pages) occupied by the guest virtual machines to exceed the amount of physical memory page resources (e.g., main memory) available on the computer system. When the computer system is low on physical memory page resources the memory page ballooning may allocate the memory page resources selectively among the virtual machines. The memory page balloon represents the memory page provided to other virtual machines and the process of a virtual machine relinquishing memory page may be referred to as inflating the balloon and the process of acquiring memory page may be referred to as deflating the balloon. Portions of memory page ballooning may be implemented within each of the virtual machines in the form of a driver (e.g., balloon driver) or memory page function (e.g., kernel memory page management module) of the guest operating system. Memory page ballooning may enable multiple virtual machines to share memory page resources amongst one another in a voluntary or involuntary manner. In one example, memory page ballooning may be the same or similar to a computer memory reclamation technique known as virtual memory ballooning. Virtual memory ballooning may be used by hypervisor 120 to enable the computer system (e.g., host machine) to retrieve unused memory from certain guest virtual machines.
  • The act of relinquishing memory page may be different than the act of releasing memory page, which is discussed above. Releasing memory page may involve a guest operating system freeing the memory page so that it is unused by the guest operating system even though the memory page remains allocated to the virtual memory executing the guest operating system. A guest operating system that releases memory page may not change the amount of memory page allocated to the virtual machine and may just change the use of the memory page allocated to the virtual machine. Therefore, a guest operating system that releases memory page may enable the total amount of memory page allocated to the virtual machine to remain constant (e.g., approximately the same). Relinquishing memory page may involve the guest operating system identifying a portion of memory page that can be given back to the hypervisor so that the total amount of memory page allocated to the virtual machine changes (e.g., does not remain constant) and either decreases (e.g., balloon inflates) or increases (balloon deflates).
  • Set analysis module 324 may enable hypervisor 120 to analyze the set of memory pages (e.g., set 334A or 334B) to identify one or more memory pages that can be reallocated to satisfy the request for additional memory page. Set analysis module 324 may gather data about multiple different aspects of each memory page, such as, the source of the memory page (e.g., associated virtual machine, original owner), the size of the memory page (e.g., standard page or huge page), the location of the memory page (e.g., proximity to other released memory pages), other information, or a combination thereof.
  • Page selection module 326 may access data gathered by set analysis module 324 and may select one or more memory pages that fulfill the request. The selection of a memory page may take into account the amount of memory pages that should be cleared, the locality of the memory pages (e.g., whether they are partially or completely contiguous), the size alignment (e.g., a single huge page is better than multiple standard pages), other aspects, or a combination thereof. Minimizing the memory page that needs to be paged in and out of backing store may be used to prioritize which memory pages are used to fulfill the virtual machine's request.
  • FIGS. 4 and 5 depict flow diagrams for illustrative examples of methods 400 and 500 for memory page hinting, in accordance with one or more aspects of the present disclosure. Method 400 illustrates an example process flow from the perspective of the guest operating system and method 500 is an example process flow from the perspective of a hypervisor. Methods 400 and 500 may be performed by processing devices that may comprise hardware (e.g., circuitry, dedicated logic, programmable logic, microcode, etc.), executable code (such as is run on a general purpose computer system or a dedicated machine), or a combination of both. Methods 400 and 500 and each of their individual functions, routines, subroutines, or operations may be performed by one or more processors of the computer device executing the method. In certain implementations, methods 400 and 500 may each be performed by a single processing thread. Alternatively, methods 400 and 500 may be performed by two or more processing threads, each thread executing one or more individual functions, routines, subroutines, or operations of the method. In an illustrative example, the processing threads implementing methods 400 and 500 may be synchronized (e.g., using semaphores, critical sections, and/or other thread synchronization mechanisms). Alternatively, the processes implementing methods 400 and 500 may be executed asynchronously with respect to each other.
  • For simplicity of explanation, the methods of this disclosure are depicted and described as a series of acts. However, acts in accordance with this disclosure can occur in various orders and/or concurrently, and with other acts not presented and described herein. Furthermore, not all illustrated acts may be required to implement the methods in accordance with the disclosed subject matter. In addition, those skilled in the art will understand and appreciate that the methods could alternatively be represented as a series of interrelated states via a state diagram or events. Additionally, it should be appreciated that the methods disclosed in this specification are capable of being stored on an article of manufacture to facilitate transporting and transferring such methods to computing devices. The term “article of manufacture,” as used herein, is intended to encompass a computer program accessible from any computer-readable device or memory page media. In one implementation, methods 400 and 500 may be performed by computer system 100 as shown in FIG. 1.
  • Referring to FIG. 4, method 400 may be performed by processing devices of a server device or a client device and may begin at block 402. At block 402, the processing device executing a guest operating system may determine that a memory page size of the guest operating system is different from a memory page size of a hypervisor that manages the guest operating system. The processing device may determine the memory page size of the hypervisor by transmitting a request (e.g., hypercall) to the hypervisor and receiving a message back from the hypervisor with data indicating the memory page size. The memory page size received from the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space. In one example, the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In another example, the memory page size of the hypervisor may be smaller than or equal to the memory pages size of the guest operating system and a single guest memory page may be stored within one or more hypervisor memory pages.
  • At block 404, the processing device executing the guest operating system may add a guest memory page released by the guest operating system to a set of guest memory pages. The set of guest memory pages released by the guest operating system may include one or more tuples and adding the guest memory page to the set may involve adding a tuple to the set or expanding a range of an existing tuple. In one example, the guest memory page added to the set may include multiple guest memory pages that have been released by the guest operating system and that remain allocated to a virtual machine executing the guest operating system.
  • At block 406, the processing device executing the guest operating system may determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page. The determination may involve the guest operating system determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor. This may involve identifying a location (e.g., virtual, logical, or physical address) of one or more of the guest memory pages and comparing it to a location (e.g., virtual, logical, or physical address) of one or more hypervisor memory pages. The guest operating system may base the determination on a hypothesis that the first page of guest memory starts at the beginning of a hypervisor page and may or may not contact the hypervisor to confirm this hypothesis. The guest operating system may then generate a message comprising the location (e.g., address) of the hypervisor memory page as opposed to the location of the guest memory page. As a result, the indication may be aligned with the memory page size of the hypervisor as opposed to the memory page size of the guest operating system.
  • At block 408, the processing device executing the guest operating system may provide an indication to the hypervisor that the hypervisor memory page is available for reuse. Providing the indication may be in response to the set of guest memory pages released by the guest operating system filling a hypervisor memory page or filling a predetermined threshold number of hypervisor memory pages. Filling a hypervisor memory page may involve completely filling the entire hypervisor page without having a portion of the hypervisor page in use by any guest operating system. In one example, providing the indication to the hypervisor may involve the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier. In another example, providing the indication to the hypervisor may involve the guest operating system updating a shared data structure that represents the set of guest memory pages released by the guest operating system, wherein the shared data structure is modifiable by the one or more guest operating system and is accessible to the hypervisor. In either example, providing the indication that the hypervisor memory page is available for reuse may enable the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage. The hypervisor memory page may be stored on a primary storage device and the persistent storage may include swap space of a secondary storage device. Responsive to completing the operations described herein above with references to block 408, the method may terminate.
  • Referring to FIG. 5, method 500 may be performed by processing devices of a server device or a client device and may begin at block 502. At block 502, the processing device executing a hypervisor may provide a memory page size of the hypervisor to a guest operating system. The processing device may provide the memory page size by responding to a request received from the guest operating system. The request may be initiated by the guest operating system using a hypercall and the hypervisor may respond with a message that includes data indicating the memory page size. The memory page size of the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space. The memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In one example, the memory page of the hypervisor is filled by guest memory pages released by a single guest operating system. In another example, the memory page of the hypervisor may be filled by guest memory pages released by multiple guest operating systems.
  • At block 504, the processing device executing the hypervisor may determine that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system. The guest memory pages released by the guest operating system may remain allocated to a virtual machine executing the guest operating system. The determination may involve receiving, from the guest operating system, an indication comprising data to determine that one or more of the hypervisor's memory pages comprise content released by the guest operating system. The data may identify at least one hypervisor memory page that includes content released by the guest operating system without including content in use by the guest operating system. In one example, the indication may involve a hypercall initiated by the guest operating system after one of the guest memory pages has been released and comprises a memory page identifier. In another example, the indication may involve a reference to a shared data structure and be received before the guest memory pages have been released. The shared data structure may represent a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • At block 506, the processing device executing the hypervisor may reallocate the memory page and avoid copying content of the memory page to persistent storage. The reallocation may be done in response to analyzing a set of hypervisor memory pages that include content that was released by one or more guest operating systems. For example, the set may include hypervisor memory pages that are allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released). Traditionally, reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page. The technology disclosed herein may enable hypervisor 120 to reallocate memory pages in a more efficient manner because the processing device may be able to detect when a hypervisor memory page that is allocated to a virtual machine is not in use by the virtual machine. As a result, a hypervisor memory page may be reallocated (e.g., reused) without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to access the memory page again. Responsive to completing the operations described herein above with references to block 506, the method may terminate.
  • In an alternative example of method 500, the processing device executing the hypervisor may add a plurality of memory pages of the hypervisor to a set of allocated and unused memory pages. The set of allocated and unused memory pages may include one or more tuples and adding the plurality of memory pages to the set may alter the one or more tuples. In one example, adding memory pages to the set may involve expanding a range of a single tuple to represent the plurality of memory pages. In another example, adding the plurality of memory pages to the set may involve adding a plurality of tuples to the set and each of the tuples may correspond to one of the memory pages. The processing device may subsequently select the memory page added to the set of allocated and unused memory and reallocate it to the same or different virtual machine.
  • FIG. 6 depicts a block diagram of a computer system 600 operating in accordance with one or more aspects of the present disclosure. Computer system 600 may be the same or similar to computer system 100 and may include one or more processing devices and one or more memory devices. In the example shown, computer system 600 may include a page size determination module 610, a guest page set module 620, a hypervisor page filling detection module 630, and an indication providing module 640.
  • Page size determination module 610 may enable the processing device executing a guest operating system to determine that a memory page size of the guest operating system is different from a hypervisor memory page size 652 of a hypervisor that manages the guest operating system. The processing device may determine the memory page size of the hypervisor by transmitting a request (e.g., hypercall) to the hypervisor and receiving a message back from the hypervisor with data indicating the hypervisor memory page size 652. The hypervisor memory page size 652 received from the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space. In one example, the hypervisor memory page size 652 may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In another example, hypervisor memory page size 652 may be smaller than or equal to the memory pages size of the guest operating system and a single guest memory page may be stored within one or more hypervisor memory pages.
  • Guest page set module 620 may enable the processing device executing the guest operating system to add a guest memory page released by the guest operating system to a set of guest memory pages 654. Set of guest memory pages 654 may include one or more tuples and adding the guest memory page to the set may involve adding a tuple to the set or expanding a range of an existing tuple. In one example, the guest memory page added to the set may include multiple guest memory pages that have been released by the guest operating system and that remain allocated to a virtual machine executing the guest operating system.
  • Hypervisor page filling detection module 630 may enable the processing device executing the guest operating system to determine in view of the hypervisor memory page size 652 of the hypervisor that the set of guest memory pages fills a hypervisor memory page. The determination may involve the guest operating system determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor. This may involve identifying a location (e.g., virtual, logical, or physical address) of one or more of the guest memory pages and comparing it to a location (e.g., virtual, logical, or physical address) of one or more hypervisor memory pages. The guest operating system may base the determination on a hypothesis that the first page of guest memory starts at the beginning of a hypervisor page and may or may not contact the hypervisor to confirm this hypothesis. The guest operating system may then generate a message comprising the location (e.g., address) of the hypervisor memory page as opposed to the location of the guest memory page. As a result, the indication may be aligned with the memory page size of the hypervisor as opposed to the memory page size of the guest operating system.
  • Indication providing module 640 may enable the processing device executing the guest operating system to provide an indication to the hypervisor that the hypervisor memory page is available for reuse. Providing the indication may be in response to the set of guest memory pages released by the guest operating system filling a hypervisor memory page or filling a predetermined threshold number of hypervisor memory pages. Filling a hypervisor memory page may involve completely filling the entire hypervisor page without having a portion of the hypervisor page in use by any guest operating system. In one example, providing the indication to the hypervisor may involve the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier. In another example, providing the indication to the hypervisor may involve the guest operating system updating a shared data structure that represents the set of guest memory pages released by the guest operating system, wherein the shared data structure is modifiable by the one or more guest operating system and is accessible to the hypervisor. In either example, providing the indication that the hypervisor memory page is available for reuse may enable the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage. The hypervisor memory page may be stored on a primary storage device and the persistent storage may include swap space of a secondary storage device.
  • FIG. 7 depicts a block diagram of a computer system 700 operating in accordance with one or more aspects of the present disclosure. Computer system 700 may be the same or similar to computer system 100 and may include one or more processing devices and one or more memory devices. In the example shown, computer system 700 may include a memory page size indication module 710, a memory page release detection module 720, and a reallocation module 730.
  • Memory page size indication module 710 may enable the processing device executing a hypervisor to provide a memory page size of the hypervisor to a guest operating system. The processing device may provide the memory page size by responding to a request received from the guest operating system. The request may be initiated by the guest operating system using a hypercall and the hypervisor may respond with a message that includes data indicating the memory page size. The memory page size of the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space. The memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In one example, the memory page of the hypervisor is filled by guest memory pages released by a single guest operating system. In another example, the memory page of the hypervisor may be filled by guest memory pages released by multiple guest operating systems.
  • Memory page release detection module 720 may enable the processing device executing the hypervisor to determine that a hypervisor memory page 752 of the hypervisor comprises a plurality of guest memory pages 754 released by the guest operating system. The guest memory pages 754 released by the guest operating system may remain allocated to a virtual machine executing the guest operating system. The determination may involve receiving, from the guest operating system, an indication comprising data to determine that one or more of the hypervisor's memory pages comprise content released by the guest operating system. The data may identify at least one hypervisor memory page that includes content released by the guest operating system without including content in use by the guest operating system. In one example, the indication may involve a hypercall initiated by the guest operating system after one of the guest memory pages has been released and comprises a memory page identifier. In another example, the indication may involve a reference to a shared data structure and be received before the guest memory pages have been released. The shared data structure may represent a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • Reallocation module 730 may enable the processing device executing the hypervisor to reallocate the memory page and avoid copying content of the memory page to persistent storage. The reallocation may be done in response to analyzing a set of hypervisor memory pages that include content that was released by one or more guest operating systems. For example, the set may include hypervisor memory pages that are allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released). Traditionally, reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page. The technology disclosed herein may enable hypervisor 120 to reallocate memory pages in a more efficient manner because the processing device may be able to detect when a hypervisor memory page that is allocated to a virtual machine is not in use by the virtual machine. As a result, a hypervisor memory page may be reallocated (e.g., reused) without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to access the memory page again.
  • FIGS. 8 and 9 depict flow diagrams for illustrative examples of methods 800 and 900 for memory page hinting, in accordance with one or more aspects of the present disclosure. Method 800 illustrates an example process flow from the perspective of the guest operating system and method 900 is an example process flow from the perspective of a hypervisor. Referring to FIG. 8, method 800 may be performed by processing devices of a server device or a client device and may begin at block 802. At block 802, the processing device executing a guest operating system may receive a memory page size of a hypervisor. The processing device may receive the memory page size of the hypervisor in response to a request (e.g., hypercall) transmitted to the hypervisor. The memory page size received from the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space. In one example, the memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In another example, the memory page size of the hypervisor may be smaller than or equal to the memory pages size of the guest operating system and a single guest memory page may be stored within one or more hypervisor memory pages
  • At block 804, the processing device executing the guest operating system may determine that the memory page size of the hypervisor is larger than a memory pages size of the guest operating system. This may enable a single hypervisor memory page to include the content of multiple guest memory pages. In one example, the hypervisor memory page may be a huge page (e.g., 2 MB) and the guest memory page may be a standard page (e.g., 4 KB).
  • At block 806, the processing device executing the guest operating system may add a guest memory page released by the guest operating system to a set of guest memory pages. The set of guest memory pages released by the guest operating system may include one or more tuples and adding the guest memory page to the set may involve adding a tuple to the set or expanding a range of an existing tuple. In one example, the guest memory page added to the set may include multiple guest memory pages that have been released by the guest operating system and that remain allocated to a virtual machine executing the guest operating system.
  • At block 808, the processing device executing the guest operating system may determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page. The determination may involve the guest operating system determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor. This may involve identifying a location (e.g., virtual, logical, or physical address) of one or more of the guest memory pages and comparing it to a location (e.g., virtual, logical, or physical address) of one or more hypervisor memory pages. The guest operating system may base the determination on a hypothesis that the first page of guest memory starts at the beginning of a hypervisor page and may or may not contact the hypervisor to confirm this hypothesis. The guest operating system may then generate a message comprising the location (e.g., address) of the hypervisor memory page as opposed to the location of the guest memory page. As a result, the indication may be aligned with the memory page size of the hypervisor as opposed to the memory page size of the guest operating system.
  • At block 810, the processing device executing the guest operating system may provide an indication to the hypervisor that the hypervisor memory page is available for reuse. Providing the indication may be in response to the set of guest memory pages released by the guest operating system filling a hypervisor memory page or filling a predetermined threshold number of hypervisor memory pages. Filling a hypervisor memory page may involve completely filling the entire hypervisor page without having a portion of the hypervisor page in use by any guest operating system. In one example, providing the indication to the hypervisor may involve the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier. In another example, providing the indication to the hypervisor may involve the guest operating system updating a shared data structure that represents the set of guest memory pages released by the guest operating system, wherein the shared data structure is modifiable by the one or more guest operating system and is accessible to the hypervisor. In either example, providing the indication that the hypervisor memory page is available for reuse may enable the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage. The hypervisor memory page may be stored on a primary storage device and the persistent storage may include swap space of a secondary storage device. Responsive to completing the operations described herein above with references to block 810, the method may terminate.
  • Referring to FIG. 9, method 900 may be performed by processing devices of a server device or a client device and may begin at block 902. At block 902, the processing device executing a hypervisor may receive a request for a memory page size of the hypervisor. The request may be initiated by a guest operating system and received from a guest operating system managed by the hypervisor. The guest operating system may indianite the request using a hypercall.
  • At block 904, the processing device executing a hypervisor may transmit a memory page size of the hypervisor to a guest operating system. The processing device may provide the memory page size by responding to a request received from the guest operating system. The request may be initiated by the guest operating system using a hypercall and the hypervisor may respond with a message that includes data indicating the memory page size. The memory page size of the hypervisor may include one or more page sizes that are supported by the hypervisor and each of the one or more page sizes may correspond to a different region of the hypervisors memory space. The memory page size of the hypervisor may be larger than the memory page size of the guest operating system and a single hypervisor memory page may include a plurality of guest memory pages. In one example, the memory page of the hypervisor is filled by guest memory pages released by a single guest operating system. In another example, the memory page of the hypervisor may be filled by guest memory pages released by multiple guest operating systems.
  • At block 906, the processing device executing the hypervisor may determine that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system. The guest memory pages released by the guest operating system may remain allocated to a virtual machine executing the guest operating system. The determination may involve receiving, from the guest operating system, an indication comprising data to determine that one or more of the hypervisor's memory pages comprise content released by the guest operating system. The data may identify at least one hypervisor memory page that includes content released by the guest operating system without including content in use by the guest operating system. In one example, the indication may involve a hypercall initiated by the guest operating system after one of the guest memory pages has been released and comprises a memory page identifier. In another example, the indication may involve a reference to a shared data structure and be received before the guest memory pages have been released. The shared data structure may represent a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • At block 908, the processing device executing the hypervisor may reallocate the memory page and avoid copying content of the memory page to persistent storage. The reallocation may be done in response to analyzing a set of hypervisor memory pages that include content that was released by one or more guest operating systems. For example, the set may include hypervisor memory pages that are allocated to a virtual machine but may have been released by the guest operating system of the virtual machine and may remain in an allocated but unused state (e.g., released). Traditionally, reallocating a memory page may involve copying content of the memory page to a backing store and clearing the memory page before reallocating it to fulfill the request for a memory page. The technology disclosed herein may enable hypervisor 120 to reallocate memory pages in a more efficient manner because the processing device may be able to detect when a hypervisor memory page that is allocated to a virtual machine is not in use by the virtual machine. As a result, a hypervisor memory page may be reallocated (e.g., reused) without copying the content of the memory page to a backing store and subsequently retrieving the content from the backing store when the original virtual machine attempts to access the memory page again. Responsive to completing the operations described herein above with references to block 908, the method may terminate.
  • FIG. 10 depicts a block diagram of a computer system operating in accordance with one or more aspects of the present disclosure. In various illustrative examples, computer system 1000 may correspond to computer system 100 of FIG. 1. The computer system may be included within a data center that supports virtualization. Virtualization within a data center results in a physical system being virtualized using virtual machines to consolidate the data center infrastructure and increase operational efficiencies. A virtual machine (VM) may be a program-based emulation of computer hardware. For example, the VM may operate based on computer architecture and functions of computer hardware resources associated with hard disks or other such memory. The VM may emulate a physical computing environment, but requests for a hard disk or memory may be managed by a virtualization layer of a computing device to translate these requests to the underlying physical computing hardware resources. This type of virtualization results in multiple VMs sharing physical resources.
  • In certain implementations, computer system 1000 may be connected (e.g., via a network, such as a Local Area Network (LAN), an intranet, an extranet, or the Internet) to other computer systems. Computer system 1000 may operate in the capacity of a server or a client computer in a client-server environment, or as a peer computer in a peer-to-peer or distributed network environment. Computer system 1000 may be provided by a personal computer (PC), a tablet PC, a set-top box (STB), a Personal Digital Assistant (PDA), a cellular telephone, a web appliance, a server, a network router, switch or bridge, or any device capable of executing a set of instructions (sequential or otherwise) that specify actions to be taken by that device. Further, the term “computer” shall include any collection of computers that individually or jointly execute a set (or multiple sets) of instructions to perform any one or more of the methods described herein.
  • In a further aspect, the computer system 1000 may include a processing device 1002, a volatile memory 1004 (e.g., random access memory (RAM)), a non-volatile memory 1006 (e.g., read-only memory (ROM) or electrically-erasable programmable ROM (EEPROM)), and a data storage device 1016, which may communicate with each other via a bus 1008.
  • Processing device 1002 may be provided by one or more processors such as a general purpose processor (such as, for example, a complex instruction set computing (CISC) microprocessor, a reduced instruction set computing (RISC) microprocessor, a very long instruction word (VLIW) microprocessor, a microprocessor implementing other types of instruction sets, or a microprocessor implementing a combination of types of instruction sets) or a specialized processor (such as, for example, an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), a digital signal processor (DSP), or a network processor).
  • Computer system 1000 may further include a network interface device 1022. Computer system 1000 also may include a video display unit 1010 (e.g., an LCD), an alphanumeric input device 1012 (e.g., a keyboard), a cursor control device 1014 (e.g., a mouse), and a signal generation device 1020.
  • Data storage device 1016 may include a non-transitory computer-readable storage medium 1024 on which may store instructions 1026 encoding any one or more of the methods or functions described herein, including instructions for implementing methods 300 or 500 and for encoding page hinting component 122 and modules illustrated in FIGS. 1 and 2.
  • Instructions 1026 may also reside, completely or partially, within volatile memory 1004 and/or within processing device 1002 during execution thereof by computer system 1000, hence, volatile memory 1004 and processing device 1002 may also constitute machine-readable storage media.
  • While computer-readable storage medium 1024 is shown in the illustrative examples as a single medium, the term “computer-readable storage medium” shall include a single medium or multiple media (e.g., a centralized or distributed database, and/or associated caches and servers) that store the one or more sets of executable instructions. The term “computer-readable storage medium” shall also include any tangible medium that is capable of storing or encoding a set of instructions for execution by a computer that cause the computer to perform any one or more of the methods described herein. The term “computer-readable storage medium” shall include, but not be limited to, solid-state memories, optical media, and magnetic media.
  • Other computer system designs and configurations may also be suitable to implement the system and methods described herein. The following examples illustrate various implementations in accordance with one or more aspects of the present disclosure.
  • Example 1 is a method comprising: determining, by a processing device executing a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; adding, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determining in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and providing an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 2 is the method of example 1, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
  • Example 3 is the method of example 1, wherein providing the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • Example 4 is the method of example 1, further comprising, generating, by the guest operating system, an indication aligned with the memory page size of the hypervisor, wherein the generating comprises: identifying an address of the guest memory page; determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor; and generating a message comprising the address of the hypervisor memory page.
  • Example 5 is the method of example 1, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling the hypervisor memory page.
  • Example 6 is the method of example 1, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling a plurality of hypervisor memory pages, wherein the plurality of hypervisor memory pages satisfies a predetermined threshold.
  • Example 7 is the method of example 1, wherein the set of guest memory pages released by the guest operating system comprises a tuple, and wherein adding the guest memory page to the set comprises expanding a range of the tuple or adding another tuple to the set.
  • Example 8 is method of example 1, where providing the indication to the hypervisor comprises the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier of the hypervisor memory page.
  • Example 9 is the method of example 1, wherein providing the indication to the hypervisor comprises the guest operating system updating a shared data structure that represents a plurality of hypervisor memory pages, wherein the shared data structure is modifiable by the guest operating system and is accessible to the hypervisor.
  • Example 10 is the method of example 1, wherein determining the memory page size of the hypervisor comprises receiving a message from the hypervisor indicating one or more memory page sizes supported by the hypervisor.
  • Example 11 is a method comprising: providing, by a processing device executing a hypervisor, a memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; determining, by the hypervisor, that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; and responsive to the determining, the hypervisor reallocating the memory page and avoiding copying content of the memory page to persistent storage.
  • Example 12 is the method of example 11, wherein the determining comprises receiving, from the guest operating system, an indication identifying one or more memory pages that comprise content released by the guest operating system.
  • Example 13 is the method of example 12, wherein receiving the indication comprises a hypercall initiated by the guest operating system after one of the guest memory pages has been released.
  • Example 14 is the method of example 12, wherein receiving the indication comprises receiving a reference to a shared data structure before the guest memory pages have been released, wherein the shared data structure represents a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • Example 15 is the method of example 11, further comprising: adding, by the hypervisor, a plurality of memory pages of the hypervisor to a set of allocated and unused memory pages, wherein the set of allocated and unused memory pages comprises a tuple; receiving a request to allocate a memory page; and selecting the memory page from the set of allocated and unused memory
  • Example 16 is the method of example 15, wherein adding the plurality of memory pages to the set comprises expanding a range of the tuple to represent the plurality of memory pages.
  • Example 17 is the method of example 15, wherein adding the plurality of memory pages to the set comprises adding a plurality of tuples to the set, wherein one of the plurality of tuples corresponding to one of the plurality of memory pages.
  • Example 18 is the method of example 11, wherein the memory page of the hypervisor is filled by the plurality of guest memory pages released by the guest operating system.
  • Example 19 is the method of example 11, wherein the memory page of the hypervisor is filled by guest memory pages released by a plurality of guest operating systems.
  • Example 20 is a system comprising: a memory; a processing device operatively coupled to the memory, the processing device to: determine by a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; add, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and
  • providing an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 21 is the system of example 20, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
  • Example 22 is the system of example 20, wherein to provide the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
  • Example 23 is the system of example 20, wherein the processing device is further to generate, by the guest operating system, an indication aligned with the memory page size of the hypervisor.
  • Example 24 is the system of example 20, wherein to provide the indication is in response to the set of guest memory pages released by the guest operating system filling the hypervisor memory page.
  • Example 25 is a system comprising: a memory; a processing device operatively coupled to the memory, the processing device to: provide, by a hypervisor, a memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; determine, by the hypervisor, that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; and responsive to the determining, the hypervisor reallocating the memory page and avoiding copying content of the memory page to persistent storage.
  • Example 26 is the system of example 25, wherein to determine, the processing device is to receive, from the guest operating system, an indication identifying one or more memory pages that comprise content released by the guest operating system.
  • Example 27 is the system of example 26, wherein to receive the indication, the processing device is to receive a hypercall initiated by the guest operating system after one of the guest memory pages has been released.
  • Example 28 is the system of example 26, wherein to receive the indication, the processing device is to receive a reference to a shared data structure before the guest memory pages have been released, wherein the shared data structure represents a set of memory pages that are allocated to the virtual machine and a portion of the set that is unused by the guest operating system.
  • Example 29 is the system of example 25, further comprising: add, by the hypervisor, a plurality of memory pages of the hypervisor to a set of allocated and unused memory pages, wherein the set of allocated and unused memory pages comprises a tuple; receive a request to allocate a memory page; and select the memory page from the set of allocated and unused memory
  • Example 30 is a non-transitory machine-readable storage medium storing instructions that cause a processing device to: receive, by a processing device executing a guest operating system, a memory page size of a hypervisor; determine, by the guest operating system, that the memory page size of the hypervisor is larger than a memory page size of the guest operating system; add, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and responsive to the set of guest memory pages filling the hypervisor page, provide an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 31 is a non-transitory machine-readable storage medium storing instructions that cause a processing device to: receive, by a processing device executing a hypervisor, a request for a memory page size of the hypervisor; transmit, by the hypervisor, the memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; determine, by the hypervisor, that a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; reallocate, by the hypervisor, the memory page and avoiding copying content of the memory page to persistent storage.
  • Example 32 is an apparatus comprising: means for determining, by a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor; means for adding, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages; means for determining in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and providing an indication to the hypervisor that the hypervisor memory page is available for reuse.
  • Example 33 is an apparatus comprising: means for providing, by a hypervisor, a memory page size of the hypervisor to a guest operating system, wherein the memory page size of the hypervisor is larger than a memory page size of the guest operating system; means for determining a memory page of the hypervisor comprises a plurality of guest memory pages released by the guest operating system, wherein the guest memory pages released by the guest operating system remain allocated to a virtual machine executing the guest operating system; and means for reallocating the memory page and avoiding copying content of the memory page to persistent storage.
  • The methods, components, and features described herein may be implemented by discrete hardware components or may be integrated in the functionality of other hardware components such as ASICS, FPGAs, DSPs or similar devices. In addition, the methods, components, and features may be implemented by firmware modules or functional circuitry within hardware devices. Further, the methods, components, and features may be implemented in any combination of hardware devices and computer program components, or in computer programs.
  • Unless specifically stated otherwise, terms such as “determining,” “identifying,” “adding,” “providing,” “reallocating,” “generating,” “receiving,” “selecting,” or the like, refer to actions and processes performed or implemented by computer systems that manipulates and transforms data represented as physical (electronic) quantities within the computer system registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices. Also, the terms “first,” “second,” “third,” “fourth,” etc. as used herein are meant as labels to distinguish among different elements and may not have an ordinal meaning according to their numerical designation.
  • Examples described herein also relate to an apparatus for performing the methods described herein. This apparatus may be specially constructed for performing the methods described herein, or it may comprise a general purpose computer system selectively programmed by a computer program stored in the computer system. Such a computer program may be stored in a computer-readable tangible storage medium.
  • The methods and illustrative examples described herein are not inherently related to any particular computer or other apparatus. Various general purpose systems may be used in accordance with the teachings described herein, or it may prove convenient to construct more specialized apparatus to perform methods 300 and/or each of its individual functions, routines, subroutines, or operations. Examples of the structure for a variety of these systems are set forth in the description above.
  • The above description is intended to be illustrative, and not restrictive. Although the present disclosure has been described with references to specific illustrative examples and implementations, it will be recognized that the present disclosure is not limited to the examples and implementations described. The scope of the disclosure should be determined with reference to the following claims, along with the full scope of equivalents to which the claims are entitled.

Claims (21)

What is claimed is:
1. A method comprising:
determining, by a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor;
adding, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages;
determining, by a processing device, in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and
providing an indication to the hypervisor that the hypervisor memory page is available for reuse.
2. The method of claim 1, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
3. The method of claim 1, wherein providing the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
4. The method of claim 1, further comprising, generating, by the guest operating system, an indication aligned with the memory page size of the hypervisor, wherein the generating comprises:
identifying an address of the guest memory page;
determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor; and
generating a message comprising the address of the hypervisor memory page.
5. The method of claim 1, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling the hypervisor memory page.
6. The method of claim 1, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling a plurality of hypervisor memory pages, wherein the plurality of hypervisor memory pages satisfies a predetermined threshold.
7. The method of claim 1, wherein the set of guest memory pages released by the guest operating system comprises a tuple, and wherein adding the guest memory page to the set comprises expanding a range of the tuple or adding another tuple to the set.
8. The method of claim 1, where providing the indication to the hypervisor comprises the guest operating system initiating a hypercall that transmits a message comprising a memory page identifier of the hypervisor memory page.
9. The method of claim 1, wherein providing the indication to the hypervisor comprises the guest operating system updating a shared data structure that represents a plurality of hypervisor memory pages, wherein the shared data structure is modifiable by the guest operating system and is accessible to the hypervisor.
10. The method of claim 1, wherein determining the memory page size of the hypervisor comprises receiving a message from the hypervisor indicating one or more memory page sizes supported by the hypervisor.
11-19. (canceled)
20. A non-transitory machine-readable storage medium storing instructions that cause a processing device to:
receive, by a guest operating system, an indication of a memory page size of a hypervisor;
determine, by the guest operating system, that the memory page size of the hypervisor is larger than a memory page size of the guest operating system;
add, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages;
determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and
responsive to the set of guest memory pages filling the hypervisor page, provide an indication to the hypervisor that the hypervisor memory page is available for reuse.
21. The non-transitory machine-readable storage medium of claim 20, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
22. The non-transitory machine-readable storage medium of claim 20, wherein to provide the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
23. The non-transitory machine-readable storage medium of claim 20, wherein the processing device is further to generate, by the guest operating system, an indication aligned with the memory page size of the hypervisor, and wherein to generate comprises the processing device to:
identify an address of the guest memory page;
determine an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor; and
generate a message comprising the address of the hypervisor memory page.
24. The non-transitory machine-readable storage medium of claim 20, wherein the set of guest memory pages released by the guest operating system comprises a tuple, and wherein adding the guest memory page to the set comprises expanding a range of the tuple or adding another tuple to the set.
25. A system comprising:
a memory;
a processing device operatively coupled to the memory, the processing device to:
determine, by a guest operating system, that a memory page size of the guest operating system is different from a memory page size of a hypervisor;
add, by the guest operating system, a guest memory page released by the guest operating system to a set of guest memory pages;
determine in view of the memory page size of the hypervisor that the set of guest memory pages fills a hypervisor memory page; and
provide an indication to the hypervisor that the hypervisor memory page is available for reuse.
26. The system of claim 25, wherein the hypervisor memory page comprises a plurality of guest memory pages that are released by the guest operating system and remain allocated to a virtual machine executing the guest operating system.
27. The system of claim 25, wherein providing the indication that the hypervisor memory page is available for reuse enables the hypervisor to reuse the hypervisor memory page and avoid copying content of the hypervisor memory page to persistent storage.
28. The system of claim 25, further comprising, generating, by the guest operating system, an indication aligned with the memory page size of the hypervisor, wherein the generating comprises:
identifying an address of the guest memory page;
determining an address of the hypervisor memory page containing the guest memory page in view of the memory page size of the hypervisor; and
generating a message comprising the address of the hypervisor memory page.
29. The system of claim 25, wherein providing the indication is in response to the set of guest memory pages released by the guest operating system filling the hypervisor memory page.
US15/692,346 2017-08-31 2017-08-31 Free page hinting with multiple page sizes Active 2037-11-19 US10956216B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/692,346 US10956216B2 (en) 2017-08-31 2017-08-31 Free page hinting with multiple page sizes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
US15/692,346 US10956216B2 (en) 2017-08-31 2017-08-31 Free page hinting with multiple page sizes

Publications (2)

Publication Number Publication Date
US20190065267A1 true US20190065267A1 (en) 2019-02-28
US10956216B2 US10956216B2 (en) 2021-03-23

Family

ID=65434500

Family Applications (1)

Application Number Title Priority Date Filing Date
US15/692,346 Active 2037-11-19 US10956216B2 (en) 2017-08-31 2017-08-31 Free page hinting with multiple page sizes

Country Status (1)

Country Link
US (1) US10956216B2 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190227957A1 (en) * 2018-01-24 2019-07-25 Vmware, Inc. Method for using deallocated memory for caching in an i/o filtering framework
US20210049070A1 (en) * 2018-01-29 2021-02-18 Telefonaktiebolaget Lm Ericsson (Publ) FaaS In-Memory Checkpoint Restore
US20210342260A1 (en) * 2020-04-30 2021-11-04 Red Hat, Inc. Indirect interface for virtual machine free page hinting
US11218364B2 (en) * 2018-06-25 2022-01-04 Amazon Technologies, Inc. Network-accessible computing service for micro virtual machines
US11237879B2 (en) 2017-08-29 2022-02-01 Red Hat, Inc Batched storage hinting with fast guest storage allocation
US11436141B2 (en) 2019-12-13 2022-09-06 Red Hat, Inc. Free memory page hinting by virtual machines

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100095074A1 (en) * 2008-10-10 2010-04-15 International Business Machines Corporation Mapped offsets preset ahead of process migration
US20110320682A1 (en) * 2006-09-21 2011-12-29 Vmware, Inc. Cooperative memory resource management via application-level balloon
US20120079479A1 (en) * 2010-09-27 2012-03-29 James Robert Howard Hakewill Microprocessor system for virtual machine execution
US20130145073A1 (en) * 2011-12-02 2013-06-06 Vmware, Inc. Memory defragmentation in a hosted hypervisor
US20130290596A1 (en) * 2012-04-30 2013-10-31 Vmware, Inc. Hybrid in-heap out-of-heap ballooning for java virtual machines

Family Cites Families (54)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6804766B1 (en) 1997-11-12 2004-10-12 Hewlett-Packard Development Company, L.P. Method for managing pages of a designated memory object according to selected memory management policies
US6598143B1 (en) 2000-02-24 2003-07-22 International Business Machines Corporation Method to increase performance of acquiring free memory pages
US7433951B1 (en) 2000-09-22 2008-10-07 Vmware, Inc. System and method for controlling resource revocation in a multi-guest computer system
JP4170988B2 (en) 2003-05-09 2008-10-22 富士通株式会社 Risk prediction / avoidance method, system, program, and recording medium for execution environment
US8387049B2 (en) 2005-07-15 2013-02-26 International Business Machines Corporation Facilitating processing within computing environments supporting pageable guests
US8276201B2 (en) 2007-03-22 2012-09-25 International Business Machines Corporation Integrity protection in data processing systems
US20080307188A1 (en) 2007-06-06 2008-12-11 International Business Machines Corporation Management of Guest OS Memory Compression In Virtualized Systems
US8086811B2 (en) 2008-02-25 2011-12-27 International Business Machines Corporation Optimizations of a perform frame management function issued by pageable guests
US8127086B2 (en) 2008-06-06 2012-02-28 International Business Machines Corporation Transparent hypervisor pinning of critical memory areas in a shared memory partition data processing system
US20100070678A1 (en) 2008-09-12 2010-03-18 Vmware, Inc. Saving and Restoring State Information for Virtualized Computer Systems
JP5153539B2 (en) 2008-09-22 2013-02-27 株式会社日立製作所 Memory management method and computer using the method
US9740517B2 (en) 2008-12-29 2017-08-22 Microsoft Technology Licensing, Llc Dynamic virtual machine memory management
US8429652B2 (en) 2009-06-22 2013-04-23 Citrix Systems, Inc. Systems and methods for spillover in a multi-core system
US20110154133A1 (en) 2009-12-22 2011-06-23 International Business Machines Corporation Techniques for enhancing firmware-assisted system dump in a virtualized computer system employing active memory sharing
US8583875B1 (en) 2010-07-13 2013-11-12 Vmware, Inc. Efficient readable ballooning of guest memory by backing balloon pages with a shared page
US8627112B2 (en) 2010-03-30 2014-01-07 Novell, Inc. Secure virtual machine memory
CN102236603B (en) 2010-04-29 2014-12-17 国际商业机器公司 Garbage recycling method and system in virtual environment
US8943259B2 (en) 2010-11-16 2015-01-27 Vmware, Inc. Relieving memory pressure in a host using database memory management
US8667496B2 (en) 2011-01-04 2014-03-04 Host Dynamics Ltd. Methods and systems of managing resources allocated to guest virtual machines
US9183157B2 (en) 2011-03-15 2015-11-10 Huawei Technologies Co., Ltd. Method for creating virtual machine, a virtual machine monitor, and a virtual machine system
US9355023B2 (en) 2011-03-15 2016-05-31 Anirudh Badam Virtual address pager and method for use with a bulk erase memory
US9189419B2 (en) 2011-04-14 2015-11-17 Vmware, Inc. Detecting and suppressing redundant input-output operations
US9280458B2 (en) 2011-05-12 2016-03-08 Citrix Systems, Inc. Reclaiming memory pages in a computing system hosting a set of virtual machines
US9619263B2 (en) 2011-06-11 2017-04-11 Microsoft Technology Licensing, Llc Using cooperative greedy ballooning to reduce second level paging activity
US9280486B2 (en) 2011-07-28 2016-03-08 Red Hat, Inc. Managing memory pages based on free page hints
US8789034B1 (en) 2011-12-31 2014-07-22 Parallels IP Holdings GmbH Method for updating operating system without memory reset
WO2013112538A1 (en) 2012-01-23 2013-08-01 Citrix Systems, Inc. Storage encryption
US9092318B2 (en) 2012-02-06 2015-07-28 Vmware, Inc. Method of allocating referenced memory pages from a free list
US9940228B2 (en) 2012-06-14 2018-04-10 Vmware, Inc. Proactive memory reclamation for java virtual machines
US9069782B2 (en) 2012-10-01 2015-06-30 The Research Foundation For The State University Of New York System and method for security and privacy aware virtual machine checkpointing
US9183399B2 (en) 2013-02-14 2015-11-10 International Business Machines Corporation Instruction set architecture with secure clear instructions for protecting processing unit architected state information
US8875295B2 (en) 2013-02-22 2014-10-28 Bitdefender IPR Management Ltd. Memory introspection engine for integrity protection of virtual machines
US9524233B2 (en) 2013-03-05 2016-12-20 Vmware, Inc. System and method for efficient swap space allocation in a virtualized environment
US9507540B1 (en) 2013-03-14 2016-11-29 Amazon Technologies, Inc. Secure virtual machine memory allocation management via memory usage trust groups
US9448928B2 (en) 2013-04-26 2016-09-20 Oracle International Corporation System and method for two-tier adaptive heap management in a virtual machine environment
US9201682B2 (en) 2013-06-21 2015-12-01 Ati Technologies Ulc Virtualized device reset
US9547600B2 (en) 2013-07-30 2017-01-17 Vmware, Inc. Method and system for restoring consumed memory after memory consolidation
US9053068B2 (en) 2013-09-25 2015-06-09 Red Hat Israel, Ltd. RDMA-based state transfer in virtual machine live migration
US9459900B2 (en) 2014-01-13 2016-10-04 Red Hat Israel, Ltd. Hypervisor-based balloon page initialization
US9851918B2 (en) 2014-02-21 2017-12-26 Red Hat Israel, Ltd. Copy-on-write by origin host in virtual machine live migration
US9600317B2 (en) 2014-04-16 2017-03-21 Vmware, Inc. Page compressibility checker
US9251090B1 (en) 2014-06-03 2016-02-02 Amazon Technologies, Inc. Hypervisor assisted virtual memory obfuscation
US9811366B2 (en) 2014-09-12 2017-11-07 Vmware, Inc. Dynamically using system memory as video memory for virtual graphics processing units
US9436601B2 (en) 2014-09-15 2016-09-06 International Business Machines Corporation Categorizing memory pages based on page residences
US20160085695A1 (en) 2014-09-24 2016-03-24 Intel Corporation Memory initialization in a protected region
US9390028B2 (en) 2014-10-19 2016-07-12 Strato Scale Ltd. Coordination between memory-saving mechanisms in computers that run virtual machines
US9442754B1 (en) 2015-05-27 2016-09-13 Red Hat Israel, Ltd. Deferred asynchronous actions for virtual devices
US9720846B2 (en) 2015-05-28 2017-08-01 Red Hat Israel, Ltd. Memory swap for direct memory access by a device assigned to a guest operating system
US9772962B2 (en) 2015-05-28 2017-09-26 Red Hat Israel, Ltd. Memory sharing for direct memory access by a device assigned to a guest operating system
US9552233B1 (en) 2015-09-10 2017-01-24 Red Hat Israel, Ltd. Virtual machine migration using free page hinting
US20170108914A1 (en) 2015-10-16 2017-04-20 Qualcomm Incorporated System and method for memory channel interleaving using a sliding threshold address
US10592434B2 (en) 2016-01-20 2020-03-17 Unisys Corporation Hypervisor-enforced self encrypting memory in computing fabric
US10235304B2 (en) 2016-10-01 2019-03-19 Intel Corporation Multi-crypto-color-group VM/enclave memory integrity method and apparatus
US9672062B1 (en) 2016-12-01 2017-06-06 Red Hat, Inc. Batched memory page hinting

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110320682A1 (en) * 2006-09-21 2011-12-29 Vmware, Inc. Cooperative memory resource management via application-level balloon
US20100095074A1 (en) * 2008-10-10 2010-04-15 International Business Machines Corporation Mapped offsets preset ahead of process migration
US20120079479A1 (en) * 2010-09-27 2012-03-29 James Robert Howard Hakewill Microprocessor system for virtual machine execution
US20130145073A1 (en) * 2011-12-02 2013-06-06 Vmware, Inc. Memory defragmentation in a hosted hypervisor
US20130290596A1 (en) * 2012-04-30 2013-10-31 Vmware, Inc. Hybrid in-heap out-of-heap ballooning for java virtual machines

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11237879B2 (en) 2017-08-29 2022-02-01 Red Hat, Inc Batched storage hinting with fast guest storage allocation
US20190227957A1 (en) * 2018-01-24 2019-07-25 Vmware, Inc. Method for using deallocated memory for caching in an i/o filtering framework
US20210049070A1 (en) * 2018-01-29 2021-02-18 Telefonaktiebolaget Lm Ericsson (Publ) FaaS In-Memory Checkpoint Restore
US11809275B2 (en) * 2018-01-29 2023-11-07 Telefonaktiebolaget Lm Ericsson (Publ) FaaS in-memory checkpoint restore
US11218364B2 (en) * 2018-06-25 2022-01-04 Amazon Technologies, Inc. Network-accessible computing service for micro virtual machines
US11436141B2 (en) 2019-12-13 2022-09-06 Red Hat, Inc. Free memory page hinting by virtual machines
US20210342260A1 (en) * 2020-04-30 2021-11-04 Red Hat, Inc. Indirect interface for virtual machine free page hinting
US11907115B2 (en) * 2020-04-30 2024-02-20 Red Hat, Inc. Indirect interface for virtual machine free page hinting

Also Published As

Publication number Publication date
US10956216B2 (en) 2021-03-23

Similar Documents

Publication Publication Date Title
US10956216B2 (en) Free page hinting with multiple page sizes
US11237879B2 (en) Batched storage hinting with fast guest storage allocation
US10969976B2 (en) Fast virtual machine storage allocation with encrypted storage
US10521149B2 (en) Memory poisoning support for free page hinting
US9852054B2 (en) Elastic caching for Java virtual machines
US10083058B2 (en) Batched memory page hinting
US10169088B2 (en) Lockless free memory ballooning for virtual machines
US11556468B2 (en) Multi-ring shared, traversable, and dynamic advanced database
US11150929B2 (en) Enhanced memory management for virtual machines
US11436141B2 (en) Free memory page hinting by virtual machines
US20220276889A1 (en) Non fragmenting memory ballooning
US10838753B2 (en) Efficient memory deduplication by hypervisor initialization
US20220147450A1 (en) Storage deduplication for containers with encrypted storage
US20190179657A1 (en) Tracking of memory pages by a hypervisor
US11243801B2 (en) Transparent huge pages support for encrypted virtual machines
US20230418643A1 (en) Improved memory management for busy virtual machine guests
US11550729B2 (en) Memory ballooning related memory allocation techniques for virtual machines
US20230153171A1 (en) Memory ballooning related memory allocation techniques for execution environments
US20230418644A1 (en) Efficient memory swap for virtual machines
US20230393874A1 (en) Efficient pagefaults for virtual machines
US20230132905A1 (en) Binary execuction by a virtual device
US20230359481A1 (en) Methods and apparatuses for managing tlb cache in virtualization platform
US11567866B2 (en) Free detection with double free protection
US20230168999A1 (en) Use after free detection with double free protection
Caldwell FluidMem: Open source full memory disaggregation

Legal Events

Date Code Title Description
AS Assignment

Owner name: RED HAT, INC., NEW JERSEY

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:TSIRKIN, MICHAEL;VAN RIEL, HENRI HAN;REEL/FRAME:043465/0543

Effective date: 20170830

FEPP Fee payment procedure

Free format text: ENTITY STATUS SET TO UNDISCOUNTED (ORIGINAL EVENT CODE: BIG.); ENTITY STATUS OF PATENT OWNER: LARGE ENTITY

STPP Information on status: patent application and granting procedure in general

Free format text: FINAL REJECTION MAILED

STPP Information on status: patent application and granting procedure in general

Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION

STPP Information on status: patent application and granting procedure in general

Free format text: NON FINAL ACTION MAILED

STPP Information on status: patent application and granting procedure in general

Free format text: RESPONSE TO NON-FINAL OFFICE ACTION ENTERED AND FORWARDED TO EXAMINER

STPP Information on status: patent application and granting procedure in general

Free format text: NOTICE OF ALLOWANCE MAILED -- APPLICATION RECEIVED IN OFFICE OF PUBLICATIONS

STPP Information on status: patent application and granting procedure in general

Free format text: DOCKETED NEW CASE - READY FOR EXAMINATION

STPP Information on status: patent application and granting procedure in general

Free format text: NOTICE OF ALLOWANCE MAILED -- APPLICATION RECEIVED IN OFFICE OF PUBLICATIONS

AS Assignment

Owner name: RED HAT, INC., NORTH CAROLINA

Free format text: CORRECTIVE ASSIGNMENT TO CORRECT THE ASSIGNEE ADDRESS PREVIOUSLY RECORDED AT REEL: 043465 FRAME: 0543. ASSIGNOR(S) HEREBY CONFIRMS THE ASSIGNMENT;ASSIGNORS:TSIRKIN, MICHAEL;VAN RIEL, HENRI HAN;REEL/FRAME:054588/0264

Effective date: 20170830

STPP Information on status: patent application and granting procedure in general

Free format text: PUBLICATIONS -- ISSUE FEE PAYMENT VERIFIED

STCF Information on status: patent grant

Free format text: PATENTED CASE