Memory exchange method and device, computer device and storage medium

By splitting memory blocks into multiple memory pages and creating page table entries, the problem of slow page fault handling under large management granularity is solved, enabling fast data swapping and process recovery.

CN116302550BActive Publication Date: 2026-07-24ALIBABA CLOUD COMPUTING CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ALIBABA CLOUD COMPUTING CO LTD
Filing Date
2023-03-20
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

In scenarios with large management granularity, the large size of memory blocks leads to a long time spent in page fault handling. How to improve the speed of page fault handling is an urgent technical problem to be solved.

Method used

The memory block is split into multiple memory pages, and page table entries are created for each memory page. Data swapping is performed quickly by using the data swapping location recorded in the page table entry of the target memory page, reducing the management granularity to the size of the memory block. Data swapping into the target memory page is processed first.

Benefits of technology

By splitting memory pages, process execution can be quickly resumed, data volume can be reduced, and page fault handling speed can be improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302550B_ABST
    Figure CN116302550B_ABST
Patent Text Reader

Abstract

The disclosure provides a memory exchange method and device, computer equipment and a storage medium. The method comprises: in response to an out request of a memory block, splitting the memory block into a plurality of memory pages, establishing a page table entry corresponding to each memory page, performing a data out operation on the memory page, and recording a data out position in the page table entry corresponding to the memory page; in response to a page fault request initiated by a process, determining a target memory page corresponding to a virtual address carried in the page fault request, and exchanging data into a memory space of the process according to the data out position recorded in a target page table entry corresponding to the target memory page, so as to be accessed by the process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to memory swapping methods, apparatus, computer equipment, and storage media. Background Technology

[0002] The operating system allocates a certain number of memory blocks to each running process. To make flexible use of memory, the operating system's memory management module records the hot / cold status information of each memory block allocated to each process. For memory that is not frequently used by a process, memory swapping can solve the problem of insufficient memory space.

[0003] When data is swapped out of a memory block, if the virtual address a process needs to access cannot find the corresponding physical address in the page table, the operating system will generate a page fault exception. The system will then handle the page fault by swapping in the data for the process to access. In some scenarios, the memory management module uses a relatively large management granularity, so the page fault handling process can take a considerable amount of time waiting for the entire memory block's data to be written to the newly allocated memory block. Therefore, improving the speed of page fault handling is a pressing technical problem that needs to be solved. Summary of the Invention

[0004] To overcome the problems existing in the related technologies, this disclosure provides a memory swapping method, apparatus, computer equipment, and storage medium.

[0005] According to a first aspect of the present disclosure, a memory swapping method is provided, the method comprising:

[0006] In response to a memory block swapping request, the memory block is split into multiple memory pages, a page table entry is created for each memory page, a data swapping operation is performed on the memory page, and the data swapping position is recorded in the page table entry corresponding to the memory page.

[0007] In response to a page fault request initiated by a process, the target memory page corresponding to the virtual address carried in the page fault request is determined, and the data is swapped into the process's memory space according to the data swapping location recorded in the target page table entry corresponding to the target memory page, so that the process can access it.

[0008] According to a second aspect of the present disclosure, a memory switching device is provided, comprising:

[0009] The swap-out module is used to respond to a swap-out request of a memory block, split the memory block into multiple memory pages, establish a page table entry corresponding to each memory page, perform a data swap-out operation on the memory page, and record the data swap-out position in the page table entry corresponding to the memory page;

[0010] The page fault handling module is used to respond to a page fault request initiated by a process, determine the target memory page corresponding to the virtual address carried in the page fault request, and swap the data into the memory space of the process according to the data swap-out position recorded in the target page table entry corresponding to the target memory page, so that the process can access it.

[0011] According to a third aspect of the present disclosure, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method embodiments described in the first aspect above.

[0012] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the method embodiments described in the first aspect above.

[0013] The technical solutions provided by the embodiments of this disclosure may include the following beneficial effects:

[0014] In this embodiment, the management granularity remains the memory block size. However, during the memory block swapping process, the memory block is split into multiple memory pages, and page table entries are created for each memory page. Therefore, when a process triggers a page fault, the page fault request for the target memory page can be determined based on the virtual address. During the page fault handling operation, the data corresponding to the target memory page is swapped in first, based on the data swapping position recorded in the target page table entry corresponding to the target memory page, for the process to use. Then, the data swapping tasks for other memory pages are processed. Therefore, the management granularity in this embodiment remains the memory block size, but by splitting the memory pages during the swapping process, the data of the target memory page is swapped in first, resulting in a smaller amount of swapped data and faster process recovery.

[0015] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0017] Figure 1 This is a schematic diagram illustrating a reserved memory scenario according to an exemplary embodiment of this specification.

[0018] Figure 2A This is a flowchart illustrating a memory swapping method according to an exemplary embodiment of this specification.

[0019] Figure 2BThis is a schematic diagram illustrating a NUMA architecture according to an exemplary embodiment of this specification.

[0020] Figure 3 This is a block diagram of a device in which a memory swapping apparatus is located, according to an exemplary embodiment of this specification.

[0021] Figure 4 This is a block diagram illustrating a memory swapping device according to an exemplary embodiment of this specification. Detailed Implementation

[0022] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this specification as detailed in the appended claims.

[0023] The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of this specification. The singular forms “a,” “the,” and “the” as used in this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.

[0024] It should be understood that although the terms first, second, third, etc., may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this specification, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to determination."

