Kernel page migration method, device, equipment and computer program product
By using the vmalloc function in the database to migrate cold pages to the virtualized database, the increase in memory overhead caused by memory fragmentation is solved, and the success rate of data migration operations and system stability are improved.
Patent Information
- Application Number
- CN202411275863.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-09-11
AI Technical Summary
When performing data page migration operations in the database, memory fragmentation increases memory overhead, and the existing technology is difficult to effectively solve this problem.
By obtaining the kernel page to be migrated in the physical database and determining the virtualized database used to store the migrated kernel page, when the kernel page is a cold page, the memory allocation function vmalloc function will be used to migrate the cold page to the virtualized database. middle.
This method can greatly improve the success rate of kernel page migration operations, reduce the memory overhead formed by kernel pages, thereby reducing the application cost of physical databases, and ensuring the stable progress of data processing operations.
Smart Images

Figure CN118779251B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a kernel page migration method, device, equipment and computer program product. Background Art
[0002] Memory fragmentation refers to the phenomenon that in the process of computer memory management, the available memory space is divided into many discontinuous small blocks, resulting in the inability to effectively use these small blocks to meet larger memory allocation requests. When migrating data pages in a database, most of the data pages in the database will increase memory overhead due to the impact of memory fragmentation. Therefore, a solution is urgently needed to reduce memory overhead. Summary of the invention
[0003] The embodiments of the present invention provide a kernel page migration method, apparatus, device and computer program product, which can reduce the memory overhead of the system.
[0004] In a first aspect, an embodiment of the present invention provides a kernel page migration method, comprising:
[0005] Get the kernel pages to be migrated in the physical database;
[0006] determining a virtualization database for storing migrated kernel pages;
[0007] In the case where the kernel page is a cold page, the cold page is migrated from the physical database to the virtualized database using a memory allocation function vmalloc function.
[0008] In a second aspect, an embodiment of the present invention provides a kernel page migration device, comprising:
[0009] A first acquisition module is used to acquire kernel pages to be migrated in a physical database;
[0010] A first determination module, used to determine a virtualization database for storing migrated kernel pages;
[0011] The first processing module is used for migrating the cold page from the physical database to the virtualized database by using the memory allocation function vmalloc function when the kernel page is a cold page.
[0012] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the kernel page migration method in the above-mentioned first aspect.
[0013] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the kernel page migration method in the first aspect when executed.
[0014] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to execute the steps in the kernel page migration method shown in the first aspect above.
[0015] The kernel page migration method, device, equipment and computer program product provided by the embodiments of the present invention determine the virtualization database for storing the migrated kernel page by acquiring the kernel page to be migrated in the physical database; when the kernel page is a cold page, it means that the memory access frequency of the kernel page at this time is low. In order to reduce the memory overhead caused by the kernel page, the kernel allocation function vmalloc function can be used to migrate the cold page to the virtualization database, which can not only greatly improve the success rate of the kernel page migration operation, but also reduce the memory overhead caused by the kernel page, thereby helping to reduce the application cost of the physical database; and can also avoid the page migration operation from affecting the online operation of the data, thereby ensuring the stable progress of the data processing operation, and further improving the practicality of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A schematic diagram of a scenario of a kernel page migration method provided by an embodiment of the present invention;
[0018] Figure 2 A schematic diagram of a flow chart of a kernel page migration method provided by an embodiment of the present invention;
[0019] Figure 3 A schematic diagram of a process of migrating the cold page from the physical database to the virtualized database using the memory allocation function vmalloc function provided in an embodiment of the present invention;
[0020] Figure 4 A schematic flow chart of another kernel page migration method provided by an embodiment of the present invention;
[0021] Figure 5A schematic diagram of the principle of a kernel page migration method provided by an application embodiment of the present invention;
[0022] Figure 6 A schematic diagram of the structure of a kernel page migration device provided by an embodiment of the present invention;
[0023] Figure 7 For Figure 6 A schematic diagram of the structure of an electronic device corresponding to the kernel page migration device provided in an embodiment is shown. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "an", and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the situation of including at least one.
[0026] It should be understood that the term "and / or" used in this article is only a way to describe the association relationship of associated devices, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated devices before and after are in an "or" relationship.
[0027] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0028] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0029] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0030] Terminology explanation:
[0031] VPA: VerticalPodAutoscaler, automatic expansion and reduction of pods.
[0032] Pod: A data structure that can be used as the smallest scheduling unit in a distributed system and can be created, deleted, updated, and restarted. A pod can contain one or more containers that share the same storage volume and network namespace.
[0033] In order to facilitate understanding of the specific implementation process and implementation effect of the kernel page migration method, device, equipment and computer program product in this embodiment, the relevant technology is briefly described below:
[0034] In the field of computer technology, memory fragmentation refers to the phenomenon that the available memory space is divided into many discontinuous small blocks during the computer memory management process, resulting in the inability to effectively use these small blocks to meet larger memory allocation requests. In the application scenario where the data of a physical database (for example, a database implemented by the runc technology when running a container) needs to be fully switched to a virtualized database (for example, a database implemented by the rund technology when running a container), all functions on the physical database need to be transferred to the virtualized database as much as possible. At this time, the virtualized database can be regarded as a complete virtual machine (VM for short). In the process of migrating data from the physical database to the virtualized database, it is affected by memory fragmentation, and the resource shrinking granularity of the physical database is often different from that of the virtualized database. When migrating data in the physical database, the shrinking operation of the data is likely to fail to meet the demand information of the application scenario, which will not only affect the online operation of the data, but also greatly reduce the success rate of the data migration operation, thereby increasing the memory overhead of the physical database.
[0035] In order to solve the above technical problems, the embodiments of the present invention provide a kernel page migration method, device, equipment and computer program product, wherein, with reference to the attached Figure 1 As shown, the executor of the kernel page migration method is a kernel page migration device 200, and the kernel page migration device 200 can be communicatively connected with the client 100 and the virtualization database 300, or the migration device 200 can be integrated with the client 100, or the migration device 200 can be integrated with the virtualization database 300, wherein a physical database can be configured in the client 100 to enable kernel page migration operations to be performed between the physical database and the virtualization database 300.
[0036] Among them, when the kernel page migration device 200 is implemented as a server in the cloud, the kernel page migration method can be executed in the cloud, and several computing nodes (cloud servers) can be deployed in the cloud, and each computing node has computing, storage and other processing resources. In the cloud, multiple computing nodes can be organized to provide a certain service. Of course, a computing node can also provide one or more services. The way to provide the service in the cloud can be to provide a service interface to the outside, and the user calls the service interface to use the corresponding service. The service interface includes software development kits (Software Development Kit, referred to as SDK), application programming interfaces (Application Programming Interface, referred to as API), etc.
[0037] Specifically, the client 100 that is in communication connection with the kernel page migration device 200 may include at least one of the following: a mobile phone, a personal computer PC, a tablet computer, a setting application, a wearable device, etc. In addition, the basic structure of the client 100 may include: at least one processor. The number of processors depends on the configuration and type of the client 100. The client 100 may also include a memory, which may be volatile, such as a random access memory (RAM), or non-volatile, such as a read-only memory (ROM), flash memory, etc., or may include both types. The memory usually stores an operating system (OS), one or more application programs, and may also store program data, etc. In addition to the processing unit and the memory, the client 100 also includes some basic configurations, such as a network card chip, an IO bus, a display component, and some peripheral devices, etc. Optionally, some peripheral devices may include, for example, a keyboard, a mouse, an input pen, a printer, etc. Other peripheral devices are well known in the art and will not be described in detail here.
[0038] The kernel page migration device 200 refers to a device that can provide kernel page migration operations in a network virtual environment, and generally refers to a device that uses the network to perform information planning and kernel page migration operations. In physical implementation, the kernel page migration device 200 can be any device that can provide computing services, respond to kernel page migration requests, and perform kernel page migration operations, for example: it can be a cluster server, a conventional server, a cloud server, a cloud host, a virtual center, etc. The kernel page migration device 200 mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.
[0039] In the above embodiment, the client 100 and the migration device 200, and the migration device 200 and the virtualized database 300 are connected to each other through a network, and the network connection may be a wireless or wired network connection. If the client 100 and the migration device 200, and the migration device 200 and the virtualized database 300 are connected through a communication connection, the network standard of the mobile network may be any one of 2G (Global System for Mobile Communications GSM), 2.5G (General Packet Radio Service GPRS), 3G (Wideband Code Division Multiple Access WCDMA, Time Division Synchronous Code Division Multiple Access TD-SCDMA, Code Division Multiple Access 2000 CDMA2000, Universal Mobile Telecommunications System UTMS), 4G (Long Term Evolution LTE), 4G+ (Enhanced Long Term Evolution LTE+), Worldwide Interoperability for Microwave Access WiMax, 5G, 6G, etc.
[0040] The client 100 may be configured with a physical database and may provide an application program interface for implementing kernel page migration operations. When a user has a page migration requirement, the migration requirement of the kernel page to be migrated in the physical database may be obtained through the application program interface. Specifically, the client 100 may display a human-computer interaction interface including an application program interface; obtain the interaction operation input by the user for the application program interface through the human-computer interaction interface. The interaction operation may be an interface interaction operation, a voice interaction operation, etc., and then generate a migration request for the kernel page to be migrated in the physical database based on the interaction operation. In order to implement the page migration operation for the kernel page to be migrated in the physical database, the migration request may be sent to the kernel page migration device 200.
[0041] The kernel page migration device 200 is used to obtain the kernel page migration request sent by the client 100. After obtaining the kernel page migration request, the kernel page to be migrated in the physical database can be obtained based on the migration request, and the virtualization database 300 for storing the migrated kernel page can be determined based on the kernel page migration request. The virtualization database 300 can be implemented as a destination end for implementing the kernel page migration operation.
[0042] After obtaining the kernel page, the kernel page can be analyzed and processed to determine the page type of the kernel page. Different page types may correspond to kernel page migration strategies. Specifically, when the kernel page is a cold page, it means that the access frequency of the kernel page is low. At this time, in order to reduce the memory overhead caused by the cold page to the client 100, the memory allocation function vmalloc function can be used to migrate the cold page from the physical database to the virtualized database.
[0043] In this embodiment, when there is a need to migrate kernel pages for the physical database, the kernel pages to be migrated can be obtained first, and the virtualized database used to store the migrated kernel pages can be determined. When the kernel pages are cold pages, it means that the memory access frequency of the kernel pages at this time is low. In order to reduce the memory overhead caused by the kernel pages, the kernel allocation function vmalloc function can be used to migrate the cold pages to the virtualized database. This can not only greatly improve the success rate of data migration operations, reduce the memory overhead caused by kernel pages, and thus help reduce the application cost of the physical database; it can also avoid the data migration operation affecting the online operation of the data, thereby ensuring the stable progress of the data processing operation, and further improving the practicality of the method.
[0044] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0045] Figure 2 A schematic diagram of a kernel page migration method provided by an embodiment of the present invention; Figure 2 As shown, this embodiment provides a kernel page migration method, the execution subject of the method is a kernel page migration device, the kernel page migration device can be implemented as software, or a combination of software and hardware. When the kernel page migration device is implemented as hardware, it can be various electronic devices with kernel page migration capabilities, including but not limited to personal computers, servers, etc. When the kernel page migration device is implemented as software, it can be installed in the electronic devices listed above. In some instances, the kernel page migration device can be communicatively connected with a physical database and a virtualized database, or the kernel page migration device can be integrated with the physical database to be able to perform kernel page migration operations between the physical database and the virtualized database. Specifically, based on the above-mentioned kernel page migration device (hereinafter referred to as "migration device"), the method in this embodiment may include:
[0046] Step S201: Obtain kernel pages to be migrated in the physical database.
[0047] Step S202: Determine a virtualization database for storing migrated kernel pages.
[0048] Step S203: when the kernel page is a cold page, the cold page is migrated from the physical database to the virtualized database using the memory allocation function vmalloc.
[0049] The specific implementation process and effects of each of the above steps are described in detail below:
[0050] Step S201: Obtain kernel pages to be migrated in the physical database.
[0051] When a user has a kernel page migration requirement for a physical database, the migration device can obtain the kernel pages to be migrated from the physical database. The physical database may refer to a database running on a physical machine. For example, the physical database may be implemented as a database implemented using the runc technology in a container runtime (referred to as a runc database for short).
[0052] Specifically, this embodiment does not limit the method for obtaining the kernel page to be migrated. In some instances, the kernel page to be migrated can be obtained through human-computer interaction operations. In this case, obtaining the kernel page to be migrated in the physical database may include: displaying a human-computer interaction interface for the physical database; obtaining the execution operation input by the user for the physical database in the human-computer interaction interface; and obtaining the kernel page to be migrated in the physical database based on the execution operation. In this case, the obtained kernel page to be migrated can be a kernel page specified or selected by the user, thereby effectively ensuring the accuracy and reliability of obtaining the kernel page.
[0053] In other instances, the kernel pages to be migrated can not only be obtained through human-computer interaction operations, but also the automatic acquisition operation of the kernel pages can be triggered by the occupancy of the memory space. At this time, obtaining the kernel pages to be migrated in the physical database may include: obtaining the occupancy of the memory space of the device where the physical database is located; when the occupancy is less than a preset threshold, the kernel pages to be migrated in the physical database will not be obtained; when the occupancy is greater than or equal to the preset threshold, the kernel pages to be migrated in the physical database can be automatically obtained. At this time, the obtained kernel pages to be migrated can be all free kernel pages or partially free kernel pages stored in the physical database. When the kernel page to be migrated is a partially free kernel page stored in the physical database, it can be a kernel page determined based on the occupancy and the preset threshold. This effectively realizes the automatic acquisition operation of the kernel page.
[0054] Step S202: Determine a virtualization database for storing migrated kernel pages.
[0055] After obtaining the kernel page to be migrated, in order to implement the migration operation of the kernel page, a virtualization database for storing the migrated kernel page can be determined. The virtualization database can refer to a database running in a container on a virtual machine. For example, the virtualization database can be implemented as a database implemented by the rund technology when the container is running (referred to as the rund database for short).
[0056] In addition, this embodiment does not limit the specific method for determining the virtualization database. In some instances, the virtualization database can be obtained through human-computer interaction operations. In this case, determining the virtualization database used to store the migrated kernel page can include: displaying a human-computer interaction interface for storing the migrated kernel page; obtaining the configuration operation of the virtualization database input by the user in the human-computer interaction interface; and determining the virtualization database used to store the migrated kernel page based on the configuration operation of the virtualization database. This effectively ensures the accuracy and reliability of the determination of the virtualization database.
[0057] In other instances, the virtualization database can not only be obtained through human-computer interaction operations, but also can be determined through a preset mapping relationship. In this case, determining the virtualization database used to store the migrated kernel page can include: obtaining a preset mapping relationship between a pre-configured kernel page and the virtualization database; after obtaining the kernel page to be migrated in the physical database, the virtualization database used to store the migrated kernel page can be determined based on the kernel page and the preset mapping relationship, which also ensures the accuracy and reliability of the determination of the virtualization database.
[0058] Step S203: when the kernel page is a cold page, the cold page is migrated from the physical database to the virtualized database using the memory allocation function vmalloc.
[0059] For kernel pages, the kernel pages can be divided into different types of pages according to the frequency of page access. For example, the kernel pages can include hot pages and cold pages, the hot pages are used to identify the kernel pages that are frequently accessed, and the cold pages are used to identify the kernel pages that are less frequently accessed. Since different types of kernel pages may correspond to different migration strategies, in order to accurately perform migration operations on kernel pages, after obtaining the kernel pages to be migrated in the physical database, the page type of the kernel page can be first identified. At this time, the method in this embodiment can also include: obtaining a page access identifier of the kernel page; and determining the page type of the kernel page based on the page access identifier.
[0060] After obtaining the kernel page, you can first obtain the page access identifier of the kernel page. In some instances, the page access identifier can be determined by the page table corresponding to the kernel page. At this time, obtaining the page access identifier of the kernel page may include: obtaining the page table corresponding to the kernel page; determining the page access identifier of the kernel page through the page table.
[0061] Specifically, after obtaining the kernel page, the page corresponding to the kernel page can be obtained based on the preset mapping relationship. The page table is a data structure used to store page mapping information, which records the correspondence between the kernel page in the virtual address space and the physical memory. In addition, the page table can also include the page access identifier of the kernel page. Therefore, after obtaining the page table corresponding to the kernel page, the page access identifier of the kernel page can be directly determined through the page table, which effectively ensures the accuracy and reliability of determining the page access identifier.
[0062] After obtaining the page access identifier, the page access identifier can be analyzed and processed to determine the page type of the kernel page. In some instances, the page type of the kernel page can be determined by a preset mapping relationship. At this time, based on the page access identifier, determining the page type of the kernel page can include: when the page access identifier is a first preset identifier, determining that the kernel page is a hot page; when the page access identifier is a second preset identifier, determining that the kernel page is a cold page. This effectively ensures the accuracy and reliability of determining the page type of the kernel page.
[0063] In other instances, the page type of the kernel page can be determined not only by a preset mapping relationship, but also by the access frequency of the kernel page. At this time, based on the page access identifier, determining the page type of the kernel page may include: obtaining the access frequency of the kernel page; determining the page type of the kernel page based on the access frequency of the kernel page. Specifically, when the access frequency of the kernel page is greater than or equal to a preset threshold, the kernel page is determined to be a hot page; when the access frequency of the kernel page is less than the preset threshold, the kernel page is determined to be a cold page. This effectively ensures the accuracy and reliability of determining the page type of the kernel page.
[0064] In some other examples, the page type of the kernel page can be determined not only by the access frequency of the kernel page, but also by the page miss access frequency for the kernel page. At this time, based on the page access identifier, determining the page type of the kernel page may include: obtaining the page miss access frequency for the kernel page; and determining the page type of the kernel page based on the page miss access frequency. Specifically, when the page miss access frequency is greater than or equal to a preset threshold, the kernel page is determined to be a hot page; when the page miss access frequency is less than the preset threshold, the kernel page is determined to be a cold page, which effectively ensures the accuracy and reliability of identifying hot pages and cold pages.
[0065] When it is determined that the kernel page is a cold page, the memory allocation function vmalloc can be used to migrate the cold page from the physical database to the virtualized database. Specifically, the cold page can be migrated from the physical database to the virtualized database based on the kernel allocation function vmalloc(long,size), where "size" is used to identify the memory size allocated to the cold page in bytes, and "long" is used to identify the length of size. This effectively implements the migration operation of the cold page, thereby effectively reducing the overhead caused by the cold page to the system memory, and is beneficial to saving application costs.
[0066] In other instances, after determining that the kernel page is a hot page, a storage operation may be performed on the hot page. In this case, the method in this embodiment may further include: using the memory allocation function alloc pages function to determine the hot page memory area allocated for the hot page; and storing the hot page in the hot page memory area.
[0067] When determining that a kernel page is a hot page, since the access frequency of hot pages is high, in order to facilitate the quality and efficiency of accessing hot pages, the kernel allocation function alloc pages function can be used to determine the hot page memory area allocated for the hot page. Specifically, the hot page memory area allocated for the hot page can be determined based on the kernel allocation function alloc pages function (mask, order). The obtained hot page memory area is the memory area used to store the hot page; wherein order is the size of the memory area allocated for the hot page, and mask refers to the partition identifier of the memory area that needs to be allocated for the hot page. The above order and mask can be pre-configured parameters, or the above order and mask can be obtained by the user according to the application scenario. After determining the hot page memory area allocated for the hot page, the hot page can be stored in the hot page memory area, which effectively implements the direct storage operation of the hot page without the need to migrate the hot page.
[0068] The kernel page migration method provided in the present embodiment determines a virtualized database for storing the migrated kernel page by acquiring the kernel page to be migrated in the physical database; when the kernel page is a cold page, it indicates that the memory access frequency of the kernel page is low at this time. In order to reduce the memory overhead caused by the kernel page, the kernel allocation function vmalloc function can be used to migrate the cold page to the virtualized database, which can not only greatly improve the success rate of the kernel page migration operation, but also reduce the memory overhead caused by the kernel page, thereby helping to reduce the application cost of the physical database; and it can also avoid the data migration operation from affecting the online operation of the data, thereby ensuring the stable progress of the data processing operation, and further improving the practicality of the method.
[0069] Figure 3 A flow chart of migrating cold pages from a physical database to a virtualized database using a memory allocation function vmalloc function is provided in an embodiment of the present invention; based on the above embodiment, refer to the attached Figure 3 As shown, this embodiment provides a technical solution for implementing the cold page migration operation by first releasing the original memory area for storing cold pages and then storing the data in the cold pages in the virtualized database. At this time, in this embodiment, using the memory allocation function vmalloc function to migrate the cold pages from the physical database to the virtualized database may include:
[0070] Step S301: Acquire the original memory area in the physical database for storing cold pages.
[0071] When the kernel page is a cold page, in order to reduce the memory overhead caused by the cold page, the cold page can be migrated from the physical database to the virtualized database. Specifically, the original memory area used to store the cold page in the physical database can be obtained first. In some instances, the original memory area used to store the cold page can be determined by a preset mapping relationship, or the original memory area used to store the cold page can be determined by a page table corresponding to the cold page, etc.
[0072] It is understandable that the original memory area can be determined not only by the above method, but those skilled in the art can also use other methods to obtain the original memory area for storing cold pages in the physical database, as long as the accuracy and reliability of obtaining the original memory area can be guaranteed, which will not be repeated here.
[0073] Step S302: Acquire the data objects included in the cold page.
[0074] In the process of migrating cold pages from a physical database to a virtualized database, in order to reduce system memory overhead and store the data included in the cold pages at the same time, after obtaining the cold pages, the cold pages can be analyzed and processed to determine the data objects included in the cold pages. The data objects are the data contents included in the cold pages.
[0075] Step S303: releasing the original memory area used to store the cold page, and storing the data object in the virtualization database based on the vmalloc function.
[0076] After obtaining the original memory area for storing cold pages, in order to reduce the memory overhead caused by the cold pages, the original memory area for storing cold pages can be released, so that the original memory area can be used to store other data, which is conducive to improving memory utilization.
[0077] Specifically, this embodiment does not limit the specific implementation method of releasing the original memory area used to store cold pages. In some instances, releasing the original memory area used to store cold pages may include: deleting the cold pages stored in the original memory area, thereby effectively implementing the release operation of the original memory area used to store cold pages. Alternatively, in other instances, releasing the original memory area used to store cold pages may include: obtaining a memory page table used to identify the association between the cold page and the original memory area; and using the unmap function to delete the memory page table to release the original memory area allocated for the cold page.
[0078] Among them, in the process of allocating the original memory area for the cold page and storing the cold page in the original memory area, in order to facilitate the memory access to the cold page, the association between the cold page and the original memory area can be stored in the memory page table. It can be seen that the mapping relationship included in the memory page table is related to the original memory area information. Therefore, in order to release the original memory area used to store the cold page, the memory page table used to identify the association between the cold page and the original memory area can be obtained, and then the memory page table can be deleted by using the unmap function, that is, the association between the cold page and the original memory area is deleted, thereby effectively releasing the original memory area allocated for the cold page. Specifically, the memory reduction operation can be performed at the granularity of the container pod or the granularity of the virtual machine VM, thereby reducing the memory area occupied by the cold page and reducing the memory overhead of the physical database.
[0079] In some other instances, releasing the original memory area used to store cold pages may also include: obtaining a mapping relationship between the cold page and the original memory area; deleting the mapping relationship using an unmap function to release the original memory area allocated for the cold page, wherein the implementation principles and effects of the above steps in this embodiment are similar to the specific implementation principles and effects of deleting the memory page table in the above embodiment, and the details may be referred to the above statements, which will not be repeated here.
[0080] It should be noted that the operation of migrating cold pages from a physical database to a virtualized database requires not only the release of the original memory area used to store the cold pages, but also the storage of data objects in the virtualized database based on the vmalloc function in order to ensure the stability of data processing operations. In some instances, storing data objects in the virtualized database based on the vmalloc function may include: obtaining a preset area in the virtualized database for storing data objects, which may be a pre-configured fixed area for storing data objects in cold pages; and then storing the data objects in the preset area in the virtualized database based on the vmalloc function, thereby realizing the storage of data objects in the virtualized database based on the vmalloc function.
[0081] In some other examples, storing the data object in the virtualization database based on the vmalloc function may include: determining a storage area allocated by the virtualization database for the data object based on the vmalloc function; and storing the data object in the storage area.
[0082] Specifically, in the process of storing data objects in cold pages into the storage area, in order to improve the space utilization of the memory area, the data objects can be compressed and stored. At this time, the storage of the data objects into the virtualized area in this embodiment may include: obtaining a virtual memory compression function zswap function for compressing the data objects; compressing the data objects using the zswap function to obtain compressed data; since the amount of compressed data is smaller than the amount of data of the data object, storing the compressed data in the storage area can effectively improve the space utilization and data storage efficiency in the storage area.
[0083] In this embodiment, by obtaining the original memory area for storing cold pages in the physical database, obtaining the data objects included in the cold pages, releasing the original memory area for storing cold pages, and storing the data objects in the virtualization database based on the vmalloc function, the cold pages are effectively migrated from the physical database to the virtualization database, thereby ensuring the accuracy and reliability of the kernel page migration operation and further improving the practicality of the method.
[0084] Figure 4 A flowchart of another kernel page migration method provided by an embodiment of the present invention; based on any one of the above embodiments, refer to the attached Figure 4 As shown, this embodiment can not only realize the migration operation of the kernel page, but also realize the access operation of the kernel page. At this time, the method in this embodiment can also include:
[0085] Step S401: obtaining an access request for a preset kernel page.
[0086] When the user has access requirements for a preset kernel page, the migration device can obtain an access request for the preset kernel page, wherein the access request is obtained in a manner similar to the method of obtaining the kernel page to be migrated in the physical database. For details, please refer to the above statements and will not be repeated here.
[0087] Step S402: Based on the access request, identify whether the preset kernel page is stored in the physical database.
[0088] After obtaining an access request for a preset kernel page, in order to implement an access operation for the preset kernel page, it is possible to identify whether the preset kernel page is stored in the physical database based on the access request. In some instances, based on the access request, identifying whether the preset kernel page is stored in the physical database may include: obtaining all storage pages in the physical database; determining the preset page identifier of the preset kernel page and the page identifiers corresponding to all storage pages; identifying whether there is a target page identifier matching the preset page identifier among the page identifiers corresponding to all storage pages; when there is a target page identifier matching the preset page identifier, determining that the preset kernel page is stored in the physical database; when there is no target page identifier matching the preset page identifier, determining that the preset kernel page is not stored in the physical database.
[0089] Step S403: when the preset kernel page is not stored in the physical database, the access operation of the preset kernel page is implemented through the virtualized database.
[0090] When the preset kernel page is stored in the physical database, it means that the preset kernel page to be accessed at this time is a hot page stored in the physical database. At this time, in order to accurately implement the access operation of the preset kernel page, the preset kernel page can be obtained through the physical database, so that the access operation of the preset kernel page can be implemented.
[0091] In the case where the preset kernel page is not stored in the physical database, it means that the preset kernel page to be accessed is a cold page and has been migrated from the physical database to the virtualized database. In order to accurately implement the access operation of the preset kernel page, the access operation of the preset kernel page can be implemented through the virtualized database. In some instances, implementing the access operation of the preset kernel page through the virtualized database may include: obtaining a page identifier of the preset kernel page; determining the preset kernel page stored in the virtualized database based on the page identifier; and then accessing the preset kernel page based on the access request.
[0092] In other instances, not only can the preset kernel page that needs to be accessed be obtained through the preset virtualization database, but a local kernel page for accessing can also be established based on the preset kernel page stored in the virtualization database to implement the kernel page access operation. At this time, implementing the preset kernel page access operation through the virtualization database may include: obtaining the virtualization page corresponding to the preset kernel page stored in the virtualization database; based on the virtualization page, establishing a local kernel page corresponding to the preset kernel page in the physical database; and accessing the local kernel page.
[0093] Among them, after obtaining the access request, the virtualized page corresponding to the preset kernel page stored in the virtualized database can be obtained first; then, based on the virtualized page, a local kernel page corresponding to the preset kernel page can be established in the physical database. Specifically, a blank local kernel page can be established in the physical database, and the data object included in the virtualized page can be obtained; the data object is filled in the blank local kernel page, thereby completing the establishment operation of the local kernel page corresponding to the preset kernel page; then the local kernel page can be accessed, thereby effectively realizing the access operation to the preset kernel page.
[0094] In some other examples, after accessing the local kernel page, in order to improve the practicality of the method, the method in this embodiment may also include: storing the local kernel page in a physical database, which effectively improves the flexibility and convenience of accessing and calling the local kernel page.
[0095] In other instances, in order to improve the effective utilization of the storage area of the virtualization database, after the local kernel page is stored in the physical database, the original storage area in the virtualization database allocated to the virtualization page can be released. At this time, the method in this embodiment can also include: obtaining the original storage area allocated to the virtualization page in the virtualization database; releasing the original storage area in the virtualization database used to store the virtualization page.
[0096] Specifically, since a local kernel page corresponding to the preset kernel page is established in the physical database, at this time, the virtualized page corresponding to the preset kernel page stored in the virtualized database is an invalid page. In order to improve the effective utilization rate of the storage area in the virtualized database, the original storage area allocated to the virtualized page in the virtualized database can be obtained. In some instances, the original storage area can be a storage area determined based on the zswap function; then the original storage area in the virtualized database used to store the virtualized page can be released, so that more valid data can be stored in the original storage area in the virtualized database, further improving the practicality of the method.
[0097] In this embodiment, an access request for a preset kernel page is obtained, and then based on the access request, it is identified whether the preset kernel page is stored in the physical database. If the preset kernel page is not stored in the physical database, the access operation of the preset kernel page can be implemented through the virtualized database, which effectively ensures stable access operations to the preset kernel page and further improves the practicality of the method.
[0098] For specific applications, refer to the attached Figure 5 As shown, in the scenario of dynamic kernel page migration, in order to solve the problem of increased memory overhead caused by memory fragmentation, this application embodiment provides a method for migrating kernel pages in a virtualization scenario, which can improve the shrinking efficiency of the memory area, greatly reduce memory overhead, and save the storage cost of kernel pages. Specifically, the execution subject of the method can be a system for migrating kernel pages, and the system for migrating kernel pages can include: a client device (i.e., corresponding to the physical database before migration in the above embodiment, such as: runc database) and a host device (i.e., corresponding to the virtualized database after migration in the above embodiment, such as: rund database). The method for migrating kernel pages implemented by the system for migrating kernel pages can include the following steps:
[0099] Step 1: The client device obtains the kernel page to be migrated.
[0100] Step 2: Determine the page type of the kernel page.
[0101] After obtaining the kernel page, the page table corresponding to the kernel page can be obtained, and the access identifier of the kernel page can be obtained through the page table. The page type of the kernel page is determined based on the access identifier. For example: when the access identifier is a preset first identifier, the kernel page is determined to be a hot page; when the access identifier is a preset second identifier, the kernel page is determined to be a cold page. This effectively ensures the accuracy and reliability of determining the page type of the kernel page.
[0102] Step 3: When the kernel page is a hot page, the memory block allocation slab module in the client device is used to determine the memory area allocated for the hot page, and the hot page is stored in the memory area.
[0103] Among them, the slab module can determine the memory area allocated to the hot page through the alloc pages function. When performing the memory area allocation operation, the memory area size parameter order applied for the hot page and the partition identifier mask corresponding to the memory area to be allocated can be determined. Then alloc_pages(mask, order) can be used to determine the memory area allocated to the hot page, which effectively ensures the accuracy and reliability of the memory area determination.
[0104] Step 4: When the kernel page is a cold page, the driver module driver in the client device can be used to migrate the cold page.
[0105] Among them, using the driver module driver in the client device to migrate the cold page may include: the driver module may use the Vmalloc function to determine the virtualized storage area allocated for the cold page in the main device, and specifically may use the Vmalloc function (unsigned, long, size) to determine the virtualized storage area allocated for the cold page in the main device, the above-mentioned unsigned is used to identify unsigned data, long is used to identify the character length information of size, and size is used to identify the space size information of the virtualized storage area. After determining the virtualized storage area, the client device may use the hypercall calling function to send the cold page to the main device to store the cold page in the virtualized storage area.
[0106] Specifically, when storing the cold page in the virtualized storage area, in order to improve the area utilization rate of the virtualized storage area, the data object included in the cold page can be obtained, and then the data object can be compressed using the compression function Zswap function to obtain the compressed data object, and the compressed data object is stored in the determined virtualized storage area. At this time, the determined virtualized storage area can be the memory area determined by the Zswap function, that is, the zswap function corresponds to a cache zswap area, and the cache zswap area can be a part of the storage area (for example: physical memory RAM). The zswap area is used to store the compressed data object, which effectively ensures the accurate migration operation of the cold page.
[0107] In addition, the driver module's migration operation on cold pages not only needs to migrate the cold pages from the client device to the virtualized storage area in the main device, but also can use the release function Unmap function to release the original memory area used to store cold pages in the client device in order to reduce the memory overhead of the memory area. In some instances, the mapping relationship between the cold pages stored in the client device and the original memory area can be deleted to achieve the release operation of the original memory area.
[0108] In some other examples, the method in this application embodiment can not only implement the migration operation of the kernel page, but also implement the access operation of the kernel page. In this case, the method in this embodiment can also include:
[0109] Step 5: Get access request for kernel page.
[0110] Step 6: Identify whether a kernel page exists in the client device based on the access request.
[0111] Step 7: When the kernel page does not exist in the client device, a page fault prompt message Pagefault / Refault may be generated.
[0112] Step 8: Based on the page missing prompt information, determine the virtualized page corresponding to the access request in the main device, and the virtualized page is the page information stored in the main device.
[0113] Step 9: Create a local kernel page corresponding to the virtualized page in the client device, and release the virtualized storage area in the host device for storing the virtualized page.
[0114] Specifically, after obtaining the virtualized page corresponding to the access request in the main device, a new blank page can be created in the client device first, and then the data object included in the virtualized page can be obtained; the data object included in the virtualized page can be copied to the blank page, so that the local kernel page corresponding to the virtualized page can be obtained, and then the virtualized storage area in the main device used to store the virtualized page can be released, which is beneficial to improve the area utilization rate of the virtualized storage area in the main device.
[0115] The technical solution provided by the present application embodiment, in a virtualization scenario, when the user side triggers the migration operation of the kernel page, the shrinking operation of the memory area can be implemented. Specifically, when the kernel page is a cold page, the virtualized memory area allocated for the cold page is determined by the vmalloc function, and the memory area can be expanded or shrunk with a minimum granularity of 2M. For example, when scanning a certain 2M interval, for the cold page to be migrated, the data object compression operation can be performed on the main device side through the preset calling mechanism hypercall, so as to ensure that the memory area corresponding to the cold page can be shrunk, which effectively realizes the virtualization of the cold page without changing the virtual application (Virtual The invention can realize the migration operation of cold pages and the shrinking operation of memory areas in the case of a virtualized application (VM), which is beneficial to reduce the impact of the migration operation of cold pages on the performance of client devices; in addition, when there is an access demand for cold pages, the above-mentioned cold pages are not stored in the client device, and page missing prompt information corresponding to the access demand can be generated at this time, and then the virtualized page stored in the main device can be determined based on the page missing prompt information, and then the local kernel page can be established in the client device based on the virtualized page, and then the access operation can be performed based on the local kernel page to realize the access operation of the kernel page, which further improves the practicality of the method and is beneficial to the market promotion and application.
[0116] Figure 6 A schematic diagram of a kernel page migration device provided by an embodiment of the present invention; Figure 6 As shown, this embodiment provides a kernel page migration device, which is used to perform the above Figure 2 The migration method of the kernel page shown in the figure, specifically, the migration device may include:
[0117] A first acquisition module 11 is used to acquire kernel pages to be migrated in a physical database;
[0118] A first determining module 12, used to determine a virtualization database for storing migrated kernel pages;
[0119] The first processing module 13 is used to migrate the cold page from the physical database to the virtualized database by using the memory allocation function vmalloc function when the kernel page is a cold page.
[0120] In some instances, when the first processing module 13 uses the memory allocation function vmalloc function to migrate cold pages from a physical database to a virtualized database, the first processing module 13 is used to execute: obtaining the original memory area in the physical database for storing cold pages; obtaining the data objects included in the cold pages; releasing the original memory area for storing cold pages, and storing the data objects in the virtualized database based on the vmalloc function.
[0121] In some instances, when the first processing module 13 releases the original memory area used to store the cold page, the first processing module 13 is used to execute: obtaining a memory page table used to identify the association relationship between the cold page and the original memory area; using the unmap function to delete the memory page table to release the original memory area allocated for the cold page.
[0122] In some instances, when the first processing module 13 stores the data object in the virtualization database based on the vmalloc function, the first processing module 13 is used to execute: based on the vmalloc function, determine the storage area allocated by the virtualization database for the data object; and store the data object in the storage area.
[0123] In some instances, when the first processing module 13 stores the data object in the virtualized area, the first processing module 13 is used to execute: obtaining a virtual memory compression function zswap function for compressing the data object; compressing the data object using the zswap function to obtain compressed data; and storing the compressed data in the storage area.
[0124] In some examples, after obtaining the kernel page to be migrated in the physical database, the first obtaining module 11 and the first processing module 13 in this embodiment are used to perform the following steps:
[0125] A first acquisition module 11 is used to acquire a page access identifier of a kernel page;
[0126] The first processing module 13 is used to determine the page type of the kernel page based on the page access identifier.
[0127] In some instances, when the first processing module 13 determines the page type of the kernel page based on the page access identifier, the first processing module 13 is used to execute: when the page access identifier is a first preset identifier, the kernel page is determined to be a hot page; when the page access identifier is a second preset identifier, the kernel page is determined to be a cold page.
[0128] In some examples, after determining that the kernel page is a hot page, the first processing module 13 in this embodiment is used to execute: using the memory allocation function alloc pages function to determine the hot page memory area allocated for the hot page; storing the hot page in the hot page memory area.
[0129] In some examples, the first acquisition module 11 and the first processing module 13 in this embodiment are used to perform the following steps:
[0130] A first acquisition module 11 is used to acquire an access request for a preset kernel page;
[0131] The first processing module 13 is used to identify whether the preset kernel page is stored in the physical database based on the access request; if the preset kernel page is not stored in the physical database, the access operation of the preset kernel page is implemented through the virtualized database.
[0132] In some instances, when the first processing module 13 implements the access operation of the preset kernel page through the virtualization database, the first processing module 13 is used to execute: obtaining the virtualization page corresponding to the preset kernel page stored in the virtualization database; based on the virtualization page, establishing a local kernel page corresponding to the preset kernel page in the physical database; and accessing the local kernel page.
[0133] In some examples, after accessing the local kernel page, the first processing module 13 in this embodiment is used to perform the following steps: storing the local kernel page in a physical database.
[0134] In some examples, after the local kernel page is stored in the physical database, the first acquisition module 11 and the first processing module 13 in this embodiment are used to perform the following steps:
[0135] A first acquisition module 11 is used to acquire an original storage area allocated for a virtualized page in a virtualized database;
[0136] The first processing module 13 is used to release the original storage area in the virtualization database used to store the virtualization page.
[0137] Figure 6 The device shown can perform Figure 1-Figure 5 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 1-Figure 5 The implementation process and technical effects of this technical solution refer to Figure 1-Figure 5 The description in the illustrated embodiment will not be repeated here.
[0138] In one possible design, Figure 6The structure of the migration device of the kernel page shown can be implemented as an electronic device, which can be a controller, a personal computer, a server, and other devices. Figure 7 As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 is used to store the corresponding electronic device to execute the above Figure 1-Figure 5 In the illustrated embodiment, the program of the kernel page migration method is provided, and the first processor 21 is configured to execute the program stored in the first memory 22 .
[0139] The program includes one or more computer instructions, wherein when the one or more computer instructions are executed by the first processor 21, the following steps can be implemented: obtaining the kernel page to be migrated in the physical database; determining the virtualization database used to implement the migration operation; when the kernel page is a cold page, using the memory allocation function vmalloc function to migrate the cold page from the physical database to the virtualization database.
[0140] Furthermore, the first processor 21 is also used to execute the aforementioned Figure 1-Figure 5 All or part of the steps in the illustrated embodiments.
[0141] The structure of the electronic device may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.
[0142] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 1-Figure 5 The program involved in the kernel page migration method in the illustrated embodiment.
[0143] In addition, an embodiment of the present invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the above Figure 1-Figure 5 The steps in the kernel page migration method in the method embodiment are shown.
[0144] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0145] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0146] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution can essentially or in other words be embodied in the form of a computer product, and the present invention can be implemented in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0147] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0148] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide the functions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1The steps of the functions specified in the blocks or multiple blocks. In a typical configuration, the computing device includes one or more processors (CPU), input / output interfaces, network interfaces and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0149] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0150] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A kernel page migration method, characterized in that: include: Get the kernel pages to be migrated in the physical database; Determine a virtualization database for storing the migrated kernel page, wherein the virtualization database refers to a database running in a container on the virtual machine; In the case where the kernel page is a cold page, the cold page is migrated from the physical database to the virtualized database using a memory allocation function vmalloc function; After obtaining the kernel page to be migrated in the physical database, the method further includes: Obtaining a page access identifier of the kernel page; Based on the page access identifier, determining a page type of the kernel page, wherein the page type includes: a cold page and a hot page; Migrating the cold page from the physical database to the virtualized database includes: The data objects in the cold pages are compressed and stored in the virtualized database.
2. The method according to claim 1, characterized in that Migrating the cold page from the physical database to the virtualized database using a memory allocation function vmalloc function, including: Acquire an original memory area in the physical database for storing the cold page; Acquire the data objects included in the cold page; The original memory area used to store the cold page is released, and the data object is stored in the virtualization database based on the vmalloc function.
3. The method according to claim 2, characterized in that Release the original memory area used to store the cold page, including: Acquire a memory page table for identifying an association relationship between the cold page and the original memory area; The memory page table is deleted by utilizing an unmap function to release the original memory area allocated for the cold page.
4. The method according to claim 2, characterized in that: Storing the data object in the virtualization database based on the vmalloc function includes: Based on the vmalloc function, determining a storage area allocated by the virtualization database for the data object; The data object is stored in the storage area.
5. The method according to claim 4, characterized in that Storing the data object in the virtualized database includes: Obtain a virtual memory compression function zswap function for compressing the data object; Compressing the data object using the zswap function to obtain compressed data; The compressed data is stored in the storage area.
6. The method according to claim 5, characterized in that Determining the page type of the kernel page based on the page access identifier includes: When the page access identifier is a first preset identifier, determining that the kernel page is a hot page; When the page access identifier is a second preset identifier, it is determined that the kernel page is a cold page.
7. The method according to claim 6, characterized in that After determining that the kernel page is a hot page, the method further includes: Determine the hot page memory area allocated for the hot page by using the memory allocation function alloc pages function; The hot page is stored in the hot page memory area.
8. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Get access request for preset kernel page; Based on the access request, identifying whether the preset kernel page is stored in the physical database; In the case that the preset kernel page is not stored in the physical database, the access operation of the preset kernel page is implemented through the virtualization database.
9. The method according to claim 8, characterized in that Implementing the access operation of the preset kernel page through the virtualization database includes: Acquire a virtualized page corresponding to the preset kernel page stored in the virtualized database; Based on the virtualized page, establishing a local kernel page corresponding to the preset kernel page in the physical database; The local kernel page is accessed.
10. The method according to claim 9, characterized in that After accessing the local kernel page, the method further includes: The local kernel pages are stored in the physical database.
11. The method according to claim 10, characterized in that After storing the local kernel page in the physical database, the method further comprises: Acquire an original storage area allocated to the virtualized page in the virtualized database; The original storage area in the virtualization database used for storing the virtualization page is released.
12. A kernel page migration device, characterized in that: include: A first acquisition module is used to acquire kernel pages to be migrated in a physical database; A first determination module is used to determine a virtualization database for storing migrated kernel pages, where the virtualization database refers to a database running in a container on a virtual machine; A first processing module is used for migrating the cold page from the physical database to the virtualized database by using a memory allocation function vmalloc function when the kernel page is a cold page; The first acquisition module is used to acquire the page access identifier of the kernel page after acquiring the kernel page to be migrated in the physical database; The first processing module is used to determine the page type of the kernel page based on the page access identifier, wherein the page type includes: cold page and hot page; The first processing module is further configured to compress and store the data objects in the cold pages into the virtualized database.
13. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1-11.
14. A computer storage medium, characterized in that: Used to store a computer program, which enables a computer to implement the method of any one of claims 1 to 11 when executed.
15. A computer program product, characterized in that include: A computer program, when executed by a processor of an electronic device, causes the processor to execute the steps of any one of the methods of claims 1-11.
Citation Information
Patent Citations
Large page memory compression recovery system and method
CN106980541A