CN113312170A - Memory management system and method - Google Patents

Memory management system and method Download PDF

Info

Publication number
CN113312170A
CN113312170A CN202010476952.6A CN202010476952A CN113312170A CN 113312170 A CN113312170 A CN 113312170A CN 202010476952 A CN202010476952 A CN 202010476952A CN 113312170 A CN113312170 A CN 113312170A
Authority
CN
China
Prior art keywords
memory management
management file
upgraded
file
memory
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
CN202010476952.6A
Other languages
Chinese (zh)
Other versions
CN113312170B (en
Inventor
郑豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN202010476952.6A priority Critical patent/CN113312170B/en
Publication of CN113312170A publication Critical patent/CN113312170A/en
Application granted granted Critical
Publication of CN113312170B publication Critical patent/CN113312170B/en
Active legal-status Critical Current
Anticipated 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a memory management system and a memory management method. Wherein, this system includes: the system comprises an entrance management module, a target memory management file and a virtual memory management module, wherein the entrance management module is used for providing an entrance of virtual memory management, receiving an access request to a virtual memory and linking the access request to the target memory management file provided by the memory management module; the memory management module is used for loading the upgraded memory management file; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory. The invention solves the technical problem that the related hot upgrade capability under the KVM virtualization can not be directly used for the hot upgrade of the vmem because the module related to the vmem can not be uninstalled and replaced during the running of the VM in the prior art.

Description

Memory management system and method
Technical Field
The invention relates to the field of memory management of virtual machines, in particular to a memory management system and method.
Background
In a host machine memory allocation architecture in a virtualization scene, memory management of a virtual machine depends on management of allocating and releasing reserved memory of host by a vmem related module. Because the virtual machine memory is created by the device/dev/vmem (full image file of physical memory, which can access physical memory) provided by vmem, the count of vmem module will be increased by 1 during the running period of VM when applying for one memory, and the corresponding count will not be decreased by 1 until VM is released. This results in vmem-related modules that cannot be replaced by uninstall during VM operation. But as the foundation of virtualization, the hot upgrading capability is the necessary function for the product to be online, so as to deal with the upgrading and the reconstruction and the fault repair of the product. The related hot upgrade capability under the current KVM virtualization cannot be directly used for the hot upgrade of vmem.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
Embodiments of the present invention provide a memory management system and method, so as to at least solve a technical problem in the prior art that a module related to vmem cannot be uninstalled and replaced during a VM running period, so that a related hot upgrade capability under a KVM virtualization cannot be directly used for a hot upgrade of vmem.
According to an aspect of an embodiment of the present invention, there is provided a memory management system including: the system comprises an entrance management module, a target memory management file and a virtual memory management module, wherein the entrance management module is used for providing an entrance of virtual memory management, receiving an access request to a virtual memory and linking the access request to the target memory management file provided by the memory management module; the memory management module is used for loading the upgraded memory management file; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
According to another aspect of the embodiments of the present invention, there is also provided a memory management method, including: receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module; loading the upgraded memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
According to another aspect of the embodiments of the present invention, there is provided another memory management method, including: loading the upgraded memory management file through a memory management module, and initializing the upgraded memory management file to obtain an initialized memory management file; and assigning entry point information corresponding to the initialized memory management file to the device driver, and constructing a pro file system corresponding to the upgraded memory management file to manage the virtual memory.
According to another aspect of the embodiments of the present invention, a non-volatile storage medium is further provided, where the non-volatile storage medium includes a stored program, and when the program runs, the device on which the storage medium is located is controlled to execute any one of the memory management methods.
According to another aspect of the embodiments of the present invention, there is also provided a computing device, including: a memory for storing a program; a processor running a program stored in the memory, wherein the program when running performs the processing steps of: receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module; loading the upgraded memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
In the embodiment of the invention, a mode of decoupling a memory allocation entry and memory management is adopted, and the entry management module is used for providing an entry for virtual memory management, receiving an access request for a virtual memory and linking the access request to a target memory management file provided by the memory management module; the memory management module is used for loading the upgraded memory management file; and in the upgraded memory management file, the aim of calling a target memory management file corresponding to the access request to manage the virtual memory is fulfilled, so that the technical effects that the dependence of a process on the memory management module is removed, and the vmem memory management module can be directly upgraded in a hot mode are achieved, and the technical problem that in the prior art, the related hot upgrading capability under the KVM virtualization cannot be directly used for the hot upgrading of the vmem due to the fact that the vmem related module cannot be unloaded and replaced during the running of the VM can be solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1(a) is a block diagram of a memory management system according to an embodiment of the invention;
FIG. 1(b) is a block diagram illustrating an alternative memory management system according to an embodiment of the present invention;
FIG. 1(c) is a block diagram illustrating an alternative memory management system according to an embodiment of the invention;
fig. 2 is a block diagram of a hardware structure of an optional computer terminal for implementing the memory management method according to an embodiment of the present invention;
FIG. 3(a) is a flowchart illustrating a memory management method according to an embodiment of the invention;
fig. 3(b) is a flowchart of an optional method for performing memory management according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating another memory management method according to an embodiment of the invention;
FIG. 5 is a block diagram of a computing device, according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some terms or terms appearing in the description of the embodiments of the present application are applicable to the following explanations:
KVM: kernel-based Virtual Machine (KVM) is an open source virtualization technology built in Linux. Specifically, KVM may help you turn Linux into a virtual machine monitor that enables a host computer to run multiple isolated virtual environments, i.e., virtual clients or Virtual Machines (VMs).
proc file system the/proc directory on the Linux system is a file system, i.e. a proc file system. Unlike other common file systems,/proc is a pseudo file system (i.e., a virtual file system) that stores a series of special files of the current running state of the kernel, through which a user can view information about the system hardware and the currently running process, and even can change the running state of the kernel by changing some of the files
vmem: represents a virtual memory file, as well as a so-called paging file (pagefi le. When the virtual system executes shutdown operation, the vmem file disappears, but does not disappear when suspended for shutdown.
vma: virtual Memory Areas, a Virtual Memory area (vma), is divided into several different Areas, each area having associated attributes and uses, and a valid address falling within a certain area, which Areas do not overlap.
Character device: and a device for performing transmission in units of characters during the I/O transmission.
Example 1
In the related art, in a host machine memory allocation architecture in a virtualization scene, memory management of a virtual machine depends on management of allocation and release of host reserved memory by a vmem related module. Because the virtual machine memory is created by the device/dev/vmem (full image file of physical memory, which can access physical memory) provided by vmem, the count of vmem module will be increased by 1 during the running period of VM when applying for one memory, and the corresponding count will not be decreased by 1 until VM is released. This results in vmem-related modules that cannot be replaced by uninstall during VM operation. But as the foundation of virtualization, the hot upgrading capability is the necessary function for the product to be online, so as to deal with the upgrading and the reconstruction and the fault repair of the product. The related hot upgrade capability under the current KVM virtualization cannot be directly used for the hot upgrade of vmem.
Specifically, the present embodiment provides a memory management system, as shown in fig. 1(a), the memory management system includes but is not limited to: an entry management module 10 and a memory management module 12, wherein,
an entry management module 10, configured to provide an entry for virtual memory management, receive an access request for a virtual memory, and link the access request to a target memory management file provided by the memory management module;
the memory management module 12 is used for loading the upgraded memory management file; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
In the memory management system, an entry management module is used for providing an entry for virtual memory management, receiving an access request for a virtual memory, and linking the access request to a target memory management file provided by the memory management module; the memory management module is used for loading the upgraded memory management file; and in the upgraded memory management file, the aim of calling a target memory management file corresponding to the access request to manage the Virtual memory is fulfilled, so that the technical effects that the dependence of a process on the memory management module is removed, and the vmem memory management module can be directly upgraded in a hot manner are achieved, and the technical problem that the related hot upgrading capability under a Kernel-based Virtual Machine (KVM) cannot be directly used for the hot upgrading of the vmem due to the fact that the vmem-related module cannot be unloaded and replaced during the running of the VM in the prior art is solved.
For example, a memory management system is split into two relatively independent modules, an entry management module vmem.ko and a memory management module capable of loading a memory management file vmem _ mm _ x.ko (where x represents a version number of a file), as shown in fig. 1(b), it is easily noted that in a Host Kernel (Host Kernel), a cdev structure is used to describe a character device, where cdev.op is a character device driver, and the main work performed by the character device driver is to add, initialize, delete the cdev structure, apply for, release a device number, and fill a function in a file _ operations structure, such as open, close, mmap, ioctl, where the meanings of the above letters are respectively an open function, a close function, a map function, a device interface control function (ioctl), and the like. The ko module only provides an entry for memory management of vmem, and the entry is fixed as/dev/vmem; another vmem _ mm _ x.ko (x is a version number, e.g., 0, 1, 2 …, as each hot upgrade increases) is responsible for specific memory management work, and if vmem _ mm _0.ko is a memory management file version before upgrade (old version), when an upgraded memory management file may include vmem _ mm _1.ko, vmem _ mm _2.ko, vmem _ mm _3.ko, etc., when an access request to the virtual memory is received through a vmem.ko module, the access pass/dev/vmem path may be linked to any one of the upgraded vmem _ mm _ x.ko.
It should be noted that the vmem.ko module is a kernel module file (kernel module file), which means that some functions of the kernel are moved to the outside of the kernel, the kernel is inserted when necessary, and the kernel is unloaded when not necessary, and the ko file is a driver module file.
In some optional embodiments of the present application, the memory management module is further configured to provide a memory management file before being upgraded, and when the access request is an access request for accessing the memory management file before being upgraded, call a target memory management file corresponding to the access request from the memory management file before being upgraded. For example, as shown in fig. 1(c), the memory management file before being upgraded is vmem _ mm _0.ko, and when accessing vmem _ mm _0.ko, the upgraded vmem _ mm _1.ko corresponding to vmem _ mm _0.ko may be called as the target memory management file for access request access, where the meaning of each letter is described above and is not described herein again. The vmem _ mm _0.ko file comprises commands such as info, status and the like, and the vmem _ mm _1.ko file comprises commands such as info, status, mmap and the like
In some embodiments of the present application, the memory management module is further configured to release the virtual memory corresponding to the virtual memory management file before or after the upgrade by using a release function. For example, the release function is called by using a close (close) path corresponding to vma _ operation to release the virtual memory corresponding to vmem _ mm _0.ko or the virtual memory corresponding to upgraded vmem _ mm _1. ko.
In some embodiments of the present application, the memory management module is further configured to modify a release function corresponding to the memory management file before the upgrade, so as to release the virtual memory corresponding to the virtual memory management file after the upgrade. Specifically, the memory management manner of the old version memory management file vmem _ mm _0.ko may change, so that the release of the memory applied by the old version needs to follow the path of the old version memory management file vmem _ mm _0. ko; therefore, all allocated memories are released through a close (close) path of a corresponding virtual memory area operation function (vma _ operation) of the vma to call a specific release function; if the memory release function of the new memory management file vmem _ mm _1.ko is compatible with the old memory management file vmem _ mm _0.ko, the release function pointer of the applied memory can be modified to vmem _ mm _1.ko, the dependence on vmem _ mm _0.ko is removed, the vmem _ mm _0.ko virtual memory is released, and then the newly allocated virtual memory is completed by calling the allocation function of the new memory management file vmem _ mm _1.ko through the same device/dev/vmem; and then, the subsequent release of the newly allocated memory assigns the release function of the new memory management file to a close (close) function of the vma during allocation.
In some optional embodiments of the present application, the portal management module includes: and the character equipment is used for linking the access request to the target memory management file through the file operation function pointer. For example, the entry management module is a vmem.ko module, where a cdev structure is used to describe a character device, and between the two modules, the entry/dev/vmem of vmem.ko is a character device, and a specific management operation is linked to the target memory management file vmem _ mm _0.ko through a function pointer of a set of structures (file _ operations) corresponding to the cdev.ops (device driver) of the character device.
In some embodiments of the present application, the memory management module is further configured to update the device driver based on a new file operation function corresponding to the updated memory management file after the updated memory management file is loaded, where the new file operation function is used to establish a data structure relating the driver and the system call. For example, the memory management module is configured to load the upgraded memory management file vmem _ mm _1.ko, and assign a new _ file _ operations value to cd ev. ops (device driver) based on the file vmem _ mm _1.ko, so as to replace the old memory management file vmem _ mm _0. ko; the aim that the memory of the subsequent new application can directly access the new memory management file vmem _ mm _1.ko is achieved.
In some optional embodiments of the present application, the memory management module is further configured to initialize the upgraded memory management file before the upgraded memory management file is loaded, where a global lock function is executed in an initialization process, and the global lock function is released after the loading is completed. For example, before loading vmem _ mm _1.ko, vmem _ mm _1.ko may be initialized, and in the process of this initialization, it may be ensured that the/dev/vmem is not used by other processes such as allocation or hot upgrade during the loading process by executing a global lock, and after the loading is completed, the global lock function is released.
In some embodiments of the present application, the memory management module is further configured to assign entry point information corresponding to the updated memory management file to the device driver. For example, the entry point information (fops) of the new individual call corresponding to vmem _ mm _1.ko may be assigned to the device driver (cdev. ops) after the vmem _ mm _1.ko related structure has been initialized.
In some optional embodiments of the present application, the memory management module is further configured to uninstall an export item in the proc file system, and construct a proc file system corresponding to the upgraded memory management file. For example, the export item in the proc file system corresponding to vmem _ mm _0.ko of the old memory management file is unloaded, and the proc file system corresponding to vmem _ mm _1.ko of the new (upgraded) memory management file is constructed.
In order to achieve the purposes of repairing the bug, updating the function and the like, the memory management module is further configured to parse the common data structure based on the upgraded memory management file, and add extension information of the upgraded memory management file to a reserved bit of the common data structure, where the common data structure is a common data structure corresponding to the memory management file before being upgraded.
There is also provided, in accordance with an embodiment of the present invention, a method embodiment for memory management, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than here.
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Fig. 2 shows a hardware structure block diagram of a computer terminal (or mobile device) for implementing the memory management method. As shown in fig. 2, the computer terminal 10 (or mobile device 10) may include one or more (shown as 102a, 102b, … …, 102 n) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA, etc.), a memory 104 for storing data, and a transmission module 106 for communication functions. Besides, the method can also comprise the following steps: a display, an input/output interface (I/O interface), a Universal Serial Bus (USB) port (which may be included as one of the ports of the I/O interface), a network interface, a power source, and/or a camera. It will be understood by those skilled in the art that the structure shown in fig. 2 is only an illustration and is not intended to limit the structure of the electronic device. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 2, or have a different configuration than shown in FIG. 2.
It should be noted that the one or more processors 102 and/or other data processing circuitry described above may be referred to generally herein as "data processing circuitry". The data processing circuitry may be embodied in whole or in part in software, hardware, firmware, or any combination thereof. Further, the data processing circuit may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computer terminal 10 (or mobile device). As referred to in the embodiments of the application, the data processing circuit acts as a processor control (e.g. selection of a variable resistance termination path connected to the interface).
The memory 104 may be used to store software programs and modules of application software, such as program instructions/data storage devices corresponding to the memory management method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, implementing the vulnerability detection method of the application program. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission module 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission module 106 includes a Network adapter (NIC) that can be connected to other Network devices through a base station to communicate with the internet. In one example, the transmission module 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
The display may be, for example, a touch screen type Liquid Crystal Display (LCD) that may enable a user to interact with a user interface of the computer terminal 10 (or mobile device).
Under the above operating environment, the present application provides a memory management method as shown in fig. 3 (a). Fig. 3(a) is a flowchart of a memory management method according to an embodiment of the invention.
S302, receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module;
s304, loading the upgraded memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
In the memory management method, firstly, an access request for a virtual memory is received through an entry management module, and the access request is linked to a target memory management file provided by a memory management module; secondly, loading the upgraded memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the upgraded memory management file to manage the virtual memory, so as to achieve the aim of calling the target memory management file corresponding to the access request to manage the virtual memory, thereby realizing the technical effects of relieving the dependence of a process on a memory management module and directly thermally upgrading the vmem memory management module, and further solving the technical problem that the related thermal upgrading capability under the KVM virtualization machine cannot be directly used for the thermal upgrading of vmem because the vmem related module cannot be unloaded and replaced during the running of the VM in the prior art.
For example, the entry management module is a vmem.ko module and the memory management module may load a memory management file vmem _ mm _ x.ko. The ko module only provides an entry for memory management of vmem, and the entry is fixed as/dev/vmem; another vmem _ mm _ x.ko (x is a version number, e.g., 0, 1, 2 … with each hot upgrade increment), if vmem _ mm _0.ko is a pre-upgrade memory management file version (old version), when the upgraded memory management file may include vmem _ mm _1.ko, vmem _ mm _2.ko, vmem _ mm _3.ko, etc., when an access request to the virtual memory is received through the vmem.ko module, the access may be linked into the upgraded vmem _ mm _1.ko through this/dev/vmem path.
In some embodiments of the present application, a memory management file before being upgraded is provided by a memory management module, and when an access request is an access request for accessing the memory management file before being upgraded, a target memory management file corresponding to the access request is called from the memory management file before being upgraded. For example, the memory management file before being upgraded is vmem _ mm _0.ko, and when vmem _ mm _0.ko is accessed, the upgraded vmem _ mm _1.ko corresponding to vmem _ mm _0.ko may be called as the target memory management file accessed by the access request.
In some optional embodiments of the present application, the memory management module releases the virtual memory corresponding to the virtual memory management file before or after the upgrade by using a release function. For example, the release function is called by using a close (close) path corresponding to vma _ operation to release the virtual memory corresponding to vmem _ mm _0.ko or the virtual memory corresponding to upgraded vmem _ mm _1. ko.
In some embodiments of the present application, a memory management module modifies a release function corresponding to a memory management file before being upgraded, so as to release a virtual memory corresponding to a virtual memory management file after being upgraded. Specifically, the memory management manner of the old version memory management file vmem _ mm _0.ko may change, so that the release of the memory applied by the old version needs to follow the path of the old version memory management file vmem _ mm _0. ko; therefore, all allocated memories are released through a close (close) path of a corresponding virtual operation memory area operation function (vma _ operation) of the vma to call a specific release function; if the memory release function of the new memory management file vmem _ mm _1.ko is compatible with the old memory management file vmem _ mm _0.ko, the release function pointer of the applied memory can be modified to vmem _ mm _1.ko, the dependence on vmem _ mm _0.ko is removed, the vmem _ mm _0.ko virtual memory is released, and then the newly allocated virtual memory is completed by calling the allocation function of the new memory management file vmem _ mm _1.ko through the same device/dev/vmem; and then, the subsequent release of the newly allocated memory assigns the release function of the new memory management file to a close (close) function of the vma during allocation.
In some optional embodiments of the present application, the portal management module includes: and the character equipment is used for linking the access request to the target memory management file through the file operation function pointer. For example, the entry management module is a vmem.ko module and the memory management module may load a target memory management file vmem _ mm _ x.ko, where between the two modules, an entry/dev/vmem of vmem.ko is a character device, and a specific management operation may be linked to the target memory management file vmem _ mm _0.ko through a function pointer of a set of constructs (file _ operations) corresponding to a device driver of the character device.
In some embodiments of the present application, after the memory management module loads the updated memory management file, the device driver is updated based on a new file operation function corresponding to the updated memory management file, where the new file operation function is used to establish a data structure associated with the driver and the system call. For example, the memory management module is configured to load the upgraded memory management file vmem _ mm _1.ko, and assign a new _ file _ operations value to cd ev. ops (device driver) based on the file vmem _ mm _1.ko, so as to replace the old memory management file vmem _ mm _0. ko; the aim that the memory of the subsequent new application can directly access the new memory management file vmem _ mm _1.ko is achieved.
In some optional embodiments of the present application, the memory management module initializes the updated memory management file before loading the updated memory management file, where a global lock function is executed in an initialization process, and the global lock function is released after the loading is completed. For example, before loading vmem _ mm _1.ko, vmem _ mm _1.ko may be initialized, and in the process of this initialization, it may be ensured that the/dev/vmem is not used by other processes such as allocation or hot upgrade during the loading process by executing a global lock, and after the loading is completed, the global lock function is released.
Fig. 3(b) is a flowchart of a flow framework for optionally executing the memory management method according to an embodiment of the present application, and as shown in fig. 3(b), a specific execution process is similar to the execution steps of the memory management method, specifically:
step S3002, loading a new memory management module vmem _ mm _1. ko; in order to avoid the use of processes such as other allocation or hot upgrade in the loading process, a global lock is first acquired in step S3004, and a global lock function is executed on the process by using the global lock; then, assigning the entry point (fops) called by the new memory management operation in vmem _ mm _1.ko to the device driver (cdev. ops) through step S3006; uninstalling proc entry of vmem _ mm _0.ko of the old module through step S3008; loading a proc item of a new memory management module vmem _ mm _1.ko through step S3010; secondly, multiplexing and processing a common memory information structure body through a step S3012, namely, for a common data structure, analyzing the information on the common memory information structure body by using vmem _ mm _1.ko, and if vmem _ mm _1.ko extends the data structure and wants to directly multiplex an old data structure, a new data structure can only extend at a reserved bit at the tail end of the data structure, so that an analysis error is avoided; through the step S3014, managing the reserved memory slices by using vmem, and inquiring the slice state; finally, releasing the global lock function through step S3016, thereby implementing decoupling on the memory allocation entry and the specific memory management function, and removing the dependency of the process on the memory management module; the vmem memory management module can be upgraded by using heat, so that the purpose of repairing faults or on-line functions without influencing the memory in use is achieved; the memory management module can also achieve the aim of allowing the memory management modules with different functions to exist simultaneously and can be dynamically selected according to the needs.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example 2
There is also provided, in accordance with an embodiment of the present invention, another method embodiment for memory management, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be performed in an order different than that described herein.
The method embodiment provided in the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device, and it should be noted that the method embodiment provided in the second embodiment may still be executed on the computer terminal shown in fig. 2.
In the foregoing operating environment, the present application provides a schematic flow chart of the memory management method shown in fig. 4, where the method includes:
s402, loading the upgraded memory management file through a memory management module, and initializing the upgraded memory management file to obtain an initialized memory management file;
s404, the virtual memory is managed by assigning the entry point information corresponding to the initialized memory management file to the device driver and constructing a pro file system corresponding to the upgraded memory management file.
In the memory management method, firstly, an upgraded memory management file is loaded through a memory management module, and the upgraded memory management file is initialized to obtain an initialized memory management file; secondly, the purpose of managing the virtual memory is achieved by assigning entry point information corresponding to the initialized memory management file to the device driver and constructing a pro file system corresponding to the upgraded memory management file, so that the technical effects that the dependence of a process on a memory management module is removed, the vmem memory management module can be directly and thermally upgraded are achieved, and the technical problem that in the prior art, the related thermal upgrading capability under the KVM virtualization cannot be directly used for the thermal upgrading of the vmem due to the fact that the vmem related module cannot be unloaded and replaced during the running of the VM is solved.
In some optional embodiments of the present application, the common data structure is analyzed based on the upgraded memory management file, and the extension information of the upgraded memory management file is added to the reserved bit of the common data structure, where the common data structure is a common data structure corresponding to the memory management file before the upgrade.
Example 3
Embodiments of the invention may provide a computing device that may be any one of a group of computing devices. Optionally, in this embodiment, the computing device may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computing device may be located in at least one network device of a plurality of network devices of a computer network.
In this embodiment, the computing device may execute the program code of the following steps in the memory management method of the application program: loading the upgraded memory management file through a memory management module, and initializing the upgraded memory management file to obtain an initialized memory management file; and assigning entry point information corresponding to the initialized memory management file to the device driver, and constructing a pro file system corresponding to the upgraded memory management file to manage the virtual memory.
Alternatively, fig. 5 is a block diagram of a computing device according to an embodiment of the invention. As shown in fig. 5, the computing device a may include: one or more (only one shown) processors 502, and a memory 504.
The memory may be configured to store a software program and a module, such as a program instruction/module corresponding to the memory management method in the embodiment of the present invention, and the processor executes various functional applications and data processing by operating the software program and the module stored in the memory, so as to implement the memory management method. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory remotely located from the processor, and these remote memories may be connected to terminal a through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor can call the information and the application program stored in the memory through the transmission module to execute the following steps: receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module; loading the upgraded memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
Optionally, the processor may further execute the program code of the following steps: and providing the memory management file before upgrading through the memory management module, and calling a target memory management file corresponding to the access request from the memory management file before upgrading when the access request is an access request for accessing the memory management file before upgrading.
Optionally, the processor may further execute the program code of the following steps: and releasing the virtual memory corresponding to the virtual memory management file before or after upgrading by adopting a release function through the memory management module.
Optionally, the processor may further execute the program code of the following steps: and modifying the release function corresponding to the memory management file before upgrading through the memory management module so as to release the virtual memory corresponding to the virtual memory management file after upgrading.
Optionally, the processor may further execute the program code of the following steps: and linking the access request to a target memory management file through a character device through a file operation function pointer, wherein the entry management module comprises the character device.
Optionally, the processor may further execute the program code of the following steps: after the upgraded memory management file is loaded through the memory management module, updating the device driver based on a new file operation function corresponding to the upgraded memory management file, wherein the new file operation function is used for establishing a data structure related to a driver and system call.
Optionally, the processor may further execute the program code of the following steps: and initializing the upgraded memory management file by the memory management module before loading the upgraded memory management file, wherein a global lock function is executed in the initialization process, and the global lock function is released after the loading is finished.
The embodiment of the invention provides a scheme for decoupling a memory allocation entry and memory management. The method comprises the steps that an entrance management module is used for providing an entrance for virtual memory management, receiving an access request for a virtual memory and linking the access request to a target memory management file provided by a memory management module; the memory management module is used for loading the upgraded memory management file; and in the upgraded memory management file, the aim of calling a target memory management file corresponding to the access request to manage the virtual memory is fulfilled, so that the technical effects that the dependence of a process on the memory management module is removed, and the vmem memory management module can be directly upgraded in a hot mode are achieved, and the technical problem that in the prior art, the related hot upgrading capability under the KVM virtualization cannot be directly used for the hot upgrading of the vmem due to the fact that the vmem related module cannot be unloaded and replaced during the running of the VM can be solved.
It can be understood by those skilled in the art that the structure shown in fig. 5 is only an illustration, and the computing device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 5 is a diagram illustrating a structure of the electronic device. For example, computing device 50 may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 5, or have a different configuration than shown in FIG. 5.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Example 4
Embodiments of the present invention also provide a non-volatile storage medium. Optionally, in this embodiment, the nonvolatile storage medium may be configured to store a program code executed by the memory management method provided in the first embodiment.
Optionally, in this embodiment, the nonvolatile storage medium may be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module; loading the upgraded memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (15)

1. A memory management system, comprising:
the system comprises an entrance management module, a target memory management file and a virtual memory management module, wherein the entrance management module is used for providing an entrance of virtual memory management, receiving an access request to a virtual memory and linking the access request to the target memory management file provided by the memory management module;
the memory management module is used for loading the upgraded memory management file; and calling the target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
2. The system according to claim 1, wherein the memory management module is further configured to provide a memory management file before being upgraded, and when the access request is an access request for accessing the memory management file before being upgraded, call the target memory management file corresponding to the access request from the memory management file before being upgraded.
3. The system according to claim 2, wherein the memory management module is further configured to release the virtual memory corresponding to the virtual memory management file before or after the upgrade by using a release function.
4. The system according to claim 3, wherein the memory management module is further configured to modify a release function corresponding to the memory management file before the upgrade, so as to release the virtual memory corresponding to the virtual memory management file after the upgrade.
5. The system of claim 1, wherein the portal management module comprises: and the character equipment is used for linking the access request to the target memory management file through a file operation function pointer.
6. The system of claim 1, wherein the memory management module is further configured to update the device driver based on a new file operation function corresponding to the upgraded memory management file after the upgraded memory management file is loaded, wherein the new file operation function is used to establish a data structure of an association between a driver and a system call.
7. The system of claim 1, wherein the memory management module is further configured to initialize the upgraded memory management file before loading the upgraded memory management file, wherein a global lock function is executed during the initialization process, and the global lock function is released after the loading is completed.
8. The system according to claim 7, wherein the memory management module is further configured to assign entry point information corresponding to the upgraded memory management file to a device driver.
9. The system of claim 1, wherein the memory management module is further configured to uninstall an export entry in the proc file system and construct a proc file system corresponding to the upgraded memory management file.
10. The system of claim 1, wherein the memory management module is further configured to parse a common data structure based on the upgraded memory management file, and add extension information of the upgraded memory management file to a reserved bit of the common data structure, where the common data structure is a common data structure corresponding to the memory management file before being upgraded.
11. A memory management method includes:
receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module;
loading the upgraded memory management file through a memory management module; and calling the target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
12. A memory management method includes:
loading the upgraded memory management file through a memory management module, and initializing the upgraded memory management file to obtain an initialized memory management file;
and assigning entry point information corresponding to the initialized memory management file to the device driver, and constructing a pro file system corresponding to the upgraded memory management file to manage the virtual memory.
13. The method of claim 12, wherein the method further comprises: and analyzing a public data structure based on the upgraded memory management file, and adding extension information of the upgraded memory management file in a reserved bit of the public data structure, wherein the public data structure is a public data structure corresponding to the memory management file before upgrading.
14. A non-volatile storage medium including a stored program, wherein, when the program runs, a device in which the storage medium is located is controlled to execute the memory management method according to any one of claims 11 to 13.
15. A computing device, comprising:
a memory for storing a program;
a processor running a program stored in the memory, wherein the program is run to perform the process steps of:
receiving an access request for the virtual memory through an entrance management module, and linking the access request to a target memory management file provided by a memory management module;
loading the upgraded memory management file through a memory management module; and calling the target memory management file corresponding to the access request from the upgraded memory management file so as to manage the virtual memory.
CN202010476952.6A 2020-05-29 2020-05-29 Memory management system and method Active CN113312170B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010476952.6A CN113312170B (en) 2020-05-29 2020-05-29 Memory management system and method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010476952.6A CN113312170B (en) 2020-05-29 2020-05-29 Memory management system and method

Publications (2)

Publication Number Publication Date
CN113312170A true CN113312170A (en) 2021-08-27
CN113312170B CN113312170B (en) 2024-01-23

Family

ID=77370220

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010476952.6A Active CN113312170B (en) 2020-05-29 2020-05-29 Memory management system and method

Country Status (1)

Country Link
CN (1) CN113312170B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040215749A1 (en) * 2002-08-12 2004-10-28 Tsao Sheng Ted Tai Distributed virtual san
CN103677870A (en) * 2012-09-10 2014-03-26 腾讯科技(深圳)有限公司 System upgrading method and system upgraded by means of method
CN105683985A (en) * 2013-10-29 2016-06-15 慧与发展有限责任合伙企业 Virtual machine introspection
US20160306649A1 (en) * 2015-01-19 2016-10-20 Vmware, Inc. Operating-System Exchanges Using Memory-Pointer Transfers
CN106201564A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 Online upgrading equipment based on kernel virtual machine module and method
CN106201566A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The rich big special hot upgrade method of software of profit and equipment
CN108021378A (en) * 2016-11-03 2018-05-11 阿里巴巴集团控股有限公司 Upgrade-system, the upgrade method based on virtual machine and device
US20180212909A1 (en) * 2017-01-20 2018-07-26 TEN DIGIT Communications LLC Intermediary device for data message network routing
CN109101319A (en) * 2018-08-09 2018-12-28 郑州云海信息技术有限公司 It is a kind of to realize TPCM fully virtualized platform and its working method on QEMU
CN110673927A (en) * 2019-09-27 2020-01-10 北京浪潮数据技术有限公司 Scheduling method and device of virtual machine
US20200097296A1 (en) * 2018-09-21 2020-03-26 Qualcomm Incorporated Providing late physical register allocation and early physical register release in out-of-order processor (oop)-based devices implementing a checkpoint-based architecture

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040215749A1 (en) * 2002-08-12 2004-10-28 Tsao Sheng Ted Tai Distributed virtual san
CN103677870A (en) * 2012-09-10 2014-03-26 腾讯科技(深圳)有限公司 System upgrading method and system upgraded by means of method
CN105683985A (en) * 2013-10-29 2016-06-15 慧与发展有限责任合伙企业 Virtual machine introspection
US20160306649A1 (en) * 2015-01-19 2016-10-20 Vmware, Inc. Operating-System Exchanges Using Memory-Pointer Transfers
CN106201564A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 Online upgrading equipment based on kernel virtual machine module and method
CN106201566A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The rich big special hot upgrade method of software of profit and equipment
CN108021378A (en) * 2016-11-03 2018-05-11 阿里巴巴集团控股有限公司 Upgrade-system, the upgrade method based on virtual machine and device
US20180212909A1 (en) * 2017-01-20 2018-07-26 TEN DIGIT Communications LLC Intermediary device for data message network routing
CN109101319A (en) * 2018-08-09 2018-12-28 郑州云海信息技术有限公司 It is a kind of to realize TPCM fully virtualized platform and its working method on QEMU
US20200097296A1 (en) * 2018-09-21 2020-03-26 Qualcomm Incorporated Providing late physical register allocation and early physical register release in out-of-order processor (oop)-based devices implementing a checkpoint-based architecture
CN110673927A (en) * 2019-09-27 2020-01-10 北京浪潮数据技术有限公司 Scheduling method and device of virtual machine

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
耿麦香: "关于微机内存管理及优化方法的探讨", 科技情报开发与经济, no. 04 *

Also Published As

Publication number Publication date
CN113312170B (en) 2024-01-23

Similar Documents

Publication Publication Date Title
CN103324498B (en) Method and equipment for booting bare metal computing device
US8914785B2 (en) Providing virtual appliance system firmware images
CN106657444B (en) A kind of method and device for the IP address configuring BMC
CN107391193A (en) A kind of client, the system and method for configuration server
CN105302563A (en) Plug-in method and system for mobile application service
CN115185647B (en) virtio equipment direct connection method and related device
CN108989482A (en) One kind being based on DHCP protocol network deployment method, system and client and storage medium
US10552171B2 (en) Efficient booting system
CN108733370B (en) Stylized display method, device, terminal and storage medium of native APP
CN103716400A (en) Method and system for achieving mobile working based on virtual machine
CN113849272A (en) Method and device for adding GPU (graphics processing Unit) resources in virtual machine
CN114153782B (en) Data processing system, method and storage medium
CN114691300A (en) Hot migration method of virtual machine instance
CN110879741A (en) Virtual machine live migration method and device, storage medium and processor
CN112000382A (en) Linux system starting method and device and readable storage medium
CN114691390A (en) User mode program processing method and device, storage medium and processor
CN103761126A (en) Method and device for upgrading application program
CN108108177B (en) Firmware upgrading method of physical host, physical host and virtual machine
EP3499365A1 (en) Method and device for use in accessing container
CN113821220A (en) Installation method and device of linux operating system
US20210133261A1 (en) Using web application components with different web application frameworks in a web application
CN113312170A (en) Memory management system and method
CN108153564B (en) Interface management method, device and system and computer readable storage medium
CN115268969A (en) Android system upgrading method and device and terminal equipment
CN115016862A (en) Kubernetes cluster-based software starting method, device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40059825

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant