Method for determining memory page and computing device

By dynamically determining the threshold of the access frequency of the memory page, using the maximum access frequency and the set ratio, the problem of fixed thresholds and poor accuracy in the prior art is solved, and the accuracy of the target memory page is improved.

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

Patent Information

Application Number
CN202311204412.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-14
Publication Date
2025-06-03
Estimated Expiration
2043-09-14

AI Technical Summary

Technical Problem

In the prior art, the access frequency threshold is set based on manual experience, resulting in a fixed threshold and poor accuracy, resulting in low accuracy of the target memory page.

Method used

By obtaining the maximum access frequency value and access frequency threshold in the memory page access frequency set, the access frequency threshold is dynamically determined to match the actual access situation of the memory page.

Benefits of technology

Improves the accuracy of the access frequency threshold, thereby improving the accuracy of the target memory pages determined based on the access frequency threshold, and reducing the risk of inaccurate page counts caused by excessively high or low threshold settings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117370227B_ABST
    Figure CN117370227B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a method for determining a memory page and a computing device, belonging to the technical field of servers. The maximum access frequency and the access frequency threshold setting ratio in the memory page access frequency set are respectively obtained; the memory page access frequency set includes memory pages and the access frequencies corresponding to the memory pages; based on the maximum access frequency and the access threshold setting ratio in the memory page access frequency set, a first access frequency threshold is determined; the access threshold setting ratio is less than 1; when a first memory page is accessed, it is determined whether the access frequency of the first memory page is greater than or equal to the first access frequency threshold; when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, the first memory page is stored in the memory page access frequency set. The accuracy of the access frequency threshold is improved, and thus the accuracy of the target memory page determined based on the access frequency threshold is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of servers, and particularly relates to a method for determining memory pages and a computing device. Background Art

[0002] In order to save the addresses of the memory pages (target memory pages) with the top K access frequencies into the memory with a faster access speed, usually a fixed access frequency threshold is set manually according to experience. The memory pages are sorted in descending order of access frequency, and the memory pages with an access frequency threshold greater than the set access frequency threshold are determined from the sorted memory pages. The determined memory pages are saved into the memory with a faster access speed, thereby improving the access efficiency.

[0003] When adopting the above method, since the access frequency threshold is set depending on manual experience, the access frequency threshold is fixed and has poor accuracy, resulting in low accuracy of the target memory pages based on the access frequency threshold. Summary of the Invention

[0004] Embodiments of this application provide a method for determining memory pages and a computing device, which can improve the accuracy of the access frequency threshold, and further improve the accuracy of the target memory pages determined based on the access frequency threshold.

[0005] In a first aspect, a method for determining memory pages is provided. The method includes: respectively obtaining the maximum value of the access frequencies in the memory page access frequency set and the access threshold setting ratio; wherein, the memory page access frequency set is stored in the memory of the computing device, and the memory page access frequency set includes memory pages and the access frequencies corresponding to the memory pages; determining a first access frequency threshold based on the maximum value of the access frequencies in the memory page access frequency set and the access threshold setting ratio; wherein, the access threshold setting ratio is less than 1; when a first memory page is accessed, determining whether the access frequency of the first memory page is greater than or equal to the first access frequency threshold; when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, storing the first memory page into the memory page access frequency set.

[0006] The access threshold setting ratio is set, for example, based on the distribution pattern satisfied by the access frequencies of the memory pages. Exemplarily, the distribution pattern of the access frequencies of the memory pages includes Zipf distribution (Zipf Distribution), normal distribution, or uniform distribution, etc. Exemplarily, the product of the maximum value of the access frequencies in the memory page access frequency set and the access threshold setting ratio is determined as the first access frequency threshold. The memory page access frequency set may include one or more memory pages and the access frequencies corresponding to each of the one or more memory pages.

[0007] Based on the method provided in the first aspect, since the access frequency threshold is determined by using the maximum value of the access frequency and the set ratio of the access frequency threshold, the access frequency threshold is more matched with the actual access situation of the memory page, thereby improving the accuracy of the access frequency threshold, and further improving the accuracy of the target memory page determined based on the access frequency threshold. For example, if the access frequency of the memory page is generally large, the maximum value of the access frequency will also be large. Therefore, the determined access frequency threshold will also be large, thereby reducing the risk that the access frequency threshold is too small and the number of target memory pages determined based on this threshold is too large. In addition, if the access frequency of the memory page is generally small, the maximum value of the access frequency will also be small. Therefore, the determined access frequency threshold will also be small, thereby reducing the risk of missing target memory pages due to the access frequency threshold being too large.

[0008] In a possible implementation, when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, storing the first memory page in the memory page access frequency set includes: when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, determining whether the access frequency of the first memory page is greater than the maximum value of the access frequency; when the access frequency of the first memory page is not greater than the maximum value of the access frequency, determining whether the first memory page has been selected under the first access frequency threshold; when the first memory page has not been selected under the first access frequency threshold, selecting the first memory page; storing the first memory page in the memory page access frequency set.

[0009] Since the first memory page is stored in the memory page access frequency set only when the first memory page has not been selected under the first access frequency threshold, the probability of repeatedly storing the same page in the memory page access frequency set is reduced, the risk that the memory page access frequency set has a large number of duplicate memory page addresses is reduced, the memory space occupied by the memory page access frequency set in the computing device is saved, and there is no need to require the device to perform a deduplication operation on the memory page access frequency set, reducing the increase in processing complexity.

[0010] In a possible implementation, the method further includes: when the access frequency of the first memory page is greater than the maximum value of the access frequency, storing the first memory page in the memory page access frequency set.

[0011] Since the memory page with the highest access frequency is stored in the memory page access frequency set, the probability that the memory page with the highest access frequency is missed in the statistics of the target memory page is reduced.

[0012] In a possible implementation, the method further includes: generating a second access frequency threshold according to the access frequency of the first memory page and the set ratio of the access frequency threshold; updating the first access frequency threshold to the second access frequency threshold.

[0013] Since the access frequency threshold is updated by combining the access frequencies of memory pages, it is possible to adaptively adjust the size of the access frequency threshold following the accesses of memory pages, making the access frequency threshold more matched to the real-time access situation of memory pages and more accurate.

[0014] In a possible implementation, the memory page access frequency set is stored in the first buffer area of the memory, and the first buffer area is a circular buffer; storing the first memory page into the memory page access frequency set includes: storing the first memory page at the tail of the circular buffer.

