Method for determining page visit times, electronic device and computing device

By storing the number of page accesses in the ignored bits of the target page table entry and updating it, the problem of incomplete statistics in the prior art is solved, and the efficiency and memory utilization of page migration services are improved.

CN117290195BActive Publication Date: 2025-04-25XFUSION DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311099747.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-29
Publication Date
2025-04-25
Estimated Expiration
2043-08-29

AI Technical Summary

Technical Problem

When the existing technology counts the number of page visits, the statistics are incomplete, which affects the effectiveness and memory utilization of subsequent page migration services.

Method used

By storing the number of page accesses in the ignored bit of the target page table entry and updating the number of times when the access bit indicates that the page is accessed, additional storage space overhead is avoided and query efficiency is improved.

Benefits of technology

A more comprehensive page visit count is achieved, improving the efficiency of page migration services and memory utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117290195B_ABST
    Figure CN117290195B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method for determining the number of page accesses, an electronic device, and a computing device, which relates to the field of memory management technology, improves the efficiency of querying the page access number information of a specified page, and thus can improve the utilization rate of memory. The method includes: determining a target page table address; wherein the target page table address is used to indicate the storage address of the target page table in the memory of the computing device; based on the target page table address, obtaining the target page table; determining the access bit state of the target page table entry in the target page table; wherein the target page table entry is the page table entry being traversed in the target page table; when the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the number of accesses corresponding to the target page number stored in the ignore bit in the target page table entry; wherein the target physical page number is the physical page number in the target page table entry.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of memory management technology, and in particular to a method for determining the number of page accesses, an electronic device, and a computing device. Background Art

[0002] With the continuous development of memory management technology, in order to allocate memory resources more effectively and improve memory utilization, a hierarchical paging method can be used to manage memory resources.

[0003] Currently, for the scenario of hierarchical memory, it is necessary to count the number of page accesses, so as to complete page migration according to the number of page accesses and ensure memory utilization. For the scenario of counting the number of page accesses by software, in order to avoid the large overhead caused by counting the number of page accesses, the memory can be segmented, assuming that some specific pages in the address segment are typical representatives of the memory pages in the segment, counting the number of accesses of the representative pages, and storing the number of page accesses and address segment information together.

[0004] The above-mentioned related technologies result in incomplete statistics on the number of page accesses to the page, thereby affecting the effect of subsequent page migration services according to the number of page accesses, and further affecting the utilization rate of the memory. Summary of the invention

[0005] The embodiments of the present application provide a method for determining the number of page accesses, an electronic device, and a computing device. While saving storage space, since the number of page accesses is stored in a page table entry corresponding to the page, the efficiency of querying the number of page accesses of a specified page is improved, thereby improving memory utilization.

[0006] In a first aspect, an embodiment of the present application provides a method for determining the number of page accesses, the method comprising: determining a target page table address, wherein the target page table address is used to indicate a storage address of the target page table in the memory of a computing device; determining the target page table based on the target page table address; wherein the target page table is a page table for which the number of accesses is to be determined; the target page table comprises multiple page table entries; each page table entry comprises a physical page number, an access bit and an ignore bit; the access bit is used to indicate whether the physical page indicated by the physical page number is accessed; the ignore bit is one or more bits in the target page table entry whose value is ignored by the first processor; determining the access bit state of the target page table entry; wherein the target page table entry is a page table entry being traversed in the target page table; when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the number of accesses corresponding to the target physical page number stored in the ignore bit in the target page table entry, wherein the target physical page number is the physical page number in the target page table entry.

[0007] It can be understood that by determining the target page table address, exemplarily, the target page table address can be determined by the base address and offset address in the configuration information, the target page table indicated by the target page table address can be obtained according to the target page table address and each page table item in the target page table can be scanned, and by obtaining the access bit state of the target page table item being traversed, it is determined whether the physical page corresponding to the target page table item has been accessed; if the access bit of the target page table item indicates that the target physical page has been accessed, the access count of the target physical page stored in the ignore bit in the target page table item is updated, thereby avoiding the need to set up additional storage space for storing the access count of the target physical page. While saving storage space, since the access count of the target physical page is stored in the target page table item corresponding to the target physical page, the efficiency of querying the access count of the specified physical page is also improved, thereby improving memory utilization.

[0008] In one possible implementation, before updating the number of page accesses stored in the ignore bit of the target page table entry, it also includes: obtaining mask data of the ignore bit; determining the target ignore bit from the ignore bit of the target page table entry based on the mask data; when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the number of accesses corresponding to the target physical page number stored in the ignore bit of the target page table entry, including: when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the number of accesses corresponding to the target physical page number stored in the target ignore bit of the target page table entry.

[0009] It is understandable that since the target page table entry may include multiple ignore bits, although the ignore bit is a bit that the first processor ignores accessing, other software may access it. In order to adapt to the situation where other software on the computing device uses the ignore bit, the mask data of the ignore bit can be obtained so that the target ignore bit specified in the target page table entry is used to store the number of accesses to the target physical page.

[0010] In one possible implementation, when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the access count corresponding to the target physical page number stored in the ignore bit of the target page table entry is updated, including: when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the access count value corresponding to the target physical page number stored in the ignore bit is increased by one.

[0011] It is understandable that each time the access bit status of the target page table entry is obtained to indicate that it has been accessed, the number of accesses corresponding to the target physical page number stored in the corresponding ignore bit can be increased by one to update the counted number of accesses to the target physical page.

[0012] In one possible implementation, when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the method also includes: when it is determined that the number of accesses to the physical page corresponding to the target physical page number is zero, storing the virtual page number corresponding to the target physical page number of the target page table entry in a first storage area; wherein the first storage area is located in the memory.

[0013] It can be understood that when it is determined that the physical page corresponding to the target physical page number indicated by the target page table entry ignore bit is accessed for the first time, the virtual page number corresponding to the target physical page number can be stored in the first storage area of ​​the memory of the computing device, so that the subsequent computing device can determine the physical page corresponding to the virtual address that has been accessed by obtaining the virtual page number in the first storage area.