[0025] The operating system's memory management unit divides memory into sections with defined management granularity, each section being called a page or a section. In some cases, computer devices may employ a traditional memory management architecture, where a single memory management unit manages the entire memory, allocating storage space to processes at a smaller granularity, typically 4KB (kilobyte). In other scenarios, such as virtual machine environments, computer devices may use a memory allocation architecture with reserved memory, such as... Figure 1The diagram shown is a schematic representation of a reserved memory scenario illustrated in this specification. In this architecture, the host machine's memory may include various storage spaces, such as... Figure 1 The diagram illustrates two memory storage spaces using different padding methods: a non-reserved storage space (space a) used by the kernel (filled with diagonal lines) and a reserved storage space (space b) used by virtual machines (filled with grid lines). Specifically, non-reserved storage space a is used by the kernel, and applications running on the operating system (applications 1 to 3 in the example) can use this space. Reserved storage space b, on the other hand, is used by virtual machines (VMs), such as VM1 to VMn, a total of n virtual machines. These two storage spaces can employ different management granularities; that is, the memory can be partitioned in different ways. Figure 1 For ease of illustration, the two storage spaces are shown as contiguous in the diagram. However, in practical applications, the two storage spaces can be non-contiguous. Furthermore, in real-world applications, more storage spaces can be allocated in memory to implement a wider range of functionalities.

[0026] Reserved storage space occupies a large portion of memory and is unavailable to the host kernel. A module can be inserted into the operating system kernel specifically for managing the reserved storage space. To facilitate the management of this series of memory while avoiding the memory consumption of a large amount of metadata, and considering that the memory allocated to virtual machines is often at least several hundred MB (MByte), the reserved storage space is divided with a larger granularity, such as dividing the reserved storage space into memory sections (MS) of 2MB each. In some scenarios, large granularity is also commonly used, such as 1GB (Gigabyte), which is optional. This embodiment does not limit this.

[0027] When applied to reserved memory scenarios, the operating system can use different modules to manage reserved storage space and non-reserved storage space respectively. For example, the operating system's reserved memory management module manages reserved storage space, while the kernel's memory management module manages non-reserved storage space.

[0028] Because a computer's physical memory is limited, and a process's memory usage is unpredictable, there's always a possibility that physical memory will run out. The operating system uses memory swapping to address this problem. Memory swapping includes swapping out and swapping in. Swapping out refers to storing the data from a memory block allocated to a process in another location and then releasing that memory block for reclamation by the operating system's memory management module. Swapping in refers to storing the data from the swapped-out memory block back into a new memory block and returning it to the process. For example, the kernel might select a memory block that's inactive and release it, then perform memory block merging, data compression to other memory blocks, or swapping it out to disk. The memory block is then allocated to other processes with more urgent needs. When the original process needs the data, it swaps the data into a new memory block and returns it to the original process.

[0029] When a process runs, the operating system allocates a virtual address space and a physical address space for it, and creates a page table corresponding to that process. The page table records the mapping relationship between the virtual address space and the physical address space. The operating system also maintains metadata for the managed memory, which is used for memory management. During memory swapping, the process's page table needs to be updated because the storage location of the process's data changes; the change in data storage location also causes a change in the state of the memory block, thus requiring metadata updates as well.

[0030] Page tables are a concept in virtual memory technology. To allow programs to access more available memory and expand physical memory into larger logical memory, the operating system also uses virtual memory technology. It abstracts physical memory into an address space, where the operating system allocates a separate set of virtual addresses to each process, mapping virtual addresses of different processes to physical addresses of different memory locations. When a program needs to access a virtual address, the operating system translates it into a different physical address. This involves two address concepts:

[0031] The memory address used by a program is called a virtual memory address (VA).

[0032] The physical memory address that actually exists in the hardware is called the physical memory address (PA).

[0033] Virtual addresses and physical addresses are mapped through page tables. Page tables are stored in memory. When a process cannot find a corresponding physical address in the page table for a virtual address it needs to access, the system generates a page fault exception, enters the system kernel space to allocate physical memory, updates the process page table, and finally returns to user space to resume the process's execution.

[0034] Therefore, when a page fault occurs, in order to ensure that the process that triggered the page fault can run normally, the swapping operation needs to be handled quickly. In related technologies, in scenarios with larger management granularity, such as reserved memory scenarios, the memory blocks are large, and the page fault handling process requires a long time to wait for the data stored in the entire memory block to be written to the newly allocated memory block. Therefore, how to improve the page fault handling speed in large-granularity scenarios is an urgent technical problem to be solved.

[0035] Based on this, in the memory swapping scheme of this embodiment, the management granularity is still the memory block size. However, during the memory block swapping process, the memory block is split into multiple memory pages, and page table entries are established for each memory page. Therefore, when a process triggers a page fault, it can determine the target memory page's page fault request based on the virtual address. During the page fault handling operation, the data corresponding to the target memory page is swapped in first, according to the data swapping position recorded in the target page table entry corresponding to the target memory page, for the process to use first. Then, the data swapping tasks of other memory pages are processed. Therefore, the management granularity of this embodiment is still the memory block size, but by splitting the memory pages during the swapping process, the data of the target memory page is swapped in first during the swapping in. Therefore, the amount of data swapped in is smaller, and the process can resume operation more quickly. A detailed explanation follows.

[0036] like Figure 2A The diagram shown is a schematic representation of a memory swapping method according to an exemplary embodiment of this specification, comprising the following steps:

[0037] In step 202, in response to a memory block swapping request, the memory block is split into multiple memory pages, page table entries are created for each memory page, a data swapping operation is performed on the memory page, and the data swapping position is recorded in the page table entry corresponding to the memory page.

[0038] In step 204, in response to a page fault request initiated by a process, the target memory page corresponding to the virtual address carried in the page fault request is determined, and the data is swapped into the process's memory space according to the data swap location recorded in the target page table entry corresponding to the target memory page, so that the process can access it.