[0015] The circular buffer is also known as a cyclic buffer or circular queue, and the circular buffer has a fixed-size capacity. The storage structure of the circular buffer is circular. For example, when the buffer is full of data, new data will continue to be written from the starting position of the buffer, overwriting the previous old data, so that the storage space is always occupied by the latest data, avoiding wasting extra space.

[0016] Since the circular buffer is used to save the memory page access frequency set, the number of cached memory page access frequencies is fixed, reducing the risk of excessive memory occupation caused by caching the access frequencies of a large number of memory pages due to continuous access to a large number of memory pages.

[0017] In a possible implementation, the first buffer area further includes a tail pointer; the tail pointer points to the storage unit whose access frequency is greater than or equal to the first access frequency threshold for the most recent time, and serves as the read starting point for the first processor to obtain the target memory page; wherein, the first processor is the processor of the computing device; storing the first memory page at the tail of the circular buffer includes: storing the first memory page after the tail pointer of the circular buffer.

[0018] Since the tail pointer points to the storage unit whose access frequency is greater than or equal to the first access frequency threshold for the most recent time, and after storing the first memory page after the tail pointer of the circular buffer, the processor of the computing device can obtain the target memory page by inversely searching for the addresses of K memory pages starting from the tail pointer. Therefore, the method of obtaining the target memory page is relatively simple, and at the same time, it is not necessary to require the device to support sorting the access frequencies of all memory pages, thereby reducing the implementation complexity of the device.

[0019] In a possible implementation, the first buffer further includes a head pointer; the head pointer points to the storage unit corresponding to the maximum access frequency in the memory page access frequency set; determining whether the first memory page has been selected below the first access frequency threshold includes: determining whether the first memory page is stored in the storage units between the head pointer and the tail pointer; in the case where the first memory page is not stored in the storage units between the head pointer and the tail pointer, determining that the first memory page has not been selected below the first access frequency threshold; in the case where the first memory page is stored in the storage units between the head pointer and the tail pointer, determining that the first memory page has been selected below the first access frequency threshold.

[0020] Determining that the first memory page has not been selected below the first access frequency threshold based on whether the first memory page is stored in the storage units between the head pointer and the tail pointer helps simplify the logical judgment of whether the first memory page has been selected below the first access frequency threshold. For example, there is no need to search and traverse the entire buffer to determine that the first memory page has not been selected below the first access frequency threshold, thereby improving efficiency.

[0021] In a possible implementation, the method further includes: in the case where the access frequency of the first memory page is less than the first access frequency threshold or the access frequency of the first memory page has been selected below the first access frequency threshold, determining that the first memory page has not been selected.

[0022] In a second aspect, an electronic device is provided. The electronic device includes a second processor and a memory;

[0023] wherein, the second processor and the memory are electrically connected;

[0024] The memory is used to store program instructions;

[0025] The processor is used to call the program instructions so that the electronic device executes the method provided by the first aspect or any optional manner of the first aspect.

[0026] In a third aspect, a computing device is provided. The computing device includes a first processor, a memory, and an electronic device as described in the second aspect; the electronic device is electrically connected to the first processor and the memory respectively.

[0027] In a fourth aspect, a determining device for memory pages is provided. The device includes:

[0028] An access frequency statistics module, configured to respectively obtain the maximum access frequency and the access frequency threshold setting ratio in the memory page access frequency set; wherein, the memory page access frequency set is stored in the memory of the computing device, and the memory page access frequency set includes memory pages and the corresponding access frequencies of the memory pages;

[0029] A threshold determination module, configured to determine a first access frequency threshold based on the maximum value of the access frequencies in the memory page access frequency set and a set ratio of the access threshold, where the set ratio of the access threshold is less than 1; and when a first memory page is accessed, determine whether the access frequency of the first memory page is greater than or equal to the first access frequency threshold.

[0030] A page selection module, configured to store the first memory page into the memory page access frequency set when the access frequency of the first memory page is greater than or equal to the first access frequency threshold.

[0031] In a possible implementation, the page selection module is configured to, when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, determine whether the access frequency of the first memory page is greater than the maximum value of the access frequencies; when the access frequency of the first memory page is not greater than the maximum value of the access frequencies, determine whether the first memory page has been selected under the first access frequency threshold; and when the first memory page has not been selected under the first access frequency threshold, select the first memory page.

[0032] In a possible implementation, the page selection module is further configured to store the first memory page into the memory page access frequency set when the access frequency of the first memory page is greater than the maximum value of the access frequencies.

[0033] In a possible implementation, the threshold determination module is further configured to generate a second access frequency threshold according to the access frequency of the first memory page and the set ratio of the access frequency threshold; and update the first access frequency threshold to the second access frequency threshold.

[0034] In a possible implementation, the memory page access frequency set is stored in a first buffer area of the memory, and the first buffer area is a circular buffer.

[0035] The page selection module is configured to store the first memory page at the tail of the circular buffer.

[0036] In a possible implementation, the first buffer area further includes a tail pointer; the tail pointer points to the storage unit whose access frequency is greater than or equal to the first access frequency threshold for the last time, and serves as the read start point for the first processor to obtain the target memory page; where the first processor is the processor of the computing device.

[0037] The page selection module is configured to store the first memory page after the tail pointer of the circular buffer.

[0038] In a possible implementation, the first buffer area further includes a head pointer; the head pointer points to the storage unit corresponding to the maximum value of the access frequencies in the memory page access frequency set.

[0039] The page selection module is used to determine whether the storage unit between the head pointer and the tail pointer stores the first memory page; in the case where the storage unit between the head pointer and the tail pointer does not store the first memory page, it is determined that the first memory page has not been selected under the first access frequency threshold; in the case where the storage unit between the head pointer and the tail pointer stores the first memory page, it is determined that the first memory page has been selected under the first access frequency threshold.

[0040] In a possible implementation, the page selection module is further used to determine that the first memory page has not been selected in the case where the access frequency of the first memory page is less than the first access frequency threshold or the access frequency of the first memory page has been selected under the first access frequency threshold. Description of the Drawings

[0041] Figure 1 is a schematic diagram of the system architecture of a computing device provided by an embodiment of the present application;

[0042] Figure 2 is a flowchart of a method for determining a memory page provided by this embodiment;

[0043] Figure 3 is a schematic diagram of the structure of a device for determining a memory page provided by an embodiment of the present application;

