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

By using the page table synchronization mechanism in the computing device to create a dedicated page table to store the number of page accesses, the problem of incomplete statistics in the prior art is solved, and memory utilization and query efficiency are improved.

CN117290194BActive Publication Date: 2025-06-13XFUSION DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311099690.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-29
Publication Date
2025-06-13
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 using the page table synchronization mechanism to create a dedicated page table, the number of page accesses of the target page is stored, the comprehensiveness of the number of page access statistics and the efficiency of querying the number of page access information is improved.

Benefits of technology

While ensuring the comprehensiveness of page access statistics, it improves the efficiency of querying the number of visits information of specified page accesses, thereby improving the memory utilization rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117290194B_ABST
    Figure CN117290194B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method for determining the page access count, an electronic device, and a computing device, which improve the utilization rate of memory. The method includes: determining a first target page table address and a second target page table address; respectively determining a first target page table and a second target page table based on the first target page table address and the second target page table address; wherein, the first target page table includes a plurality of second target page table entries; the second target page table includes second page table entries; the second page table entries include second physical page numbers and count bits; the count bits are used to store the number of times the physical page indicated by the second physical page number is accessed; wherein, the second physical page number is the first physical page number that has been accessed; determining the access bit status of the target page table entry; the target page table entry is the page table entry being traversed in the first target page table; when the access bit status of the target page table entry indicates that the target physical page has been accessed, updating the access count stored in the count bit corresponding to the second physical page number in the second target page table.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of memory management, and in particular, to a method for determining the page access count, 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 page access count, so as to complete page migration according to the page access count and ensure memory utilization. For the scenario of counting the page access count through software, in order to avoid large overhead caused by counting the page access count, the memory can be segmented. Assume that some specific pages within the address segment are typical representatives of the memory pages within the segment. Count the access count of the representative pages and store the page access count and the address segment information together.

[0004] In the above related technologies, the statistics of the page access count of pages are incomplete, which affects the effect of subsequent page migration services according to the page access count, and further affects memory utilization. Summary of the Invention

[0005] Embodiments of this application provide a method for determining the page access count, an electronic device, and a computing device. By using a page table synchronization mechanism to create a dedicated page table to store the page access count of target pages, it is possible to ensure the comprehensiveness of the statistics of the page access count while improving the efficiency of querying the page access count information of a specified page, and further improve memory utilization.

[0006] First aspect, an embodiment of the present application provides a method for determining the page access count. The method includes: determining a first target page table address and a second target page table address, where the first target page table address is used to indicate the storage address of the first target page table in the memory of the computing device; the second target page table address is used to indicate the storage address of the second target page table in the memory of the computing device; respectively determining the first target page table and the second target page table based on the first target page table address and the second target page table address; where the first target page table is the page table for which the access count is to be statistically calculated; the first target page table includes a plurality of first page table entries; each first page table entry includes a first physical page number and an access bit; the access bit is used to indicate whether the physical page indicated by the first physical page number is accessed; the second target page table includes a plurality of second page table entries; each second page table entry includes a first physical page number and a count bit; the count bit is used to store the number of times the physical page indicated by the first physical page number is accessed; determining the access bit status of the target page table entry in the first target page table; where the target page table entry is the page table entry being traversed in the first target page table; in the case where the access bit status of the target page table entry indicates that the physical page corresponding to the target page number is accessed, updating the access count stored in the count bit corresponding to the target page number in the second target page table; where the target page number is the first physical page number in the target page table entry.

[0007] It can be understood that by obtaining the first target page table address and the second target page table address, obtaining the first target page table and scanning each page table entry in the first target page table, and determining whether the physical page corresponding to each page table entry is accessed by obtaining the access bit status of each page table entry. Since the page access count of the target page table entry is stored in the second target page table, the page access count of the target page table entry can be determined according to the second target page table address and stored in the second target page table. By creating a dedicated page table, that is, the second target page table, to store the page access count of the target physical page using the page table synchronization mechanism, it is possible to ensure the comprehensiveness of the page access count statistics while also improving the efficiency of querying the page access count of a specified page, thereby improving the utilization rate of the memory.

[0008] In a possible implementation manner, in the case where the access bit status of the target page table entry indicates that the physical page corresponding to the target page number is accessed, updating the access count stored in the count bit corresponding to the target page number in the second target page table includes: in the case where the access bit status of the target page table entry indicates that the physical page corresponding to the target page number is accessed, incrementing the value of the access count stored in the count bit corresponding to the target page number in the second target page table by one.

[0009] It can be understood that when the access bit status of the target page table entry indicates that the physical page corresponding to the target page number has been accessed, the way to update the access count stored in the count bit corresponding to the target page number in the second target page table can be to increment the access count value stored in the count bit corresponding to the target page number in the second target page table by one each time it is determined that the physical page corresponding to the target page number has been accessed, so as to update the access count of the physical page corresponding to the target page number.

[0010] In a possible implementation, when the access bit of the target page table entry indicates that the physical page corresponding to the target page number has been accessed, the method further includes: when it is determined that the access count of the physical page corresponding to the target page number is zero, storing the virtual page number corresponding to the physical page number of the target page table entry in the first storage area; where the first storage area is located in the memory of the computing device.

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

[0012] In a possible implementation, when it is determined that the access count of 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 the first storage area includes: when it is determined that the access count is zero, storing the virtual page number corresponding to the physical page number of the target page table entry in the first buffer; when the virtual page numbers stored in the first buffer reach a predetermined condition, storing the virtual page numbers in the first storage area; where the predetermined condition includes a predetermined storage size or a predetermined quantity.