[0039] The solution in this embodiment can be applied to any computer device. The computer device can be a single-core CPU (Central Processing Unit) device or a device including multiple physical CPUs. Depending on the needs, a Non-Uniform Memory Access Architecture (NUMA) can be used. A NUMA architecture includes at least two NUMA nodes, such as... Figure 2BAs shown, using two NUMA nodes as an example, the host machine can include NUMA node 1 and NUMA node 2. In a NUMA architecture, multiple physical CPUs and multiple memory modules of the host machine belong to different NUMA nodes. Each NUMA node includes at least one physical CPU and at least one physical memory module. Figure 2B Taking a NUMA node consisting of one physical CPU and one physical memory as an example. Within a NUMA node, the physical CPU and physical memory communicate using the Integrated Memory Controller Bus (IMC Bus), while NUMA nodes communicate with each other using Quick Path Interconnect (QPI). Because the latency of QPI is higher than that of the IMC Bus, the physical CPU's access to memory on the host machine differs in terms of distance (remote / local). The physical CPU can access the physical memory of its own node faster, while accessing the physical memory of other NUMA nodes is slower.

[0040] In a NUMA architecture scenario, the memory in this embodiment may include any of the aforementioned physical memory. Optionally, any physical memory in a NUMA architecture may also employ a reserved memory architecture. Based on this, the storage space managed in this embodiment may also refer to the reserved storage space within any physical memory in a NUMA architecture.

[0041] It is understood that in practical applications, computer devices may also adopt other architectures. Depending on actual needs, the memory referred to in this embodiment may have multiple implementation methods depending on the actual application scenario, which will not be listed one by one here.

[0042] The method described in this embodiment can be applied to the operating system of any computer device. As in the aforementioned reserved memory scenario, it can be applied to the memory swapping function of the reserved memory management module in the operating system. This method can run continuously after the computer device starts up, performing memory swapping as needed. Alternatively, it can be started and run only when required, for example, after receiving a startup command. This startup command can be initiated by a technician or automatically initiated according to preset rules, etc.

[0043] The process in this embodiment may include any process running in a computer device, such as the aforementioned virtual machine, etc.

[0044] The memory swapping in this embodiment can be understood as exchanging data from main memory to secondary storage. It can include various swapping methods, such as memory merging (or memory block merging), memory compression (or memory block data compression), and data exchange with external storage. As an example, memory merging refers to the operating system's memory merging module retrieving cold-state memory blocks to be released, initially as candidate memory blocks. Subsequent retrieved memory blocks are compared with the data stored in each candidate memory block to determine if there is a mergeable block, until a mergeable candidate block is found or all candidate memory blocks have been traversed. If a mergeable candidate block is found, the virtual address of the memory block to be released is mapped to the physical address of the found candidate block, thus releasing the physical address of the memory block to be released. Memory compression refers to compressing the data of the original memory block using a compression algorithm and storing it in a smaller memory block, thereby releasing the original memory block. Data exchange with external storage refers to storing the memory block data in external storage, such as a disk, to release the memory block. When needed, the data is retrieved from the external storage, stored in the memory block, and returned to the process.

[0045] Optionally, for step 202, the memory block swapping request can be initiated by the swapping decision function in the memory management module. The swapping decision function in the memory management module can determine whether to initiate a memory block swapping based on the memory's operating status. If a memory block is determined to be swapped out, this embodiment executes the subsequent swapping process. For scenarios such as reserved memory, the memory block granularity is relatively large. To facilitate rapid swapping in subsequent steps, this embodiment splits the memory block into multiple memory pages, i.e., memory pages are a smaller granularity. The splitting method can be flexibly configured as needed; the sizes of the split memory pages can be the same or different, and the size of the memory pages can also be configured as needed.

[0046] In some examples, this embodiment is applied to the reserved memory management module, where the kernel's memory management unit manages memory at a different granularity than the reserved memory management module. The step of splitting the memory block into multiple memory pages may include:

[0047] Based on the granularity of memory management by the memory management unit, the memory block is split into multiple memory pages.

[0048] As an example, in a reserved memory scenario, a 2MB memory block can be divided into 512 4KB memory pages. The split memory pages have the same management granularity as the kernel's memory management unit. Therefore, the page table entries of each split memory page are consistent with the page table entries of the memory pages managed by the memory management unit. This embodiment facilitates page table management when there are multiple memory management functions.

[0049] For each memory block that has been split off, a page table entry is created for each memory page. In practice, the page table structure can be configured as needed. For example, some kernels use a four-level page table structure, including: Page Global Directory (PGD), Page Upper Directory (PUD), Page Middle Directory (PMD), and Page Table Entry (PTE). Under more stringent management requirements, a page table structure with fewer than four levels is also optional. For example, a three-level page table structure can be used in reserved memory scenarios. Higher-level page table structures are also optional in practice. Therefore, the page table entries here can be page table entries of any page table structure.

[0050] It's understandable that the memory block to be swapped out already has a corresponding page table entry. Optionally, the page table entry for each split memory page can be associated with the page table entry of the memory block. For example, the page table entry for each memory page can be the next level of the page table entry for the memory block. In reserved memory scenarios, memory blocks use a larger granularity. For example, the page table can adopt a three-level structure. The page table entry for the memory block is the Page Intermediate Directory (PMD) to reduce the page table's space usage and improve page table lookup efficiency. The page table entry for the split memory page is the Page Table Entry (PTE). Therefore, the PTE for each memory page can be the next level page table entry of the memory block's PMD, and each PTE can be directly associated with the PMD of the previous level.

[0051] Subsequently, data swapping operations can be performed on the memory pages. Optionally, the data swapping operations of the split memory pages can be implemented serially or in parallel. Optionally, a swapping task queue can be established to store the swapping tasks for each memory page. Completing the swapping tasks of all memory pages requires a certain amount of time. If a page fault occurs during this period, the swapping task queue can be used to easily stop the swapping and perform a rollback of the swapped-in pages.

[0052] After all memory blocks have been successfully swapped out, the swap location can be recorded in the page table entry corresponding to the memory page. Optionally, other information can also be recorded in the page table entry as needed; this embodiment does not limit this.