[0044] Figure 4 is a flowchart of a method for determining a memory page provided by this embodiment;

[0045] Figure 5 is a flowchart of a method for selecting a memory page provided by this embodiment;

[0046] Figure 6 is a schematic diagram of the state of a circular buffer provided by this embodiment;

[0047] Figure 7 is a schematic diagram of the state of a circular buffer provided by this embodiment;

[0048] Figure 8 is a schematic diagram of the state of a circular buffer provided by this embodiment. Detailed Embodiments

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

[0050] The following explains some term concepts related to the embodiments of the present application.

[0051] (1) Memory Page

[0052] A memory page is the basic unit for memory management in a computer. A memory page is usually a block composed of a continuous sequence of bytes of a fixed size, used to store and manage data or programs. The size of a memory page is typically 4 kilobytes (KB), 8 KB, or larger. Each memory page has a unique address, based on which the data in the memory page can be located and accessed.

[0053] (2) Access frequency of memory pages

[0054] The access frequency of a memory page refers to the number of times the memory page is accessed within a certain period. For example, if memory page 1 is accessed 100 times within a certain period, then the access frequency of memory page 1 is 100 times. The magnitude of the access frequency of a memory page can indicate how frequently the memory page is accessed within a certain period.

[0055] (3) Zipf

[0056] The Zipf distribution is a power-law distribution, which means that the access frequencies of most memory pages are inversely proportional to the rankings of the memory pages. For example, among a set of memory pages, the access frequency of memory page A is the highest, that of memory page B is the second highest, and that of memory page C is the third highest. The access frequency of memory page A is twice that of memory page B, and the access frequency of memory page C is half that of memory page B, and so on.

[0057] (4) Buffer

[0058] A buffer is a section of memory in a computer used for temporarily storing data. Buffers are usually used to balance the speed differences between different components or to handle the need for temporary data during data transmission.

[0059] (5) Circular Buffer

[0060] A circular buffer, also known as a cyclic buffer or circular queue, is a linear data structure. A circular buffer typically includes a read pointer and a write pointer, and data reading and writing operations are achieved by continuously moving the pointers in a circular manner. A circular buffer has a fixed-size capacity. For example, when creating a circular buffer, a fixed size is specified, such that the number of data saved through the circular buffer remains fixed and does not change due to data addition or deletion. The storage structure of a circular buffer is circular. For example, when the buffer is full of data, new data will continue to be written from the starting position of the buffer, overwriting the previous old data, so that the storage space is always occupied by the latest data, avoiding waste of additional space. In addition, since a circular buffer is continuously stored in memory and the movement of the read and write pointers is also based on simple and fast operations, the reading and writing operations are usually relatively efficient.

[0061] Optionally, the circular buffer further includes a head pointer and a tail pointer. The head pointer points to the starting position of the buffer (e.g., the first storage unit in the buffer), and the head pointer can be used as the starting point for data reading. The tail pointer points to the ending position of the buffer (e.g., the last storage unit in the buffer), and the tail pointer can be used as the starting point for data writing.

[0062] (6) Hierarchical memory

[0063] Hierarchical memory is a hierarchical memory architecture. Hierarchical memory provides higher performance and capacity by introducing multiple levels of storage media in the memory system. Each level of storage media has different access speeds and capacities.

[0064] For example, the hierarchical memory architecture in a computing device includes a level 1 cache (L1 Cache), a level 2 cache (L2 Cache), main memory, and a hard disk. The L1 Cache is the cache inside the central processing unit (CPU), with an extremely fast access speed but a small capacity, and is used to cache the most frequently used data and instructions. The L2 Cache is located between the CPU and the main memory, with a larger capacity but a relatively slower speed, and is used to process data that cannot be accommodated by the L1 Cache. The main memory is the primary memory, with a larger capacity but a relatively slower read and write speed, and is used to store programs and data. The hard disk has a very large capacity but a slower read and write speed than the main memory, and is used to store a large number of files and data.

[0065] Based on the hierarchical memory architecture, a computing device can save data with a higher access frequency (frequently accessed) to a faster memory level and save data with a lower access frequency (less frequently accessed) to a slower but larger-capacity level, thereby improving the overall performance and resource utilization rate of the computing device.

[0066] (7) The addresses of the top K pages

[0067] The addresses of the top K pages refer to the addresses of the memory pages whose access frequencies rank among the top K. The top K pages are frequently accessed and used, and their access times are more than those of other pages. By identifying the top K pages, the top K pages can be saved to the memory level with a faster speed in the hierarchical memory, thereby providing a faster access speed and response time. K is a positive integer greater than or equal to 1.

[0068] The following is an example of the application scenario of the embodiment of the present application.

[0069] The embodiment of the present application can be applied to the scenario of memory management in hierarchical memory.

[0070] In some possible implementation manners of the present application, by counting the access frequencies of memory pages, an access frequency threshold is determined based on the statistical results, so that the access frequency threshold matches the overall access frequency situation of the memory pages. Therefore, the risk of determining too many memory pages due to too small an access frequency threshold and the risk of determining too few memory pages due to too large an access frequency threshold are reduced. In particular, in the scenario where the number of accessed memory pages is large or the access frequency changes violently, it is difficult to set the access frequency threshold, and the access frequency threshold can be automatically determined according to the statistical results of the access frequency, reducing the complexity of determining the threshold.

[0071] The following is an example of the system architecture of the embodiment of the present application.

[0072] Figure 1 It is a schematic diagram of the system architecture of a computing device provided by the embodiment of the present application. Figure 1 The shown computing device 100 includes an electronic device 110, a processor 120 (also referred to as the first processor), and a memory 130.

[0073] The electronic device 110 is used to determine a first access frequency threshold based on the maximum value of the access frequencies in the memory page access frequency set and the access threshold setting ratio. Since the first access frequency threshold is determined by the electronic device 110, the processor 120 does not need to determine the first access frequency threshold, reducing the computational burden on the processor 120.

[0074] The electronic device 110 includes a processor 111 (also referred to as the second processor) and a memory 112; the processor 111 and the memory 112 are electrically connected; the memory 112 is used to store program instructions; the processor 111 is used to call the program instructions so that the electronic device 110 executes Figure 2 the method provided by the embodiment.

