Computer memory management in computing devices
By dividing the memory of a computing device into areas of different functional types and concurrently managing metadata, the overhead and latency problems caused by metadata memory are solved, and system performance and resource utilization efficiency are improved.
Patent Information
- Application Number
- CN202180028863.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-04-17
- Filing Date
- 2021-03-12
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2041-03-12
AI Technical Summary
In computing devices, the management of metadata memory results in significant memory overhead and high processing latency, especially in large-scale computer memory environments, impacting system performance.
The physical memory is divided into a first memory area of a first functional type and a second memory area of a second functional type, and the operating system is used to concurrently track the memory subdivision status of different sizes, manage metadata separately, and reduce the demand for metadata memory.
Significantly reduces memory overhead and processing latency, improving system performance of computing devices, especially during the instantiation of virtual machines or containers.
Smart Images

Figure CN115398408B_ABST
Abstract
Description
Background Art
[0001] In computing, memory management is a form of resource management applied to computer memory, such as random access memory ("RAM") in a computing device. For example, a memory manager in an operating system may initially allocate a certain amount of memory space (often referred to as a "block") to a program or process executed by a processor in the computing device. The processor may then utilize the allocated memory space to store objects and data structures corresponding to the executed program or process. Once the allocated memory space is no longer needed, for example, when the execution of the program or process is complete, the memory manager may deallocate or "free" the previously allocated memory space for reuse by another program or process. Summary of the Invention
[0002] This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter.
[0003] In some computing devices, a memory manager may manage computer memory, such as RAM, in the computing device by subdividing the computer memory into multiple memory segments or "pages" of a specific data size (e.g., 4 KB). The memory manager may also reserve a certain amount of memory space (referred to herein as "metadata memory") in the computer memory for storing metadata for each memory page. The metadata memory may include metadata indicating whether the corresponding memory page is allocated, deallocated, or include other appropriate status information.
[0004] During operation, when a request for a certain amount of memory (e.g., 1 MB) is received from a program or process, the memory manager can search the metadata memory and find memory pages that fit the request (e.g., 256 memory pages of 4 KB each). The memory manager can then perform allocation of multiple memory pages to the program or process by notifying the program or process of the allocated memory pages. The memory manager can also modify the metadata in the corresponding metadata memory to reflect that the memory pages have been allocated to the program or process.
[0005] The aforementioned memory management techniques have certain drawbacks when applied to computing devices with large amounts of computer memory. On the one hand, metadata memory can represent a significant overhead in the computing device because metadata memory cannot be allocated to support the execution of programs or processes. For example, servers in cloud computing facilities may have several GB or even several TB of computer memory. Although metadata memory typically accounts for approximately 1% of the total computer memory size, the actual size of the metadata memory becomes significant when the total computer memory size is large. For example, when a computing device has 1 TB of computer memory, the metadata memory may be approximately 10 GB in size. On the other hand, updating metadata when allocating a large number of memory pages to a requesting program or process can result in high processing latency, which can degrade system performance in the computing device. For example, to allocate 1 GB of memory to a requesting program or process, the memory manager must update the metadata in the metadata memory for each of 262,144 4 KB memory pages. This update process can take a significant amount of time, thereby reducing the responsiveness of memory allocation operations.
[0006] Several embodiments of the disclosed technology can address several aspects of the above-mentioned deficiencies by implementing multiple functional types of memory that coexist on physical memory in a computing device and utilizing an operating system in the computing device to concurrently track the state of memory subdivisions of different sizes. In some embodiments, physical memory having a total size (e.g., 1TB) can be divided into a first memory area of a first functional type and a second memory area of a second functional type. The first and second memory areas can each have a preconfigured size or percentage of the total size. In some embodiments, the preconfigured size or percentage of the first and / or second memory area can be set by a user of the computing device and stored persistently in a configuration file of the computing device. In other embodiments, the preconfigured size or percentage can have a default value, can be set during operation, or can be set in another appropriate manner. In further embodiments, at least a portion of the first memory area can be converted to the second functional type, or vice versa, during operation, as will be discussed in more detail herein.
[0007] In some embodiments, the first memory area can be configured to be available for allocation by an operating system of the computing device. For example, the first memory area can be subdivided into a plurality of memory sub-areas of a first size (e.g., the size of a memory page in physical memory, such as 4KB), each memory sub-area having a designated metadata memory in the first memory area for storing metadata of the memory sub-area. The first memory area can also be configured to support a first set of memory management operations. Examples of such memory management operations may include operations for allocation, release, swapping, memory protection, segmentation, error checking, and other appropriate tasks. During operation, the operating system at the computing device can allocate memory from the first memory area to a program or process executing on the operating system at the computing device.
[0008] The second memory area can be configured to be available for allocation to a virtual machine, container, or other appropriate guest operating system hosted on the computing device, but not for allocation to the operating system of the computing device. In one example, the second memory area can be subdivided into multiple memory sub-areas of a second size (e.g., 1GB), the second size being larger than the first size of the first functional type. It will also be recognized that not all memory management operations are applicable to memory allocated to a guest operating system. Thus, the second memory area can also be configured to support a second set of memory management operations that are different from the first set of memory management operations. For example, the memory allocated to the virtual machine may not require operations other than allocation and release. Therefore, the second group may only support allocation and release of memory from the second memory area, but not support other operations supported by the first group.
[0009] During startup, the computing device may initialize physical memory to have coexisting first and second memory regions according to a configuration file, and utilize a memory manager to concurrently track the state of memory subdivisions in the first and second memory regions. During operation, when a first request for memory is received from a program or process executing in the operating system, the memory manager may allocate a portion of the first memory region to the program or process and update the corresponding metadata memory accordingly. Upon receiving a second memory request from, for example, a virtual machine manager (which is used for a virtual machine to be instantiated on the computing device), the memory manager may be configured to allocate a portion of the second memory region (instead of the first memory region) for use by the virtual machine. The memory manager may be configured to distinguish between the first and second requests in various ways. In one example, the memory manager (or other components of the operating system) may provide different application programming interfaces ("APIs"), each configured to receive the first or second request, respectively. In other examples, the memory manager may be configured to distinguish between the first and second requests based on metadata included in the first and second requests or in other appropriate ways.
[0010] Several embodiments of the disclosed technology can significantly reduce memory overhead in a computing device. By subdividing the second memory area according to a second size that is larger than the first size, and using a memory manager to concurrently track the status of memory sub-areas of different sizes, the amount of metadata in the second memory area can be significantly reduced. For example, assuming a metadata memory overhead of 1%, subdividing 1TB of memory into 4KB memory pages will produce approximately 10GB of metadata memory per memory page. On the other hand, subdividing 1TB of memory into 1GB memory sub-areas will produce approximately 40KB of metadata memory. By reducing memory overhead, more memory space in the physical memory can be used to allocate to virtual machines or containers to perform computing tasks. In addition, computing operations such as searching, locking and / or updating metadata can become more efficient because the metadata to be parsed is much smaller. Therefore, the cost of providing computing services from virtual machines or containers at a computing device can be reduced.
[0011] In addition, the processing delay of allocating memory from the second memory area to a virtual machine, container, or other appropriate type of guest operating system can be much lower than the processing delay of allocating memory from the first memory area. The second function type can have a memory sub-area that is much larger than the first function type. Therefore, the number of updates to the metadata memory during allocation can be significantly reduced compared to allocating from the first memory area. For example, allocating each 4KB of 1TB of memory involves updating metadata in approximately 10GB of metadata memory. In contrast, allocating each 1GB of 1TB of memory includes updating metadata in approximately 40KB of metadata memory. Therefore, computing system performance (for example, operations such as instantiating virtual machines or containers) can use less energy and execute faster.
[0012] In some embodiments, at least a portion of the first memory area can be converted to the second functional type, and vice versa. For example, after initialization, a user of the computing device can issue a command to convert a portion of the second memory area to the first functional type. In response, the memory manager can remap or reallocate a portion of the physical memory mapped to the second memory area to the first functional type. For example, the memory manager can redesignate a 1GB memory block from the second memory area as the first functional type. The memory manager can then subdivide the 1GB memory block into multiple 4KB memory pages and mark the multiple 4KB memory pages as available for allocation by the operating system. In other embodiments, the relative sizes of the first and second memory areas can be modified by updating a configuration file and reinitializing the computing device, or by other appropriate techniques.
[0013] In a further embodiment, a computing device may include multiple physical memories that can be accessed locally or remotely by the computing device. For example, non-uniform memory access ("NUMA") is a computer memory design in which a processor can access local memory and non-local memory (e.g., local memory of another processor or memory shared between processors). Each local or non-local memory can form a NUMA node. According to several aspects of the disclosed technology, each NUMA node can have a respective ratio of first and second memory regions ranging from 0% to 100%. In one example, one NUMA node can include only the first memory region, while another NUMA node includes only the second memory region. In other examples, at least some NUMA nodes can include the same ratio or different ratios of the first and second memory regions.
[0014] Several embodiments of the disclosed technology may also support efficient updating / resetting of an operating system on a computing device while maintaining state information of virtual machines or containers hosted on the computing device. For example, during a kernel software reset ("KSR"), the memory manager may be configured to maintain a mapping and distribution of first and second memory areas. The data of the operating system in the first memory area may then be overwritten and updated, while the data in the second memory area is retained. After reinitializing the operating system in the first memory area, various virtual machines or containers may be restored on the computing device based on the state information maintained in the second memory area. In this way, rapid updating / resetting of the operating system on the computing device may be achieved while retaining the state information of the virtual machines or containers. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 is a schematic diagram illustrating a distributed computing system that implements computer memory management according to an embodiment of the disclosed technology.
[0016] Figure 2 is a diagram showing an embodiment according to the disclosed technology Figure 1 A schematic diagram of some of the hardware and software components of a distributed computing system.
[0017] Figure 3A-3C During the phase of initializing the memory area in the host according to an embodiment of the disclosed technology Figure 1 and 2 A diagram of some of the hardware / software components of the host.
[0018] Figures 4A-4D During the memory allocation phase in the host according to an embodiment of the disclosed technology Figure 1 and Figure 2 A diagram of some of the hardware / software components of the host.
[0019] Figure 5 is a schematic diagram illustrating multiple memory nodes according to an embodiment of the disclosed technology.
[0020] Figure 6 is a flow chart illustrating a memory management process according to an embodiment of the disclosed technology.
[0021] Figure 7 is applicable to Figure 1 A computing device that is part of a distributed computing system. DETAILED DESCRIPTION
[0022] Certain embodiments of systems, devices, components, modules, routines, data structures, and processes for computer memory management are described below. In the following description, specific details of the components are included to provide a thorough understanding of certain embodiments of the disclosed technology. Those skilled in the relevant art will also understand that the technology can have additional embodiments. It can also be used without the following references. Figure 1-Figure 7 The embodiments described herein are described in detail without further detail to practice the technology.
[0023] As used herein, the term "distributed computing system" generally refers to a computing facility having a computer network that interconnects multiple hosts with each other or with an external network (e.g., the Internet). Examples of such computing facilities may include data centers used to provide cloud computing services. A computing network may include multiple network devices. The term "network device" generally refers to a physical network device, examples of which include routers, switches, hubs, bridges, load balancers, security gateways, or firewalls.
[0024] As used herein, a "host computing device" or "host" generally refers to a computing device configured to support the execution of one or more applications or computer programs. In some embodiments, the host may include a host operating system configured to support the execution of the application or computer program. In other embodiments, the host may also support, for example, the implementation of one or more virtual machines (VMs), containers, or other appropriate virtualization components. For example, the host may include a server having a hypervisor configured to support one or more virtual machines, containers, or other appropriate types of virtual components. One or more virtual machines or containers can be used to launch and execute appropriate applications or computer programs to provide corresponding computing services.
[0025] As also used herein, a "host operating system" generally refers to an operating system that is deployed to interact directly with the hardware components of a computer device (e.g., a server) and can grant or deny system-level access to services provided by the host operating system. In some implementations, a hypervisor (e.g., a hosted hypervisor) can run on top of the host operating system rather than interacting directly with the hardware components of the computing device. The hypervisor can then create, manage, or otherwise support one or more VMs or containers, each of which has a "guest operating system" or "guest" separated from the host operating system by a security boundary. In some embodiments, the guest operating system may be different from the host operating system that supports the guest operating system.
[0026] As used herein, "hypervisor" generally refers to the computer software, firmware, and / or hardware that creates, manages, and runs one or more virtual machines on a host computer. A "virtual machine" or "VM" is a simulation of a physical computing system using computer software. Different virtual machines can be configured to provide appropriate computing environments for executing different processes for the same or different users on a single host computer. During operation, the hypervisor on the host computer can present different virtual machines with virtualized execution platforms to the hardware resources on the host computer and manage the execution of various processes for the virtual machines.
[0027] The terms "computing service" or "cloud service," also as used herein, generally refer to one or more computing resources provided over a computer network, such as the Internet. Example cloud services include Software as a Service ("SaaS"), Platform as a Service ("PaaS"), and Infrastructure as a Service ("IaaS"). SaaS is a software distribution technology in which software applications are hosted by a cloud service provider, such as in a data center, and accessed by users over a computer network. PaaS generally refers to the delivery of an operating system and related services over a computer network, without the need for downloading or installing. IaaS generally refers to outsourced equipment used to support storage, hardware, servers, network equipment, or other components, all of which are accessible over a computer network.
[0028] As used herein, a memory region generally refers to a portion of physical memory having a plurality of memory sub-regions, blocks, pages, or other suitable subdivisions. For example, a memory region may include 1 TB of physical memory divided into 1,000 memory sub-regions of 1 GB each. Each memory sub-region may also include a certain amount of designated memory for storing metadata for the corresponding memory sub-region (referred to herein as "metadata memory"). The metadata may include information indicating the state of the memory sub-region, such as allocation status, refresh status, etc.
[0029] In some computing devices, a physical memory can be subdivided into multiple memory pages of a certain size (e.g., 4KB). During operation, when a request for a certain amount of memory (e.g., 1MB) is received from a program or process, the memory manager can search the metadata memory and find memory pages that are suitable for the request (e.g., 256 memory pages of 4KB each). The memory manager can then perform the allocation of multiple memory pages to the program or process by notifying the program or process of the allocated memory pages. The memory manager can also modify the metadata in the corresponding metadata memory to reflect that the memory pages have been allocated to the program or process.
[0030] The above-described memory management techniques have certain drawbacks when applied to computing devices with large amounts of computer memory. On the one hand, metadata memory can represent a significant overhead in the computing device because metadata memory cannot be allocated to support the execution of programs or processes. On the other hand, updating metadata for large amounts of memory pages when allocating memory pages to requesting programs or processes can result in high processing delays that degrade system performance in the computing device.
[0031] Several embodiments of the disclosed technology can address several aspects of the above-mentioned deficiencies by implementing multiple functional types of memory that coexist on physical memory in a computing device, and utilizing an operating system in the computing device to concurrently track the state of memory subdivisions of different sizes. For example, physical memory having a total size (e.g., 1TB) can be divided into a first memory region of a first functional type and a second memory region of a second functional type. The first and second memory regions can each have a size or percentage of the total size. The first and second memory regions can have memory sub-regions of different sizes and support different memory management operations. In this way, when a request for memory is received, the request can be appropriately serviced by allocating memory from the first or second memory region, which will be referred to below. Figure 1-Figure 7 Describe in more detail.
[0032] Figure 1 FIG. 1 is a schematic diagram illustrating a distributed computing system 100 having a host computer 106 that implements computer memory management according to an embodiment of the disclosed technology. Figure 1 As shown, the distributed computing system 100 may include a computer network (shown as "underlying network 108") that interconnects a plurality of hosts 106, a plurality of client devices 102 of users 101, and a resource manager 110. The resource manager 110 may be a cluster controller, a fabric controller, a database controller, and / or other suitable types of controllers configured to monitor and manage the resources and operations of the hosts 106 and / or other components in the distributed computing system 100. Although Figure 1Specific components of the computing system 100 are shown in FIG. 1 , but in other embodiments, the computing system 100 may also include a network storage device, a maintenance manager, and / or a server. Figure 1 Other suitable components (not shown) in addition to or in place of those shown.
[0033] like Figure 1 As shown, the lower layer network 108 may include multiple network devices 112 that interconnect multiple hosts 106 and client devices 102. In some embodiments, the hosts 106 may be organized into racks, zones, groups, sets, or other suitable partitions. For example, in the illustrated embodiment, the hosts 106 are grouped into three clusters, identified as first, second, and third clusters 107a-107c, respectively. In the illustrated embodiment, each of the clusters 107a-107c is operably coupled to a corresponding network device 112a-112c, which are commonly referred to as "top-of-rack" or "TOR" network devices. The TOR network devices 112a-112c can, in turn, be operably coupled to additional network devices 112 to form a network with a hierarchical, flat, mesh, or other suitable type of topology. The computer network can allow communication between the hosts 106 and the client devices 102. In other embodiments, multiple sets of host machines 107a-107c can share a single network device 112 or can have other suitable arrangements.
[0034] The hosts 106 can be individually configured to provide computing, storage, and / or other appropriate cloud computing services to the respective users 101. For example, as described below with reference to Figure 2 In more detail, each host 106 can start and maintain one or more virtual machines 144 (such as Figure 2 ). User 101 can then utilize the instantiated virtual machine 144 to execute appropriate processes to perform computing, communication, and / or other appropriate tasks. In some embodiments, one of hosts 106 can provide virtual machines 144 to multiple users 101. In other embodiments, multiple hosts 106 can host virtual machines 144 for one or more users 101a-101c.
[0035] Each client device 102 may comprise a computing device that enables a corresponding user 101 or administrator 104 to access computing services provided by a host 106 via an underlying network 108. For example, in the illustrated embodiment, the client devices 102 each comprise a desktop computer. In other embodiments, the client devices 102 may also comprise laptop computers, tablet computers, smartphones, or other suitable computing devices. Although for illustrative purposes only, the client devices 102 may be configured as a single computer. Figure 1Three users 101 are shown in FIG, but in other embodiments, the distributed computing system 100 can support any appropriate number of users 101 or administrators accessing cloud and / or other appropriate types of computing services provided by the host 106 and / or other components in the distributed computing system 100.
[0036] Figure 2 is a diagram showing that an embodiment of the disclosed technology can be Figure 1 Schematic diagram of an upper layer network 108' implemented on a lower layer network 108 in FIG. Figure 2 For the sake of clarity, only Figure 1 Certain components of the lower layer network 108. Figure 2 As shown, the first host 106a and the second host 106b can each include a CPU 132, a memory 134, and a network interface 136 operatively coupled to each other. The CPU 132 can include one or more processors, microprocessors, field programmable gate arrays, and / or other suitable logic devices. The memory 134 can include volatile and / or non-volatile media (e.g., ROM; RAM, magnetic disk storage media; optical storage media; flash memory devices, and / or other suitable storage media) and / or other types of computer-readable storage media, which are configured to store data received from the CPU 132 and instructions for the CPU 132 (e.g., for executing the instructions described below). Figure 6 The network interface 136 may include a network interface card, a connection switch, and / or other appropriate types of input / output devices configured to accept input from and provide output to other components on the upper network 108'.
[0037] The first host 106a and the second host 106b can each contain instructions in memory 134 that are executable by the CPU 132 to cause the individual hosts 106a and 106b to provide a hypervisor 140 (identified as first and second hypervisors 140a and 140b, respectively). The hypervisors 140 can be independently configured to generate, monitor, terminate, and / or otherwise manage one or more virtual machines 144 organized into tenant sites 142. For example, Figure 2 As shown, the first host 106a may provide a first hypervisor 140a that manages first and second tenant sites 142a and 142b, respectively. The second host 106b may provide a second hypervisor 140b that manages first and second tenant sites 142a' and 142b', respectively. Figure 2 140 are each shown as a software component. However, in other embodiments, hypervisor 140 may also include firmware and / or hardware components.
[0038] Tenant sites 142 may each include multiple virtual machines 144 for a specific tenant. For example, first host 106a and second host 106b may both host tenant sites 142a and 142a' for first user 101a. First host 106a and second host 106b may both host tenant sites 142b and 142b' for second user 101b. Each virtual machine 144 may be executing an application or process 147 corresponding to an operating system, middleware, and / or appropriate applications. The executed applications or processes 147 may each correspond to one or more computing services or other appropriate types of computing services. Examples of such computing services may include platform services, microservices, authentication services, or other appropriate types of services.
[0039] Also like Figure 2 As shown, computing system 100 may include an upper layer network 108' having one or more virtual networks 146 that interconnect tenant sites 142a and 142b across first and second hosts 106a and 106b. For example, first virtual network 146a interconnects first tenant sites 142a and 142a' at first host 106a and second host 106b. Second virtual network 146b interconnects second tenant sites 142b and 142b' at first host 106a and second host 106b. Although a single virtual network 146 is shown corresponding to a single tenant site 142, in other embodiments, multiple virtual networks (not shown) may be configured to correspond to a single tenant site 146.
[0040] Even if the virtual machines 144 are located or hosted on different hosts 106, the virtual machines 144 on the virtual network 146 can access the underlying network 108 ( Figure 1 ) can communicate with each other. Each virtual network 146 can communicate isolated from other virtual networks 146. In some embodiments, communication from one virtual network 146 to another virtual network 146 can be allowed in a controlled manner through a security gateway or otherwise. A virtual network address can correspond to one of the virtual machines 144 in a particular virtual network 146. Thus, different virtual networks 146 can use one or more of the same virtual network addresses. Example virtual network addresses can include IP addresses, MAC addresses, and / or other suitable addresses.
[0041] In operation, the host 106 can support communications between virtual machines and / or applications executing in the virtual machines 144. For example, the CPU 132 of the first host 106a can perform appropriate network communication operations to support the first virtual machine 144a transmitting packets to the second virtual machine 144b via the virtual network 146a by traversing the network interface 136 on the first host 106a, the underlying network 108 ( Figure 1) and the network interface 136 on the second host 106b. In this way, the first virtual machine 144a of the tenant site 142a on the first host 106a can cooperate with another virtual machine 144b on another server 106b to execute appropriate applications 147 or processes to provide appropriate computing services for the user 101.
[0042] To host the virtual machine 144, the host 106 may allocate a certain amount of memory space to the virtual machine 144. The inventors have recognized that having fixed-size (e.g., 4KB) memory pages in the memory 134 may not be efficient for providing memory access to the virtual machine 144 or other appropriate types of guest operating systems. For example, having a large number of 4KB memory pages may result in a large amount of the memory 134 being designated as metadata memory, thereby increasing operational overhead in the memory 134. In another example, during allocation, updating each of the large number of 4KB memory pages may result in high latency when instantiating the virtual machine 144. Several embodiments of the disclosed technology may address at least some of the above-mentioned deficiencies by implementing multiple memory types in the memory 134 of the host 106 and utilizing the operating system to concurrently track the state of memory subdivisions of different sizes, so that the memory overhead and operational latency associated with allocating memory to the virtual machine 144 can be reduced, which will be referred to below. Figures 3A-4D Describe in more detail.
[0043] Figure 3A-3C During the phase of initializing the memory region in the host 106 according to an embodiment of the disclosed technology Figure 1 and 2 For illustration purposes, Figures 3A-3C Only certain components of the host 106 are shown. In other embodiments, the host 106 may include additional memory 134 or other suitable components.
[0044] like Figure 3A As shown, the processor 132 of the host 106 can execute appropriate instructions to provide an operating system 138 that supports a hypervisor 140 and a virtual stack 148 that are operably coupled to each other. The processor 132 is also operably coupled to the physical memory 134 and the persistent storage 135 that stores the memory profile 111. The virtual stack 148 can be configured to supplement the hypervisor 140 in running a guest operating system such as Figure 2 For example, the virtualization stack 148 may include software library components that emulate devices, management services, and user interfaces.
[0045] The configuration file 111 may include data indicating the partitioning of the physical memory 134 into a plurality of memory regions. In some embodiments, the physical memory 134 may have a total size (e.g., 1 TB), which may be divided into a first memory region 134a of a first functional type (e.g., Figure 3B ) and a second memory area 134b of a second functional type (as shown in FIG. Figure 3B ). The first and second memory regions 134a and 134b may each have a preconfigured size or percentage of the total size of the physical memory 134. In some embodiments, the preconfigured size or percentage of the first and / or second memory regions may be determined by a user 101 ( Figure 1 ) and is persistently stored in the configuration file 111 of the persistent storage 135. In other embodiments, the preconfigured size or percentage may have a default value, may be set during operation, or may be set in another suitable manner. In further embodiments, at least a portion of the first memory area 134a may be converted to the second functional type during operation, or vice versa, which will be referred to as Figure 3C Discuss in more detail.
[0046] like Figure 3A As shown, the memory manager 150 includes a partitioner 152 and an allocator 154 operatively coupled to each other. Figure 3A Only the aforementioned components of the memory manager 150 are shown in FIG. 1 , but in other embodiments, the memory manager 150 may include components other than the aforementioned components. Figure 3A Other suitable components besides those shown in FIG.
[0047] The partitioner 152 may be configured to partition the physical memory 134 into a plurality of memory regions according to the configuration file 111. For example, Figure 3A As shown, in response to receiving the start command 120, the partitioner 152 of the memory manager 150 can be configured to retrieve the configuration file 111 from the persistent storage 135 and configure the first and second memory regions 134a and 134b accordingly. For example, the partitioner 152 can be configured to subdivide a preconfigured size or percentage of the physical memory 134 into the first and second memory regions 134a and 134b, each having a plurality of memory sub-regions of a preset size according to the configuration file 111.
[0048] In some embodiments, the first memory area 134a can be subdivided into a plurality of memory sub-areas 123a of a first size (e.g., 4KB, 1MB, or 2MB), each having a designated metadata memory 124a in the first memory area 134a. The metadata memory 124a can be configured to store metadata for the memory sub-areas 123a. The first memory area 134a can also be configured to support a first set of memory management operations. Examples of such memory management operations can include operations for allocation, deallocation, swapping, memory protection, segmentation, error checking, and other appropriate tasks. During operation, the operating system 138 at the host 106 can allocate memory from the first memory area 134a to programs or processes executing on the operating system 138, which will be referred to below. Figures 4A-4B Describe in more detail.
[0049] The second memory region 134b may be subdivided into a plurality of memory sub-regions 123b of a second size (e.g., 1 GB), the second size being larger than the first size of the first functional type. It is also recognized that not all memory management operations may be suitable for being assigned to a guest operating system (e.g., Figure 2 Thus, the second memory region 134b may also be configured to support a second set of memory management operations that are different from the first set of memory management operations. For example, the memory allocated to the virtual machine 144 may not require operations other than allocation and deallocation. Thus, the second group may only support allocation and deallocation of memory from the second memory region 134b, but not support other operations supported by the first group. During operation, the operating system 138 at the host 106 may allocate memory from the second memory region 134b to the virtual machine 144 (or other appropriate type of guest operating system), as described below with reference to Figures 4C-4D Described in more detail.
[0050] like Figure 3C As shown, in some embodiments, the relative proportions of the first and second memory regions 134a and 134b can be modified during operation. For example, upon receiving the conversion command 121, the partitioner 152 can be configured to convert at least a portion of the first memory region to the second memory functional type, or vice versa. Figure 3CIn the example shown, a portion of the first memory region 134a is shown as being converted to a memory sub-region 123b (shaded as 134') of the second memory region 134b. In other examples, one or more memory sub-regions 123b of the second memory region 134b may also be converted to a memory sub-region 123a of the first memory region 134a. The partitioner 152 may also be configured to designate and / or update the metadata memory 124a or 124b to reflect any conversion between the first and second memory regions 134a and 134b. After completing the partitioning of the physical memory 134, the memory manager 150 may be configured to allocate memory from the first and second memory regions 134a and 134b based on the characteristics of the allocation request, as described below with reference to Figures 4A-4D Described in more detail.
[0051] Figures 4A-4D During the memory allocation phase in the host according to an embodiment of the disclosed technology Figure 1 and 2 A diagram of some of the hardware / software components of the host. Figure 4A and Figure 4B As shown, during operation, upon receiving a first request 126 for memory from a program or process executing in the operating system 138, the allocator 154 of the memory manager 150 may be configured to allocate a portion of the first memory region 134a to the program or process. Thus, the allocator 154 may be configured to: provide a first response 128 to the program or process, identifying one or more memory sub-regions 123a from the first memory region 134a; and update the corresponding metadata memory 124a accordingly.
[0052] like Figure 4C and Figure 4D As shown, for example, a virtual machine 144 ( Figure 2 ) receives second request 126′. In response, allocator 154 of memory manager 150 may be configured to allocate second memory region 134b, rather than a portion of first memory region 134a, for use by virtual machine 144. Thus, allocator 154 may be configured to provide a second response 128′ to the virtual machine manager, identifying one or more memory sub-regions 123b from second memory region 134b, and to update metadata memory 124b accordingly.
[0053] The allocator 154 of the memory manager 150 can be configured to distinguish between the first and second requests 126 and 126' in various ways. In one example, the memory manager 150 (or other components of the operating system 138) can provide different application programming interfaces ("APIs"), each of which is configured to receive the first or second request 126 and 126', respectively. In this way, the allocator 154 can be configured to select one of the first or second memory areas 134a and 134b for allocating memory based on an identification of the API that received the first or second request 126 or 126'. In other examples, the allocator 154 can be configured to distinguish between the first and second requests 126 and 126' based on metadata included in the first and second requests 126 and 126' or in other suitable ways. For example, the memory manager 150 can be configured to maintain a list of registered processes for each of the first and second memory areas 134a and 134b. Upon receiving the first or second request 126 or 126', the memory manager 150 may be configured to identify the corresponding process and allocate from one of the first or second memory areas 134a and 134b when the process is registered. Otherwise, the memory manager 150 may be configured to allocate from a default memory area (e.g., the first memory area 134a). Such registration may be per-thread, per-process, per-processor, or on another appropriate basis. In other embodiments, the hypervisor 140 may maintain a metadata table and use the metadata to determine which of the first or second memory areas 134a and 134b to allocate based on the caller identity and the listing in the metadata table.
[0054] Several embodiments of the disclosed technology can significantly reduce memory overhead in the host 106. By subdividing the second memory area 134b according to a second size that is larger than the first size, the amount of metadata in the second memory area 134b can be significantly reduced compared to if the second memory area 134b is also subdivided according to the first size. For example, assuming that the overhead of the metadata memory 124a or 124b is 1%, subdividing 1TB of memory into memory sub-areas 123a of 4KB each (i.e., a single memory page) will result in approximately 10GB of metadata memory 124a. On the other hand, subdividing 1TB of memory into memory blocks of 1GB each will result in approximately 40KB of metadata memory 124b. By reducing memory overhead, more memory space in the physical memory 134 can be used to allocate to virtual machines 144 or containers for performing computing tasks. Therefore, the cost of providing computing services from virtual machines 144 or containers at the host 106 can be reduced.
[0055] Several embodiments of the disclosed technology may also support efficient update / reset of the operating system 138 on the host 106 while maintaining the virtual machine 144 ( Figure 2 ) or state information of containers hosted on the host 106. For example, during a kernel software reset ("KSR"), the memory manager 150 can be configured to maintain the distribution of the first and second memory regions 134a and 134b. For example, the memory manager 150 can maintain which pages of the second memory region 134b are being used by the virtual machines 144 and selectively maintain / restore metadata of the pages in use. The data of the operating system 138 in the first memory region 134a can then be overwritten and updated, while the data in the second memory region 134b is maintained. After the operating system 138 in the first memory region 134a is reinitialized, the various virtual machines 144 or containers can be restored on the computing device based on the state information maintained in the second memory region 134b. Therefore, a rapid update / reset of the operating system 138 can be achieved while preserving the state information of the virtual machines 144 or containers.
[0056] Furthermore, the processing latency for allocating memory from the second memory area 134b to a virtual machine 144, container, or other appropriate type of guest operating system can be significantly lower than the processing latency for allocating memory from the first memory area 134a. The second function type can have a much larger memory sub-area than the first function type. Consequently, the number of updates to the metadata memory 124b during allocation can be significantly reduced compared to allocating from the first memory area 134a. For example, allocating 4KB of 1TB of memory per block involves updating approximately 10GB of metadata in the metadata memory 124a. In contrast, allocating 1GB of 1TB of memory per block involves updating approximately 40KB of metadata in the metadata memory 124b. As a result, the speed of instantiating virtual machines 144 or containers and / or other system performance can be improved in the host 106.
[0057] Despite Figures 3A-4D Only one physical memory 134 is shown in FIG, but in other embodiments, the host 106 may have multiple physical memories 134, which may be local or remotely accessible to the processor 132, such as Figure 5 As shown. For example, non-uniform memory access ("NUMA") is a computer memory design in which a processor can access local memory and non-local memory (e.g., local memory of another processor or memory shared between processors). Each local or non-local memory 134, 134', and 134" can form a NUMA node. According to several aspects of the disclosed technology, each NUMA node can have a corresponding ratio of first and second memory regions 134a and 134b, ranging from 0% to 100%. In one example, as Figure 5As shown, one NUMA node (e.g., memory 134) may include only first memory region 134a, while another NUMA node (e.g., memory 134') may include only second memory region 134b. In other examples, at least some NUMA nodes (e.g., memory 134") may include first and second memory regions 134a and 134b in the same ratio or in different ratios.
[0058] Figure 6 is a flow chart illustrating a process 200 for memory management according to an embodiment of the disclosed technology. Figures 3A-4D Process 200 is described in the context of host 106 in FIG. 1 , but in other embodiments, process 200 may be implemented in a computing device or system having additional and / or different components. Figure 6 As shown, process 200 may include receiving an allocation request at stage 202. Process 200 may then include a decision stage 204 to determine whether the request is for an allocation from physical memory 134 ( Figures 3A-4D ) is allocated to the first memory region 134a or the second memory region 134b. The first memory region 134a has multiple memory sub-regions 123a of a first size. The second memory region 134b may also have multiple memory sub-regions 123b of a second size, which is larger than the first size of the first memory region 134a and is not available for allocation to programs or processes executed by a processor on the operating system 138. Instead, the second memory region 134a is available for allocation to a virtual machine, container, or other appropriate type of guest operating system. In response to determining that the memory allocation request is for an allocation from the first memory region 134a, process 200 proceeds to stage 206 to allocate a portion of the memory sub-region 123a of the first memory region 134a. If the memory allocation request is for an allocation from the second memory region 134b, process 200 continues to stage 208 to allocate a portion of the memory sub-region 123b of the second memory region 134b.
[0059] Figure 7 is applicable to Figure 1-4D100 . In a very basic configuration 302 , the computing device 300 may include one or more processors 304 and a system memory 306 . A memory bus 308 may be used to communicate between the processor 304 and the system memory 306 . Depending on the desired configuration, the processor 304 may be of any type, including but not limited to a microprocessor (μR), a microcontroller (μC), a digital signal processor (DSP), or any combination thereof. The processor 304 may include multiple levels of cache, such as a level 1 cache 310 and a level 2 cache 312 , a processor core 314 , and registers 316 . An example processor core 314 may include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 318 may also be used with the processor 304 , or in some embodiments, the memory controller 318 may be an internal part of the processor 304 .
[0060] Depending on the desired configuration, system memory 306 can be any type of storage device, including but not limited to volatile memory (e.g., RAM), non-volatile memory (e.g., ROM, flash memory, etc.), or any combination thereof. System memory 306 can include an operating system 320, one or more applications 322, and program data 324.
[0061] Computing device 300 may have additional features or functionality and additional interfaces to support communication between basic configuration 302 and any other devices and interfaces. For example, bus / interface controller 330 may be used to support communication between basic configuration 302 and one or more data storage devices 332 via storage interface bus 334. Data storage device 332 may be a removable storage device 336, a non-removable storage device 338, or a combination thereof. Examples of removable and non-removable storage devices include magnetic disk devices such as floppy disk drives and hard disk drives (HDDs), optical disk drives such as compact disk (CD) drives or digital versatile disk (DVD) drives, solid-state drives (SSDs), and tape drives, among others. Example computer storage media may include volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. The terms "computer-readable storage medium" or "computer-readable storage device" do not include propagating signals and communication media.
[0062] System memory 306, removable storage device 336, and non-removable storage device 338 are examples of computer-readable storage media. Computer-readable storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVDs) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by computing device 300. Any such computer-readable storage medium can be computing device 300. The term "computer-readable storage medium" does not include propagating signals and communication media.
[0063] The computing device 300 may also include an interface bus 340 for supporting communication from various interface devices (e.g., output devices 342, peripheral interfaces 344, and communication devices 346) to the basic configuration 302 via the bus / interface controller 330. Example output devices 342 include a graphics processing unit 348 and an audio processing unit 350, which can be configured to communicate with various external devices (e.g., a display or speakers) via one or more A / V ports 352. Example peripheral interfaces 344 include a serial interface controller 354 or a parallel interface controller 356, which can be configured to communicate with input devices (e.g., a keyboard, mouse, pen, voice input device, touch input device, etc.) or other peripheral devices (e.g., a printer, scanner, etc.) via one or more I / O ports 358. Example communication devices 346 include a network controller 360, which can be arranged to support communication with one or more EO ports. Further other computing devices 362 are connected to a network communication link via one or more communication ports 364.
[0064] A network communication link can be an example of a communication medium. Communication media can generally be embodied by computer-readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and can include any information transfer medium. A "modulated data signal" can be a signal having one or more of its characteristics that are set or changed in a manner that encodes information in the signal. By way of example, and not limitation, communication media can include wired media, such as a wired network or a direct wired connection, and wireless media, such as acoustic, radio frequency (RF), microwave, infrared (IR), and other wireless media. The term computer-readable media, as used herein, can include storage media and communication media.
[0065] The computing device 300 may be implemented as part of a small portable (or mobile) electronic device, such as a cell phone, a personal data assistant (PDA), a personal media player device, a wireless network watch device, a personal headset device including any of the above functions, a dedicated device, or a hybrid device. The computing device 300 may also be implemented as a personal computer including laptop and non-laptop computer configurations.
[0066] For illustrative purposes, specific embodiments of the technology have been described above. However, various modifications may be made without departing from the foregoing disclosure. Furthermore, many elements of one embodiment may be used in addition to or in place of elements of other embodiments, and the present invention may be combined with other embodiments. Therefore, the technology is not limited by the appended claims.
Claims
1. A method of computer memory management in a computing device, the computing device having a processor operatively coupled to a physical memory, the processor executing instructions to provide a first operating system in the computing device, the method comprising: At the first operating system, receiving a memory allocation request; In response to receiving the memory allocation request, determining whether the request is for allocation from a first memory region or a second memory region of the physical memory, wherein: The first memory area is allocated to the first operating system and is subdivided into a plurality of first memory sub-areas, each of the plurality of first memory sub-areas having a first size; and the second memory region is allocated to a second operating system and is subdivided into a plurality of second memory sub-regions, each of the plurality of second memory sub-regions having a second size, the second size being larger than the first size, wherein the second operating system is a guest operating system hosted by the computing device; and the first operating system concurrently tracking memory operation states of each of the plurality of first memory sub-regions and each of the plurality of second memory sub-regions at the first memory region and the second memory region, respectively; and In response to determining that the memory allocation request is for allocation from the first memory region, allocating a portion of the plurality of first memory sub-regions or the plurality of second memory sub-regions; or In response to determining that the memory allocation request is for an allocation from the second memory region, a portion of the plurality of second memory sub-regions is allocated.
2. The method of claim 1 , wherein determining whether the request is for allocation of the first memory region or the second memory region from the physical memory comprises: A determination is made as to whether the request is received from a first application programming interface ("API") corresponding to the first memory region or from a second API corresponding to the second memory region, and wherein the first memory sub-regions each have a memory page of a certain size in the physical memory.
3. The method according to claim 1, wherein: The first operating system is a host operating system; as well as Determining whether the request is for allocation of the first memory region or the second memory region from the physical memory comprises: determining whether the received request is for a memory allocation to a guest operating system supported by the host operating system in the computing device; as well as In response to determining that the received request is for a memory allocation to the guest operating system, indicating that the request is for an allocation from the second memory region.
4. The method according to claim 1, wherein: The first memory region supports a first set of memory management operations; The second memory region supports a second set of memory management operations; as well as The first group is larger than the second group.
5. The method according to claim 1, wherein: The first memory area and the second memory area each include a percentage of memory configured to store metadata corresponding to the plurality of first memory sub-areas and the plurality of second memory sub-areas, respectively; as well as The percentage of memory configured to store metadata of the plurality of second memory sub-areas is smaller than the percentage of memory of the plurality of first memory sub-areas.
6. The method according to claim 1, wherein: The first memory area and the second memory area each include an amount of memory configured to store metadata of the plurality of first memory sub-areas and the plurality of second memory sub-areas, respectively; as well as Allocating a portion of the plurality of first memory sub-regions or the plurality of second memory sub-regions of the first memory region or the second memory region, respectively, comprises: In response to the request, allocating an amount of memory from the second memory area; as well as Metadata of the allocated amount of memory from the second memory region is updated by an amount that is less than the amount of metadata that would be updated if the same amount of memory were allocated from the first memory region.
7. The method according to claim 1, further comprising: receiving, at the first operating system, a request to transfer a portion of memory from the second memory area to the first memory area; as well as In response to receiving the request, the portion of memory is converted from the second memory area to one or more first memory sub-areas having the first size, the first size being smaller than the second size.
8. The method according to claim 1, further comprising: receiving, at the first operating system, a request to transfer a portion of memory from the first memory area to the second memory area; as well as In response to receiving the request, the portion of memory is converted from the first memory region to one or more second memory sub-regions having a second size, the second size being larger than the first size.
9. The method according to claim 1, further comprising: After receiving a command to update the first operating system in the computing device, maintaining a mapping between the first memory area and the second memory area and data in the second memory area in the physical memory; updating the data of the first operating system in the first memory area while maintaining the data in the second memory area; as well as After maintaining the data in the second memory area and updating the data of the first operating system in the first memory area, the first operating system is restarted.
10. A computing device comprising: processor; as well as a physical memory operatively coupled to the processor, the physical memory containing instructions executable by the processor to cause the computing device to provide a first operating system, wherein the physical memory comprises: a first memory area, allocated to the first operating system and subdivided into a plurality of first memory sub-areas of a first size; a second memory region allocated to a second operating system and subdivided into a plurality of second memory sub-regions of a second size, the second size being larger than the first size, wherein the second operating system is a guest operating system hosted by the computing device; and wherein the first operating system concurrently tracks memory operation states of each of the plurality of first memory sub-regions and each of the plurality of second memory sub-regions at the first memory region and the second memory region, respectively; and The physical memory includes additional instructions executable by the processor to cause the computing device to: At the first operating system, receiving a memory allocation request; and In response to receiving the memory allocation request, a portion of the plurality of first memory sub-regions or the plurality of second memory sub-regions of the first memory region or the second memory region, respectively, is selectively allocated.
11. The computing device of claim 10, wherein selectively allocating comprises: A determination is made as to whether the request was received from a first application programming interface ("API") corresponding to the first memory region or from a second API corresponding to the second memory region.
12. The computing device of claim 10, wherein: The first operating system is a host operating system; as well as Optional allocations include: determining whether the received request is for a memory allocation to a guest operating system supported by the host operating system in the computing device; as well as In response to determining that the received request is for a memory allocation to the guest operating system, indicating that the request is for an allocation from the second memory region.
13. The computing device of claim 10, wherein: The first memory region and the second memory region each include an amount of memory configured to store metadata corresponding to the plurality of first memory sub-regions and the plurality of second memory sub-regions, respectively; as well as An amount of memory configured to store metadata of the plurality of second memory sub-regions is smaller than an amount of memory configured to store metadata of the plurality of first memory sub-regions.
14. The computing device of claim 10, wherein: The first memory area and the second memory area each include an amount of memory configured to store metadata of the plurality of first memory sub-areas and the plurality of second memory sub-areas, respectively; as well as Selectively allocating a portion of the plurality of first memory sub-regions or the plurality of second memory sub-regions of the first memory region or the second memory region, respectively, comprises: In response to the request, allocating an amount of memory from the second memory area; as well as Metadata of the allocated amount of memory from the second memory region is updated by an amount that is less than the amount of metadata that would be updated if the same amount of memory were allocated from the first memory region.
15. The computing device of claim 10, wherein the physical memory contains further instructions executable by the processor to cause the computing device to: receiving, at the first operating system, a request to transfer a portion of memory from the second memory area to the first memory area; and In response to receiving the request, the portion of memory is formatted from the second memory area into one or more first memory sub-areas having the first size, the first size being smaller than the second size.
16. The computing device of claim 10, wherein the physical memory contains further instructions executable by the processor to cause the computing device to: At the first operating system, receiving a request to transfer a portion of memory from the first memory area to the second memory area; and In response to receiving the request, the portion of memory is formatted from the first memory region into one or more second memory sub-regions having a second size, the second size being larger than the first size.
17. A method of computer memory management in a computing device, the computing device having a processor operatively coupled to a physical memory, the processor executing instructions to provide a first operating system in the computing device, the method comprising: Upon receiving input for executing startup of the computing device, A configuration file containing data indicating sizes or percentages of the physical memory to be configured as the first memory region and the second memory region is accessed, wherein: The first memory region is allocated to the first operating system and has a first plurality of memory sub-regions of a first size; and the second memory region being allocated to a second operating system and having a second plurality of memory sub-regions of a second size, the second size being larger than the first size, wherein the second operating system is a guest operating system hosted by the computing device; configuring a first portion of the physical memory as the first plurality of memory sub-regions having the first size according to the size or percentage of the physical memory in the configuration file; configuring a second portion of the physical memory as the second plurality of memory sub-regions having the second size according to the size or percentage of the physical memory in the configuration file; and Utilizing the first operating system, memory operation states of each first memory area of the first size and each memory sub-area of the second plurality of memory sub-areas of the second size are concurrently tracked at the first memory area and the second memory area of the physical memory, respectively.
18. The method according to claim 17, wherein: The first memory region and the second memory region each include an amount of memory configured to store metadata corresponding to the first plurality of memory sub-regions and the second plurality of memory sub-regions, respectively; An amount of memory configured to store metadata of the second plurality of memory sub-regions is less than an amount of memory configured to store metadata of the first plurality of memory sub-regions.
19. The method of claim 17, wherein: The first memory region supports a first set of memory management operations; The second memory region supports a second set of memory management operations; as well as The first group is larger than the second group.
20. The method of claim 17, further comprising: receiving, at the first operating system, a request to transfer a portion of memory from the second memory area to the first memory area; as well as In response to receiving the request, the portion of memory is formatted from the second memory area into one or more first memory sub-areas having the first size, the first size being smaller than the second size.
Citation Information
Patent Citations
Computer and memory region management method
CN107710160A
Memory allocator
CN111008155A