[0013] It can be understood that when it is determined that the target physical page indicated by the target page number in the target page table entry is accessed for the first time, the virtual page number corresponding to the physical page number of the target page table entry can be stored in the first buffer until it is determined that the virtual page numbers in the first buffer reach a predetermined condition, and then the virtual page numbers are stored in the first storage area. So that when the virtual page numbers in the first buffer reach a predetermined condition, the virtual page numbers can be transferred to the first storage area uniformly, thereby improving the memory utilization rate.

[0014] In a possible implementation, the predetermined condition is that the predetermined storage size reaches the minimum length of direct memory access (DMA); the method further includes: obtaining an output address; where the output address is a specified storage address in the first storage area; when the virtual page numbers stored in the first buffer reach the minimum length of DMA, storing the virtual page numbers in the first storage area based on the output address.

[0015] It can be understood that by obtaining the specified storage address in the first storage area, when it is determined that the virtual page numbers stored in the first buffer reach the minimum length of the DMA, the virtual page numbers can be stored in the first storage area according to the specified storage address, that is, the output address, to prevent data from being overwritten during multiple DMA operations.

[0016] In a possible implementation, the first 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; the method further includes: obtaining update information of the page directory; determining whether the first target page table is updated based on the update information of the page directory; and stopping traversing the page table entries of the first target page table when the first target page table is updated and the traversal of the page table entries of the first target page table has already started.

[0017] It can be understood that for the case of a multi-level page table, the first 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 a page directory. When the page directory is updated, it may affect the page table entries in the first target page table. Therefore, after determining that the page directory is updated, it can be determined whether the first target page table is updated according to the update information of the page directory. If it is determined that the first target page table is updated, in order not to affect the access count update of the target physical page when traversing the page table entries of the first target page table that have already started, it is necessary to stop traversing the page table entries of the first target page table that have already started traversing, to avoid the situation of incorrect modification of the memory content.

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

[0019] It can be understood that if the first target page table is determined to be updated and the traversal of the page table entries in the first target page table has not started yet, the updated first target page table can be directly traversed to avoid incorrect determination of the access count.

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

[0021] It can be understood that after obtaining the status of the access bit, during the process of updating the access count of the target physical page, the status of the access bit of the target page table entry can be initialized synchronously, that is, reset, so that subsequently, it can continue to be determined whether to access the target physical page indicated by the target page table entry again through the status of the access bit. While clearing the access bit of this page, the update of the access count of the target physical page can be completed incidentally.

[0022] In a second aspect, the present application provides a page access count determination device, which is used to execute any of the page access count determination methods provided in the first aspect above.

[0023] In a possible implementation manner, the present application may divide the functional modules of the page access count determination device according to the method provided in the first aspect above. For example, each functional module may be divided corresponding to each function, or two or more functions may be integrated into one processing module. Exemplarily, the present application may divide the storage device of the page access count information into an acquisition module, a processing module, a storage module, etc. according to functions. The descriptions of the possible technical solutions and beneficial effects executed by each of the above-divided functional modules may refer to the technical solutions provided in the first aspect or its corresponding possible implementation manners, and will not be elaborated here.

[0024] 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 page access count determination method as described in the above aspect.

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

[0026] 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, and the computer program instruction is loaded and executed by the second processor to implement the page access count determination method as described in the above aspect.

[0027] In a sixth aspect, an embodiment of the present application provides a computer program product, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The 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 page access count determination method provided in various optional implementation manners of the first aspect above.

[0028] The specific descriptions of the second to sixth aspects and their various implementation manners in the present application may refer to the detailed descriptions in the first aspect and its various implementation manners; and the beneficial effects of the second to sixth aspects and their various implementation manners may refer to the beneficial effect analysis in the first aspect and its various implementation manners, and will not be elaborated here.

[0029] These aspects or other aspects of the present application will be more clearly understood in the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 is a schematic diagram of a hierarchical page structure shown according to an exemplary embodiment;

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

[0032] Figure 3 is a flowchart schematic diagram of a method for determining the number of page accesses shown according to an exemplary embodiment;

[0033] Figure 4 is Figure 3 a flowchart schematic diagram of page access count statistics storage involved in the illustrated embodiment;

[0034] Figure 5 is Figure 3 a flowchart schematic diagram of page access count statistics involved in the illustrated embodiment;

[0035] Figure 6 is a schematic diagram of a system structure for statistically counting page accesses shown according to an exemplary embodiment;

[0036] Figure 7 is a schematic diagram of the structure of a page access count determination device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0037] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0038] As used herein, "a plurality" means two or more. "And / or" describes the association relationship of associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after.

[0039] Moreover, in the description of the present application, unless otherwise specified, "a plurality" means two or more than two. "At least one (item)" or a similar expression thereof refers to any combination of these items, including any combination of single item (s) or plural item (s). For example, at least one (item) of a, b, or c may represent: a, b, c, a - b, a - c, b - c, or a - b - c, where a, b, c may be single or multiple.

[0040] In addition, for the convenience of clearly describing the technical solutions of the embodiments of the present application, in the embodiments of the present application, terms such as "first" and "second" are used to distinguish identical or similar items with basically the same functions and effects. Those skilled in the art can understand that terms such as "first" and "second" do not limit the quantity and execution order, and "first", "second", etc. do not necessarily mean different. At the same time, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design solution described as "exemplary" or "for example" in the embodiments of the present application should not be construed as being more preferred or having more advantages than other embodiments or design solutions. Rather, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way for easy understanding.