[0075] The electronic device 110 is electrically connected to the processor 120 and the memory 130 respectively. In a possible implementation, the electronic device 110 is an independent electronic device. For example, the electronic device 110 is a peripheral component interconnect express (PCIe) card. The electronic device 110 is electrically connected to the processor 120 and the memory 130 through the PCIe bus. The electronic device 110 can communicate with the processor 120 and the memory 130 through the PCIe protocol. Exemplarily, the electronic device 110 includes a housing, and the processor 111 and the memory 112 are both disposed within the housing of the electronic device 110. In another possible implementation, the electronic device 110 is a memory controller.

[0076] The processor 120 is, for example, a central processing unit (CPU) of the computing device 100. The memory 130 includes a set of memory pages. The set of memory pages includes one or more memory pages. The processor 120 can access the memory pages. The memory 130 can be a random access memory, and the memory 130 can also include other random access memories, such as a static random access memory (SRAM), etc. The memory 130 can also be a Compute Express Link (CXL) storage device. The CXL storage device can be inserted into the motherboard as a card.

[0077] The memory 130 includes a buffer 131 and a buffer 132. The buffer 131 is used to store the addresses of the memory pages and the access counts of the memory pages. The buffer 131 can store the addresses of all the memory pages and the access counts of all the memory pages. The buffer 132 is used to store the addresses of the memory pages whose access frequency is greater than or equal to a first access frequency threshold. In a possible implementation, the electronic device 110 determines, based on the access counts and the addresses of each memory page in the buffer 131, the addresses of the memory pages whose access frequency is greater than or equal to the first access frequency threshold from the buffer 131, and stores the determined addresses of the memory pages into the buffer 132. In a possible implementation, the processor 120 runs memory management software, and the processor 120 allocates the buffer 131 and the buffer 132 through the memory management software.

[0078] In a possible implementation, the computing device 100 includes a main board 140, and the main board 140 includes a processor 120 and a memory 130. The main board 140 is also referred to as a system board. The main board 140 may include a CPU slot and a memory slot. The CPU slot is used to connect the processor 120, and the memory slot is used to connect the memory 130. The memory 130 includes a plurality of memory pages.

[0079] Figure 2 is a flowchart of a method for determining a memory page provided in this embodiment. Figure 2 The method shown is applied to Figure 1 the computing device 100 shown. For example, Figure 2 the method shown is executed by the electronic device 110 in the computing device 100.

[0080] S210, the electronic device 110 respectively obtains the maximum value of the access frequency and the access frequency threshold setting ratio in the memory page access frequency set.

[0081] The access threshold setting ratio is less than 1. The access threshold setting ratio indicates the ratio between the maximum value of the access frequency and the access frequency threshold. Exemplarily, the access threshold setting ratio is determined based on the distribution pattern satisfied by the access frequency of the memory page. The distribution pattern indicates the law of the access frequency, thereby providing guidance for determining the threshold. Exemplarily, the distribution pattern of the access frequency includes Zipf distribution, normal distribution, or uniform distribution, etc.

[0082] Regarding the manner in which the electronic device 110 obtains the access frequency threshold setting ratio, in a possible implementation, the processor 120 obtains the access frequency threshold setting ratio, and the processor 120 sends the access frequency threshold setting ratio to the electronic device 110. In another possible implementation, the electronic device 110 determines the access frequency threshold setting ratio. For example, the electronic device 110 receives the access frequency threshold setting ratio input by the user.

[0083] The memory page access frequency set includes the access frequencies of one or more memory pages. In a possible implementation, the electronic device 110 detects an event that a memory page is accessed. In response to detecting that a memory page is accessed, the access frequency of the memory page is obtained. In a possible implementation, the electronic device 110 detects the value of the access bit in the page table to determine the access frequency of the memory page. A page table is a data structure used to map virtual addresses to physical memory addresses. The page table includes multiple page table entries, and each page table entry corresponds to a memory page. The access bit is a flag bit in the page table entry used to record whether the memory page has been accessed. Each page table entry has a corresponding access bit to indicate the access status of the corresponding memory page. For example, when a program accesses a virtual memory address, the operating system looks up the page table based on the virtual memory address to obtain the corresponding physical memory address, and sets the access bit in the page table entry hit by the virtual memory address to 1, indicating that the memory page has been accessed.

[0084] Regarding the method for determining the access frequency of a memory page, for example, the electronic device 110 scans the value of the access bit in a page table entry. In response to scanning that the value of the access bit in the page table entry is 1, the access frequency of the memory page corresponding to the page table entry is incremented by one; the value of the access bit in the page table entry is reset to 0 so that when the value of the access bit is scanned as 1 next time, the access frequency of the memory page can be continuously accumulated. Optionally, the electronic device 110 periodically scans the page table entries according to a set scanning period. Optionally, the electronic device 110 traverses the values of the access bits in each page table entry in the page table to record the access frequencies of each memory page.

[0085] Since the access frequency of the memory page is determined by the electronic device 110 scanning the value of the access bit in the page table, rather than by the CPU in the processor 120 scanning the value of the access bit in the page table to determine the access frequency of the memory page, the burden on the CPU is reduced, enabling the CPU to spend more time performing other important tasks, improving the overall performance of the computing device, more efficiently utilizing the resources of the computing device, and also reducing the time for counting the access frequencies of the memory pages.

[0086] Taking the process of counting the maximum access frequency of memory page A in the memory page set as an example, in an exemplary embodiment, in response to memory page A in the memory page set being accessed, the access frequency of memory page A is obtained, and the access frequency of memory page A is compared with the first maximum access frequency in the historical record; in response to the access frequency of memory page A being greater than the first maximum access frequency, the first maximum access frequency is updated to the access frequency of memory page A. In another exemplary embodiment, all memory pages in the memory page set are traversed, and the access frequencies of different memory pages are compared. For example, first, the access frequency of the first memory page is set as the current maximum value, and then the access frequencies of subsequent memory pages are sequentially compared with the current maximum value. In response to determining that the access frequency of a certain page is greater than the current maximum value, the current maximum value is updated to the access frequency of that page. After traversing all memory pages, the maximum access frequency is used as the maximum value of the access frequencies of the memory pages.

[0087] The memory 130 in the computing device 100 stores a memory page access frequency set. Alternatively, the memory of the electronic device 110 stores a memory page access frequency set. The memory page access frequency set includes memory pages and the corresponding access frequencies of the memory pages. Optionally, the memory page access frequency set includes the addresses of the memory pages. The address of a memory page can be the number of the storage unit storing the address of the memory page. The address of a memory page can be a logical address or a physical address.