[0014] In one possible implementation, when it is determined that the physical page corresponding to the target physical page number stored in the ignore bit of the target page table entry is accessed for the first time, the virtual page number corresponding to the target physical page number can be stored in the first storage area of ​​the memory of the computing device, including: when it is determined that the number of accesses stored in the ignore bit is zero, the virtual page number corresponding to the target physical page number is stored in the first cache area; when the virtual page number stored in the first cache area meets a predetermined condition, the virtual page number is stored in the first storage area; wherein the predetermined condition includes a predetermined storage size or a predetermined number.

[0015] It is understandable that, when it is determined that the physical page corresponding to the target physical page number indicated by the target page table entry is accessed for the first time, the virtual page number corresponding to the target physical page number can be stored in the first cache area until it is determined that the virtual page number in the first cache area meets a predetermined condition and then the virtual page number is stored in the first storage area. When the virtual page number in the first cache area meets the predetermined condition, the virtual page number is uniformly transferred to the first storage area, thereby improving memory utilization.

[0016] In one possible implementation, the predetermined condition is that the predetermined storage size is the minimum length of direct memory read DMA; the method also includes: obtaining an output address; wherein the output address is a specified storage address in the first storage area; when the virtual page number stored in the first cache area reaches the minimum length of DMA, the virtual page number is stored in the first storage area based on the output address.

[0017] It can be understood that by obtaining the designated storage address in the first storage area, when it is determined that the virtual page number stored in the first cache area reaches the minimum length of DMA, the virtual page number can be stored in the first storage area according to the designated storage address, that is, the output address, so that when the virtual page number in the first cache area reaches the minimum length of DMA, the virtual page number is uniformly transferred to the designated storage address in the first storage area, thereby preventing data overwriting during multiple DMA operations.

[0018] In one possible implementation, the target page table is the last-level page table of the multi-level page table; the first-level page table of the multi-level page table is the page directory; the method also includes: obtaining update information of the page directory; based on the update information of the page directory, determining whether the target page table is updated; if the target page table is updated and traversing the target page table has begun, stopping traversing the target page table.

[0019] It can be understood that, in the case of a multi-level page table, the target page table can be the last-level page table of the multi-level page table, and the first-level page table of the multi-level page table can be the page directory. When the page directory is updated, it may affect the target page table. Therefore, after determining that the page directory is updated, it can be determined whether the target page table is updated based on the update information of the page directory. If it is determined that the target page table is updated, in order not to affect the traversal of the target page table and then update the access count of the target physical page, it is necessary to stop traversing the target page table that has already been traversed.

[0020] In a possible implementation, the method further includes: when the target page table is updated and traversal of the target page table has not started, traversing the updated target page table.

[0021] It can be understood that if the target page table is determined to be updated and the traversal of the target page table has not yet begun, the updated target page table can be directly traversed.

[0022] In a possible implementation, when the access bit of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the method further includes: resetting the access bit of the target page table entry.

[0023] It can be understood that after obtaining the state of the access bit, in the process of updating the access count of the target physical page, the state of the access bit of the target page table entry can be synchronously initialized, that is, reset, so that the state of the access bit can be used to determine whether to access the physical page corresponding to the target physical page number indicated by the target page table entry again. The access count of the target physical page can be updated while clearing the access bit of the page, or the access count of the page corresponding to the target physical page number can be updated after clearing the access bit of the page, or the access bit of the page can be cleared after updating the access count of the physical page corresponding to the target physical page number.

[0024] In a second aspect, an embodiment of the present application provides a device for determining the number of page visits, and the device for determining the number of page visits is used to execute any one of the methods for determining the number of page visits provided in the first aspect above.

[0025] In a possible implementation, the present application may divide the device for determining the number of page visits into functional modules according to the method provided in the first aspect above. For example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. Exemplarily, the present application may divide the device for determining the number of page visits into an acquisition module, a processing module, a storage module, etc. according to the function. The description of the possible technical solutions and beneficial effects executed by each of the functional modules divided above can refer to the technical solutions provided in the first aspect above or its corresponding possible implementation, and will not be repeated here.

[0026] In a third aspect, an embodiment of the present application provides an electronic device, which includes a second processor and a memory, and the second processor is coupled to the memory; the memory is used to store computer instructions, and the computer instructions are loaded and executed by the second processor to enable the electronic device to implement the method for determining the number of page visits as described above.

[0027] In a fourth aspect, an embodiment of the present application provides a computing device, which includes a first processor, a memory, and an electronic device as described above, wherein the electronic device is electrically connected to the first processor and the memory, respectively.

[0028] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, in which at least one computer program instruction is stored. The computer program instruction is loaded and executed by a second processor to implement a method for determining the number of page visits as described above.

[0029] In a sixth aspect, an embodiment of the present application provides a computer program product, the computer program product including computer instructions, the computer instructions stored in a computer-readable storage medium. A second processor of the electronic device reads the computer instructions from the computer-readable storage medium, and the second processor executes the computer instructions, so that the electronic device executes the method for determining the number of page visits provided in various optional implementations of the first aspect.

[0030] For the specific description of the second to sixth aspects and their various implementations in the present application, reference may be made to the detailed description in the first aspect and its various implementations; and for the beneficial effects of the second to sixth aspects and their various implementations, reference may be made to the analysis of the beneficial effects in the first aspect and its various implementations, which will not be repeated here.

[0031] These and other aspects of the present application will become more apparent from the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 is a schematic diagram showing a hierarchical page structure according to an exemplary embodiment;

[0033] Figure 2 is a schematic diagram of a computing device according to an exemplary embodiment;

[0034] Figure 3 is a flow chart of a method for determining the number of page visits according to an exemplary embodiment;

[0035] Figure 4 yes Figure 3 A schematic diagram of a process for storing statistics of page access times involved in the illustrated embodiment;

[0036] Figure 5 yes Figure 3 A schematic diagram of a page table update process for a page directory update scenario involved in the illustrated embodiment;