[0053] After a memory block is successfully swapped out, its physical address is reclaimed, and neither the page table entry for the memory block nor the page table entries for each memory page record its physical address. For a process, it can access any address in its allocated virtual address space. When a process accesses any virtual address of the swapped-out memory block, a page fault request is triggered because the physical address is not recorded in the page table. Since the memory block has been split into multiple memory pages, and page table entries for each memory page have been created, the memory page corresponding to the virtual address carried in the page fault request can be determined; in this embodiment, this is referred to as the target memory page.

[0054] In practical applications, taking the Linux operating system as an example, the allocation of virtual address ranges for user-mode processes is implemented by the kernel-provided system call `mmap()`. Here, "mmap()" refers to the kernel-provided interface name. After the `mmap()` interface is called, it allocates virtual address space for the process and generates VMA metadata, namely the kernel's `vm_area_struct` structure, abbreviated as VMA, also known as the process address space or process linear region. The kernel uses this structure to define virtual memory regions and is the most basic management unit for virtual memory management. VMA metadata uses virtual addresses as unique identifiers. This VMA metadata includes multiple fields, one or more of which are used to store pointers to various operation functions in the relevant operation function set, such as pointers to functions related to page fault handling. For step 202, the actual implementation could be a page fault handling function, which can be attached to the page fault handling function pointers stored in the VMA metadata to respond to relevant page fault requests.

[0055] This embodiment addresses page fault handling for a target memory page, including: swapping data into memory according to the data swap-out location recorded in the target page table entry corresponding to the target memory page, so that the process can access it. That is, the data is swapped back into main memory, such as the memory space allocated to the process, allowing the process to access the required data. In this embodiment, only the target memory page is swapped in, thus quickly recovering from the page fault and enabling the process to run normally. Since management is done at the memory block level, data can be swapped in after allocating a free memory block; in other examples, mixed-granularity management can be implemented as needed, allocating free memory pages to swap in data.

[0056] As for the other memory pages that belong to the same block as the target memory page and are split together, in practical applications, they can either be swapped in or remain swapped out until the process accesses them before being swapped in.

[0057] When swapping in a target memory page, the method uses a free memory block. Since only one page of data is written, the free memory block still has a large amount of free space, while the process already needs to access the target memory page, and the probability of other memory blocks being accessed is also relatively high. Based on this, in some examples, the method may further include:

[0058] For the other memory pages of the target memory block from which the target memory page is split, process the data swapping tasks for the other memory pages.

[0059] Therefore, in this embodiment, other memory pages can be swapped in first to ensure the efficient operation of the process. Since the data of the target memory page has already been swapped in for the process to use, the data swapping in of other memory pages is processed asynchronously relative to step 202.

[0060] In some examples, the task of handling the data swapping in of the other memory pages may include:

[0061] Establish a swap-in task queue; wherein, the swap-in task queue includes: data swap-in tasks corresponding to each of the other memory pages;

[0062] If the set triggering conditions are met, process each data swapping task in the swapping task queue.

[0063] In this embodiment, instead of swapping in existing memory blocks, the swapping in of the target memory page is performed. Because memory pages have a smaller granularity, page fault operations can be completed more quickly. Simultaneously, a swapping task queue stores multiple data swapping tasks, with each data swapping task corresponding to a memory page swapping operation. The target memory page and multiple other memory pages are derived from the same memory block during swapping out. For example, if the swapped-out memory block is split into 512 memory pages, and the virtual address triggering the page fault is the target memory page, then the swapping task queue can include 511 data swapping tasks for other memory pages. Optionally, including data swapping tasks for the target memory page is also optional; the process only needs to identify that the target memory page has been swapped in when processing the swapping task queue.

[0064] Since the data in the target memory page has already been swapped in for the process to use, the swap-in task queue in this embodiment is processed asynchronously. Subsequently, when a set trigger condition is detected, the data swap-in tasks in the swap-in task queue are processed. Optionally, the set trigger condition can be configured as needed. For example, it can include the processor being in an idle state. This idle state can have various forms, such as being in a preset idle time period, or being determined to be in an idle state by one or more hardware indicators of the device; or it can be that there is no need to perform a page fault handling operation at present, so that the execution of the swap-in task queue is started as soon as possible after the page fault exception handling operation is completed. Through the above embodiment, asynchronous data swap-in tasks can be executed under various set trigger conditions, realizing the flexibility of asynchronous processing, and also allowing the processor to prioritize urgent tasks. During asynchronous processing, the swap-in task queue can be processed serially or in parallel by multiple CPUs.

[0065] In some examples, swapping data into the process's memory space according to the data swap-out location recorded in the target page table entry corresponding to the target memory page includes:

[0066] Allocate a free memory block for the process, read data from the data swap location recorded in the target page table entry corresponding to the target memory page, and write the read data to the corresponding location of the target memory page in the free memory block;

[0067] The task of swapping in the other memory pages includes:

[0068] Read data from the data swap location recorded in the page table entry of the other memory page, and write the read data to the corresponding location of the other memory page in the free memory block.

[0069] In this embodiment, under the large-granularity management of memory blocks, during the swapping of the target memory page, this embodiment allocates a new free memory block according to the existing granularity, referred to as a free memory block in this embodiment, while the swapped-in data is the data of the target memory page at a small granularity. This embodiment can calculate the corresponding position of the target memory page in the free memory block based on the virtual address, the granularity of the memory block, and the granularity of the memory page. For example, if the target memory page is at position 10 when it is split from the target memory block, then during data swapping, the data is read from the page table entry recording the data swap-out position and written to the position of the 10th memory page in the free memory block. Similarly, in the asynchronous swapping task queue, each data swapping task, during processing, reads data from the page table entries of the other memory pages corresponding to the data swapping task and writes it to the corresponding position of those other memory pages in the free memory block.

[0070] In some examples, after the step of processing the data swapping task of the other memory pages, the method further includes:

[0071] Obtain the page table entry corresponding to the target memory block, and write the physical address of the free memory block into the obtained page table entry;