[0088] S220, the electronic device 110 determines a first access frequency threshold based on the maximum value of the access frequencies in the memory page access frequency set and the set ratio of the access threshold.

[0089] In a possible implementation, the electronic device 110 multiplies the maximum value of the access frequencies in the memory page access frequency set by the set ratio of the access threshold, and uses the obtained product as the first access frequency threshold. Of course, the electronic device 110 can also add the product of the maximum value of the access frequencies in the memory page access frequency set and the set ratio of the access threshold to the set coefficient, and use the obtained sum value as the first access frequency threshold.

[0090] Since the access frequency threshold is determined based on the product of the maximum access frequency and the ratio value, the access frequency threshold is more matched with the actual situation of memory page access. Therefore, the access frequency threshold is more accurate, reducing the risk of too few pages caused by too high an access frequency threshold or too many pages caused by too low an access frequency threshold. In addition, the access frequency threshold can be adjusted according to the actual situation of memory page access, so it has stronger flexibility and adaptability. In addition, it is not necessary to require the electronic device 110 to be able to sort the access frequencies of memory pages, so the implementation complexity of the electronic device 110 is reduced.

[0091] S230. When the first memory page is accessed, the electronic device 110 determines whether the access frequency of the first memory page is greater than or equal to the first access frequency threshold.

[0092] The first memory page is one of the memory pages in the memory page set. The electronic device 110 determines that the first memory page is accessed. The electronic device 110 compares the access frequency of the first memory page with the first access frequency threshold to determine that the access frequency of the first memory page is greater than or equal to the access frequency threshold.

[0093] S240. When the access frequency of the first memory page is greater than or equal to the first access frequency threshold, the electronic device 110 stores the first memory page in the memory page access frequency set.

[0094] The memory page access frequency set can be a hot memory address list. The hot memory address list is used to save the addresses of memory pages whose access frequencies are greater than or equal to the access frequency threshold. For example, the hot memory address list includes multiple entries. One entry in the hot memory address list is used to save the address of a memory page whose access frequency is greater than or equal to the access frequency threshold and the access frequency of this memory page.

[0095] In a possible implementation, when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, the electronic device 110 determines whether the access frequency of the first memory page is greater than the maximum value of the access frequency; when the access frequency of the first memory page is not greater than the maximum value of the access frequency, the electronic device 110 determines whether the first memory page has been selected under the first access frequency threshold; when the first memory page has not been selected under the first access frequency threshold, the electronic device 110 selects the first memory page. The electronic device 110 stores the first memory page in the memory page access frequency set.

[0096] Since the first memory page is stored in the memory page access frequency set when the first memory page has not been selected under the first access frequency threshold, the probability of repeatedly storing the same page in the memory page access frequency set is reduced, the risk that there are a large number of duplicate memory page addresses in the memory page access frequency set is reduced, the memory space occupied by the memory page access frequency set in the computing device is saved, and there is no need to require the electronic device 110 to perform a deduplication operation on the memory page access frequency set, reducing the increase in processing complexity.

[0097] In a possible implementation, when the access frequency of the first memory page in the electronic device 110 is greater than the maximum value of the access frequency, the first memory page is stored in the memory page access frequency set. Since the memory page with the highest access frequency is stored in the memory page access frequency set, when the processor 120 obtains the target memory page from the memory page access frequency set, it can obtain the memory page with the highest access frequency, reducing the probability of missing the memory page with the highest access frequency. After the processor 120 subsequently reads the memory page with the highest access frequency, it can migrate the memory page with the highest access frequency to the memory whose access speed is greater than or equal to the access speed threshold, so that the memory page with the highest access frequency can be accessed preferentially.

[0098] In a possible implementation, the electronic device 110 generates a second access frequency threshold according to the access frequency of the first memory page and the set ratio of the access frequency threshold; and updates the first access frequency threshold to the second access frequency threshold. Since the threshold is updated in combination with the access frequency of the memory page when it is detected that the memory page is accessed, the size of the threshold can be adaptively adjusted following the access of the memory page, making the threshold closer to the actual situation, reducing the risk of misjudging the memory page as a top K page due to the static threshold, and improving the accuracy of identifying the top K pages.

[0099] In a possible implementation, the memory page access frequency set is stored in the buffer 132 in the memory 130, and the buffer 132 is a circular buffer; storing the first memory page in the memory page access frequency set includes: the electronic device 110 storing the first memory page at the tail of the circular buffer. In a possible implementation, the buffer 132 is a circular buffer. Considering that the number of memory pages is large, by restricting the type of the buffer and using a circular buffer to save the memory page access frequency set, the risk of excessive memory occupation caused by continuously accessing and recording pages and storing a large number of page addresses in the memory is reduced. By storing the first memory page at the tail of the circular buffer, the complexity for the processor 120 to obtain the target memory page is reduced. For example, the processor 120 starts from the tail of the circular buffer and searches for the addresses of K memory pages in the order from the tail end to the head end as the top K page addresses, so as to obtain approximate top K page addresses without sorting the memory pages according to the access frequency.

[0100] In a possible implementation, buffer 132 further includes a tail pointer; the tail pointer points to a storage unit whose access frequency is greater than or equal to the first access frequency threshold for the most recent time, and serves as the read starting point for the processor 120 to obtain the target memory page; wherein, the processor 120 is the processor of the computing device 100; after the electronic device 110 stores the first memory page behind the tail pointer of the circular buffer. The target memory page is, for example, the top K pages (the memory pages with the top K access frequencies). In this way, it helps the processor 120 quickly find the pages with the top K access frequencies. In a possible implementation, the processor 120 sequentially reversely searches for the addresses of K pages starting from the tail pointer of the buffer 132. For example, the processor 120 first locates the storage unit pointed to by the tail pointer in the buffer 132, finds the memory page whose access frequency is greater than or equal to the first access frequency threshold for the most recent time (such as the first target memory page) from the storage unit pointed to by the tail pointer, then obtains the address of the memory page from the previous storage unit of the storage unit pointed to by the tail pointer (such as the second target memory page), and so on, sequentially searching forward from the tail pointer until K target memory pages are found, and then ending the search process, so as to obtain the K target memory pages with higher access frequencies.