[0041] First, an exemplary introduction to the application scenarios of the embodiments of the present application is given.

[0042] Currently, in order to manage memory more effectively and reduce storage errors, a virtual memory can be set as an intermediate layer between physical memory and processes. The virtual address space of the virtual memory can divide the virtual memory into multiple pages, and the corresponding physical memory can be divided into physical storage units of the same size as the page size, that is, page frames or physical pages. Each process corresponds to a page table, and the page table can be used to maintain the mapping relationship between each virtual address space and the 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 and the corresponding physical storage unit of the page.

[0043] In addition, for the 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 the form of a page directory and using a two-dimensional structure for memory management, similarly, memory management can also be performed through a multi-dimensional page table structure, such as a multi-level page table.

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

[0045] For example, the page table entry can include a page number, a status bit P, an access field A, and a modification bit M;

[0046] Among them, the status bit P can be used to indicate whether the page has been loaded into 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 a page to be swapped out; the modified bit M is used to indicate whether the page has been modified after being loaded into memory for reference when replacing the page.

[0047] Exemplarily, Figure 1 FIG. shows a schematic diagram of a hierarchical page structure provided by an embodiment of the present application. As Figure 1 shown, the page directory address is stored in the register. During the process of data access 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 page table i in the page directory according to the page directory offset value in the first 10 bits (bits 31-22) of the virtual address, combines the page table offset value in bits 21-10 of the virtual address, determines the page frame number corresponding to the virtual address page in page table i, 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 (bits 9-0) in the virtual address. The corresponding data or code instructions in the physical memory can be accessed according to the physical address.

[0048] In the related art, for the scenario of hierarchical memory, it is necessary to count the page access times, so as to complete page migration according to the page access times and ensure the utilization rate of memory. For the scenario of counting page access times through software, in order to avoid large overhead caused by counting page access times, the memory can be segmented. Assuming that some specific pages within the address segment are typical representatives of the memory pages within the segment, the access times of the representative pages are counted, and the page access times and the address segment information are stored together. This results in incomplete statistics of the page access times of the pages, thereby affecting the effect of subsequent page migration services according to the page access times, and further affecting the utilization rate of memory.

[0049] When counting the page access times through dedicated hardware, a full-scale counting method is adopted, and multiple registers are set in the dedicated hardware. Each register can correspond to a page respectively and is used to store the page access times of the page. Although the above method can comprehensively count the page access times of each page, it is necessary to set a sufficiently large storage space in the dedicated hardware to store the page access times of each page. And since the page access times of each page are stored through a linked list data structure, this results in a long time consumption when retrieving the page access times of a specified page, which is not conducive to quickly finding the page access times information, thereby affecting the efficiency of page migration services and further affecting the utilization rate of memory.

[0050] In view of this, the following embodiments of the present application provide a method for determining the page access count. Based on the memory paging management according to the related art, each page is scanned by a dedicated page scanning hardware to obtain the access count of the target physical page, and the access count is stored in a dedicated page table, such as the second target page table. By using the page table synchronization mechanism to create a dedicated page table to store the access count of the target physical page, the comprehensiveness of the access count statistics of the target physical page can be ensured, and the efficiency of querying the access count of the target physical page can be improved, thereby improving the utilization rate of the memory.

[0051] Secondly, an exemplary introduction to the system architecture of the embodiments of the present application is provided.

[0052] Figure 2 FIG. shows a schematic diagram of a computing device provided by an embodiment of the present application. The computing device 100 includes a first entity, which may be an electronic device 106.

[0053] 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.

[0054] 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.

[0055] The electronic device 106 may be used to count the access situation of the physical page, and the computing device 100 may be used to obtain the access count of the physical page.

[0056] In one implementation, the electronic device 106 may be a page scanning hardware. The electronic device 106 may be used to scan the page table corresponding to the target application program running on the computing device 100 by the first processor 102. The page table may be stored in the memory 103, and the electronic device 106 may 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.

[0057] Wherein, 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 initial state, the access field bit A may 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 may be changed from the initial setting of 0 to 1.

[0058] That is to say, when the electronic device 106 determines that the setting of the access field A bit is 1, it can determine that the page is accessed. The electronic device 106 can update based on the access count of the target physical page stored in the second target page table, so as to record the access counts of the physical pages corresponding to each page table entry included in the first target page table, avoiding resource waste caused by setting additional storage space on the electronic device 106. At the same time, since the access count of the target physical page is stored in the count bit of the page table entry where the physical page number of the target physical page is located in the second target page table, it is convenient to query the access count of the target physical page, improving the efficiency of obtaining the access count of the physical page, and thus improving the utilization rate of the memory.

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

[0060] 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 counted access counts are not zero; the storage space for storing sparse information, such as the second storage area 105, can be used to store the first target page table for statistics.

[0061] In addition, the first processor 102 can also run an operating system. For the scenario of multi-level memory, if the electronic device 106 has scanned the page table of the target application program, 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 to say, the kernel no longer regards the page table entry corresponding to a certain page as a page table entry to be traversed. To avoid the electronic device 106 incorrectly modifying the memory content, 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.

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

[0063] It should be noted that the system architecture and application scenarios described in the embodiments of this application are for more clearly explaining the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those of ordinary skill in the art will know that with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided by the embodiments of this application are equally applicable to similar technical problems.