[0072] Delete the page table entries corresponding to the target memory page and each of the other memory pages.

[0073] In this embodiment, after the swapping out of each memory page is completed, the data is swapped into the newly allocated memory block. Therefore, based on the virtual address of the target memory page carried in the page fault request, the page table entry corresponding to the target memory block from which the target memory page was split can be obtained. For example, the page table entry is uniquely identified by the virtual address. Since the memory block has been swapped out, multiple page table entries for memory pages are also split under the page table entry of the memory block. Based on the virtual address carried in the page fault request, the corresponding page table entry for the target memory page can be determined, as can the page table entry corresponding to the target memory block from which the target memory page was split. Then, the physical address of the free memory block is written into the obtained page table entry. In this way, the process can access the data through the page table entry of the memory block. Since multiple page table entries for memory pages are split during the swapping out, this embodiment deletes the page table entries corresponding to each memory page obtained from the target memory block after successful swapping in, thus reducing the space occupied.

[0074] In some examples, swapping data into the process's memory space according to the data swap-out location recorded in the target page table entry corresponding to the target memory page includes:

[0075] Determine whether lock protection for page fault handling of the target memory page can be obtained;

[0076] If the lock protection for page fault handling of the target memory page is successfully acquired, check whether the target memory page is still in a page fault state;

[0077] If the process is not in a page fault state, a page fault handling completion message is returned; if the process is still in a page fault state, the data is swapped into the process's memory space according to the data swapping position recorded in the target page table entry corresponding to the target memory page.

[0078] In multi-CPU scenarios, multiple threads within a process may execute on different CPUs, and multiple processes within a process share the memory address space allocated to the process. Therefore, multiple different threads may simultaneously trigger page faults at the same virtual address. To prevent multiple processors from handling page faults simultaneously, this embodiment acquires a lock for the target memory page before performing page fault handling. Since acquiring the lock takes time, other processors may have just finished handling the page fault during the lock acquisition process. Therefore, after successfully acquiring the lock for the target memory page, this embodiment checks whether the target memory page is still in a page fault state. If it is in an accessible state, it means another processor has just finished handling the page fault, so a page fault completion message is returned, and processing ends. If it is still in a page fault state, the page fault handling operation is then performed. This embodiment ensures the accuracy of page fault handling in multi-CPU scenarios, addressing the possibility of multiple different threads within a process simultaneously triggering page faults at the same virtual address. Optionally, before acquiring lock protection, you can first check if you are in a page fault state. If you are not in a page fault state, return a page fault handling completed message. If you are still in a page fault state, then acquire lock protection.

[0079] In some cases, if lock acquisition fails, the lock acquisition step can be executed again. While this method can acquire lock protection quickly, it consumes processor resources, preventing the processor from handling other tasks. Considering that failure to acquire lock protection likely indicates that another processor is performing a swap-in, in this embodiment, the method may further include:

[0080] If the lock protection is not successfully acquired, the process will sleep for a preset time before proceeding with the step of determining whether the lock protection for page fault handling of the target memory page can be acquired.

[0081] In this embodiment, if the lock protection is not successfully acquired, the processor sleeps for a preset time. While the task to acquire the lock protection is in a sleep state, the processor can handle other tasks. After the preset time expires, the processor resumes the task of acquiring the lock protection. Therefore, the sleep period allows the processor to execute other tasks, preventing the processor from consuming processor resources. The preset time can be flexibly configured as needed, such as 10 microseconds. During this sleep period, other processors may have already handled page faults. Therefore, after acquiring the lock protection, the processor checks whether the target memory page is still in a page fault state to determine whether to return a page fault completion message or perform a page fault handling operation.

[0082] The following example illustrates this further. This example uses a scenario involving reserved memory on the host machine as an example, demonstrating how to achieve relatively fast page fault handling.

[0083] Example 1: Page Fault Preprocessing in Host Machine Reserved Memory

[0084] This embodiment can be applied to a reserved memory management module, which uses a larger management granularity for reserved memory space, such as 2MB or 1GB. In this embodiment, the page table is pre-processed during memory block swapping to improve the efficiency of swapping in during page fault handling. Optionally, the following steps may be included:

[0085] 1. Determine the memory block (ms) that needs to be swapped out, and the target storage location to be swapped out.

[0086] In this embodiment, memory swapping out can include the following three modes: exchanging data with external storage, compressing memory block data, or merging memory blocks. Correspondingly, the target storage location here can be external storage (such as a disk), a smaller-granularity memory block in memory used to store compressed memory data, or a memory block managed by a reserved memory management module.

[0087] 2. The page table entry corresponding to the memory block ms to be swapped out is split into multiple smaller page table entries.

[0088] For example, a memory block ms to be swapped out is 2MB in size, and this memory block ms has a corresponding page table entry in the page table before swapping out. In this embodiment, during the swapping out process of this memory block ms, the page table entry of the memory block ms is split into 512 page table entries, and each page table entry corresponds to a memory page with a granularity of 4KB (also referred to as a small page in this embodiment).

[0089] In related technologies, some kernels employ a four-level page table structure, including: Page Global Directory (PGD), Page Upper Directory (PUD), Page Middle Directory (PMD), and Page Table Entry (PTE). Optionally, if the reserved memory space uses a larger granularity, the page table structure can adopt a three-level structure. Based on this, where the page table entry for a memory block ms is a PMD, the page table entries for the 512 4KB memory blocks can be used to create the next-level PTE under the PMD corresponding to the memory block ms.

[0090] 3. In the PTE page table entry corresponding to each 4KB granular page (mp) after the memory block ms is split, set the status of each page to read-only, so that each page (and also the memory block ms) cannot be written to.

[0091] 4. Swap out the data stored in each 4KB granular page mp after splitting the memory block ms to the target storage location, i.e., the data swapping location in the aforementioned embodiment.

