[go: up one dir, main page]

CN113312170B - Memory management system and method - Google Patents

Memory management system and method Download PDF

Info

Publication number
CN113312170B
CN113312170B CN202010476952.6A CN202010476952A CN113312170B CN 113312170 B CN113312170 B CN 113312170B CN 202010476952 A CN202010476952 A CN 202010476952A CN 113312170 B CN113312170 B CN 113312170B
Authority
CN
China
Prior art keywords
memory management
management file
file
memory
updated
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.)
Active
Application number
CN202010476952.6A
Other languages
Chinese (zh)
Other versions
CN113312170A (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

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a memory management system and a memory management method. Wherein, this system includes: the access management module is used for providing an access for virtual memory management, receiving an access request for the 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 updated memory management file; and calling a target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory. The invention solves the technical problem that the related hot upgrading capability under the KVM virtualization cannot be directly used for hot upgrading of vmem because vmem related modules cannot be unloaded and replaced during VM operation 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 the host memory allocation architecture under the virtualization scene, the memory management of the virtual machine depends on the vmem related module to perform management such as allocation and release on reserved memory of host. Because the virtual machine memory is created by vmem provided devices/dev/vmem (full image file of physical memory, which can access physical memory), the vmem module count will be incremented by 1 during VM operation every application of a block of memory, and the corresponding count will not be decremented by 1 until the VM is released. This results in vmem-related modules that cannot be uninstalled for replacement during VM operation. But as a basic building of virtualization, the hot upgrading capability is a necessary function of product on-line to cope with upgrading and reconstruction of the product and fault repair. The related hot upgrade capability under KVM virtualization cannot be directly used for vmem hot upgrade at present.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a memory management system and a memory management method, which at least solve the technical problem that the related hot upgrading capability under the KVM virtualization cannot be directly used for hot upgrading of vmem because a vmem related module cannot be unloaded and replaced during VM operation in the prior art.
According to an aspect of an embodiment of the present invention, there is provided a memory management system, including: the access management module is used for providing an access for virtual memory management, receiving an access request for the 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 updated memory management file; and calling a target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory.
According to another aspect of the embodiment of the present invention, there is also provided a memory management method, including: receiving an access request to the virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module; loading the updated memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory.
According to another aspect of the embodiment of the present invention, there is also provided another memory management method, including: loading the updated memory management file through the memory management module, and initializing the updated memory management file to obtain an initialized memory management file; the virtual memory is managed 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 updated memory management file.
According to another aspect of the embodiment of the present invention, there is further provided a nonvolatile storage medium, where the nonvolatile storage medium includes a stored program, and when the program runs, the device where the storage medium is controlled to execute any one of the memory management methods.
According to another aspect of 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 run performs the following processing steps: receiving an access request to the virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module; loading the updated memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory.
In the embodiment of the invention, a decoupling memory allocation inlet and a memory management mode are adopted, an inlet management module is used for providing a virtual memory management inlet, receiving an access request to 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 updated memory management file; and the aim of calling a target memory management file corresponding to an access request from the updated memory management file to manage the virtual memory is achieved, so that the technical effects of releasing the dependence of a process on a memory management module and directly thermally upgrading the vmem memory management module are achieved, and the technical problem that the related thermal upgrading capability under the KVM virtualization cannot be directly used for the thermal upgrading of vmem because the vmem related module cannot be unloaded and replaced during the VM operation in the prior art is 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 embodiments of the invention and together with the description serve to explain the invention and do not constitute a limitation on the invention. In the drawings:
FIG. 1 (a) is a schematic diagram of a memory management system according to an embodiment of the present invention;
FIG. 1 (b) is a schematic diagram of an alternative memory management system according to an embodiment of the present invention;
FIG. 1 (c) is a schematic diagram of an alternative memory management system according to an embodiment of the present invention;
FIG. 2 is a block diagram of an alternative hardware architecture of a computer terminal for implementing a memory management method according to an embodiment of the present invention;
FIG. 3 (a) is a flow chart illustrating a memory management method according to an embodiment of the invention;
FIG. 3 (b) is a flowchart of an alternative memory management method according to an embodiment of the present invention;
FIG. 4 is a flowchart of 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 that those skilled in the art will better understand the present invention, a technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise 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, partial terms or terminology appearing in describing embodiments of the present application are applicable to the following explanation:
KVM: kernel-based virtual machine Kernel-based Virtual Machine (KVM for short) is an open source virtualization technology built in Linux. Specifically, the 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. proc file system. Unlike other common file systems, the proc is a pseudo file system (i.e., virtual file system) that stores a series of special files of the current kernel running state, through which a user can view information about the system hardware and the current running process, and even change the running state of the kernel by changing some of the files
vmem: representing virtual memory files is the same as what is known as paging files (pagefi. Sys). When the virtual system executes the shutdown operation, the vmem file disappears, but does not disappear when the virtual system is suspended to be closed.
vma: the virtual memory area Virtual Memory Areas (vma) is divided into a plurality of different areas, each having associated attributes and uses, and a legal address falls within a certain area, which do not overlap.
Character device: a device that performs transmission in units of characters during I/O transmission.
Example 1
In the related art, in a host memory allocation architecture in a virtualization scenario, memory management of a virtual machine depends on a vmem related module to perform management such as allocation and release on reserved memory of host. Because the virtual machine memory is created by vmem provided devices/dev/vmem (full image file of physical memory, which can access physical memory), the vmem module count will be incremented by 1 during VM operation every application of a block of memory, and the corresponding count will not be decremented by 1 until the VM is released. This results in vmem-related modules that cannot be uninstalled for replacement during VM operation. But as a basic building of virtualization, the hot upgrading capability is a necessary function of product on-line to cope with upgrading and reconstruction of the product and fault repair. The related hot upgrade capability under KVM virtualization cannot be directly used for vmem hot upgrade at present.
Specifically, in this embodiment, as shown in fig. 1 (a), a memory management system is provided, where the memory management system includes, but is not limited to: an ingress management module 10 and a memory management module 12, wherein,
the entry management module 10 is configured to provide an entry for virtual memory management, receive an access request to 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 updated memory management file; and calling a target memory management file corresponding to the access request from the updated memory management file 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 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 updated memory management file; and the aim of calling a target memory management file corresponding to an access request from the updated memory management file to manage the virtual memory is achieved, so that the technical effects of releasing the dependence of a process on a memory management module and directly thermally upgrading the vmem memory management module are achieved, and the technical problem that the related thermal upgrading capability under a Kernel-based virtual machine (Kernel-based Virtual Machine, simply called KVM) cannot be directly used for the thermal upgrading of vmem because the vmem related module cannot be unloaded and replaced during the VM operation in the prior art is solved.
For example, the memory management system is split into two relatively independent modules, namely, an entry management module vmem_mm_x.ko module and a memory management module capable of loading a memory management file vmem_mm_x.ko (where x represents a version number of the file), as shown in fig. 1 (b), it is easy to note 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 done by the character device driver is to add, initialize, and delete the cdev structure, apply, release a device number, and fill functional functions in the file_operations structure, such as open, close, mmap, and ioctl, which have meanings of an open function, a close function, a mapping function, and a device interface control function (ioctl), respectively. It should be noted that the vmem.ko module only provides an entry for vmem memory management, and its entry is fixed as/dev/vmem; another vmem mm x.ko (x is version number, e.g. 0,1,2 … with each increase in thermal upgrade) is responsible for specific memory management tasks, if vmem mm 0.ko is the pre-upgrade memory management file version (old version), when the post-upgrade memory management file may include vmem mm 1.Ko, vmem mm 2.Ko, vmem mm 3.Ko, etc., when an access request to virtual memory is received through the vmem. Ko module, the access pass/dev/vmem path may be linked to any one of the vmem mm x.ko after the upgrade.
The vmem. Ko module is a kernel module file, which means that some functions of the kernel are moved to the outside of the kernel, the kernel is inserted when needed, and unloaded when not needed.
In some optional embodiments of the present invention, the memory management module is further configured to provide a memory management file before the upgrade, and call, when the access request is an access request for accessing the memory management file before the upgrade, a target memory management file corresponding to the access request from the memory management file before the upgrade. For example, as shown in fig. 1 (c), the memory management file before upgrading is vmem_mm_0.ko, when accessing vmem_mm_0.ko, the updated vmem_mm_1.ko corresponding to vmem_mm_0.ko can be called as the target memory management file accessed by the access request, where the meaning of each letter is already described above and will not be repeated herein. Wherein, 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 and mmap and the like
In some embodiments of the present application, the memory management module is further configured to release, by using a release function, a virtual memory corresponding to the virtual memory management file before or after the upgrade. For example, the release function is called by using a close (close) path through the vma_operation corresponding to vma, and the virtual memory corresponding to vmem_mm_0.ko or the virtual memory corresponding to vmem_mm_1.ko after upgrading corresponding to vmem_mm_0.ko is released.
In some embodiments of the present application, the memory management module is further configured to modify a release function corresponding to a memory management file before upgrading, so as to release a virtual memory corresponding to a virtual memory management file after upgrading. Specifically, the memory management mode 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 memory management file vmem_mm_0.ko; to this end, the release of all allocated memory invokes a specific release function through the close (close) path of the corresponding virtual memory region operation function (vma_operation) of vma; 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 released, 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 releasing the memory which is newly allocated, and assigning the release function of the new memory management file to the closing (close) function of vma during allocation.
In some optional embodiments of the present application, the portal management module includes: and the character device 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, vmem.ko's entry/dev/vmem is a character device, and a specific management operation is linked to a target memory management file vmem_mm_0.ko by a function pointer of a corresponding set of structures (file_operations) of 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 loading 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 updated memory management file vmem_mm_1.Ko, and assign a value to cdev.ops (device driver) based on the new_file_operations corresponding to the file vmem_mm_1.Ko, thereby replacing the old memory management file vmem_mm_0.ko; the purpose that the memory of the subsequent new application directly accesses 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 updated memory management file before loading the updated memory management file, where the global lock function is executed during the initialization process, and after loading is completed, the global lock function is released. For example, vmem_mm_1.Ko may be initialized before vmem_mm_1.Ko is loaded, during this initialization, a global lock may be executed, so that it may be ensured that the vmem/dem is not used by other processes such as allocation or thermal upgrade during loading, and after 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, after initializing the vmem_mm_1.Ko correlation structure, the device driver (cdev. Ops) may be assigned entry point information (fops) of the new calls corresponding to vmem_mm_1. Ko.
In some optional embodiments of the present application, the memory management module is further configured to offload export items in the proc file system, and construct a proc file system corresponding to the updated 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 the new (updated) memory management file vmem_mm_1.ko is built.
In order to achieve the purposes of repairing bug, updating function and the like, the memory management module is also used for analyzing the public data structure based on the updated memory management file and adding the extension information of the updated memory management file into the reserved bit of the public data structure, wherein the public data structure is the public data structure corresponding to the memory management file before updating.
There is also provided, in accordance with an embodiment of the present invention, a method embodiment of memory management, where the steps shown in the flowchart of the figures may be performed in a computer system, such as a set of computer-executable instructions, and where a logical sequence is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than what is shown or 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. Fig. 2 shows a block diagram of a hardware structure of a computer terminal (or mobile device) for implementing a memory management method. As shown in fig. 2, the computer terminal 10 (or mobile device 10) may include one or more processors 102 (shown as 102a, 102b, … …,102 n) which may include, but are not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA, a memory 104 for storing data, and a transmission module 106 for communication functions. In addition, the method may further include: 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 supply, and/or a camera. It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 2 is merely illustrative and is not intended to limit the configuration of the electronic device described above. 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 circuits described above may be referred to generally herein as "data processing circuits. The data processing circuit may be embodied in whole or in part in software, hardware, firmware, or any other combination. Furthermore, the data processing circuitry 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 present application, the data processing circuit acts as a processor control (e.g., selection of the path of the variable resistor termination to 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 the software programs and modules stored in the memory 104, thereby executing various functional applications and data processing, that is, implementing the above-mentioned vulnerability detection method of application program. 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. The 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 (Network Interface Controller, NIC) that can connect 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 for communicating with the internet wirelessly.
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).
In the above-described 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 a first embodiment of the present invention.
S302, receiving an access request to a virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module;
s304, loading the updated memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the updated memory management file 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 the memory management module; secondly, loading the updated memory management file through a memory management module; and the target memory management file corresponding to the access request is called from the updated memory management file to manage the virtual memory, so that the aim of calling the target memory management file corresponding to the access request to manage the virtual memory is fulfilled, the technical effects that the dependence of a process on a memory management module is relieved, the vmem memory management module can be directly thermally upgraded are realized, and the technical problem that the relevant thermal upgrading capability under the virtualization of the KVM cannot be directly used for the thermal upgrading of the vmem because the vmem related module cannot be unloaded and replaced during the operation of the VM in the prior art is solved.
For example, the portal management module is a vmem.ko module and the memory management module may load a memory management file vmem_mm_x.ko. It should be noted that the vmem.ko module only provides an entry for vmem memory management, and its entry is fixed as/dev/vmem; another vmem mm x.ko (x is version number, e.g., 0,1,2 …) with each increase in thermal upgrade, if vmem mm 0.ko is the pre-upgrade memory management file version (old version), the post-upgrade memory management file may include vmem mm 1.Ko, vmem mm 2.Ko, vmem mm 3.Ko, etc., and the access pass/dev/vmem path may be linked to the post-upgrade vmem mm 1.Ko when an access request to virtual memory is received through the vmem.ko module.
In some embodiments of the present application, a memory management module is used to provide a memory management file before an upgrade, and when an access request is an access request for accessing the memory management file before the upgrade, a target memory management file corresponding to the access request is called from the memory management file before the upgrade. For example, the memory management file before upgrading is vmem_mm_0.ko, when accessing vmem_mm_0.ko, the updated vmem_mm_1.ko corresponding to vmem_mm_0.ko can 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 uses a release function to release the virtual memory corresponding to the virtual memory management file before or after the upgrade. For example, the release function is called by using a close (close) path through the vma_operation corresponding to vma, and the virtual memory corresponding to vmem_mm_0.ko or the virtual memory corresponding to vmem_mm_1.ko after upgrading corresponding to vmem_mm_0.ko is released.
In some embodiments of the present application, the memory management module modifies the 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 mode 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 memory management file vmem_mm_0.ko; to this end, the release of all allocated memory invokes a specific release function through the close (close) path of the corresponding virtual operating memory region operating function (vma_operation) of vma; 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 released, 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 releasing the memory which is newly allocated, and assigning the release function of the new memory management file to the closing (close) function of vma during allocation.
In some optional embodiments of the present application, the portal management module includes: and the character device 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, between the two modules, where vmem.ko's entry/dev/vmem is a character device, and a specific management operation is linked to the target memory management file vmem_mm_0.ko by using a function pointer of a corresponding set of structures (file_operations) of cdev.ops (device driver) of the character device.
In some embodiments of the present application, after loading the updated memory management file, the memory management module updates the device driver based on a new file operation function corresponding to the updated memory management file, where the new file operation function is used to build an associated data structure of the driver and the system call. For example, the memory management module is configured to load the updated memory management file vmem_mm_1.Ko, and assign a value to cdev.ops (device driver) based on the new_file_operations corresponding to the file vmem_mm_1.Ko, thereby replacing the old memory management file vmem_mm_0.ko; the purpose that the memory of the subsequent new application directly accesses the new memory management file vmem_mm_1.Ko is achieved.
In some optional embodiments of the present application, before loading the updated memory management file, the memory management module initializes the updated memory management file, where a global lock function is executed during the initialization process, and after loading is completed, the global lock function is released. For example, vmem_mm_1.Ko may be initialized before vmem_mm_1.Ko is loaded, during this initialization, a global lock may be executed, so that it may be ensured that the vmem/dem is not used by other processes such as allocation or thermal upgrade during loading, and after loading is completed, the global lock function is released.
Fig. 3 (b) is a flowchart of an alternative implementation of the memory management method according to the embodiment of the present application, and as shown in fig. 3 (b), the specific implementation is similar to the implementation steps of the memory management method, specifically:
step S3002, loading a new memory management module vmem_mm_1.Ko; in order to avoid being used by other processes such as allocation or hot upgrading in the loading process, the global lock is acquired first through step S3004, and the global lock function is executed on the process by using the global lock; then, assigning an entry point (fops) called by the new memory management operation in vmem_mm_1.Ko to a device driver (cdev. Ops) through step S3006; unloading the proc item of vmem_mm_0.ko of the old module by step S3008; loading a proc item of a new memory management module vmem_mm_1.Ko through step S3010; secondly, multiplexing and processing the common memory information structure by step S3012vmem_mm_1.Ko, specifically, for the common data structure vmem_mm_1.Ko needs to parse the information thereon, if vmem_mm_1.Ko expands the data structure and wants to directly multiplex the old data structure, the new data structure can only be expanded at the reserved bit at the end of the data structure, avoiding parsing errors; s3014, managing reserved memory slices by utilizing vmem, and inquiring the slice state; finally, releasing the global lock function through step S3016, thereby realizing the decoupling of the memory allocation entry and the specific memory management function, and releasing the dependence of the process on the memory management module; the purpose of repairing faults or on-line functions without affecting the memory in use can be achieved by utilizing a thermal upgrade vmem memory management module; the purpose of simultaneously allowing memory management modules with different functions to exist simultaneously and dynamically selecting the memory management modules according to the needs can also be achieved.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present invention is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present invention. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present invention.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
Example 2
In accordance with an embodiment of the present invention, there is also provided another embodiment of a method of memory management, it being noted that the steps shown in the flowchart of the figures may be performed in a computer system, such as a set of computer executable instructions, and that, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order other than that shown or described herein.
The method embodiment provided in the first embodiment of the present application may be performed 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 performed on the computer terminal shown in fig. 2.
In the above operating environment, the present application provides a flowchart of a memory management method as shown in fig. 4, where the method includes:
s402, loading the updated memory management file through a memory management module, and initializing the updated 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 updated memory management file.
In the memory management method, firstly, an updated memory management file is loaded through a memory management module, and initialization processing is carried out on the updated memory management file to obtain an initialized memory management file; secondly, 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 updated memory management file, the purpose of managing the virtual memory is achieved, so that the technical effects that the dependence of a process on a memory management module is relieved, the vmem memory management module can be directly thermally upgraded are achieved, and the technical problem that the relevant thermal upgrading capability under the KVM virtualization cannot be directly used for the thermal upgrading of the vmem because the vmem-related module cannot be unloaded and replaced during the VM operation in the prior art is solved.
In some optional embodiments of the present application, the common data structure is parsed based on the updated memory management file, and extension information of the updated memory management file is added to reserved bits of the common data structure, where the common data structure is a common data structure corresponding to the memory management file before the update.
Example 3
Embodiments of the invention may provide a computing device, which may be any one of a group of computing devices. Alternatively, in this embodiment, the above-mentioned computing device may be replaced by a terminal device such as a mobile terminal.
Alternatively, in this embodiment, the computing device may be located in at least one network device of a plurality of network devices of the 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 updated memory management file through the memory management module, and initializing the updated memory management file to obtain an initialized memory management file; the virtual memory is managed 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 updated memory management file.
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 is shown) processors 502, memory 504.
The memory may be used to store software programs and modules, such as program instructions/modules corresponding to the memory management method in the embodiment of the present invention, and the processor executes the software programs and modules stored in the memory, thereby executing various functional applications and data processing, that is, implementing the memory management method described above. 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 with respect to the processor, which 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 may call the information and the application program stored in the memory through the transmission module to execute the following steps: receiving an access request to the virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module; loading the updated memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory.
Optionally, the above processor may further execute program code for: and providing a 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 above processor may further execute program code for: and releasing the virtual memory corresponding to the virtual memory management file before or after the upgrade by the memory management module through a release function.
Optionally, the above processor may further execute program code for: and modifying a release function corresponding to the memory management file before upgrading by the memory management module so as to release the virtual memory corresponding to the virtual memory management file after upgrading.
Optionally, the above processor may further execute program code for: and linking the access request to the target memory management file through the file operation function pointer by the character equipment, wherein the entry management module comprises the character equipment.
Optionally, the above processor may further execute program code for: after the updated memory management file is loaded through the memory management module, the device driver is updated based on a new file operation function corresponding to the updated memory management file, wherein the new file operation function is used for establishing a data structure of association of a driver and system call.
Optionally, the above processor may further execute program code for: initializing the updated memory management file before loading the updated memory management file by the memory management module, wherein the global lock function is executed in the initialization process, and the global lock function is released after loading is completed.
By adopting the embodiment of the invention, a scheme for decoupling the memory allocation inlet and the memory management is provided. The access management module is used for providing an access of virtual memory management, receiving an access request to the 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 updated memory management file; and the aim of calling a target memory management file corresponding to an access request from the updated memory management file to manage the virtual memory is achieved, so that the technical effects of releasing the dependence of a process on a memory management module and directly thermally upgrading the vmem memory management module are achieved, and the technical problem that the related thermal upgrading capability under the KVM virtualization cannot be directly used for the thermal upgrading of vmem because the vmem related module cannot be unloaded and replaced during the VM operation in the prior art is solved.
It will be appreciated by those skilled in the art that the configuration shown in fig. 5 is only illustrative, and the computing device may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 5 is not limited to the 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 of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing a terminal device to execute in association with hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
Example 4
Embodiments of the present invention also provide a nonvolatile storage medium. Alternatively, in this embodiment, the nonvolatile storage medium may be used to store the program code executed by the memory management method provided in the first embodiment.
Alternatively, in this embodiment, the above-mentioned nonvolatile storage medium may be located in any one of the computer terminals in the computer terminal group in the computer network, or in any one of the mobile terminals in the mobile terminal group.
Optionally, in the present embodiment, the non-volatile storage medium is arranged to store program code for performing the steps of: receiving an access request to the virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module; loading the updated memory management file through a memory management module; and calling a target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
In the foregoing embodiments of the present invention, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed technology content may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown 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 may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied essentially or in part or all of the technical solution or in part in the form of a software product stored in a storage medium, including instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform 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, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (13)