[0064] For ease of understanding, the following provides an exemplary introduction to the method for determining the page access count of this application in conjunction with the accompanying drawings. This method for determining the page access count is applicable to Figure 2 the computing device shown, and this method for determining the page access count is executed by an electronic device. Specifically, this method for determining the page access count is implemented by the second processor in the electronic device performing the corresponding operations.

[0065] Figure 3 The flowchart of the method for determining the page access count provided by an exemplary embodiment of this application is shown. This method for determining the page access count includes the following steps:

[0066] S101, determine the first target page table address and the second target page table address.

[0067] In a possible implementation manner, in order for the electronic device to start scanning the first target page table, the electronic device needs to pre-determine the first target page table address, the second target page table address, the offset address, and the first storage area.

[0068] In a possible implementation manner, as Figure 1 shown, the electronic device obtains the first page directory through the first page directory address, and then determines the first page table address based on the page directory offset. This first page table address is the first target page table address.

[0069] It should be noted that as Figure 1 only shows a two-level page table, and this page table can also be a multi-level page table such as a three-level page table, and the first target is the last level of the multi-level page table. The embodiments of this application do not limit the number of levels of the page table.

[0070] In a possible implementation manner, as Figure 1 shown, the electronic device obtains the second page directory through the second page directory address, and then determines the second page table address based on the second page directory offset. This second page table address is the second target page table address.

[0071] Among them, the computing device can configure a storage space in the memory as the first storage area through the first processor. The first storage area can be used to store information indicating physical pages with non-zero access counts. For example, the first storage area can be used to store the virtual page numbers corresponding to physical pages with non-zero access counts, so that the first processor can perform data migration processing on the accessed physical pages subsequently to improve the utilization rate of the memory.

[0072] In a possible implementation manner, the computing device can also determine a second storage area. The second storage area can also be a storage area in the memory and is used to store sparse information. The second storage area can be used to store the first target page table for access count statistics and the page table (second target page table) for recording access counts; Exemplarily, the first page directory address and the second page directory address are located in the second storage area.

[0073] In a possible implementation manner, the computing device can also determine a third storage area. The third storage area can also be a storage area in the memory and is used for the second target page table for recording access counts; Exemplarily, the first page directory address is located in the second storage area, and the second page directory address is located in the second storage area.

[0074] In the embodiments of the present application, the electronic device in the computing device for performing access count statistics of physical pages can obtain the first target page table address.

[0075] Among them, the first target page table address can be used to indicate the storage address of the first target page table in the memory. The first target page table can be the page table corresponding to the target application program. This page table contains the mapping relationship between each virtual address used during the memory access of the target application program and the physical page. The first target page table includes multiple second target page table entries; each second target page table entry includes the first physical page number and the access bit. The target application program can be the application program concerned about the memory access process.

[0076] In a possible implementation manner, the computing device can create a dedicated page table (second target page table) for supporting the first entity to traverse the page table entries to query the page access counts according to the synchronization mechanism for the first target page table, so as to ensure that each physical page number in each first target page table traversed by the electronic device can find the page table entry containing the corresponding physical page number in the dedicated page table (second target page table).

[0077] If an electronic device simultaneously counts the page access times of the pages of multiple applications or processes respectively, and each application or process has a first target page table, a computing device may create a corresponding second target page table for each first target page table according to a synchronization mechanism. Each second target page table is used to store the access times of the physical pages corresponding to the physical page numbers stored in the corresponding first target page table. That is to say, when a first entity simultaneously counts the access times of the physical pages corresponding to multiple applications or processes, the access times of each application or process obtained by counting can be stored through multiple page tables respectively.

[0078] In addition, if an electronic device simultaneously counts the page access times of the pages of multiple applications or processes respectively, and multiple applications or processes each have a first target page table, a computing device may create a second target page table according to a synchronization mechanism for each first target page table, and store the access times of each physical page obtained by counting for each first target page table through the second target page table. That is to say, when an electronic device simultaneously counts the access times of the physical pages corresponding to multiple applications or processes, the page access times of each application or process obtained by counting can be stored uniformly through one page table. The page access times corresponding to each application or process are stored uniformly in the second target page table.

[0079] Among them, each page table entry of the second target page table includes the physical page numbers in each page table entry of each first target page table.

[0080] In a possible implementation manner, a computing device for obtaining page access times may set configuration information, which includes a page table address (such as Figure 1 the page directory address in), a second target page base address, and an offset address or an offset address segment (if not set, it is default to scan all page tables). A first processor may send the configuration information to the electronic device, and the electronic device may determine the first target page table address and the second target page table address through the obtained configuration information. Exemplarily, if the electronic device is page table scanning hardware, the electronic device may perform data transmission with the first processor through a communication interface. That is to say, the first processor may transmit the configuration information to the electronic device through the communication interface.

[0081] In a possible implementation manner, an electronic device determines a first target page table address based on a first page table address and an offset address; determines a second target page table address based on a second page table address and an offset address. Exemplarily, the offset address for determining the second target page address is the same as the offset address for determining the first target page address.

[0082] In addition, due to different page table formats of the processor, the electronic device can be set to support receiving multiple page table formats. When the electronic device is page table scanning hardware, the first processor can declare the page table format of the current first target page table through the communication interface of the page table scanning hardware. The page table scanning hardware can determine the page table scanning logic for scanning the first target page table in accordance with the page table format of the first target page table, so as to perform page table scanning on the first target page table.

[0083] S102. Obtain a first target page table and a second target page table respectively based on a first target page table address and a second target page table address.