[0037] Figure 6 is a schematic diagram of a system structure for counting page visit times according to an exemplary embodiment;

[0038] Figure 7 It is a structural diagram of a device for determining the number of page visits provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0039] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0040] The term "multiple" as used herein refers to two or more than two. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the related objects are in an "or" relationship.

[0041] Furthermore, in the description of this application, unless otherwise specified, "plurality" means two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0042] In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second" and the like are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art will understand that the words "first", "second" and the like do not limit the quantity and execution order, and the words "first", "second" and the like do not necessarily limit the differences. At the same time, in the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or design solutions. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.

[0043] First, the application scenarios of the embodiments of the present application are exemplarily introduced.

[0044] Currently, in order to manage memory more effectively and reduce storage errors, virtual memory can be set as an intermediate layer between physical memory and process. The virtual address space of virtual memory can divide virtual memory into multiple pages, and the corresponding physical memory can be divided into physical storage units with the same page size, that is, page frames or physical pages. Each process corresponds to a page table, which can be used to maintain the mapping relationship between each virtual address space and physical memory space. Each page table includes at least one page table entry, and each page table entry can be used to indicate a page, which corresponds to a corresponding physical storage unit in the memory.

[0045] In addition, for efficient use of memory, large-scale page tables are generally not stored in continuous memory, so the page table can be indexed in the form of an address index table of the page table, such as a page directory. By providing a page directory, a two-dimensional structure is used for memory management. Similarly, memory management can also be performed through a multi-dimensional page table structure, such as a multi-level page table.

[0046] Among them, the table entry in the page directory is used to determine the physical memory page where the page table is located. The page directory entry may include the page table address and other bits; the page table entry of the page table is used to describe the correspondence between a logical memory address page and a physical memory address page. The page table entry may include the base address of the physical storage unit corresponding to the page and several functional bits. The base address can be used to represent the starting storage address of the page table in the physical memory.

[0047] For example, a page table entry may include a page number, a status bit P, an access field A, a modification bit M, and an ignore bit I;

[0048] Among them, the status bit P can be used to indicate whether the page has been loaded into the memory, for reference when the program accesses it; the access field A can be used to record whether the page has been accessed, for reference when selecting to swap out the page; the modification bit M is used to indicate whether the page has been modified after being loaded into the memory, for reference when replacing the page; the hardware ignore bit I is a bit set in the processor page table, and the processor will ignore its value.

[0049] For example, for ARM processors, in the page table entries used to register 4K pages, bits 2-7, bits 10-11, and bits 51-58 are all hardware ignore bits, and other entities outside the processor can freely use these hardware ignore bits without affecting the execution of the processor.

[0050] For example, Figure 1 A schematic diagram of a hierarchical page structure provided by an embodiment of the present application is shown. Figure 1 As shown, the page directory address is stored in the register. In the process of accessing data according to the virtual address, after the CPU obtains the virtual address, the MMU (memory management unit) in the CPU obtains the page directory address from the register, determines the page directory corresponding to the process according to the page directory address, determines the base address of the page table i in the page directory according to the page directory offset value in the first 10 bits (31-22 bits) of the virtual address, and determines the page frame number corresponding to the virtual address page in the page table i in combination with the page table offset value in the 21-10 bits of the virtual address, thereby obtaining the physical base address corresponding to the page frame, and determines the physical address based on the physical base address of the page frame and the last 10 bits (9-0 bits) of the virtual address, and the corresponding data or code instructions in the physical memory can be accessed according to the physical address.

[0051] In the related art, for the scenario of hierarchical memory, it is necessary to count the number of page accesses, so as to complete page migration according to the number of page accesses and ensure the memory utilization. For the scenario of counting the number of page accesses by software, in order to avoid the large overhead caused by counting the number of page accesses, the memory can be segmented, assuming that certain specific pages in the address segment are typical representatives of the memory pages in the segment, counting the number of accesses of the representative pages, and storing the number of page accesses and address segment information together. This leads to an incomplete statistics of the number of page accesses to the page, which affects the effect of the subsequent page migration service according to the number of page accesses, and further affects the memory utilization.

[0052] When the page access count is counted through special hardware, a full count method is adopted, and multiple registers are set in the special hardware, each register can correspond to a page, and is used to store the page access count of the page. Although the page access count of each page can be comprehensively counted through the above method, it is necessary to set up a sufficiently large storage space in the special hardware to store the page access count of each page, and because the page access count of each page is stored through a linked list data structure, it takes a long time to retrieve the page access count of a specified page, which is not conducive to quickly finding the page access count information, thereby affecting the efficiency of the page migration service, and further affecting the memory utilization.

[0053] In view of this, the following embodiment of the present application provides a method for determining the number of page accesses. On the basis of memory paging management according to relevant technologies, each page is scanned by special page scanning hardware to obtain the number of accesses of the target physical page, and the number of accesses is stored in the ignore bit of the page table entry of the target physical page, thereby avoiding the setting of additional storage space for storing the number of accesses information. While saving storage space, since the number of accesses of the target physical page is stored in the page table entry corresponding to the target physical page, the efficiency of querying the number of accesses of the target physical page is improved, thereby improving memory utilization.

[0054] Secondly, the system architecture of the embodiment of the present application is exemplarily introduced.

[0055] Figure 2 A schematic diagram of a computing device provided by an embodiment of the present application is shown. The computing device 100 includes a first entity which may be an electronic device 106 .

[0056] The computing device 100 may further include a first processor 102 and a memory 103. The first processor 102 and the memory 103 are electrically connected to the electronic device 106, respectively.

[0057] The electronic device 106 may include a second processor 107 and a memory 108. The second processor 107 and the memory 108 are electrically connected.

[0058] The electronic device 106 may be used to collect statistics on accesses to the physical page, and the computing device 100 may be used to obtain the number of accesses to the physical page.