[0101] Optionally, based on the addresses of the K memory pages, the processor 120 migrates the K memory pages to the first type of memory in the memory 130, and the access speed of the first type of memory is greater than or equal to the access speed threshold, thereby improving the access speed of the frequently accessed pages and improving the response performance of the system.

[0102] In a possible implementation, buffer 132 further includes a head pointer; the head pointer points to the storage unit corresponding to the maximum value in the memory page access frequency set; the electronic device 110 determines whether the first memory page is stored in the storage units between the head pointer and the tail pointer; in the case that the first memory page is not stored in the storage units between the head pointer and the tail pointer, the electronic device 110 determines that the first memory page has not been selected under the first access frequency threshold; in the case that the first memory page is stored in the storage units between the head pointer and the tail pointer, the electronic device 110 determines that the first memory page has been selected under the first access frequency threshold. By using the head pointer to point to the storage unit corresponding to the maximum value in the memory page access frequency set, it helps to quickly locate and find the memory page with the highest access frequency, and reduces the probability that the memory page with the highest access frequency is missed in the statistics.

[0103] In a possible implementation, when the access frequency of the first memory page is less than the first access frequency threshold or the access frequency of the first memory page has been selected under the first threshold, the electronic device 110 determines that the first memory page has not been selected.

[0104] In a possible implementation, the electronic device 110 saves a list of hot memory addresses in the buffer 132. The electronic device 110 writes the address of the first memory page to the list of hot memory addresses in the buffer 132.

[0105] In a possible implementation, the buffer 132 includes one or more storage units, and one storage unit is used to store an entry in the list of hot memory addresses.

[0106] In a possible implementation, the buffer 132 is a circular buffer. Considering the large number of memory pages, by restricting the type of the buffer, a circular buffer is used to save the set of memory page access frequencies, thereby reducing the risk of excessive memory occupation caused by continuously accessing and recording pages, resulting in a large number of page addresses being stored in the memory.

[0107] Optionally, during the process of running the memory management software, the processor 120 allocates the buffer 131 in the memory 130 for the electronic device 110. Optionally, the electronic device 110 saves the access frequency information of the memory page set and the memory page set to the buffer 131. Since the access frequency information of the memory page set and the memory page set are cached through the buffer 131, the storage space in the memory 130 can be utilized to accommodate the access frequencies of more memory pages, reducing the risk that the limited storage capacity of the electronic device 110 itself cannot accommodate the access frequencies of all memory pages, which is applicable to scenarios where the data volume of the access frequency information is large due to a large number of memory pages.

[0108] Optionally, during the process of running the memory management software, the processor 120 also allocates the buffer 132 in the memory 130 for the electronic device 110. The buffer 131 is used to store the access frequencies of all memory pages, while the buffer 132 is used to cache the memory pages that meet the threshold conditions in the memory page set (such as the first memory page in the memory page set that is greater than or equal to the first access frequency threshold). In a possible implementation, the processor 120 creates a list of hot memory addresses in the buffer 132, and the processor 120 writes the address of the first memory page in the memory page set that is greater than or equal to the first access frequency threshold and the access frequency of the first memory page to the list of hot memory addresses.

[0109] In a possible implementation, the processor 120 looks up the addresses of K memory pages from the list of hot memory addresses in the buffer 132, where K is a positive integer greater than or equal to 1.

[0110] Optionally, the processor 120 obtains the addresses of K memory pages from the buffer 132. Based on the addresses of the K memory pages, the processor 120 migrates the K memory pages to the first type of memory, and the access speed of the first type of memory is greater than or equal to the access speed threshold, thereby improving the access speed of the frequently accessed pages and improving the response performance of the system.

[0111] The method provided in this embodiment improves the accuracy of the access frequency threshold by statistically counting the access frequency of memory pages and determining the access frequency threshold based on the statistical results, so that the access frequency threshold is more matched with the overall access frequency of memory pages.

[0112] In addition, since the access frequency threshold is relatively accurate, the number of memory pages determined based on the access frequency threshold is closer to the number of top K pages, reducing the risk that the number of determined memory pages is too large due to too small an access frequency threshold, and further reducing the probability of insufficient memory capacity caused by migrating too many memory pages to the memory with a faster access speed. It also reduces the probability of low memory resource utilization caused by the risk that the number of determined memory pages is too small due to too large an access frequency threshold.

[0113] In addition, it is not necessary to require the hardware to sort the access frequencies of memory pages before outputting the addresses of memory pages to the memory management software, thereby reducing the implementation complexity of the hardware. In addition, in the scenario where the memory access frequency changes violently, the determined access frequency threshold is still relatively accurate.

[0114] Figure 3 FIG. 13 is a schematic structural diagram of a memory page determination device 200 provided by an embodiment of the present application. The memory page determination device 200 includes an access frequency statistics module 221, a threshold determination module 223, and a page selection module 222.

[0115] In a possible implementation, the memory 112 in the electronic device 110 is used to store program instructions. The program instructions include multiple software modules, such as Figure 3 the access frequency statistics module 221, the threshold determination module 223, and the page selection module 222 in FIG. 13. After the processor 111 in the electronic device 110 executes each software module, it can perform Figure 2 the corresponding operations in the embodiment according to the instructions of each software module. The operations performed by a software module actually refer to the operations executed by the processor 111 according to the instructions of the software module.

[0116] The access frequency statistics module 221 is used to count the access frequency of memory pages. The threshold determination module 223 is used to determine the access frequency threshold based on the statistical result of the access frequency of memory pages. The page selection module 222 is used to output the address of the memory page whose access frequency is greater than or equal to the access frequency threshold. Since the access frequency of memory pages is counted by the electronic device 110, there is no need for the processor in the processor 120 to count the access frequency of memory pages, which reduces the computing burden on the processor in the processor 120.

[0117] Figure 4 It is a flowchart of a method for determining a memory page provided in this embodiment. Figure 4 The illustrated embodiment is Figure 2 a further refinement of the embodiment. Figure 4 The illustrated embodiment is based on the processor 111 operating in accordance with Figure 3 the instructions of each software module in the embodiment Figure 2 and is described by taking the corresponding operations in the embodiment as an example. Figure 4 The embodiment is described by taking the access processing process of memory page A in the memory page set as an example. Memory page A is any memory page in the memory page set. Figure 4 The embodiment involves the process of updating the access frequency of memory pages. In order to distinguish and describe the access frequency before and after the update, the "first access frequency" is used to describe the access frequency before the update, and the "second access frequency" is used to describe the access frequency after the update.