[0084] S103. Determine the access bit status of a target page table entry in the first target page table.

[0085] In the embodiment of the present application, after the electronic device determines the first target page table address, it obtains the first target page table according to the first target page table address, and then traverses the access bit status of each page table entry.

[0086] Among them, the target page table entry can be the page table entry being traversed in the first target page table.

[0087] Among them, the first target page table can be obtained from the memory according to the first target page table address. Since the first target page table includes each page table entry, the electronic device can traverse each page table entry, and the electronic device can obtain the access bit status in the target page table entry being traversed. The initial state of the access bit is that the access bit is set to 0. After the physical page corresponding to the target page table entry is accessed, the access bit status of the target page table entry can indicate that the physical page has been accessed, and the access bit of the target page table entry can be set to 1.

[0088] In a possible implementation manner, after obtaining that the access bit status of the target page table entry indicates being accessed, or when the update of the access times of the physical page corresponding to the target page number of the target page table entry is completed, the electronic device can notify the first processor to reset the access bit status of the target page table entry, such as initialization.

[0089] Since the electronic device can periodically traverse each page table entry of the first target page table, that is to say, it can be at a specified time after traversing each page table entry in the first target page table once, and then traverse each page table entry in the first target page table again, and so on, until the condition for stopping statistics is reached, the electronic device can stop traversing each page table entry of the first target page table. In order to ensure that the access bit status in the page table entries that have been statistically counted before does not affect the acquisition of the access bit status 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 status in a timely manner after each acquisition of the access bit status, such as initialization processing, so as to avoid inaccurate statistics of the number of accesses to physical pages.

[0090] That is to say, when traversing each page table entry of the first target page table for the nth time, if the access bit status of the target page table entry indicates that it has been accessed, before traversing each page table entry of the first target page table for the (n + 1)th time to obtain the access bit status of the target page table entry, the electronic device needs to notify the computing device to reset the access bit status, such as initialization processing. Wherein, n is a positive integer.

[0091] In a possible implementation, according to the second target page table address, the electronic device can obtain the second target page table.

[0092] Wherein, the second target page table includes second page table entries, and the second page table entries can include a first physical page number and a count bit, and the count bit can be used to store the number of times the physical page indicated by the first physical page number is accessed.

[0093] S104, when the access bit status of the target page table entry indicates that the physical page indicated by the target page number has been accessed, update the access count stored in the count bit corresponding to the target page number in the second target page table.

[0094] In the embodiment of the present application, the electronic device determines whether to update the access count of the physical page corresponding to the target page number in the target page table entry according to the obtained access bit status of the target page table entry. If an update is required, the electronic device can obtain the page access count stored in the second page table entry corresponding to the target page table entry in the second target page table according to the second target page table address and the page table offset. If the count bit in the second page table entry corresponding to the target page number in the second target page table has not stored the access count of the target physical page, the access count can be stored as 1 in the count bit of the second page table entry; if the second page table entry corresponding to the target page number in the second target page table has stored the access count of the target physical page, the access count of the target physical page stored in the count bit of the second page table entry can be incremented by one to update the stored access count of the target physical page.

[0095] That is to say, the electronic device scans the access bit status of each page table entry according to the first target page table, and then when the access bit status of the target page table entry indicates being accessed, queries the second target page table according to the second target page table address, determines the second page table entry in the second target page table that contains the physical page number of the physical page indicated by the target page table entry, and updates the access count stored in the count bit of the second page table entry.

[0096] For example, taking the first target page table as page table 1, and page table 1 includes page table entries 1 to 10 as an example, if the electronic device starts to traverse each page table entry in page table 1 and obtains that the access bit status of page table entries 1 to 5 respectively indicates not being accessed, and the access bit status of page table entry 6 indicates being accessed, then the electronic device can obtain the second target page table according to the second target page table address of the second target page table, and obtain the second page table entry corresponding to page table entry 6 of page table 1 in the second target page table, query the page access count stored in the second target page table entry, and update the page access count, such as adding one to the stored access count. That is to say, if the value of the access count already stored in the count bit of the second page table entry corresponding to page table entry 6 of page table 1 is 2, the electronic device notifies the computing device to add one to the value of the access count stored in the count bit of the second page table entry in the second target page table corresponding to page table entry 6 of page table 1, so that the access count stored in the count bit of the second page table entry is updated to 3; if the page access count is not stored in the count bit of the second page table entry in the second target page table corresponding to page table entry 6, the electronic device notifies the computing device to add one to the value of the access count stored in the count bit of the second page table entry in the second target page table corresponding to page table entry 6 of page table 1, so that the access count stored in the count bit of the second page table entry in the second target page table corresponding to page table entry 6 is updated to 1.

[0097] In a possible implementation manner, after obtaining that the access bit status of the target page table entry indicates that the target physical page is accessed, the physical page address of the target page table entry can be obtained, and then the physical page address of the target page table entry is cached in the first buffer.

[0098] Among them, the first buffer can be used to cache a set of physical page addresses whose access counts of the target physical pages are not zero. Among them, if the electronic device is hardware for page table scanning, a first buffer can be set in the electronic device to cache a set of physical page addresses whose access counts of the target physical pages are not zero. That is to say, each time when starting to count the access count of the physical page, when it is first determined that the target physical page is accessed, the physical page address of the target page table entry is put into the first buffer, and afterwards, when it is found that the target physical page of this target page table entry is accessed again, it is not put into the first buffer; it will be put into the first buffer again until starting to count the page access count again and the counter is cleared.

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