[0059] Among them, the electronic device 106 can be a page scanning hardware, which can be used to scan the page table corresponding to the target application run by the computing device 100 through the first processor 102. The page table can be stored in the memory 103, and the electronic device 106 can traverse each page table entry in the page table, and then count whether the access field bit A (access) in each page table entry is set for each page table entry.

[0060] Among them, the access field bit A is used to indicate the access bit status of the physical page corresponding to the page table entry. In the initialized state, the access field bit A can be set to 0. If the physical page is accessed, the access field bit A (access) in the page table entry corresponding to the physical page can be changed from the initialized setting 0 to 1.

[0061] That is to say, when the electronic device 106 determines that the access field A bit is set to 1, it can be determined that the page is accessed, and the electronic device 106 can update the number of accesses to the physical page stored in the ignore bit I in the page table entry or the number of accesses to the physical page already stored in the ignore bit I in the page table entry, thereby recording the number of accesses to the physical page corresponding to each page table entry contained in the page table, avoiding the waste of resources caused by setting up additional storage space, and at the same time, because the number of accesses to the physical page is stored in the ignore bit I in the page table entry corresponding to the physical page, it is convenient to query the number of accesses to the physical page, thereby improving the efficiency of obtaining the number of accesses to the physical page, thereby improving the utilization of memory.

[0062] The first processor 102 may be a central processing unit (CPU), and the first processor 102 may be used to control the sending of configuration information to the electronic device 106, and the configuration information may include page table address information corresponding to the target application. The first processor 102 may also be used to perform page migration services, and the first processor 102 may configure a storage space for storing dense information, such as the first storage area 104, and a storage space for storing sparse information, such as the second storage area 105, in the memory 103.

[0063] Among them, the storage space for storing dense information, such as the first storage area 104, and the storage space for storing sparse information, such as the second storage area 105, can both be storage spaces configured by the first processor 102 in the memory 103. The storage space for storing dense information, such as the first storage area 104, can be used to store the virtual page numbers corresponding to the physical pages whose access times are not zero; the storage space for storing sparse information, such as the second storage area 105, can be used to store the target page table for statistics.

[0064] In addition, the first processor 102 can also run the operating system. For the multi-level memory scenario, if the electronic device 106 has scanned the page table of the target application, but the kernel of the operating system has deleted the mapping relationship of the memory page where a certain page table entry is located, that is, the kernel no longer regards the page table entry corresponding to a certain page as a page table entry that needs to be traversed. In order to prevent the electronic device 106 from modifying the memory content incorrectly, the kernel needs to notify the electronic device 106 of the modification information of the page table entry through a callback mechanism. After receiving the notification, the electronic device 106 updates the set of page table entries to be scanned.

[0065] In a possible implementation, the first entity may also be software in the computing device 100 , and the software is executed by the first processor 102 .

[0066] It should be noted that the system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Ordinary technicians in this field can know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0067] For ease of understanding, the following is an exemplary introduction to the method for determining the number of page visits provided by the present application in conjunction with the accompanying drawings. The method for determining the number of page visits is applicable to Figure 2 In the computing device shown, the method for determining the number of page visits is executed by the electronic device. Specifically, the method for determining the number of page visits is implemented by a second processor in the electronic device.

[0068] Figure 3 A flow chart of a method for determining the number of page visits provided by an exemplary embodiment of the present application is shown. The method for determining the number of page visits includes the following steps:

[0069] S101, determine the target page table address.

[0070] In a possible implementation, in order for the electronic device to start scanning the target page table, the first processor needs to predetermine the page table address, the offset address (offset address segment, if not set, all page tables are scanned by default) and the first storage area. The first processor configures a storage space in the memory as the first storage area, and the first storage area can be used to store information indicating physical pages with non-zero access times. For example, the first storage area can be used to store virtual page numbers corresponding to physical pages with non-zero access times, so that the first processor can subsequently perform data migration and other processing on the visited physical pages to improve memory utilization.

[0071] In one possible implementation, the computing device may also determine a second storage area, which may also be a storage area in the memory for storing sparse information. The second storage area may be used to store a target page table for access count statistics, so that subsequent electronic devices can determine the target page table according to the target page table address, thereby realizing access count statistics for each physical page indicated by the target page table.

[0072] In an embodiment of the present application, an electronic device in a computing device for performing statistics on the number of accesses to a physical page can determine a target page table address.

[0073] The target page table address may be used to indicate the storage address of the target page table in the memory. The target page table may be a page table used by the target application. The target application may be an application for the memory access process of interest.

[0074] In one possible implementation, the first processor may set configuration information including a page table base address (page directory address) and an offset address, and send the set configuration information to the electronic device. The electronic device may determine the target page table address through the acquired configuration information.

[0075] In one possible implementation, in order to count the number of times the target application accesses each physical page, the computing device may register and allocate a storage space for storing dense information, such as a first storage area, and may also register and allocate a storage space for storing sparse information, such as a second storage area. The computing device may send the page table address and the offset address as configuration information to the electronic device, and the electronic device may determine the target page table address based on the page table address and the offset address. The computing device may also send the location information of the first storage area to the electronic device, so that the electronic device may subsequently notify the computing device to store the virtual page number corresponding to the physical page that has been accessed and determined by statistics in the first storage area, so as to perform page migration services.

[0076] In a possible implementation, based on Figure 1 In the page table format shown, the electronic device obtains the page directory through the page directory address (page table address) and determines the target page table address based on the offset address. Exemplarily, when the offset address is an address, the target page table is a page table; when the offset address is an address segment, the target page table is multiple. In the case where the offset address segment is missing, all page tables are scanned by default.

[0077] Exemplarily, if the electronic device is a page table scanning hardware, the electronic device can perform data transmission with the first processor through the communication interface. In other words, the first processor can transmit the configuration information (page table address information) to the electronic device through the communication interface.