1. A memory management system, comprising:
the access management module is used for providing an access for virtual memory management, receiving an access request for the 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 updated memory management file; and calling the target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory; and analyzing a public data structure based on the updated memory management file, and adding the extension information of the updated memory management file into 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 updating.
2. The system of claim 1, wherein the memory management module is further configured to provide a memory management file before an upgrade, and when the access request is an access request for accessing the memory management file before the upgrade, call the target memory management file corresponding to the access request from the memory management file before the upgrade.
3. The system of 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 of claim 3, wherein the memory management module is further configured to modify a release function corresponding to the memory management file before the upgrade to release the virtual memory corresponding to the virtual memory management file after the upgrade.
5. The system of claim 1, wherein the ingress 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 a device driver after loading the updated memory management file based on a new file operation function corresponding to the updated memory management file, wherein the new file operation function is configured to establish a data structure associated with a driver and a system call.
7. The system of claim 1, wherein the memory management module is further configured to initialize the updated memory management file before loading the updated memory management file, wherein a global lock function is executed during the initialization process, and the global lock function is released after loading is completed.
8. The system of 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 offload export items in the proc file system and construct the proc file system corresponding to the upgraded memory management file.
10. A memory management method, comprising:
receiving an access request to the virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module;
loading the updated memory management file through a memory management module; and calling the target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory;
analyzing a public data structure based on the updated memory management file through the memory management module, and adding extension information of the updated memory management file into reserved bits of the public data structure, wherein the public data structure is a public data structure corresponding to the memory management file before updating.
11. A memory management method, comprising:
loading the updated memory management file through the memory management module, and initializing the updated memory management file to obtain an initialized memory management file;
assigning the entry point information corresponding to the initialized memory management file to a device driver, and constructing a pro file system corresponding to the updated memory management file so as to manage the virtual memory;
analyzing a public data structure based on the updated memory management file through the memory management module, and adding extension information of the updated memory management file into reserved bits of the public data structure, wherein the public data structure is a public data structure corresponding to the memory management file before updating.
12. A non-volatile storage medium comprising a stored program, wherein the program, when run, controls a device in which the storage medium is located to perform the memory management method of any one of claims 10 to 11.
13. A computing device, comprising:
a memory for storing a program;
a processor that runs a program stored in the memory, wherein the program, when run, performs the following processing steps:
Receiving an access request to the virtual memory through an entry management module, and linking the access request to a target memory management file provided by a memory management module;
loading the updated memory management file through a memory management module; and calling the target memory management file corresponding to the access request from the updated memory management file to manage the virtual memory;
analyzing a public data structure based on the updated memory management file through the memory management module, and adding extension information of the updated memory management file into reserved bits of the public data structure, wherein the public data structure is a public data structure corresponding to the memory management file before updating.
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 CN113312170A (en) 2021-08-27
CN113312170B true 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114003257B (en) * 2021-10-29 2025-07-22 联想(北京)信息技术有限公司 Upgrading method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN106201566A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The rich big special hot upgrade method of software of profit and equipment
CN106201564A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 Online upgrading equipment based on kernel virtual machine module and method
CN108021378A (en) * 2016-11-03 2018-05-11 阿里巴巴集团控股有限公司 Upgrade-system, the upgrade method based on virtual machine and device
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

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7379990B2 (en) * 2002-08-12 2008-05-27 Tsao Sheng Ted Tai Distributed virtual SAN
US10007546B2 (en) * 2015-01-19 2018-06-26 Vmware, Inc. Operating-system exchanges using memory-pointer transfers
US10367766B2 (en) * 2017-01-20 2019-07-30 TEN DIGIT Communications LLC Intermediary device for data message network routing
US10860328B2 (en) * 2018-09-21 2020-12-08 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 (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN106201566A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 The rich big special hot upgrade method of software of profit and equipment
CN106201564A (en) * 2015-05-07 2016-12-07 阿里巴巴集团控股有限公司 Online upgrading equipment based on kernel virtual machine module and method
CN108021378A (en) * 2016-11-03 2018-05-11 阿里巴巴集团控股有限公司 Upgrade-system, the upgrade method based on virtual machine and device
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

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
关于微机内存管理及优化方法的探讨;耿麦香;科技情报开发与经济(第04期);全文 *

Also Published As

Publication number Publication date
CN113312170A (en) 2021-08-27

Similar Documents

Publication Publication Date Title
EP3353651B1 (en) In-service upgrade of kernel loadable modules
CN109871222B (en) Application updating method and recording medium
US20060223517A1 (en) Field downloading of wireless device software
US20140033189A1 (en) Providing virtual appliance system firmware images
CN105302563A (en) Plug-in method and system for mobile application service
US10078532B2 (en) Resource management method and device for terminal system among multiple operating systems
CN104765624B (en) Method and device for updating application program of virtual machine
CN114153782A (en) Data processing system, method and storage medium
KR20180101545A (en) A method for managing objects in a security element
CN113312170B (en) Memory management system and method
CN103761126A (en) Method and device for upgrading application program
CN112306843A (en) Test method, test device and storage medium
CN114594999A (en) Method, device, storage medium and system for publishing file
CN114205176A (en) Network virtualization service system and network virtualization server
US11609845B2 (en) Configurable memory device connected to a microprocessor
CN108153564B (en) Interface management method, device and system and computer readable storage medium
CN110362350B (en) Managing multiple operating systems in an integrated circuit card
CN110968393B (en) Migration processing method of virtual machine, storage medium and computing device
CN111190866A (en) Application document display method, device, equipment and storage medium
CN110543312B (en) Application software installation method and device and server
HK40059825A (en) Memory management system and method
KR20150029916A (en) Apparatus and method for setting up computting environments
CN114327748A (en) Virtual machine interaction method and device, nonvolatile storage medium and processor
CN112486559A (en) Product adjusting method and device, storage medium and electronic device
CN117539521B (en) Application program upgrading method and device, nonvolatile storage medium and electronic equipment

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