[0100] That is to say, when the access bit status of the target page table entry indicates that the target physical page is accessed and the access count is determined to be zero, the virtual page number corresponding to the physical page number of the target page table entry is stored in the first buffer; when the virtual page numbers stored in the first buffer reach a predetermined condition, the virtual page numbers are stored in the first storage area; wherein, the predetermined condition may include a predetermined storage size or a predetermined quantity.

[0101] Among them, the first storage area may be a storage area for storing a set of virtual page numbers corresponding to target physical pages with a non-zero access count of the target physical page. The first storage area may be a storage area in the memory of the computing device.

[0102] Exemplarily, for a page table scanning hardware with an internal storage area larger than the specified storage threshold, the virtual page numbers of the accessed physical pages can be all put into the first buffer contained therein until a predetermined condition is reached and the set of virtual page numbers of the accessed physical pages is output to the computing device. The predetermined condition may be that the page table scanning hardware completes the scanning of the first target page table and the computing device needs to manage the physical pages of the memory according to the information obtained by the scanning, such as the set of virtual page numbers, so that the computing device can accurately complete the page migration of the hot and cold pages indicated in the first target page table.

[0103] Alternatively, in order to save storage costs, the predetermined condition may further include a predetermined storage size or a predetermined quantity. The first buffer set in the page table scanning hardware is less than or equal to the specified storage threshold. The page table scanning hardware can cache the virtual page numbers corresponding to the accessed physical pages with a size less than the specified threshold in the first buffer during the process of scanning the first target page table. When the size of the set of virtual page numbers stored in the first buffer meets the minimum length of a Direct Memory Access (DMA) request, the set of virtual page numbers corresponding to the accessed physical pages can be transferred from the first buffer to the first storage area in the memory through a DMA request, facilitating subsequent processing of the physical pages corresponding to the virtual page numbers in the first storage area.

[0104] Exemplarily, when the page table scanning hardware scans and determines that the access count of the target physical page is 0, it can record the page address of the target physical page in the first buffer of the page table scanning hardware. When the usage condition of the first buffer reaches a predetermined condition, for example, the predetermined condition can be that the occupied size of the page addresses recorded in the first buffer meets the minimum length of the DMA request, the page scanning hardware can send the page addresses recorded in the first buffer to the computing device.

[0105] In addition, during the process of sending the page addresses recorded in the buffer to the computing device, if the page table scanning hardware scans and finds that a new page has an access count of 0, it can record the newly counted page address in another buffer, and after the process of sending the current page address to the computing device ends, send the newly counted page address to the computing device again.

[0106] Alternatively, during the process of sending the page addresses recorded in the buffer to the computing device, suspend scanning the access counts of each page through the page table scanning hardware until the page addresses in the buffer are completely sent to the computing device, that is, when the buffer can be used to record data again, resume scanning the access counts of each page through the page table scanning hardware, and record the page addresses of the newly counted page access counts from 0 to 1 in the buffer.

[0107] Exemplarily, Figure 4 is a schematic flowchart of a process for counting and storing page access counts involved in an embodiment of the present application. As Figure 4As shown, to enable page access count statistics, first, the first processor 102 needs to set the first page table address, the second page table address, and the offset address. The first page table address is used to obtain the first target page table, where the first target page table is the page table used by one or more applications; the second page table base address is used to obtain the second target page table (S201). After the first processor 102 finishes preparing the above content, it notifies the electronic device 106 of the above content, and the electronic device 106 can start scanning the first target page table to obtain the page access situation of the target physical page (S202), where the page access situation can be determined by obtaining the access bit status in the target page table entry in the first target page table. The electronic device 106 updates the access count of the target physical page stored in the second target page table according to the obtained access count of the stored target physical page (S203). After updating the access count of the target physical page, reset the access bit status of the target page table entry, and then continue to traverse the next target page table entry in the first target page table (S204). When the electronic device 106 obtains the page access situation, that is, when the obtained page access situation indicates that the target physical page is accessed, it notifies the first processor 102 to obtain the access count of the target physical page from the second target page table, and the first processor 102 obtains the access count of the target physical page from the second target page table (S205),

[0108] In addition, Figure 5 is a schematic flow chart of page access count statistics according to an embodiment of the present application. As Figure 5 shown, the electronic device 106 can also determine that the access bit status of the target page table entry indicates that the target physical page is accessed (S301), and then determine whether it is the first access to the target physical page indicated by the target page table entry (S302). If it is determined that it is the first access to the target physical page, the virtual page number of the target physical page can be added to the first storage area (S303), and the access count of the target physical page stored in the second target page table is updated (S304). Otherwise, directly update the access count of the target physical page stored in the second target page table. Where S303 and S304 need to be executed, the execution order is not limited here.

[0109] Taking the electronic device as the page scanning hardware as an example, Figure 6 shows a schematic structural diagram of a system for counting page access times provided by an exemplary embodiment of the present application. As Figure 6As shown, the page scanning hardware can be electrically connected to the first processor 102 through a set interface 13, such as a PCIe interface. The page migration service running in the first processor 102 of the computing device requests to register the first target page table 11 expected to be scanned, the second target page table 12 for recording the access times (recording the access times through bits other than the address), and the first storage area 104 with the page scanning hardware. For example, the first storage area 104 is used to store the set of accessed page addresses or the virtual page numbers of the accessed physical pages. 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. Among them, the page migration service can perform page table synchronization on the first target page table 11 in the first target page table set according to the page table synchronization logic to generate the second target page table 12. The second target page table 12 is only used by the page table scanning hardware, and a dedicated page table format supporting a 64-bit virtual address space can be defined for the second target page table 12. This page table format can be the same as or different from the page table structure supported by the current processor.