[0078] In addition, since different types of processors have different page table formats, the electronic device can be configured to support receiving multiple page table formats. In the case where the electronic device is page table scanning hardware, the first processor can declare the page table format of the current target page table by setting the communication interface of the page table scanning hardware. The page table scanning hardware can determine the page table scanning logic used to scan the page table of the page table format according to the page table format of the target page table, thereby performing a page table scan on the target page table.

[0079] S102, obtaining a target page table based on the target page table address.

[0080] S103, determining the access bit state of the target page table entry in the target page table.

[0081] In an embodiment of the present application, after the electronic device obtains the target page table address, it obtains the target page table according to the target page table address, and then determines the access bit state of the target page table entry. The target page table entry may be a page table entry being traversed in the target page table.

[0082] Among them, the target page table can be obtained from the memory according to the target page table address, and because the target page table includes multiple page table entries, the electronic device can traverse each page table entry, and the electronic device can obtain the access bit state in the target page table entry being traversed. The initialization state of the access bit is that the access bit is set to 0, and after the physical page corresponding to the target page table entry is accessed, the access bit state of the target page table entry can indicate that the physical page is accessed, and the access bit of the target page table entry can be set to 1.

[0083] In one possible implementation, after obtaining the access bit status indication of the target page table entry that has been accessed, or when the number of accesses to the physical page corresponding to the target page number in the target page table entry is updated, the electronic device can reset the access bit status of the target page table entry, such as initializing it, to facilitate the next access statistics.

[0084] Since the electronic device can periodically traverse each page table entry of the target page table, that is, it can traverse each page table entry in the target page table for a second time after a specified time after traversing each page table entry in the target page table, and so on, until the condition for stopping statistics is reached, the electronic device can stop traversing each page table entry in the target page table. In order to ensure that the access bit state in the previously counted page table entry does not affect the process of obtaining the access bit state this time during the next periodic traversal, and to determine whether the page is accessed again after the last access, it is necessary to reset the access bit state in time after each access bit state is obtained, such as initialization processing, so as to avoid inaccurate statistics on the number of accesses to the physical page.

[0085] That is, when traversing each page table entry of the target page table for the nth time, if the access bit state of the target page table entry is obtained to indicate that it has been accessed, before traversing each page table entry of the target page table for the n+1th time to obtain the access bit state of the target page table entry, the electronic device needs to reset the access bit state, such as initialization processing. Where n is a positive integer.

[0086] S104 , when the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the access count corresponding to the target physical page number stored in the ignore bit of the target page table entry.

[0087] In the embodiment of the present application, the electronic device determines whether the target page table entry needs to update the number of accesses to the physical page by the target physical page number according to the access bit state of the acquired target page table entry. If it needs to be updated, the number of accesses to the target physical page can be updated, and the electronic device stores the number of accesses to the physical page corresponding to the target physical page number in the ignore bit of the target page table entry. The target physical page number is the physical page number in the target page table entry.

[0088] In a possible implementation, if the access bit state of the target page table entry indicates that it is accessed, the value stored in the ignore bit of the target page table entry is incremented by one to obtain the number of accesses corresponding to the target physical page number.

[0089] For example, taking the target page table as page table 1, which includes page table entries 1 to 10, if the electronic device starts to traverse the page table entries in page table 1, and sequentially traverses and obtains the access bit status indications of page table entries 1 to 5, and when traversing to page table entry 6, it determines that the access bit status indication of page table entry 6 is accessed, then the electronic device can add one to the value of the number of accesses stored in the ignore bit of page table entry 6 in page table 1, and while or after updating the number of accesses stored in the ignore bit of page table entry 6, it can continue to traverse from page table entry 7. That is to say, if the value of the access count already stored in the ignore bit of page table entry 6 is 2, the electronic device can add one to the value of the access count stored in the ignore bit of page table entry 6 in page table 1, so that the access count stored in the ignore bit of page table entry 6 is updated to 3; if the access count is not stored in the ignore bit of page table entry 6, the electronic device adds one to the value of the access count stored in the ignore bit of page table entry 6 in page table 1, so that the access count stored in the ignore bit of page table entry 6 is updated to 1.

[0090] In one possible implementation, mask data of the ignore bit is obtained, and based on the mask data of the ignore bit, a target ignore bit is determined from the ignore bits of the target page table entry, and when the access bit state of the target page table entry indicates that the target physical page is accessed, the access count of the target physical page stored in the target ignore bit of the target page table entry is updated.

[0091] Among them, the first processor in the computing device can set the mask data of the ignore bit to specify the target ignore bit in the ignore bit of the target page table entry. The mask data of the ignore bit can be used to indicate the bit number of the ignore bit used to store the number of accesses corresponding to the target physical page number in the page table entry of the target page table. When the electronic device determines that the access bit state of the target page table entry indicates that it has been accessed, it can add one to the value stored in the target ignore bit of the target page table entry to obtain the number of accesses to the target physical page.

[0092] Exemplarily, if the electronic device is page table scanning hardware, the computing device can also set the mask data of the ignore bit through the first processor to set the communication interface (such as PCIE interface), so that the computing device uses the target ignore bit indicated by the mask data of the ignored bit to store the page access count. This avoids the situation where the ignore bit used by other software conflicts with the ignore bit storing the access count of the target physical page.

[0093] In a possible implementation, after obtaining the access bit state of the target page table entry indicating that the target physical page is accessed, the physical page address of the target page table entry may be obtained, and then the physical page address of the target page table entry may be cached in the first cache area.

[0094] Wherein, the first cache area can be used to cache a set of physical page addresses whose access times of the target physical page are not zero. Wherein, if the electronic device is hardware for page table scanning, a first cache area can be set in the electronic device to cache a set of physical page addresses whose access times of the target physical page are not zero, that is, each time the number of accesses to the physical page starts to be counted, the physical page address of the target page table item is placed in the first buffer when it is determined for the first time that the target physical page is accessed, and then the target physical page of this target page table item is found to be accessed again, and it is no longer placed in the first cache area; it will not be placed in the first cache area again until the number of page accesses is counted again and the counter is cleared.