[0118] S310, the access frequency statistics module 221 detects that memory page A is accessed.

[0119] S320, the access frequency statistics module 221 obtains the current access frequency of memory page A.

[0120] S330, the access frequency statistics module 221 determines whether memory page A is accessed for the first time.

[0121] S340, in the case where it is determined that memory page A is accessed for the first time, the access frequency statistics module 221 adds the address of memory page A to the buffer 131.

[0122] S350, in the case where it is determined that memory page A is not accessed for the first time, the access frequency statistics module 221 updates the access frequency of memory page A recorded in the buffer 131. For example, if the access frequency of memory page A recorded in the buffer 131 is the first access frequency, the access frequency statistics module 221 adds one to the first access frequency to obtain the second access frequency.

[0123] S360, the threshold determination module 223 updates the access frequency threshold based on the second access frequency of the memory page.

[0124] S370, the page selection module 222 selects a memory page from the set of memory pages in buffer 131.

[0125] For the implementation details of S370, reference can be made to Figure 5 S410 to S440 in

[0126] S380, the page selection module 222 determines whether memory page A is selected.

[0127] S390, when it is determined that memory page A is selected, the page selection module 222 adds the address of memory page A to the end of buffer 132.

[0128] S391, when it is determined that memory page A is not selected, the page selection module 222 ends the current memory page access process.

[0129] Figure 5 It is a flowchart of a method for selecting memory pages provided by this embodiment, Figure 5 The illustrated embodiment is Figure 4 a further refinement of S370 in the embodiment, Figure 5 The embodiment involves the process of updating the access frequency threshold. To distinguish between the access frequency thresholds before and after the update, the access frequency threshold before the update is described as the "first access frequency threshold", and the access frequency after the update is described as the "second access frequency threshold". Figure 5 The embodiment includes the following steps.

[0130] S410, the page selection module 222 determines whether the access frequency of memory page A is greater than the recorded first threshold.

[0131] S420, when it is determined that the access frequency of memory page A is greater than the first threshold, the page selection module 222 further determines whether the access frequency of memory page A is greater than the maximum value of the access frequencies of each memory page in the currently recorded set of memory pages.

[0132] S430, when it is determined that the access frequency of memory page A is greater than the maximum value of the currently recorded access frequencies, the page selection module 222 generates a second threshold according to the threshold determination method and the access frequency of memory page A.

[0133] S440, the threshold determination module 223 updates the first threshold to the second threshold.

[0134] Since, when it is detected that a memory page is accessed, the threshold is updated in combination with the access frequency of the memory page, the size of the threshold can be adaptively adjusted following the access of the memory page, making the threshold closer to the actual situation, reducing the risk of misjudging a memory page as a top K page caused by a static threshold, and improving the accuracy of identifying top K pages.

[0135] S450, the page selection module 222 outputs that memory page A is selected.

[0136] S460, when it is determined that the access frequency of memory page A is not greater than the maximum value of the currently recorded access frequency, the page selection module 222 determines whether the address of memory page A has ever been selected under the first threshold.

[0137] By determining whether memory page A has been selected before, the probability of repeatedly selecting the same page is reduced.

[0138] S470, when it is determined that the address of memory page A has not been selected under the first threshold, the page selection module 222 records that the address of memory page A is selected under the first threshold.

[0139] S480, when it is determined that the access frequency of memory page A is not greater than the first threshold or the address of memory page A has been selected under the first threshold, the page selection module 222 outputs that the address of memory page A is not selected.

[0140] The following combines an example to illustrate the above Figures 4 to 5 embodiment. In the following example, the access frequency threshold is determined based on the maximum value of the access frequency of the memory page and the ratio value.

[0141] Example 1

[0142] In some implementation manners, the memory management software determines the threshold determination method according to the estimation of the access pattern of the memory page; the threshold determination method includes the ratio r between the access frequency of the first memory page and the access frequency of the Kth memory page when the access frequencies are arranged in descending order; the memory management software sends the ratio r to the electronic device 110; when the electronic device 110 statistically counts the page access frequency in real time, it determines the access frequency threshold Ft for distinguishing whether a page belongs to the top K pages according to the currently known maximum access frequency Fm and the access frequency threshold setting ratio r, where Ft = Fm * r; for each accessed memory page, the electronic device 110 maintains the position pointer and access frequency of the memory page in the top K circular buffer; for the circular buffer, the electronic device 110 makes the storage unit pointed to by the head pointer of the circular buffer store the page address with the maximum access frequency, and makes the storage unit pointed to by the tail pointer of the circular buffer store the page address whose access frequency is greater than or equal to the access frequency threshold for the last time.

[0143] In some embodiments, the buffer 132 is a circular buffer, and the state of the circular buffer storing the top K page addresses is as Figure 6 shown. Figure 6In the figure, the storage units in the circular buffer are represented by rectangles. The capital letters in the rectangles represent the addresses of specific memory pages, the numbers inside the rectangles represent the values of access frequencies, and the numbers marked above the rectangles are the position information of the memory page addresses in the circular buffer. For example, the 4th storage unit in the circular buffer stores the address of memory page A and the access frequency 100 of memory page A. The 5th storage unit in the circular buffer stores the address of memory page B and the access frequency 92 of memory page B. The 6th storage unit in the circular buffer stores the address of memory page C and the access frequency 80 of memory page C.

[0144] For example, the ratio r = 0.8. As Figure 6 shown, the head pointer of the circular buffer points to page K. The memory management software learns from the access frequency information 101 that the access frequency of page K is 120, indicating that the current known maximum access frequency Fm is 120. Therefore, the memory management software determines the access frequency threshold Ft = 120 * 0.8 = 96. The access frequency of page B is 96, and page B is the memory page whose access frequency is greater than or equal to the access frequency threshold for the most recent time. Therefore, the tail pointer points to page B.

[0145] Optionally, the circular buffer further includes a second-largest value pointer that points to the third storage unit, and the third storage unit stores the address of the memory page with the second-largest access frequency in the memory page set. The second-largest value pointer can be used to indicate the dynamic adjustment of the access frequency threshold when the maximum access frequency changes. For example, the third storage unit stores the address of the memory page that was last recorded as the maximum access frequency in the memory page set. Since a pointer is used to point to the address of the memory page that was last recorded as the maximum access frequency, if necessary, the memory management software can read the address of the memory page that was last recorded as the maximum access frequency based on the pointer. For example, as Figure 6 shown, the second-largest value pointer points to the 4th storage unit, and the 4th storage unit stores the address of memory page A that was last recorded as the maximum access frequency.