[0110] Since the page table formats of mainstream processors are different, the page scanning hardware can be designed to support multiple page table formats. The page migration service can declare which page table format is currently used through the setting interface 13 provided by the page scanning hardware. The page table scanning hardware can use the page table lookup logic corresponding to the page table format according to the used page table format to scan and traverse each page table entry in the first target page table.

[0111] For page scanning hardware with a relatively large internal storage area, the set of page addresses that have been accessed can be completely placed in the page address set buffer 14 contained therein until these page address sets are output externally after reaching a predetermined condition. However, for cost-saving considerations, the page scanning hardware can also store a small amount of page address information of the page. When this information accumulates to the minimum length of a DMA request, it is dumped into the memory 103 through DMA. Since the accessed page sets are stored in batches multiple times, the page scanning hardware includes an output address buffer 15 to ensure that the information output multiple times is stored continuously without being overwritten. For the case where the page directory pointing to the page table is updated during the operation of the application, the page migration service obtains control when the page directory entry is updated by registering a page directory entry update callback function, updates the second target page table 12, and after obtaining the consent of the page table scanning hardware, returns the control to complete the update of the page directory entry. After receiving the page directory entry update request, the page table scanning hardware immediately abandons the scanning of the page table entries contained in the page directory involved in the request to ensure correctness, and then reports to the page migration service that "the page directory entry update event has been processed". In addition, the page table scanning hardware can also support the method of not using a unified second target page table 12 to support the statistics of the page access times of multiple page tables simultaneously.

[0112] The above mainly introduces the solution of the embodiment of the present application from the perspective of the method. It can be understood that in order to implement the above functions, the page access times determination device includes at least one of the corresponding hardware structures and software modules for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.

[0113] The embodiment of the present application can divide the function units of the page access times determination device according to the above method examples. For example, each function 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 a software function unit. It should be noted that the division of units in the embodiment of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.

[0114] Exemplarily, Figure 7FIG. 0 shows a schematic structural diagram of a page access count determination device 400 provided by an exemplary embodiment of the present application. The page access count determination device 400 is applied to a computing device. The page access count determination device 400 includes:

[0115] An acquisition module 410, configured to acquire a first target page table address and a second target page table address; wherein, the first target page table address is used to indicate the storage address of a first target page table in the memory of the computing device; the second target page table address is used to indicate the storage address of a second target page table in the memory of the computing device;

[0116] A processing module 420, configured to respectively determine the first target page table and the second target page table based on the first target page table address and the second target page table address; wherein, the first target page table includes a plurality of second target page table entries; each second target page table entry includes a first physical page number and an access bit; the access bit is used to indicate whether the physical page indicated by the first physical page number is accessed; the second target page table includes second page table entries; the second page table entry includes a second physical page number and a count bit; the count bit is used to store the number of times the physical page indicated by the second physical page number is accessed; wherein, the second physical page number is the first physical page number that has been accessed; determine the access bit status of the target page table entry; wherein, the target page table entry is the page table entry being traversed in the first target page table.

[0117] A storage module 430, configured to update the access count stored in the count bit corresponding to the second physical page number in the second target page table when the access bit status of the target page table entry indicates that the target physical page is accessed.

[0118] For example, in combination with Figure 3 , the acquisition module 410 can be used to execute S101 as shown in Figure 3 , the processing module 420 can be used to execute S102 as shown in Figure 3 , and the storage module 430 can be used to execute S103 as shown in Figure 3 .

[0119] In a possible implementation manner, the storage module 430 is further configured to increment by one the access count value stored in the count bit corresponding to the second physical page number in the second target page table when the access bit status of the target page table entry indicates that the target physical page is accessed.

[0120] In a possible implementation, the storage module 430 is further configured 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 status of the target page table entry indicates that the target physical page has been accessed and the access count of the target physical page is zero; wherein, the first storage area is located in the memory of the computing device.

[0121] In a possible implementation, the storage module 430 is further configured to store the virtual page number corresponding to the physical page number of the target page table entry in the first buffer when the access count of the target physical page is zero.

[0122] When the virtual page numbers stored in the first buffer reach a predetermined condition, store the virtual page numbers in the first storage area; wherein, the predetermined condition includes a predetermined storage size or a predetermined quantity.

[0123] In a possible implementation, the predetermined condition is that the predetermined storage size reaches the minimum length of direct memory access (DMA); the processing module 420 is further configured to obtain an output address; wherein, the output address is a specified storage address in the first storage area; when the virtual page numbers stored in the first buffer reach the minimum length of direct memory access (DMA), store the virtual page numbers in the first storage area based on the output address.

[0124] In a possible implementation, the processing module 420 is further configured to: the first 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; obtain update information of the page directory; determine whether the first target page table has been updated based on the update information of the page directory; when the first target page table has been updated and the traversal of the page table entries of the first target page table has started, stop traversing the page table entries of the first target page table.

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

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

[0127] For the specific descriptions of the above optional manners, reference may be made to the foregoing method embodiments, which will not be elaborated herein. In addition, the explanations and beneficial effects descriptions of any of the above-provided page access count determination devices may refer to the corresponding method embodiments above, and will not be elaborated.