[0095] In a possible implementation, if the storage space occupied by the set of physical page addresses in the first cache area reaches a specified threshold, the physical pages may be migrated and stored in the first storage area based on the set of physical page addresses.

[0096] That is to say, when the access bit state of the target page table entry indicates that the target physical page is accessed and the number of accesses is determined to be zero, the virtual page number corresponding to the target physical page number is stored in the first cache area; when the virtual page number stored in the first cache area meets a predetermined condition, the virtual page number is stored in the first storage area; wherein the predetermined condition may include a predetermined storage size or a predetermined quantity.

[0097] The first storage area may be a storage area for storing a set of virtual page numbers corresponding to target physical page numbers whose access times of target physical pages are not zero. The first storage area may be a storage area in a memory in a computing device.

[0098] Exemplarily, for page table scanning hardware whose internal storage area is larger than a specified storage threshold, all virtual page numbers corresponding to the accessed physical page numbers can be placed in the first cache area contained in itself, until a predetermined condition is met and the set of virtual page numbers of the accessed physical pages is output to the computing device. The predetermined condition can be that the page table scanning hardware completes the scan of the target page table and the computing device needs to manage the physical pages of the memory according to the information obtained from the scan, such as the set of virtual page numbers, so that the computing device can accurately complete the page migration of the cold and hot pages indicated in the target page table.

[0099] Alternatively, the predetermined condition may also include a predetermined storage size or a predetermined number. The first buffer area set in the page table scanning hardware is less than or equal to a specified storage threshold. The page table scanning hardware may cache virtual page numbers corresponding to visited physical pages that are less than the specified threshold size in the first buffer area during the process of scanning the target page table. When the size of the set of virtual page numbers stored in the first buffer area meets the minimum length of a direct memory access (DMA) request, the set of virtual page numbers corresponding to the visited physical pages may be transferred from the first buffer area to the first storage area of ​​the memory through a DMA request, so as to facilitate subsequent processing of the physical pages corresponding to the virtual page numbers in the first storage area.

[0100] Exemplarily, when the page table scanning hardware determines that the number of accesses to the target physical page is 0, the page address of the target physical page can be recorded in the first buffer of the page table scanning hardware. When the usage of the first buffer reaches a predetermined condition, such as the predetermined condition may be that the size of the page address recorded in the buffer satisfies the minimum length of the DMA request, the page scanning hardware can send the page address recorded in the first buffer to the computing device.

[0101] In addition, in the process of sending the page address recorded in the buffer to the computing device, if the page table scanning hardware scans a new page address whose page access count increases from 0 to 1, the newly counted page address can be recorded in the second buffer. After the process of sending the current page address to the computing device is completed, the newly counted page address can be sent to the computing device again.

[0102] Alternatively, in the process of sending the page addresses recorded in the buffer to the computing device, the scanning of the number of page accesses by the page table scanning hardware is suspended until the page addresses in the buffer are completely sent to the computing device, that is, when the buffer can re-record the data usage, the scanning of the number of page accesses by the page table scanning hardware is resumed, and the newly counted page accesses are obtained from 0 to 1 and recorded in the buffer.

[0103] For example, Figure 4 1 is a flow chart of a method for storing statistics of page access times involved in an embodiment of the present application. Figure 4As shown, in order to enable the page access count statistics, first, the first processor 102 needs to register a callback function and initialize it (S301). The first processor 102 determines the first storage area and the page table address and offset address (S302). The first processor 102 can set the first storage area to store intensive information, such as a virtual page number for storing the physical memory page that has been accessed. After the first processor 102 is ready to complete the above content, the above content is notified to the electronic device 106, and the electronic device 106 can start to obtain the page access situation (S200), wherein the page access situation can be determined by obtaining the access bit state in the target page table entry in the target page table. Then the electronic device 106 determines whether to update the access count stored in the ignore bit of the target page table entry according to the page access situation of the acquired target physical page. If the access bit state in the target page table entry indicates that the target physical page is accessed, the page access count stored in the ignore bit of the target page table entry is updated, and the first storage area (S201) is updated, that is, the virtual page number of the physical page that has been accessed is stored in the first storage area. Then, the electronic device 106 determines whether the stop counting condition is met (S202), wherein the stop counting condition may include the number of times of traversing each page table item in the target page table reaches a specified number threshold, or the time of traversing each page table item in the target page table reaches a specified time threshold, etc. If it is determined that the stop counting condition is not met, then the traversal of each page table item continues to obtain the access status of each page; if it is determined that the stop counting condition is met, then the entity that needs to obtain the number of page accesses may be notified (S203), wherein the entity that needs to obtain the number of page accesses may be the first processor 102, which is used to perform services such as page migration according to the number of page accesses, and the page migration service may include storing the data content of the page whose number of page accesses is greater than the specified number threshold into the memory space that the CPU can quickly process, and moving the data content of the page whose number of page accesses is less than or equal to the specified number threshold out of the memory and storing it in an external storage space such as a disk. The electronic device 101 can also stop counting the number of visits to each page (S204). The order in which the electronic device 106 executes S203 and S204 is not limited here. The electronic device 106 can notify the computing device 102 that the statistics of the number of visits to each page are completed (S303). Then, the computing device 102 can process the content of the first storage area according to the number of visits to each page obtained by statistics, and complete the page migration service to achieve improved memory utilization (S304).

[0104] in addition, Figure 5 1 is a schematic diagram of a page table update process for a page directory update scenario according to an embodiment of the present application. Figure 5As shown, when the operating system kernel of the computing device 100 needs to update the page directory, the callback function will be triggered (S401), and the electronic device 106 will be notified of the page directory that needs to be updated through the callback function (S402), and then the electronic device 106 will be waited for to learn of the page directory that needs to be updated (S403). When the callback function returns, the kernel starts to update the page directory (S404). When the electronic device 106 receives the notification of the page directory update (S501), the electronic device 106 determines whether the page table entry currently being scanned is within the page table entry range involved in the updated page directory, that is, the electronic device 106 checks whether the update content will affect the currently ongoing page table entry scanning process (S502). If it is determined that the page table entry currently being scanned is a page table entry under the updated page directory, then due to the update of the page directory, the currently ongoing page table entry scan can be abandoned immediately, and the electronic device 106 can skip the page table entry affected by the updated page directory to perform page access statistics (S503). For the situation where the page table entry under the updated page directory is not currently being processed, the electronic device 106 can directly return to the callback function that has been informed that the page directory entry has been modified, because the page table entry corresponding to the updated page directory entry can be determined when the target page table is subsequently scanned (S504).