[0092] In this embodiment, the swapping out of 512 small pages can be performed serially or in parallel. Optionally, a swapping task queue can be established, storing 512 swapping tasks, each corresponding to one of the 512 small pages. In the case of parallel operation, if a swapping task is interrupted, the swapped-out position needs to be checked and a swap-in rollback performed.

[0093] 5. Clear the PTE page table entries of memory block ms, and write the relevant information of the target storage location into the PTE page table entries of each memory page.

[0094] 6. After swapping out 512 4KB pages, reclaim the memory block ms, retaining the 512 PTE-level page table entries after the split.

[0095] Example 2: Page Fault Handling in Host Machine Reserved Memory

[0096] This embodiment is used to quickly perform memory swapping in the event of a page fault using the following steps. Optionally, it may include the following steps:

[0097] 1. In response to a page fault request, determine whether the virtual address that triggered the page fault is a page that has been swapped out. If not, return the request directly to the kernel for processing. In this embodiment, since the page table of the memory block has been split into multiple 4K page table entries, the virtual address that triggered the page fault can be used to determine the corresponding target memory page. In other words, the page fault request can be understood as coming in from the PTE entry point.

[0098] 2. Determine if the virtual address of the page fault is being swapped out; if so, proceed to step 3; otherwise, proceed to step 6.

[0099] If the page is being swapped out, it means that the swapping process of memory block ms has not yet been completed. Since step 3 of embodiment 1 has changed the page to read-only to prevent data from being changed during the swapping process, if memory block ms is accessed at this time, a page fault will be triggered.

[0100] Whether a swap is in progress can be determined in several ways, such as by checking if there is a swap task queue as described in step 4 of Example 1.

[0101] 3. If the swapping is in progress, set the swapping cancellation flag for the structure corresponding to the swapping task, trigger the operation rollback, and remove the write protection of the corresponding 4KB page to restore it to a read-write state.

[0102] 4. If swapping out is in progress, simultaneously check if a task queue for swapped-out memory blocks (ms) and their re-swapped memory blocks (mp) has already been established; if the task queue already exists, return and end the process.

[0103] This situation mainly occurs in multi-CPU scenarios, where other CPUs have already triggered the re-swapping of the memory block by milliseconds.

[0104] 5. If there is no task queue for swapped-out pages in the memory block (ms) that has been swapped out and then swapped back in, this step requires swapping back all the pages in the memory block.

[0105] Optionally, a task queue for swapping in small pages can be established to record all 4KB small pages that have been swapped out under the same 2MB page that need to be swapped in again and returned. At the beginning of the embodiment, when swapping out, a task queue for swapping out each 4KB small page is established. At this time, the swapping out tasks of small pages can be taken from this task queue and placed into the task queue for swapping in small pages here, so that each small page can be swapped back in.

[0106] In other examples, there may be other processing methods. Since this embodiment splits the memory block into 512 4KB pages, and since the memory block has not completed the swapping out of all 512 pages, the memory block is not released, and the data stored in it is still there. Alternatively, the re-swap-in operation can be skipped, and the step of restoring the page table can be performed directly, while discarding the data that has already been swapped out.

[0107] 6. If the virtual address of the page fault is not being swapped out, it means that the memory block corresponding to the virtual address has already been swapped out, and the page fault swapping process needs to be executed: The process can access any location in the virtual address space allocated to it. The accessed virtual address can first perform an alignment operation to align the virtual address vaddr0 of the page fault to the virtual address vaddr of the 4KB small page granularity memory block.

[0108] 7. Since different CPUs may trigger page faults at the same virtual address vaddr0 simultaneously, check whether the address of the memory block vaddr can be read or written before actually swapping it in. If it can be accessed, it means that another thread has already handled the page fault, and return that the handling was successful.

[0109] In this embodiment, in a multi-CPU scenario, there is a certain amount of time between one CPU executing step 1 and step 6, during which other CPUs may have already successfully swapped in the data for the memory block. If the computer device has only one CPU, this step is unnecessary.

[0110] 8. If direct access is still not possible, in order to avoid handling multiple page faults simultaneously, attempt to acquire the lock protection for the page fault. If the lock protection is successfully acquired, proceed to step 10; if the lock protection is not successfully acquired, proceed to step 9.

[0111] 9. If the lock acquisition fails, you can sleep for a short period of time as needed, and then return the page fault retry flag. In this way, the page fault will be retried, and when you come in again, other threads may have already handled the page fault.

[0112] The sleep duration can be configured as needed. Since page faults occur in an interrupt context, prolonged sleep (e.g., 10 microseconds) may cause the host machine to freeze. This embodiment does not impose such restrictions. Optionally, sleep can be omitted. In this case, the CPU will continuously check until it successfully acquires the lock. During this process, the CPU cannot relinquish resources, which may affect the completion of other tasks.

[0113] 10. After acquiring the swapped-in page fault lock, check again whether the memory block can be directly accessed. Because the above steps are not atomic operations, the page fault may have been handled during the lock acquisition process. If it can be accessed, unlock it and return a success message.

[0114] 11. If it cannot be directly accessed, the formal page fault swapping operation begins. Since the process's page table is recorded in the vma structure, the PTE page table entry corresponding to the aligned vaddr address can be obtained from the vma structure (the vma structure is uniquely identified by the process's virtual address) based on the vma structure to which the page fault's virtual address belongs. From the PTE page table entry, the secondary storage device ds to which vaddr was swapped out, and the target storage location ids of the page content in the secondary storage are parsed out.

[0115] 12. Attempt to allocate a memory block ms from main memory, with the physical address paddr of ms; if allocation fails, release the page fault lock and return a page fault exception; otherwise, proceed to step 13.

[0116] 13. Establish a temporary mapping relationship between paddr and a virtual address vaddr1 (kernel-mode virtual address).