[0146] Figure 7 Another possible state of the circular buffer 132 storing the addresses of the top K pages. The access frequency information in buffer 131 includes the position (7) of the address of memory page B in buffer 132. In Figure 7In the illustrated scenario, when the electronic device 110 detects again that memory page B is accessed, the electronic device 110 updates the access frequency of memory page B from 92 to 93. During the process of updating the access frequency of memory page B, the electronic device 110 compares the position of the address of memory page B in buffer 132 with the positions pointed to by the head pointer and the tail pointer; since it is determined that the address of memory page B falls between the positions pointed to by the head pointer and the tail pointer, indicating that the address of memory page B is already in the circular buffer (between the head and tail pointers), the electronic device 110 cancels putting the address of memory page B into the circular buffer. However, for memory page K, since the previous storage position of the address of memory page K in the circular buffer was 5, the access frequency of memory page K is greater than the access frequency threshold, and the storage position of the address of memory page K in the circular buffer is not between the positions pointed to by the head pointer and the tail pointer, so if the electronic device 110 detects an access to memory page K again, the electronic device 110 will put memory page K into the circular buffer, forming Figure 8 the state of.

[0147] In the method provided in this embodiment, instead of adopting a fixed access frequency threshold, the maximum value of the access frequency and the set ratio of the access frequency threshold are used to determine the access frequency threshold, making the access frequency threshold more matched with the actual access situation of the memory page. For example, if the access frequencies of memory pages are generally large, the maximum value of the access frequency will also be large, so the determined access frequency threshold will also be large, thereby reducing the risk of having too many target memory pages due to an overly small access frequency threshold; if the access frequencies of memory pages are generally small, the maximum value of the access frequency will also be small, so the determined access frequency threshold will also be small, thereby reducing the risk of missing target memory pages due to an overly large access frequency threshold. Since the access frequency threshold is relatively accurate, the processor (such as a CPU) on the motherboard can obtain the target memory page more accurately.

[0148] In addition, there is no need to require the electronic device to support sorting the access frequencies of all pages, reducing the implementation complexity of the electronic device.

[0149] Each embodiment in this specification is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments.

[0150] A referring to B means that A is the same as B or A is a simple variation of B.

[0151] In the description and claims of the embodiments of the present application, terms such as "first" and "second" are used to distinguish different objects, rather than to describe a specific order of the objects, nor should they be construed as indicating or implying relative importance. For example, the first memory page and the second memory page are used to distinguish different memory pages, rather than to describe a specific order of the memory pages, nor can it be understood that the first memory page is more important than the second memory page.

[0152] In the embodiments of the present application, unless otherwise specified, the meaning of "at least one" refers to one or more, and the meaning of "a plurality" refers to two or more. For example, a plurality of memory pages refers to two or more memory pages.

[0153] The above embodiments can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid-state drive SolidState Disk (SSD)).

[0154] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for determining a memory page, characterized in that, the method includes: respectively obtaining the maximum access frequency and the set ratio of the access frequency threshold in the memory page access frequency set; wherein, the memory page access frequency set is stored in the memory of the computing device, and the memory page access frequency set includes memory pages and the corresponding access frequencies of the memory pages; determining a first access frequency threshold based on the maximum access frequency in the memory page access frequency set and the set ratio of the access frequency threshold; wherein, the set ratio of the access frequency threshold is less than 1; when a first memory page is accessed, determining whether the access frequency of the first memory page is greater than or equal to the first access frequency threshold; when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, storing the first memory page into the memory page access frequency set.

2. The method according to claim 1, characterized in that, when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, storing the first memory page into the memory page access frequency set includes: when the access frequency of the first memory page is greater than or equal to the first access frequency threshold, determining whether the access frequency of the first memory page is greater than the maximum access frequency; when the access frequency of the first memory page is not greater than the maximum access frequency, determining whether the first memory page has been selected under the first access frequency threshold; when the first memory page has not been selected under the first access frequency threshold, selecting the first memory page; storing the first memory page into the memory page access frequency set.

3. The method according to claim 2, characterized in that, the method further includes: when the access frequency of the first memory page is greater than the maximum access frequency, storing the first memory page into the memory page access frequency set.

4. The method according to claim 3, characterized in that, the method further includes: generating a second access frequency threshold according to the access frequency of the first memory page and the set ratio of the access frequency threshold; updating the first access frequency threshold to the second access frequency threshold.

5. The method according to claim 4, characterized in that, the memory page access frequency set is stored in the first buffer area of the memory, and the first buffer area is a circular buffer; storing the first memory page into the memory page access frequency set includes: storing the first memory page at the tail of the circular buffer.

6. The method according to claim 5, characterized in that, the first buffer area further includes a tail pointer; the tail pointer points to the storage unit whose access frequency is greater than or equal to the first access frequency threshold for the last time, and serves as the read start point for the first processor to obtain the target memory page; wherein, the first processor is the processor of the computing device; storing the first memory page at the tail of the circular buffer includes: Store the first memory page after the tail pointer of the circular buffer.

7. The method according to any one of claims 2-6, wherein, the first buffer further includes a head pointer; the head pointer points to the storage unit corresponding to the maximum access frequency in the memory page access frequency set; Determining whether the first memory page has been selected under the first access frequency threshold includes: Determining whether the storage unit between the head pointer and the tail pointer stores the first memory page; In the case that the storage unit between the head pointer and the tail pointer does not store the first memory page, determining that the first memory page has not been selected under the first access frequency threshold; In the case that the storage unit between the head pointer and the tail pointer stores the first memory page, determining that the first memory page has been selected under the first access frequency threshold.

8. The method according to any one of claims 2-6, wherein, the method further includes: In the case that the access frequency of the first memory page is less than the first access frequency threshold or the access frequency of the first memory page has been selected under the first access frequency threshold, determining that the first memory page has not been selected.

9. An electronic device, wherein, the electronic device includes a second processor and a memory; wherein, the second processor and the memory are electrically connected; the memory is used to store program instructions; the processor is used to call the program instructions to enable the electronic device to execute the method according to any one of claims 1-8.

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

Citation Information

Patent Citations

  • Cache elimination method and device, electronic device and storage medium

    CN114138690A

  • Storage system

    CN115794676A