[0105] Take the electronic device as page scanning hardware as an example, Figure 6 FIG. 1 is a schematic diagram showing a system structure for counting page access times provided by an exemplary embodiment of the present application. Figure 6 As shown, the page scanning hardware can be electrically connected to the first processor 102 and the memory 103 via the setting interface 11 .

[0106] The page migration service running in the first processor 102 requests to register the target page table and the first storage area 104 expected to be scanned with the page scanning hardware. For example, the first storage area 104 is used to store the accessed page address set or the virtual page number of the accessed physical page. Among them, the first storage area 104 can also be configured in the memory 108 of the electronic device 106. If the first storage area 104 is in the memory 108, the first processor 102 of the computing device 100 can read the data in the first storage area through memory mapping input / output (IO) or DMA. After receiving the above information, the page scanning hardware can start scanning the target page table and counting the number of page accesses. Since the page table formats of various processors are not the same, the page scanning hardware can be designed to support multiple page table formats. The page migration service can declare the currently used page table format through the setting interface 11 provided by the page scanning hardware. The page table scanning hardware can use the page table search logic corresponding to the page table format according to the page table format used to scan the target page table and traverse each page table entry therein. In order to adapt to the situation where there is software using hardware ignore bits on the processor, the page scanning hardware also supports the page migration service to set the ignore bit mask by setting the interface 11, so that only the target ignore bits contained in the ignored bit mask are used to store the number of page accesses. For page scanning hardware with a relatively large internal storage area, the accessed page address set can be completely placed in the page address set buffer area 12 contained in itself, and these page address sets are not output externally until the predetermined conditions are met; but the page scanning hardware can also be based on cost saving considerations. When there is a small amount of page address information on the page, when this information reaches the minimum length of a DMA request, it is dumped into the memory 103 through DMA. Since the accessed page set is stored in batches for multiple times, the page scanning hardware will include an output address buffer 13 to ensure that the information output multiple times is stored continuously without overwriting. In addition, the page table scanning hardware can support the statistics of the number of page accesses to multiple target page tables. At this time, the page scanning hardware will include each monitored target page table.

[0107] The above mainly introduces the scheme of the embodiment of the present application from the perspective of the method. It is understandable that it includes at least one of the hardware structure and software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0108] The embodiment of the present application can divide the functional units of the device for determining the number of page visits according to the above method example. For example, each functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units. It should be noted that the division of units in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0109] For example, Figure 7 The schematic diagram of the structure of a device 400 for determining the number of page visits provided by an exemplary embodiment of the present application is shown. The device 400 for determining the number of page visits is applied in a computing device. The device 400 for determining the number of page visits includes:

[0110] The acquisition module 410 is used to acquire a target page table address; wherein the target page table address is used to indicate a storage address of the target page table in the memory of the computing device;

[0111] The processing module 420 is used to determine a target page table based on the target page table address; wherein the target page table includes a plurality of page table entries; each page table entry includes a physical page number, an access bit and an ignore bit; the access bit is used to indicate whether the physical page indicated by the physical page number is accessed; the ignore bit is one or more bits in the target page table entry whose value is ignored by the first processor; the first processor is a processor of the computing device;

[0112] The processing module 420 is further used to determine the access bit state of the target page table entry in the target page table; wherein the target page table entry is the page table entry being traversed in the target page table;

[0113] The storage module 430 is used to update the access count of the target physical page stored in the ignore bit of the target page table entry when the access bit state of the target page table entry indicates that the target physical page is accessed, wherein the target physical page is a physical page in the target page table entry.

[0114] For example, combined with Figure 3 , the acquisition module 410 can be used to perform the following steps: Figure 3 As shown in S101, the processing module 420 can be used to perform the following steps: Figure 3 As shown in S102, the storage module 430 can be used to perform the following Figure 3 S103 shown.

[0115] In a possible implementation, the processing module 420 is further configured to obtain mask data of the ignore bit before updating the page access count stored in the target ignore bit of the target page table entry; determine the target ignore bit from the ignore bits of the target page table entry based on the mask data;

[0116] The storage module 430 is further configured to increase the access count value of the target physical page stored in the ignore bit by one when the access bit state of the target page table entry indicates that the target physical page is accessed.

[0117] In one possible implementation, the storage module 430 is also used to store the virtual page number corresponding to the physical page number of the target page table entry in the first storage area when the access bit state of the target page table entry indicates that the target physical page is accessed and when it is determined that the number of accesses to the target physical page is zero; wherein the first storage area is located in the memory of the computing device.

[0118] In one possible implementation, the processing module 420 is also used to store the virtual page number corresponding to the physical page number of the target page table entry in the first cache area when it is determined that the number of accesses is zero; and to store the virtual page number in the first storage area when the virtual page number stored in the first cache area meets a predetermined condition; wherein the predetermined condition includes a predetermined storage size or a predetermined number.

[0119] In one possible implementation, the processing module 420 is also used when the target page table is the last-level page table of a multi-level page table; the first-level page table of the multi-level page table is a page directory; obtaining update information of the page directory; determining whether the target page table is updated based on the update information of the page directory; and when the target page table is updated and traversing the page table entries of the target page table has begun, stopping traversing the page table entries of the target page table.

[0120] In a possible implementation, the processing module 420 is further configured to traverse the page table entries of the updated target page table when the target page table is updated and the traversal of the page table entries of the target page table has not started.