[0128] As an example, in combination with Figure 3 , some or all of the functions implemented by the acquisition module 410, the processing module 420, and the storage module 430 in the page access count determination device can be executed by Figure 2 in the computing device. Among them, the first entity in the computing device can be hardware or software. When the first entity is software, it is executed by the first processor; when the first entity is hardware, the first entity itself includes a second processor and a memory, and can be executed by the second processor of the first entity.

[0129] In an exemplary embodiment, an electronic device is further provided. The electronic device 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 so that the electronic device executes the above Figure 3 all or part of the steps of the page access count determination method shown in any one of the embodiments.

[0130] 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, where the electronic device is electrically connected to the first processor and the memory respectively.

[0131] In an exemplary embodiment, a computer-readable storage medium is further provided, which is used to store at least one instruction, at least one segment of program, a code set or an instruction set, and the at least one instruction, the at least one segment of program, the code set or the instruction set are loaded and executed by a processor to implement all or part of the steps of the above 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), magnetic tape, floppy disk, and optical data storage device, etc.

[0132] In an exemplary embodiment, a computer program product or a computer program is further provided. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computing device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computing device executes the above Figure 3 all or part of the steps of the method shown in any one of the embodiments.

[0133] In some embodiments, the method shown in the embodiments of the present application may 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 articles.

[0134] From the description of the above embodiments, those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0135] In several embodiments provided by the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical functional division. In actual implementation, there may be other division methods. For example, 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 displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

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

[0137] In addition, each functional unit in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0138] 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 such an understanding, the technical solution of the embodiments of the present application, in essence, 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. The software product is stored in a storage medium and includes several instructions for causing a device (which can be a single-chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.

[0139] The foregoing are only alternative embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for determining the page access count, characterized in that, the method includes: determining a first target page table address and a second target page table address; wherein, the first target page table address is used to indicate the storage address of the first target page table in the memory of the computing device; the second target page table address is used to indicate the storage address of the second target page table in the memory of the computing device; respectively obtaining the first target page table and the second target page table based on the first target page table address and the second target page table address; wherein, the first target page table is the page table for which the access count is to be statistically calculated; the first target page table includes a plurality of first page table entries; each first page table entry includes a first physical page number and an access bit; the access bit is used to indicate whether the physical page indicated by the first physical page number is accessed; the second target page table includes a plurality of second page table entries; each second page table entry includes a first physical page number and a count bit; the count bit is used to store the number of times the physical page indicated by the first physical page number is accessed; determining the access bit status of the target page table entry in the first target page table; wherein, the target page table entry is the page table entry being traversed in the first target page table; when the access bit status of the target page table entry indicates that the physical page indicated by the target page number is accessed, updating the access count stored in the count bit corresponding to the target page number in the second target page table; wherein, the target page number is the first physical page number in the target page table entry.

2. The method according to claim 1, characterized in that, when the access bit status of the target page table entry indicates that the physical page indicated by the target page number is accessed, updating the access count stored in the count bit corresponding to the target page number in the second target page table includes: when the access bit status of the target page table entry indicates that the physical page indicated by the target page number is accessed, incrementing by one the value of the access count stored in the count bit corresponding to the target page number in the second target page table.

3. The method according to claim 1 or 2, characterized in that, when the access bit status of the target page table entry indicates that the physical page indicated by the target page number is accessed, the method further includes: when the access count of the physical page indicated by the target page number is zero, storing the virtual page number corresponding to the target page number into a first storage area; wherein, the first storage area is located in the memory of the computing device.

4. The method according to claim 3, characterized in that, the storing the virtual page number corresponding to the target page number into a first storage area when the access count of the physical page indicated by the target page number is zero includes: when the access count of the physical page indicated by the target page number is zero, storing the virtual page number corresponding to the target page number into a first buffer; when the virtual page numbers stored in the first buffer reach a predetermined condition, storing the virtual page numbers into the first storage area; wherein, the predetermined condition includes a predetermined storage size or a predetermined quantity.

5. The method according to claim 4, characterized in that, The predetermined condition is that a predetermined storage size reaches the minimum length of direct memory access (DMA); The method further includes: Obtaining an output address; wherein, the output address is a specified storage address in the first storage area; When the virtual page numbers stored in the first buffer reach the minimum length of direct memory access (DMA), storing the virtual page numbers into the first storage area based on the output address.

6. The method according to any one of claims 1, 2, 4, and 5, wherein, The first 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; The method further includes: Obtaining update information of the page directory; Based on the update information of the page directory, determining whether the first target page table is updated; When the first target page table is updated and the traversal of the page table entries of the first target page table has started, stopping the traversal of the page table entries of the first target page table.

7. The method according to claim 6, wherein, The method further includes: When the first target page table is updated and the traversal of the page table entries of the first target page table has not started, traversing the page table entries of the updated first target page table.

8. The method according to any one of claims 1, 2, 4, 5, and 7, wherein, When the access bit status of the target page table entry indicates that the physical page corresponding to the target page number is accessed, the method further includes: Resetting the access bit status of the target page table entry.

9. An electronic device, wherein, The electronic device includes 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 page access count determination method according to any one of claims 1 to 8.

10. A computing device, wherein, The computing device includes a first processor, a memory, and the electronic device according to claim 9; wherein, the electronic device is electrically connected to the first processor and the memory respectively.

Citation Information

Patent Citations

  • Virtual memory address translation method based on memory mapping adjacency

    CN110688330A

  • Page table prediction method, storage access operation method, electronic device and electronic equipment

    CN115292214A