[0117] This embodiment is executed by a kernel module. Kernel modules can only use the kernel-mode address space. Therefore, in this embodiment, after setting the kernel-mode virtual address vaddr1, data is written to the paddr in memory using vaddr1.

[0118] 14. Call the read function of the secondary storage (which can be read from disk, from persistent memory, or even restored from a zero page, or restored from a decompressed page, etc.) to write the contents of the secondary storage ids location to the paddr corresponding to the virtual address vaddr1.

[0119] During the write operation, the specific write location can be analyzed. At this time, a memory block is allocated, while a 4KB page is to be written. The location can be determined based on the virtual address of the page fault, the granularity of the page, and the granularity of the memory block.

[0120] 15. Waiting for the read / write to complete, or a read / write error may occur.

[0121] 16. If successful, cancel the temporary mappings of vaddr1 and paddr; if a read error occurs or the write process is canceled, release the page fault lock and return failure; otherwise, proceed to the next step. Optionally, mappings for all kernel-mode virtual addresses can be pre-established for all physical addresses, and the mappings can be left unresolved after use, avoiding the overhead of creating or canceling mappings each time.

[0122] 17. If the swap is successful, the PTE page table corresponding to the process's vaddr needs to be updated to establish the association with paddr.

[0123] 18. Create an asynchronous task to record all 4KB pages within the 2MB-aligned address vaddr2 (where vaddr is located) into the asynchronous data swapping task queue. Then, perform active swapping operations and complete page fault handling.

[0124] At this point, the content corresponding to vaddr in the secondary storage has not yet been fully swapped into paddr.

[0125] Example 3: Asynchronous Task Processing for Page Faults in Host Machine Reserved Memory

[0126] This embodiment is executed asynchronously after step 18 of embodiment two, and is used to process tasks asynchronously added to the task queue. It may include the following steps:

[0127] 1. Take a 4KB page from the data swapping task queue and swap it in actively; you can first determine whether the page has been swapped in due to a page fault, and if so, take the next 4KB page.

[0128] 2. Otherwise, swap a 4KB page into the corresponding memory block ms.

[0129] 3. Repeat steps 1 and 2. After all 4k small pages under ms have been successfully swapped in, other metadata in the reserved memory needs to be updated.

[0130] 4. Attempt to acquire the memory allocation information protection lock, update the memory allocation information mmap, and record the paddr corresponding to ms into the position corresponding to vaddr2 in mmap;

[0131] 5. Complete the asynchronous task handling for page fault exceptions and delete the asynchronous task queue.

[0132] 6. Perform the page table recovery operation, which involves deleting the page table entries corresponding to each of the 512 4KB small pages, shrinking the page table back to a 2MB memory block of page table entries; thereby reducing the page table space occupied and improving query efficiency.

[0133] Corresponding to the embodiments of the aforementioned memory swapping method, this specification also provides embodiments of a memory swapping apparatus and the computer equipment on which it is applied.

[0134] The embodiments of the memory switching device described in this specification can be applied to computer devices, such as servers or terminal devices. The device embodiments can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by a processor that handles file processing reading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 3 The diagram shown is a hardware structure diagram of a computer device containing the memory switching device described in this manual. (Except for...) Figure 3 In addition to the processor 310, memory 330, network interface 320, and non-volatile memory 340 shown, the computer device in which the memory switching device 331 is located in the embodiment may also include other hardware depending on the actual function of the computer device, which will not be described in detail here.

[0135] like Figure 4 As shown, Figure 4 This is a block diagram illustrating a memory swapping apparatus according to an exemplary embodiment of this specification, the apparatus comprising:

[0136] The swap-out module 41 is used to respond to a swap-out request of a memory block, split the memory block into multiple memory pages, establish a page table entry corresponding to each memory page, perform a data swap-out operation on the memory page, and record the data swap-out position in the page table entry corresponding to the memory page;

[0137] Page fault handling module 42 is used to respond to a page fault request initiated by a process, determine the target memory page corresponding to the virtual address carried in the page fault request, and swap the data into the memory space of the process according to the data swap location recorded in the target page table entry corresponding to the target memory page, so that the process can access it.

[0138] In some examples, the device further includes:

[0139] The asynchronous swap-in module is used to process the data swap-in tasks of other memory pages in the target memory block from which the target memory page is split.

[0140] In some examples, the page fault handling module 42 is further configured to: establish a swap-in task queue; wherein the swap-in task queue includes: data swap-in tasks corresponding to each of the other memory pages;

[0141] The asynchronous swap-in module is also used to process each data swap-in task in the swap-in task queue if a set trigger condition is detected.

[0142] In some examples, the page fault handling module 42 is also used for:

[0143] Allocate a free memory block for the process, read data from the data swap location recorded in the target page table entry corresponding to the target memory page, and write the read data to the corresponding location of the target memory page in the free memory block;

[0144] The process of processing each data swapping task in the swapping task queue includes:

[0145] Read data from the data swap location recorded in the page table entry of the other memory page, and write the read data to the corresponding location of the other memory page in the free memory block.

[0146] In some examples, the asynchronous swap-in module is also used for:

[0147] Obtain the page table entry corresponding to the target memory block, and write the physical address of the free memory block into the obtained page table entry;

[0148] Delete the page table entries corresponding to the target memory page and each of the other memory pages.

[0149] In some examples, the set triggering conditions include: the processor is currently idle, or there is currently no need to perform a page fault operation.

[0150] In some examples, the page fault handling module 42 is also used for:

[0151] Determine whether lock protection for page fault handling of the target memory page can be obtained;

[0152] If the lock protection for page fault handling of the target memory page is successfully acquired, check whether the target memory page is still in a page fault state;

[0153] If the process is not in a page fault state, a page fault handling completion message is returned; if the process is still in a page fault state, the data is swapped into the process's memory space according to the data swapping position recorded in the target page table entry corresponding to the target memory page.

[0154] In some examples, the page fault handling module 42 is also used for:

[0155] If the lock protection is not successfully acquired, the process will sleep for a preset time before proceeding with the step of determining whether the lock protection for page fault handling of the target memory page can be acquired.

[0156] In some examples, the device is used in a reserved memory management module in an operating system, which also includes a memory management unit;

[0157] The swapping module is also used for:

[0158] Based on the granularity of memory management by the memory management unit, the memory block is split into multiple memory pages.

[0159] The specific implementation process of the functions and roles of each module in the above-mentioned memory swapping device can be found in the implementation process of the corresponding steps in the above-mentioned memory swapping method, and will not be repeated here.

[0160] Accordingly, this specification also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the aforementioned memory swapping method embodiments.

[0161] Accordingly, embodiments of this specification also provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the memory swapping method embodiment.

[0162] Accordingly, embodiments of this specification also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the memory swapping method embodiments.

[0163] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The device embodiments described above are merely illustrative. The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of the solution in this specification according to actual needs. Those skilled in the art can understand and implement this without creative effort.

[0164] The above embodiments can be applied to one or more computer devices. The computer device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions. The hardware of the computer device includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0165] The computer device can be any electronic product that can interact with the user, such as a personal computer, tablet computer, smartphone, personal digital assistant (PDA), game console, interactive network television (IPTV), smart wearable device, etc.

[0166] The computer equipment may also include network equipment and / or user equipment. The network equipment includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud based on cloud computing consisting of a large number of hosts or network servers.

[0167] The network in which the computer device is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and virtual private network (VPN).

[0168] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.

[0169] The steps of the various methods described above are only for clarity. In practice, they can be combined into one step or some steps can be split into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this patent. Adding insignificant modifications or introducing insignificant designs to the algorithm or process, but without changing the core design of the algorithm and process, are also within the scope of protection of this application.

[0170] The terms "specific example" or "some examples," etc., refer to specific features, structures, materials, or characteristics described in connection with the embodiments or examples, which are included in at least one embodiment or example of this specification. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.

[0171] Other embodiments of this specification will readily occur to those skilled in the art upon consideration of the specification and practice of the invention claimed herein. This specification is intended to cover any variations, uses, or adaptations that follow the general principles of this specification and include common knowledge or customary techniques in the art not claimed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this specification are indicated by the following claims.

[0172] It should be understood that this specification is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this specification is limited only by the appended claims.

[0173] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.

Claims

1. A memory swapping method, the method comprising: In response to a swap-out request for a memory block in the reserved memory used by the virtual machine in the host machine, the memory block is split into multiple memory pages, a page table entry corresponding to each memory page is created, a data swap-out operation is performed on the memory page, and the data swap-out position is recorded in the page table entry corresponding to the memory page. In response to a page fault request initiated by a process, the target memory page corresponding to the virtual address carried in the page fault request is determined. Data is swapped into the process's memory space according to the data swapping location recorded in the target page table entry corresponding to the target memory page, so that the process can access it. For other memory pages in the target memory block from which the target memory page is split, the data swapping tasks of the other memory pages are processed.

2. The method according to claim 1, wherein processing the data swapping task of the other memory pages includes: Establish a swap-in task queue; wherein, the swap-in task queue includes: data swap-in tasks corresponding to each of the other memory pages; If the set triggering conditions are met, process each data swapping task in the swapping task queue.

3. The method according to claim 1, wherein swapping data into the process's memory space according to the data swap-out location recorded in the target page table entry corresponding to the target memory page includes: Allocate a free memory block for the process, read data from the data swap location recorded in the target page table entry corresponding to the target memory page, and write the read data to the corresponding location of the target memory page in the free memory block; The task of swapping in the other memory pages includes: Read data from the data swap location recorded in the page table entry of the other memory page, and write the read data to the corresponding location of the other memory page in the free memory block.

4. The method according to any one of claims 1 to 3, wherein after the step of processing the data swapping task of the other memory pages, the method further comprises: Obtain the page table entry corresponding to the target memory block, and write the physical address of the free memory block into the obtained page table entry; Delete the page table entries corresponding to the target memory page and each of the other memory pages.

5. The method according to claim 2, wherein setting the trigger condition includes: The processor is currently idle, or there is no page fault operation required at present.

6. The method according to claim 1, wherein swapping data into the process's memory space according to the data swap-out location recorded in the target page table entry corresponding to the target memory page comprises: Determine whether lock protection for page fault handling of the target memory page can be obtained; If the lock protection for page fault handling of the target memory page is successfully acquired, check whether the target memory page is still in a page fault state; If the page fault is not in a page fault state, a page fault handling completion message is returned; If the page fault persists, the data is swapped into the process's memory space according to the data swap location recorded in the target page table entry corresponding to the target memory page.

7. The method according to claim 6, further comprising: If the lock protection is not successfully acquired, the process will sleep for a preset time before proceeding with the step of determining whether the lock protection for page fault handling of the target memory page can be acquired.

8. The method according to claim 1, wherein the method is applied to a reserved memory management module in an operating system, and the operating system further includes a memory management unit; The step of splitting the memory block into multiple memory pages includes: Based on the granularity of memory management by the memory management unit, the memory block is split into multiple memory pages.

9. A memory switching device, the device comprising: The swap-out module is used to respond to swap-out requests in the reserved memory blocks in the host machine for use by virtual machines, split the memory blocks into multiple memory pages, establish page table entries corresponding to each memory page, perform data swap-out operations on the memory pages, and record the data swap-out position in the page table entries corresponding to the memory pages. The page fault handling module is used to respond to a page fault request initiated by a process, determine the target memory page corresponding to the virtual address carried in the page fault request, swap the data into the process's memory space according to the data swapping location recorded in the target page table entry corresponding to the target memory page, so that the process can access it; and process the data swapping tasks of other memory pages in the target memory block from which the target memory page is split.

10. A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method of any one of claims 1 to 8.

11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.