[0121] In a possible implementation, the processing module 420 is further configured to reset the access bit of the target page table entry when the access bit state of the target page table entry indicates that the target physical page is accessed.

[0122] For the detailed description of the above optional methods, please refer to the above method embodiments, which will not be repeated here. In addition, the explanation of any of the above-mentioned devices for determining the number of page visits and the description of the beneficial effects can refer to the above-mentioned corresponding method embodiments, which will not be repeated here.

[0123] As an example, combining Figure 2 The functions implemented in part or in whole in the acquisition module 410, the processing module 420 and the storage module 430 in the device for determining the number of page visits can be realized by Figure 2The first entity in the computing device may be hardware or software. When the first entity is software, it is executed by a first processor of the computing device. When the first entity is hardware, the first entity itself includes a second processor and a memory, and it may be executed by a second processor of the first entity.

[0124] In an exemplary embodiment, an electronic device is also provided, the electronic device comprises a second processor and a memory, the second processor is coupled to the memory; the memory is used to store computer instructions, the computer instructions are loaded and executed by the second processor to enable the electronic device to perform the above Figure 3 All or part of the steps of the method for determining the number of page visits shown in any embodiment.

[0125] In an exemplary embodiment, a computing device is further provided. The computing device includes a first processor, a memory, and the electronic device provided in the above embodiment, wherein the electronic device is electrically connected to the first processor and the memory, respectively.

[0126] In an exemplary embodiment, a computer-readable storage medium is also provided, which is used to store at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement all or part of the steps in the above-mentioned memory fault prediction method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0127] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device performs the above Figure 3 All or part of the steps of the method shown in any embodiment.

[0128] In some embodiments, the method shown in the embodiments of the present application can be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or encoded on other non-transitory media or products.

[0129] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0130] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0131] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0132] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0133] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0134] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A method for determining the number of page visits, characterized in that: The method comprises: Determine a target page table address; wherein the target page table address is used to indicate a storage address of the target page table in a memory of a computing device; Based on the target page table address, obtaining the target page table; The target page table is a page table whose access times are to be determined; the target page table includes a plurality of page table entries; each page table entry includes a physical page number, an access bit and an ignore bit; the access bit is used to indicate whether the physical page corresponding to the physical page number is accessed; the ignore bit is one or more bits in the page table entry whose value is ignored by the first processor; the first processor is a processor of a computing device; Determine an access bit state of a target page table entry in the target page table; wherein the target page table entry is a page table entry being traversed in the target page table; When the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the access count corresponding to the target page number stored in the ignore bit in the target page table entry is updated; wherein the target physical page number is the physical page number in the target page table entry.

2. The method according to claim 1, characterized in that Before updating the number of accesses corresponding to the target page number stored in the ignore bit in the target page table entry when the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the method further includes: Obtain mask data of the ignored bit; determining a target ignore bit from the ignore bits of the target page table entry based on the mask data; When the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the access count corresponding to the target physical page number stored in the ignore bit of the target page table entry includes: When the access bit of the target page table entry indicates that a page corresponding to the target physical page number is accessed, the access count corresponding to the target physical page number stored in the target ignore bit of the target page table entry is updated.

3. The method according to claim 1 or 2, characterized in that: When the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, updating the access count corresponding to the target page number stored in the ignore bit in the target page table entry includes: When the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the access count value corresponding to the target physical page number stored in the ignore bit is increased by one.

4. The method according to claim 1 or 2, characterized in that: In a case where the access bit state of the target page table entry indicates that a physical page corresponding to the target physical page number is accessed, the method further includes: When it is determined that the number of accesses corresponding to the target physical page number in the ignore bit is zero, the virtual page number corresponding to the target physical page number is stored in a first storage area; wherein the first storage area is located in the memory of the computing device.

5. The method according to claim 4, characterized in that When it is determined that the number of accesses corresponding to the target physical page number in the ignore bit is zero, storing the virtual page number corresponding to the target physical page number in the first storage area includes: When it is determined that the number of accesses corresponding to the target physical page number in the ignored bit is zero, storing the virtual page number corresponding to the target physical page number in the first cache area; When the virtual page number stored in the first cache area meets a predetermined condition, the virtual page number is stored in the first storage area; wherein the predetermined condition includes a predetermined storage size or a predetermined number.

6. The method according to claim 5, characterized in that The predetermined condition is that the predetermined storage size is the minimum length of direct memory read DMA; The method further comprises: Obtaining an output address; wherein the output address is a specified storage address in the first storage area; When the virtual page number stored in the first buffer area reaches a minimum length of the direct memory access DMA, the virtual page number is stored in the first storage area based on the output address.

7. The method according to any one of claims 1, 2, 5 and 6, characterized in that: The target page table is the last level page table of the multi-level page table; the first level page table of the multi-level page table is the page directory; The method further comprises: Obtaining update information of the page directory; Based on the update information of the page directory, determining whether the target page table is updated; When the target page table is updated and the traversal of the target page table has begun, the traversal of the target page table is stopped.

8. The method according to claim 7, characterized in that The method further comprises: When the target page table is updated and traversal of the target page table has not started, traverse the updated target page table.

9. The method according to any one of claims 1, 2, 5, 6 and 8, characterized in that: In a case where the access bit state of the target page table entry indicates that the physical page corresponding to the target physical page number is accessed, the method further includes: Reset the access bit state of the target page table entry.

10. An electronic device, characterized in that: The electronic device comprises a second processor and a memory; The second processor is coupled to the memory; The memory is used to store computer instructions, and the computer instructions are loaded and executed by the second processor to enable the electronic device to implement the method for determining the number of page visits as described in any one of claims 1 to 9.

11. A computing device, characterized in that: The computing device comprises a first processor, a memory and the electronic device as claimed in claim 10; Wherein, the electronic device is electrically connected to the first processor and the memory respectively.

Citation Information

Patent Citations

  • Physical memory protection unit, physical memory permission control method, and processor

    CN113722247A

  • Virtual memory management method and device supporting physical address larger than virtual address

    CN114201265A