A memory access method and apparatus

CN116795739BActive Publication Date: 2025-11-04DOUYIN VISION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210253507.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-15
Publication Date
2025-11-04
Estimated Expiration
2042-03-15

Smart Images

  • Figure CN116795739B_ABST
    Figure CN116795739B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a memory access method and device, and relate to the technical field of computers. The method comprises: receiving a memory access request carrying a first virtual page address; obtaining a first page table entry according to the first virtual page address, the first page table entry being a page table entry in a page table with a virtual page address of the first virtual page address; obtaining a storage state identifier used to indicate a storage location of a physical page corresponding to the first page table entry; when the storage state identifier is a first identifier or a second identifier, the first identifier indicating that the physical page corresponding to the first page table entry is stored in a DRAM, and the second identifier indicating that the physical page corresponding to the first page table entry is stored in a PMEM, determining a first physical page according to a physical page address of the first page table entry, and accessing the first physical page; the DRAM and the PMEM are parallel physical memory space supporting application use. Embodiments of the present application are used to avoid waste of DRAM memory space, thereby providing greater total physical memory space.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and in particular, to a memory access method and device. BACKGROUND

[0002] With the development of computer technology, the contradiction between the growing memory resource demand and the limited memory resource is increasingly prominent, and therefore how to expand the memory resource to meet the growing memory resource demand is one of the research focuses in the field of computer.

[0003] The traditional memory resource refers to dynamic random access memory (DRAM). Although DRAM has the advantages of low delay, byte addressable, large read-write bandwidth, etc., the space of DRAM is generally small and expensive, and therefore in recent years, a new type of memory medium called persistent memory (PMEM) has emerged. Based on the advantages of low delay, byte addressable, and large space of PMEM, PMEM can be used as an extension of memory resources to support scenarios with large memory demand. When both DRAM and PMEM are available, the existing memory management mode is to replace DRAM with PMEM as a large memory resource managed by the operating system, and DRAM becomes a cache layer between CPU and PMEM and cannot be used for memory allocation. Since the existing memory management mode hides the memory space of DRAM at the operating system management level, the memory resource of DRAM is wasted. SUMMARY

[0004] Therefore, the present application provides a memory access method and device to avoid wasting DRAM memory space when both DRAM and PMEM are available, thereby providing a larger total physical memory space.

[0005] To achieve the above object, the technical solutions of the embodiments of the present application are provided as follows.

[0006] In a first aspect, the embodiments of the present application provide a memory access method, comprising:

[0007] receiving a memory access request, the memory access request carrying a first virtual page address;

[0008] obtaining a first page table entry according to the first virtual page address, the first page table entry being a page table entry in a page table with a virtual page address of the first virtual page address;

[0009] obtaining a storage state identifier of the first page table entry, the storage state identifier being used to indicate a storage location of a physical page corresponding to the first page table entry;

[0010] When the storage state identifier is the first identifier or the second identifier, the first identifier indicates that the physical page corresponding to the first page table entry is stored in a dynamic random access memory (DRAM), and the second identifier indicates that the physical page corresponding to the first page table entry is stored in a persistent memory (PMEM), a first physical page is determined according to a physical page address of the first page table entry, and the first physical page is accessed.

[0011] As an optional implementation of the embodiment of the present application, the method further comprises:

[0012] When the storage state identifier is the third identifier, the third identifier indicates that the physical page corresponding to the first page table entry is stored in a disk swap space, it is determined whether there is a free physical page in the PMEM;

[0013] If the second physical page in the PMEM is a free physical page, data in the first physical page is migrated to the second physical page, the first page table entry is updated, and the second physical page is accessed according to the updated first page table entry;

[0014] If there is no free physical page in the PMEM, it is determined whether there is a free physical page in the DRAM;

[0015] If the third physical page in the DRAM is a free physical page, data in the first physical page is migrated to the third physical page, the first page table entry is updated, and the third physical page is accessed according to the updated first page table entry.

[0016] As an optional implementation of the embodiment of the present application, the method further comprises:

[0017] If there is no free physical page in the DRAM, it is determined whether there is a first access hotness physical page in the PMEM; the first access hotness physical page is a physical page whose access frequency in the corresponding page table entry is less than an average access frequency of physical pages in the DRAM and the PMEM by a first multiple;

[0018] If the fourth physical page in the PMEM is the first access hotness physical page, data in the fourth physical page is migrated to a fifth physical page in the disk swap space, data in the first physical page is migrated to the fourth physical page, the first page table entry and a second page table entry are updated, and the fourth physical page is accessed according to the updated first page table entry; the second page table entry is a page table entry whose physical page address is the address of the fourth physical page;

[0019] if the first access hotness physical page does not exist in the persistent memory, determining whether the first access hotness physical page exists in the dynamic random access memory;

[0020] if the sixth physical page in the dynamic random access memory is the first access hotness physical page, migrating data in the sixth physical page to a seventh physical page in the disk swap space, migrating data in the first physical page to the sixth physical page, updating the first page table item and a third page table item, and accessing the sixth physical page according to the updated first page table item; wherein the third page table item is a page table item with a physical page address being an address of the sixth physical page.

[0021] As an optional implementation of an embodiment of the present application, the method further comprises:

[0022] if the first access hotness physical page does not exist in the dynamic random access memory, randomly selecting an eighth physical page from the persistent memory;

[0023] migrating data in the eighth physical page to a ninth physical page in the disk swap space, migrating data in the first physical page to the eighth physical page, updating the first page table item and a fourth page table item, and accessing the eighth physical page according to the updated first page table item;

[0024] wherein the fourth page table item is a page table item with a physical page address being an address of the eighth physical page.

[0025] As an optional implementation of an embodiment of the present application, the method further comprises:

[0026] in a case where the storage state identifier of the first page table item is the first identifier or the second identifier, increasing the access frequency of the first page table item by one, and updating the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0027] determining whether the first physical page is a second access hotness physical page; the second access hotness physical page is a physical page with an access frequency in a corresponding page table item being greater than a second multiple of the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0028] if yes, determining whether there is a free physical page in the dynamic random access memory;

[0029] if the ninth physical page in the dynamic random access memory is a free physical page, migrating data in the first physical page to the ninth physical page, and updating the first page table item.

[0030] As an optional implementation of the embodiment of the present application, the method further comprises:

[0031] If there is no free physical page in the dynamic random access memory, it is determined whether there is a third access hotness physical page in the dynamic random access memory; the third access hotness physical page is a physical page whose access frequency in the corresponding page table entry is less than the average access frequency of the physical pages in the dynamic random access memory and the persistent memory by a third multiple;

[0032] If the tenth physical page in the dynamic random access memory is the third access hotness physical page, it is determined whether there is a free physical page in the persistent memory;

[0033] If the eleventh physical page in the persistent memory is a free physical page, the data in the tenth physical page is migrated to the eleventh physical page, the data in the first physical page is migrated to the tenth physical page, and the first page table entry and the fifth page table entry are updated; the fifth page table entry is a page table entry whose physical page address is the address of the tenth physical page;

[0034] If there is no free physical page in the persistent memory, the data in the tenth physical page is migrated to the twelfth physical page in the disk swap space, the data in the first physical page is migrated to the tenth physical page, and the first page table entry and the fifth page table entry are updated.

[0035] As an optional implementation of the embodiment of the present application, the memory access request is used to request reading target data; the access to the first physical page comprises:

[0036] reading the target data from the first physical page;

[0037] writing the target data into a last level cache (LLC).

[0038] As an optional implementation of the embodiment of the present application, the memory access request is used to request writing target data into the memory; the access to the first physical page comprises:

[0039] reading placeholder data from the first physical page, the placeholder data being data in a storage location in the first physical page configured to write the target data;

[0040] writing the placeholder data into an LLC;

[0041] modifying the placeholder data in the LLC to the target data, and writing the target data in the LLC into the first physical page when a preset condition is met.

[0042] As an optional implementation of the embodiment of the present application, before the first page table item is acquired according to the first virtual page address, the method further comprises:

[0043] allocating the first physical page for the target data from the dynamic random access memory or the persistent memory, and creating the first page table item.

[0044] As an optional implementation of the embodiment of the present application, the allocating the first physical page for the target data from the dynamic random access memory or the persistent memory comprises:

[0045] allocating the first physical page for the target data from the dynamic random access memory based on a first probability, and allocating the first physical page for the target data from the persistent memory based on a second probability;

[0046] wherein the first probability is positively related to the capacity of the dynamic random access memory, and the second probability is positively related to the capacity of the persistent memory.

[0047] In a second aspect, an embodiment of the present application provides a memory access device, comprising:

[0048] a receiving unit configured to receive a memory access request, the memory access request carrying a first virtual page address;

[0049] an acquiring unit configured to acquire a first page table item according to the first virtual page address, the first page table item being a page table item in a page table with a virtual page address being the first virtual page address;

[0050] a processing unit configured to acquire a storage state identifier of the first page table item, the storage state identifier being used to indicate a storage location of a physical page corresponding to the first page table item;

[0051] an accessing unit configured to, when the storage state identifier is a first identifier or a second identifier, the first identifier indicating that the physical page corresponding to the first page table item is stored in a dynamic random access memory (DRAM) and the second identifier indicating that the physical page corresponding to the first page table item is stored in a persistent memory (PMEM), determine a first physical page according to a physical page address of the first page table item, and access the first physical page; wherein the DRAM and the PMEM are parallel physical memory spaces supporting application use.

[0052] As an optional implementation of the embodiment of the present application, the access unit is further configured to, when the storage state identifier is a third identifier, the third identifier indicating that the first page table entry corresponds to a physical page stored in the disk swap space, determine whether there is a free physical page in the persistent memory; if the second physical page in the persistent memory is a free physical page, migrate data in the first physical page to the second physical page, update the first page table entry, and access the second physical page according to the updated first page table entry; if there is no free physical page in the persistent memory, determine whether there is a free physical page in the dynamic random access memory; if the third physical page in the dynamic random access memory is a free physical page, migrate data in the first physical page to the third physical page, update the first page table entry, and access the third physical page according to the updated first page table entry.

[0053] As an optional implementation of the embodiment of the present application, the access unit is further configured to, if there is no free physical page in the dynamic random access memory, determine whether there is a first access hotness physical page in the persistent memory; the first access hotness physical page is a physical page whose access frequency in the corresponding page table entry is less than an average access frequency of physical pages in the dynamic random access memory and the persistent memory by a first multiple.

[0054] If the fourth physical page in the persistent memory is the first access hotness physical page, migrate data in the fourth physical page to a fifth physical page in the disk swap space, migrate data in the first physical page to the fourth physical page, update the first page table entry and a second page table entry, and access the fourth physical page according to the updated first page table entry; the second page table entry is a page table entry whose physical page address is the address of the fourth physical page.

[0055] If there is no first access hotness physical page in the persistent memory, determine whether there is a first access hotness physical page in the dynamic random access memory.

[0056] If the sixth physical page in the dynamic random access memory is the first access hotness physical page, migrate data in the sixth physical page to a seventh physical page in the disk swap space, migrate data in the first physical page to the sixth physical page, update the first page table entry and a third page table entry, and access the sixth physical page according to the updated first page table entry; the third page table entry is a page table entry whose physical page address is the address of the sixth physical page.

[0057] As an optional implementation of the embodiment of the present application, the access unit is further configured to

[0058] if the first access hotness physical page does not exist in the dynamic random access memory, randomly selecting an eighth physical page from the persistent memory;

[0059] migrating data in the eighth physical page to a ninth physical page in the disk swap space, migrating data in the first physical page to the eighth physical page, updating the first and fourth page table entries, and accessing the eighth physical page according to the updated first page table entry;

[0060] The fourth page table entry is a page table entry with a physical page address being an address of the eighth physical page.

[0061] As an optional implementation of the embodiment of the present application, the access unit is further configured to, when the storage state identifier is the first identifier or the second identifier, increase the access frequency of the first page table entry by one, and update the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0062] determining whether the first physical page is a second access hotness physical page; the second access hotness physical page is a physical page with an access frequency in the corresponding page table entry being greater than a second multiple of the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0063] if yes, determining whether there is a free physical page in the dynamic random access memory;

[0064] if the ninth physical page in the dynamic random access memory is a free physical page, migrating data in the first physical page to the ninth physical page, and updating the first page table entry.

[0065] As an optional implementation of the embodiment of the present application, the access unit is further configured to, if there is no free physical page in the dynamic random access memory, determining whether there is a third access hotness physical page in the dynamic random access memory; the third access hotness physical page is a physical page with an access frequency in the corresponding page table entry being less than a third multiple of the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0066] if the tenth physical page in the dynamic random access memory is the third access hotness physical page, determining whether there is a free physical page in the persistent memory;

[0067] if the eleventh physical page in the persistent memory is a free physical page, migrating data in the tenth physical page into the eleventh physical page, migrating data in the first physical page into the tenth physical page, and updating the first page table entry and the fifth page table entry; the fifth page table entry is a page table entry with an address of the tenth physical page;

[0068] if there is no free physical page in the persistent memory, migrating data in the tenth physical page into a twelfth physical page in a disk swap space, migrating data in the first physical page into the tenth physical page, and updating the first page table entry and the fifth page table entry.

[0069] As an embodiment of the present application, the memory access request is used to request reading target data; the accessing the first physical page comprises:

[0070] reading the target data from the first physical page;

[0071] writing the target data into a last level cache (LLC).

[0072] As an optional embodiment of the present application, the memory access request is used to request writing target data into the memory; the accessing unit is specifically configured to read placeholder data from the first physical page, the placeholder data being data in a storage location in the first physical page configured to write the target data; write the placeholder data into an LLC; modify the placeholder data in the LLC into the target data, and write the target data in the LLC into the first physical page when a preset condition is met.

[0073] As an optional embodiment of the present application, the accessing unit is further configured to allocate the first physical page for the target data from the dynamic random access memory or the persistent memory and create the first page table entry before acquiring the first page table entry according to the first virtual page address.

[0074] As an optional embodiment of the present application, the accessing unit is specifically configured to allocate the first physical page for the target data from the dynamic random access memory based on a first probability, and allocate the first physical page for the target data from the persistent memory based on a second probability.

[0075] wherein the first probability is positively related to a capacity of the dynamic random access memory, and the second probability is positively related to a capacity of the persistent memory.

[0076] In a third aspect, an electronic device is provided, comprising: a memory configured to store a computer program; and a processor configured to execute the memory access method of the first aspect or any of the optional implementations of the first aspect when the computer program is invoked.

[0077] In a fourth aspect, a computer readable storage medium is provided, having stored thereon a computer program, which, when executed by a processor, implements the memory access method of the first aspect or any of the optional implementations of the first aspect.

[0078] In a fifth aspect, a computer program product is provided, which, when running on a computer, causes the computer to implement the memory access method of the first aspect or any of the optional implementations of the first aspect.

[0079] The memory access method provided by the embodiments of the present application, when receiving a memory access request, first acquires a first page table entry in a page table with a virtual page address carried in the memory access request being the first virtual page address, then acquires a storage state identifier used to indicate a storage location of a physical page corresponding to the first page table entry, and when the storage state identifier is a first identifier or a second identifier, the first identifier indicating that the physical page corresponding to the first page table entry is stored in a dynamic random access memory (DRAM), and the second identifier indicating that the physical page corresponding to the first page table entry is stored in a persistent memory (PMEM), determines a first physical page according to a physical page address of the first page table entry, and accesses the first physical page. Since the DRAM and the PMEM are parallel physical memory spaces supporting application use, the DRAM and the PMEM in the embodiments of the present application are parallel architecture physical memories, and can be used for memory allocation. Compared with the existing memory management mode, the PMEM masks the DRAM memory space at the operating system management level, and in the memory access method provided by the embodiments of the present application, the DRAM and the PMEM are parallel architecture physical memories, and can be used for memory allocation. Therefore, the embodiments of the present application can effectively use the memory space of the DRAM, avoid wasting the memory space of the DRAM, and further provide a larger total physical memory space. BRIEF DESCRIPTION OF DRAWINGS

[0080] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the application.

[0081] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.

[0082] Figure 1 One of the step flow charts of the memory access method provided by the embodiments of the present application;

[0083] Figure 2 The second step flow chart of the memory access method provided by the embodiments of the present application;

[0084] Figure 3 The third step flow chart of the memory access method provided by the embodiments of the present application;

[0085] Figure 4 The structural schematic diagram of the memory access device provided by the embodiments of the present application;

[0086] Figure 5 The hardware structural schematic diagram of the electronic device provided by the embodiments of the present application. DETAILED DESCRIPTION

[0087] In order to more clearly illustrate the above-mentioned purposes, features and advantages of the present application, the solutions of the present application will be further described below. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.

[0088] In the following description, many specific details are set forth in order to provide a thorough understanding of the present application. However, the present application can be practiced in different ways from those described herein without departing from the present application. It is apparent that the embodiments described in the specification only represent some of the embodiments of the present application, not all the embodiments.

[0089] In the embodiments of the present application, the words such as "exemplary" or "for example" are used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as more preferred or more advantageous than other embodiments or design schemes. In fact, the words such as "exemplary" or "for example" are intended to present the relevant concept in a specific way. In addition, in the description of the embodiments of the present application, the meaning of "plurality" is two or more, unless otherwise specified.

[0090] Based on the above content, the embodiments of the present application provide a memory access method, referring to Figure 1 The memory access method provided by the embodiments of the present application includes the following steps:

[0091] S11, receiving a memory access request.

[0092] The memory access request carries a first virtual page address.

[0093] Specifically, the memory access request in the application can be a memory access request triggered by a program reading data from the memory, or a memory access request triggered by the program writing data into the memory. Regardless of the memory access request triggered by reading data from the memory or the memory access request triggered by writing data into the memory, when the program accesses the memory, the program uses the address of the virtual page corresponding to the physical page that needs to be accessed. Therefore, the first virtual page address carried by the memory access request is the address of the virtual page corresponding to the physical page that needs to be accessed by the program.

[0094] S12, obtaining a first page table item according to the first virtual page address.

[0095] The first page table item is a page table item in a page table with a virtual page address being the first virtual page address.

[0096] As described above, when the program accesses the memory, the program uses the address of the virtual page corresponding to the physical page that needs to be accessed. The virtual page address needs to be converted into a physical page address by a memory management unit (MMU) of an operating system before accessing the physical memory. To achieve the conversion of the virtual page address and the physical page address, the MMU constructs a page table including the corresponding relationship between each virtual page address and the physical page address. Therefore, the page table item in the page table with the virtual page address being the first virtual page address can be obtained as the first page table item in the embodiment of the application.

[0097] S13, obtaining a storage state identifier of the first page table item.

[0098] The storage state identifier is used to indicate the storage location of the physical page corresponding to the first page table item.

[0099] In the embodiment of the application, the physical page corresponding to the page table item is the physical page corresponding to the physical page address of the table item.

[0100] The storage state identifier of the first page table item in the embodiment of the application can be a first identifier, a second identifier, or a third identifier. The first identifier indicates that the physical page corresponding to the page table item is a physical page in a dynamic random access memory, the second identifier indicates that the physical page corresponding to the page table item is a physical page in a persistent memory, and the third identifier indicates that the physical page corresponding to the page table item is a physical page in a disk swap space.

[0101] The disk exchange space in the embodiment of the present application is an extension of the physical memory resource. When the physical memory is exhausted or exceeds a certain usage ratio, the operating system can transfer a part of data on the physical memory to the disk, thereby giving up the space resource of the physical memory for new allocation requests and data occupation, and the disk used for storing the data on the physical memory is the disk exchange space in the embodiment of the present application.

[0102] For example, each page table entry in the page table can store the storage state identifier by 2 data bits. When the values of the two data bits are 01, the storage state identifier is the first identifier, indicating that the physical page corresponding to the physical page address of the page table entry is a physical page in the dynamic random access memory. When the values of the two data bits are 10, the storage state identifier is the second identifier, indicating that the physical page corresponding to the physical page address of the page table entry is a physical page in the persistent memory. When the values of the two data bits are 11, the storage state identifier is the third identifier, indicating that the physical page corresponding to the physical page address of the page table entry is a physical page in the disk exchange space.

[0103] S14, when the storage state identifier is the first identifier or the second identifier, the first identifier indicates that the physical page corresponding to the first page table entry is stored in the dynamic random access memory, and the second identifier indicates that the physical page corresponding to the first page table entry is stored in the persistent memory, determining a first physical page according to the physical page address of the first page table entry, and accessing the first physical page.

[0104] The dynamic random access memory and the persistent memory are parallel physical memory spaces supporting application use.

[0105] That is, after obtaining the storage state identifier of the first page table entry, it is determined whether the storage state identifier of the first page table entry is the first identifier or the second identifier. If the storage state identifier of the first page table entry is the first identifier or the second identifier, a first physical page is determined according to the physical page address of the first page table entry, and the first physical page is accessed.

[0106] The memory access request in the embodiment of the present application can be a memory access request triggered by reading data from the memory, or a memory access request triggered by writing data to the memory. The implementation of accessing the first physical page in step S14 is described below when the memory access request is used to request reading data from the memory and the memory access request is used to request writing data to the memory.

[0107] As an optional implementation of the embodiment of the present application, when the memory access request is used to request reading target data, the accessing of the first physical page includes:

[0108] reading the target data from the first physical page;

[0109] write the target data into a last level cache (LLC).

[0110] As an optional implementation of the embodiment of the present application, when the memory access request is used to request writing target data into the memory, the accessing the first physical page comprises:

[0111] reading placeholder data from the first physical page, the placeholder data being data in a storage location of the first physical page configured to write the target data;

[0112] writing the placeholder data into the LLC;

[0113] modifying the placeholder data in the LLC into the target data, and writing the target data in the LLC into the first physical page when a preset condition is met.

[0114] Further, when the memory access request is a memory access request triggered by writing target data into the memory, before writing the target data into the physical page, the target data needs to be allocated a physical page for writing the target data, and then the subsequent writing operation can be performed, therefore, before obtaining the first page table item according to the first virtual page address, the memory access method provided by the embodiment of the present application further comprises:

[0115] allocating the first physical page for the target data from the dynamic random access memory or the persistent memory, and creating the first page table item.

[0116] That is, compared with the prior art, the memory allocation algorithm of the embodiment of the present application further needs to add a selection layer for selecting a physical page for writing data from the DRAM or the PMEM.

[0117] As an optional implementation of the embodiment of the present application, the allocating the first physical page for the target data from the dynamic random access memory or the persistent memory comprises:

[0118] allocating the first physical page for the target data from the dynamic random access memory based on a first probability, and allocating the first physical page for the target data from the persistent memory based on a second probability;

[0119] wherein the first probability is positively related to the capacity of the dynamic random access memory, and the second probability is positively related to the capacity of the persistent memory.

[0120] For example, the first probability is proportional to the capacity of the dynamic random access memory, and the second probability is proportional to the capacity of the persistent memory. For example, if the ratio of the capacity of the DRAM to the capacity of the PMEM is 1:K, then when a program applies for a page allocation, the probability of allocating a physical page from the DRAM is 1 / K+1, and the probability of allocating a physical page from the PMEM is K / K+1.

[0121] The memory access method provided by the embodiment of the present application first acquires a first page table entry with a virtual page address as the first virtual page address in a page table according to the virtual page address carried in the memory access request, then acquires a storage state identifier used for indicating the storage location of the physical page corresponding to the first page table entry, and when the storage state identifier is a first identifier or a second identifier, the first identifier indicates that the physical page corresponding to the first page table entry is stored in the dynamic random access memory DRAM, and the second identifier indicates that the physical page corresponding to the first page table entry is stored in the persistent memory PMEM, the first physical page is determined according to the physical page address of the first page table entry, and the first physical page is accessed. Since the DRAM and the PMEM are parallel physical memory spaces supporting application use, the DRAM and the PMEM are parallel architecture physical memories in the embodiment of the present application, and can be used for memory allocation. Compared with the existing memory management mode in which the PMEM masks the DRAM memory space at the operating system management level, in the memory access method provided by the embodiment of the present application, the DRAM and the PMEM are parallel architecture physical memories, and can be used for memory allocation. Therefore, the embodiment of the present application can effectively use the memory space of the DRAM, avoid wasting the memory space of the DRAM, and further provide a larger total physical memory space.

[0122] As an extension and refinement of the above embodiment, the embodiment of the present application provides another memory access method, which is shown in Figure 2 The memory access method includes the following steps:

[0123] S201, receiving a memory access request.

[0124] The memory access request carries a first virtual page address.

[0125] S202, acquiring a first page table entry according to the first virtual page address.

[0126] The first page table entry is a page table entry with a virtual page address as the first virtual page address in a page table.

[0127] S203, acquiring a storage state identifier of the first page table entry.

[0128] The storage state identifier is used for indicating the storage location of the physical page corresponding to the first page table entry.

[0129] S204, determine whether the storage state identifier of the first page table entry is the first identifier or the second identifier.

[0130] The first page table entry corresponds to a physical page stored in a dynamic random access memory (DRAM), and the second identifier indicates that the physical page corresponding to the first page table entry is stored in a persistent memory (PMEM). The DRAM and the PMEM are parallel physical memory spaces supporting application use.

[0131] In the above step S204, if the storage state identifier of the first page table entry is the first identifier or the second identifier, the following step S205 is performed.

[0132] S205, determine a first physical page according to the physical page address of the first page table entry, and access the first physical page.

[0133] In the above step S204, if the storage state identifier of the first page table entry is the third identifier, the following step S206 is performed.

[0134] The third identifier indicates that the first physical page is a physical page in a disk swap space.

[0135] S206, determine whether there is a free physical page in the persistent memory.

[0136] Specifically, the free physical page in the embodiment of the present application refers to a physical page in the physical memory that is not configured for data storage.

[0137] In the above step S206, if it is determined that the second physical page in the persistent memory is a free physical page, the following steps S207 to S209 are performed.

[0138] S207, migrate data in the first physical page to the second physical page.

[0139] That is, the data in the first physical page is migrated from the physical page of the disk swap space to the physical page of the PMEM.

[0140] S208, update the first page table entry.

[0141] As an optional implementation of the embodiment of the present application, the above step S208 (updating the first page table entry) includes:

[0142] updating the storage state identifier of the first page table entry to the second identifier, updating the physical page address of the first page table entry to the address of the second physical page, and updating the access frequency of the first page table entry to the average access frequency of the physical pages in the dynamic random access memory and the persistent memory.

[0143] Since the embodiments described above migrate the data of the physical page in the disk swap space to the physical page of the physical memory, and update the access times of the corresponding page table item as the average access times of the physical pages in the dynamic random access memory and the persistent memory, the embodiments described above can avoid the cold start problem.

[0144] S209, access the second physical page according to the updated first page table item.

[0145] That is, when the physical page that needs to be accessed by the program is in the physical page of the disk swap space, first determine whether there is a free physical page in the PMEM, if there is a free physical page in the PMEM, migrate the data in the physical page that needs to be accessed to the free physical page in the PMEM, and update the corresponding page table item, and then access the physical page according to the updated page table item.

[0146] In the above step S206, if it is determined that there is no free physical page in the persistent memory, the following step S210 is performed.

[0147] S210, determine whether there is a free physical page in the dynamic random access memory.

[0148] That is, when there is no free physical page in the persistent memory, determine whether there is a free physical page in the dynamic random access memory.

[0149] In the above step S210, if the third physical page in the dynamic random access memory is a free physical page, the following steps S211 to S213 are performed:

[0150] S211, migrate the data in the first physical page to the third physical page.

[0151] S212, update the first page table item.

[0152] As an optional implementation of the embodiments of the present application, the above step S212 (updating the first page table item) comprises:

[0153] updating the storage state identifier of the first page table item to the first identifier, updating the physical page address of the first page table item to the address of the third physical page, and updating the access times of the first page table item to the average access times of the physical pages in the dynamic random access memory and the persistent memory.

[0154] S213, access the third physical page according to the updated first page table item.

[0155] That is, when the physical page required to be accessed is in the physical page of the disk swap space, first determine whether there is a free physical page in the PMEM, if there is no free physical page in the PMEM, determine whether there is a free physical page in the DRAM. If yes, migrate the data in the physical page required to be accessed to the free physical page in the DRAM, and update the corresponding page table entry, and then access the physical page according to the updated page table entry.

[0156] In the above step S210, if there is no free physical page in the dynamic random access memory, the following step S213 is performed:

[0157] S213, determine whether there is a physical page with a first access frequency in the persistent memory.

[0158] The physical page with the first access frequency is a physical page with an access frequency in the corresponding page table entry less than a first multiple of an average access frequency of the physical pages in the dynamic random access memory and the persistent memory.

[0159] That is, the page table entry in the embodiment of the application further includes an access frequency indicating the access frequency of the corresponding physical page. For example, 4 data bits can be added to each page table entry, and the access frequency is saved through the 4 data bits.

[0160] For example, the physical pages in the physical memory can be divided into 4 categories based on the access frequency, and the 4 categories are:

[0161] The physical page with an access frequency higher than T1 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM);

[0162] The physical page with an access frequency lower than T1 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM) but higher than T2 times of the average access frequency;

[0163] The physical page with an access frequency lower than T2 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM) but higher than T3 times of the average access frequency;

[0164] The physical page with an access frequency lower than T3 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM).

[0165] Wherein, T1>T2>T3. For example, T1, T2, T3 can be 1.2, 0.8, 0.5 respectively.

[0166] Further, the first access hotness in the embodiment of the present application can be a physical page whose access frequency is higher than T1 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM) or a physical page whose access frequency is lower than T2 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM) but higher than T3 times of the average access frequency of the physical pages in the physical memory (DRAM+PMEM).

[0167] In the step S214, if the fourth physical page in the persistent memory is the first access hotness, the following steps S215-S218 are performed.

[0168] S215, migrating the data in the fourth physical page to a fifth physical page in the disk swap space.

[0169] S216, migrating the data in the first physical page to the fourth physical page.

[0170] S217, updating the first page table entry and the second page table entry.

[0171] The second page table entry is a page table entry whose physical page address is the address of the fourth physical page.

[0172] As an optional implementation of the embodiment of the present application, the step S217 (updating the first page table entry and the second page table entry) includes:

[0173] updating the storage state identifier of the first page table entry to the second identifier, updating the physical page address of the first page table entry to the address of the fourth physical page, and updating the access frequency of the first page table entry to the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0174] updating the storage state identifier of the second page table entry to the third identifier, updating the physical page address of the second page table entry to the address of the fifth physical page, and updating the access frequency of the second page table entry to a preset value.

[0175] For example, the preset value can be 0.

[0176] S218, accessing the fourth physical page according to the updated first page table entry.

[0177] That is, when the physical page accessed by the program is in the physical page of the disk swap space, first, it is determined whether there is a free physical page in the PMEM and the DRAM, if there is no free physical page in the PMEM and the DRAM, it is determined whether there is a physical page with low access heat in the PMEM, if yes, the data of the physical page with low access heat in the PMEM is migrated to the physical page in the disk swap space, the data in the physical page to be accessed is migrated to the physical page with low access heat in the PMEM, and the corresponding page table item is updated, and then the physical page is accessed according to the updated page table item.

[0178] In the step S214, if there is no physical page with the access times less than the first threshold times in the persistent memory, the following step S219 is performed:

[0179] S219, determining whether there is a physical page with the first access heat in the dynamic random access memory.

[0180] In the step S219, if it is determined that the sixth physical page in the dynamic random access memory is a physical page with the first access heat, the following steps S220 to S223 are performed:

[0181] S220, migrating the data in the sixth physical page to a seventh physical page in the disk swap space.

[0182] S221, migrating the data in the first physical page to the sixth physical page.

[0183] S222, updating the first page table item and a third page table item.

[0184] The third page table item is a page table item with the physical page address being the address of the sixth physical page.

[0185] As an optional implementation of the embodiment of the application, updating the first page table item and the third page table item comprises:

[0186] updating the storage state identifier of the first page table item to the first identifier, updating the physical page address of the first page table item to the address of the sixth physical page, and updating the access times of the first page table item to the average access times of the physical pages in the dynamic random access memory and the persistent memory;

[0187] updating the storage state identifier of the third page table item to a third identifier, updating the physical page address of the third page table item to the address of the seventh physical page, and updating the access times of the third page table item to the preset value.

[0188] S223, access the sixth physical page according to the updated first page table entry.

[0189] That is, when the physical page required to be accessed is in the physical page of the disk swap space, first, it is determined whether there is a free physical page in the PMEM and the DRAM, if there is no free physical page in the PMEM and the DRAM, it is determined whether there is a physical page with low access frequency in the PMEM, if there is no physical page with low access frequency in the PMEM, it is determined whether there is a physical page with low access frequency in the DRAM, if yes, the data of the physical page with low access frequency in the DRAM is migrated to the physical page in the disk swap space, the data in the physical page required to be accessed is migrated to the physical page with low access frequency in the DRAM, and the corresponding page table entry is updated, and then the physical page is accessed according to the updated page table entry.

[0190] In the step S219, if it is determined that there is no physical page with access frequency less than the first threshold value in the dynamic random access memory, the following steps S224 to S228 are executed:

[0191] S224, randomly select an eighth physical page from the persistent memory.

[0192] S225, migrate the data in the eighth physical page to a ninth physical page in the disk swap space.

[0193] S226, migrate the data in the first physical page to the eighth physical page.

[0194] S227, update the first page table entry and a fourth page table entry.

[0195] The fourth page table entry is a page table entry with a physical page address being the address of the eighth physical page

[0196] As an optional implementation of the embodiment of the application, the step S227 (updating the first page table entry and the fourth page table entry) includes:

[0197] updating the storage state identifier of the first page table entry to the second identifier, updating the physical page address of the first page table entry to the address of the eighth physical page, and updating the access frequency of the first page table entry to the average access frequency of the physical pages in the dynamic random access memory and the persistent memory;

[0198] updating the storage state identifier of the fourth page table entry to the third identifier, updating the physical page address of the third page table entry to the address of the ninth physical page, and updating the access frequency of the fourth page table entry to the preset value.

[0199] S228, accessing the eighth physical page row according to the updated first page table entry.

[0200] To sum up, the memory access method provided by the embodiment of the application includes the following steps:

[0201] When the physical page (first physical page) to be accessed is in the DRAM (the first page table entry storage state identifier is the first identifier) or the PMEM (the first page table entry storage state identifier is the second identifier), the first physical page is directly accessed.

[0202] When the physical page (first physical page) to be accessed is in the disk exchange space (the first page table entry storage state identifier is the third identifier), the data in the first physical page is first migrated from the disk exchange space to the physical memory (DRAM or PMEM), and then the target data is accessed from the physical memory. The process of migrating the data in the first physical page from the disk exchange space to the physical memory includes: first checking whether there is a free physical page in the PMEM, if yes, extracting the data of the first physical page to the free physical page in the PMEM and updating the first page table entry; then performing the subsequent process, if there is no free physical page in the PMEM, continuing to check whether there is a free physical page in the DRAM, if yes, extracting the data of the first physical page to the free physical page in the DRAM and updating the first page table entry, and then performing the subsequent process. If there is no free physical page in the DRAM, continuing to check whether there is a physical page with a smaller access frequency in the PMEM, if yes, migrating the data of the physical page to a physical page in the disk exchange space and updating the corresponding page table entry to give up a PMEM free physical page, and then continuing to perform the foregoing process. If there is no physical page with a smaller access frequency in the PMEM, continuing to check whether there is a physical page with a smaller access frequency in the DRAM, if yes, migrating the data of the physical page to a physical page in the disk exchange space and updating the corresponding page table entry to give up a DRAM free physical page, and then continuing to perform the foregoing process. If there is no physical page with a smaller access frequency in the DRAM and the PMEM, randomly selecting a physical page from the PMEM, migrating the data of the physical page to a physical page in the disk exchange space to give up a PMEM free physical page, and then continuing to perform the foregoing process.

[0203] As an extension and refinement of the above embodiment, the embodiment of the application provides another memory access method, which is shown in FIG. 3 and includes the following steps: Figure 3

[0204] S301, receiving request information for requesting to access target data in the physical memory.

[0205] The request information carries a virtual page address of the target data. ​

[0206] S302, obtaining a first page table item according to the virtual page address.

[0207] The first page table item is a page table item corresponding to the virtual page address.

[0208] S303, obtaining a storage state identifier of the first page table item.

[0209] The storage state identifier is used to indicate a storage location of a physical page corresponding to the first page table item.

[0210] If the storage state identifier of the first page table item obtained in the step S303 is a first identifier, the following steps S304-S305 are performed.

[0211] S304, determining a first physical page according to a physical page address of the first page table item, and accessing the first physical page.

[0212] S305, increasing an access frequency of the first page table item by one.

[0213] S306, updating an average access frequency of the physical page in the dynamic random access memory and the persistent memory.

[0214] If the storage state identifier of the first page table item obtained in the step S303 is a second identifier, the following steps S307-S310 are performed.

[0215] S307, determining a first physical page according to a physical page address of the first page table item, and accessing the first physical page.

[0216] S308, increasing an access frequency of the first page table item by one.

[0217] S309, updating an average access frequency of the physical page in the dynamic random access memory and the persistent memory.

[0218] S310, judging whether the first physical page is a second access hotness physical page.

[0219] The second access hotness physical page is a physical page with an access frequency greater than a second multiple of the average access frequency of the physical page in the dynamic random access memory and the persistent memory.

[0220] For example, the second access hotness physical page is a physical page with an access frequency greater than a T1 multiple of the average access frequency of the physical page in the dynamic random access memory and the persistent memory.

[0221] In step S310, if the first physical page is not a second access hotness physical page, the method flow ends, and if the first physical page is a second access hotness physical page, step S311 is performed.

[0222] S311, determining whether there is a free physical page in the dynamic random access memory.

[0223] In step S311, if it is determined that the ninth physical page in the dynamic random access memory is a free physical page, steps S312 and S313 are performed.

[0224] S312, migrating data in the first physical page to the ninth physical page.

[0225] S313, updating the first page table entry.

[0226] As an optional implementation of an embodiment of the application, step S313 (updating the first page table entry) includes:

[0227] updating the storage state identifier of the first page table entry to the first identifier, and updating the physical page address of the first page table entry to the address of the ninth physical page.

[0228] In step S311, if it is determined that there is no free physical page in the dynamic random access memory, step S314 is performed.

[0229] S314, determining whether there is a third access hotness physical page in the dynamic random access memory.

[0230] The third access hotness physical page is a physical page corresponding to a page table entry, and the access frequency of the physical page is less than the average access frequency of the physical pages in the dynamic random access memory and the persistent memory by a third multiple.

[0231] In step S314, if there is no physical page of the third access hotness physical page in the dynamic random access memory, the method flow of the embodiment of the application ends, and if the tenth physical page in the dynamic random access memory is the third access hotness physical page, step S314 is performed.

[0232] S315, determining whether there is a free physical page in the persistent memory.

[0233] In step S315, if the eleventh physical page in the persistent memory is a free physical page, steps S316 to S318 are performed.

[0234] S316, migrating data in the tenth physical page to the eleventh physical page.

[0235] S317, migrating data in the first physical page to the tenth physical page.

[0236] S318, updating the first page table entry and the fifth page table entry.

[0237] The fifth page table entry is a page table entry with a physical page address being an address of the tenth physical page

[0238] As an optional implementation of the embodiment of the present application, the step S318 (updating the first page table entry and the fifth page table entry) comprises:

[0239] updating a storage state identifier of the first page table entry to the first identifier, and updating a physical page address of the first page table entry to an address of the tenth physical page;

[0240] updating a storage state identifier of the fifth page table entry to the second identifier, and updating a physical page address of the fifth page table entry to an address of the eleventh physical page.

[0241] In the step S315, if there is no free physical page in the persistent memory, the following steps S319 to S321 are performed.

[0242] S319, migrating data in the tenth physical page to a twelfth physical page in the disk swap space.

[0243] S320, migrating data in the first physical page to the tenth physical page.

[0244] S321, updating the first page table entry and the fifth page table entry.

[0245] As an optional implementation of the embodiment of the present application, the step S321 (updating the first page table entry and the fifth page table entry) comprises:

[0246] updating a storage state identifier of the first page table entry to the first identifier, and updating a physical page address of the first page table entry to an address of the tenth physical page;

[0247] updating a storage state identifier of the fifth page table entry to the third identifier, updating a physical page address of the fifth page table entry to an address of the twelfth physical page, and updating a visit number of the fifth page table entry to a preset value.

[0248] That is, when the first physical page is in the PMEM (i.e., the first page table entry storage state identifier is the second identifier), the first physical page is accessed, and the first page table entry access times are also incremented by 1, and the average access times of all physical pages in the memory are updated. Next, it is checked whether the first physical page is upgraded to the second access hot physical page; if yes, the data in the first physical page of the PMEM is migrated into the physical page in the DRAM. Specifically, the implementation of migrating the data in the first physical page of the PMEM into the physical page in the DRAM includes: first, it is checked whether there is a free page in the DRAM, if yes, the data in the first physical page can be directly migrated to the free page, and the first page table entry is updated. If there is no free page in the DRAM, it is checked whether the physical page in the DRAM is the third access hot physical page, if yes, it is further checked whether there is a free page in the PMEM; if there is a free page in the PMEM, the third access hot physical page in the DRAM is migrated to the free page in the PMEM, and the first page table entry is updated; if there is no free page in the PMEM, the data of the third access hot physical page in the DRAM is directly migrated to the physical page in the disk swap space, and the corresponding page table entry is updated, so as to give up a free physical page in the DRAM for migrating the data in the first physical page.

[0249] By the same inventive concept, as an implementation of the above method, the embodiment of the application also provides a sensitive instruction sending device, which corresponds to the above method embodiment. For the convenience of reading, the details of the above method embodiment will not be described one by one, but it should be clear that the sensitive instruction sending device in the embodiment can correspondingly implement all the contents in the above method embodiment.

[0250] Figure 4 The structure diagram of the memory access device provided by the embodiment of the application is shown in FIG. 4, and the memory access device 400 provided by the embodiment of the application includes: Figure 4

[0251] The receiving unit 41 is configured to receive a memory access request, and the memory access request carries a first virtual page address;

[0252] The obtaining unit 42 is configured to obtain a first page table entry according to the first virtual page address, and the first page table entry is a page table entry with the first virtual page address in a page table;

[0253] The processing unit 43 is configured to obtain a storage state identifier of the first page table entry, and the storage state identifier is used to indicate a storage position of a physical page corresponding to the first page table entry;

[0254] ​The access unit 44 is configured to, when the storage state identifier is the first identifier or the second identifier, the first identifier indicating that the physical page corresponding to the first page table entry is stored in the DRAM, and the second identifier indicating that the physical page corresponding to the first page table entry is stored in the PMEM, determine a first physical page according to a physical page address of the first page table entry, and access the first physical page; wherein the DRAM and the PMEM are parallel physical memory spaces supporting application use.

[0255] As an optional implementation of the embodiment of the present application, the access unit 44 is further configured to, when the storage state identifier is the third identifier, the third identifier indicating that the physical page corresponding to the first page table entry is stored in the disk swap space, determine whether there is a free physical page in the PMEM; if a second physical page in the PMEM is a free physical page, migrate data in the first physical page to the second physical page, update the first page table entry, and access the second physical page according to the updated first page table entry; if there is no free physical page in the PMEM, determine whether there is a free physical page in the DRAM; if a third physical page in the DRAM is a free physical page, migrate data in the first physical page to the third physical page, update the first page table entry, and access the third physical page according to the updated first page table entry.

[0256] As an optional implementation of the embodiment of the present application, the access unit 44 is further configured to, if there is no free physical page in the DRAM, determine whether there is a first access frequency physical page in the PMEM; the first access frequency physical page is a physical page whose access frequency in the corresponding page table entry is less than an average access frequency of physical pages in the DRAM and the PMEM by a first multiple.

[0257] If a fourth physical page in the PMEM is the first access frequency physical page, migrate data in the fourth physical page to a fifth physical page in the disk swap space, migrate data in the first physical page to the fourth physical page, update the first page table entry and a second page table entry, and access the fourth physical page according to the updated first page table entry; wherein the second page table entry is a page table entry whose physical page address is the address of the fourth physical page.

[0258] If there is no first access frequency physical page in the PMEM, determine whether there is a first access frequency physical page in the DRAM.

[0259] If the sixth physical page in the dynamic random access memory is the physical page of the first access frequency, data in the sixth physical page is migrated to a seventh physical page in the disk swap space, data in the first physical page is migrated to the sixth physical page, the first page table entry and a third page table entry are updated, and the sixth physical page is accessed according to the updated first page table entry; wherein the third page table entry is a page table entry with an address of the sixth physical page.

[0260] As an optional implementation of an embodiment of the present application, the access unit 44 is further configured to

[0261] If there is no physical page of the first access frequency in the dynamic random access memory, an eighth physical page is randomly selected from the persistent memory.

[0262] Data in the eighth physical page is migrated to a ninth physical page in the disk swap space, data in the first physical page is migrated to the eighth physical page, the first page table entry and a fourth page table entry are updated, and the eighth physical page is accessed according to the updated first page table entry.

[0263] The fourth page table entry is a page table entry with an address of the eighth physical page.

[0264] As an optional implementation of an embodiment of the present application, the access unit 44 is further configured to, when the storage state identifier is the first identifier or the second identifier, increase the access frequency of the first page table entry by one, and update the average access frequency of the physical pages in the dynamic random access memory and the persistent memory.

[0265] It is determined whether the first physical page is a physical page of a second access frequency; the physical page of the second access frequency is a physical page with an access frequency in a corresponding page table entry greater than twice the average access frequency of the physical pages in the dynamic random access memory and the persistent memory.

[0266] If yes, it is determined whether there is a free physical page in the dynamic random access memory.

[0267] If a ninth physical page in the dynamic random access memory is a free physical page, data in the first physical page is migrated to the ninth physical page, and the first page table entry is updated.

[0268] As an optional implementation of the embodiment of the present application, the access unit 44 is further configured to, if there is no free physical page in the dynamic random access memory, determine whether there is a third access hotness physical page in the dynamic random access memory; the third access hotness physical page is a physical page corresponding to a page table entry, and the access frequency of the physical page is less than the average access frequency of the physical pages in the dynamic random access memory and the persistent memory by a third multiple.

[0269] If the tenth physical page in the dynamic random access memory is the third access hotness physical page, it is determined whether there is a free physical page in the persistent memory.

[0270] If the eleventh physical page in the persistent memory is a free physical page, the data in the tenth physical page is migrated to the eleventh physical page, the data in the first physical page is migrated to the tenth physical page, and the first page table entry and the fifth page table entry are updated; the fifth page table entry is a page table entry with the address of the tenth physical page as the physical page address.

[0271] If there is no free physical page in the persistent memory, the data in the tenth physical page is migrated to the twelfth physical page in the disk swap space, the data in the first physical page is migrated to the tenth physical page, and the first page table entry and the fifth page table entry are updated.

[0272] As an implementation of the embodiment of the present application, the memory access request is used to request reading target data; the access to the first physical page includes:

[0273] reading the target data from the first physical page;

[0274] writing the target data into the last level cache (LLC).

[0275] As an optional implementation of the embodiment of the present application, the memory access request is used to request writing target data into the memory; the access unit 44 is specifically configured to read placeholder data from the first physical page, the placeholder data is data in a storage location in the first physical page configured to write the target data; write the placeholder data into the LLC; modify the placeholder data in the LLC to the target data, and write the target data in the LLC into the first physical page when a preset condition is met.

[0276] As an optional implementation of the embodiment of the present application, the access unit 44 is further configured to, before obtaining the first page table entry according to the first virtual page address, allocate the first physical page for the target data from the dynamic random access memory or the persistent memory, and create the first page table entry.

[0277] As an optional implementation of the embodiment of the present application, the access unit 44 is specifically configured to allocate the first physical page for the target data from the dynamic random access memory based on a first probability and from the persistent memory based on a second probability.

[0278] The first probability is positively related to the capacity of the dynamic random access memory, and the second probability is positively related to the capacity of the persistent memory.

[0279] The sensitive instruction sending device provided by the embodiment can execute the memory access method provided by the method embodiment, and has similar implementation principles and technical effects, which will not be described here.

[0280] Through the same inventive concept, the embodiment of the present application also provides an electronic device. Figure 5 As shown in the structural schematic diagram of the electronic device provided by the embodiment of the present application, Figure 5 The electronic device provided by the embodiment of the present application includes a memory 51 and a processor 52, the memory 51 is configured to store a computer program, and the processor 52 is configured to execute the memory access method provided by the above-mentioned embodiment when the computer program is called.

[0281] The embodiment of the present application also provides a computer readable storage medium, the computer readable storage medium stores a computer program, and the computer program is executed by the processor to realize the memory access method provided by the above-mentioned embodiment.

[0282] The embodiment of the present application provides a computer program product, when the computer program product runs on a computer, so that the computer realizes the memory access method provided by the above-mentioned embodiment.

[0283] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer usable storage media containing computer usable program code.

[0284] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic components, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0285] The memory can include non-persistent memory in computer-readable media, random access memory (RAM), and / or non-volatile memory, such as read-only memory (ROM) or flash memory. The memory is an example of computer-readable media.

[0286] The computer-readable media include non-transitory and transitory, removable and non-removable media. The storage media can be implemented by any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile discs (DVDs) or other optical storage, magnetic cassettes, magnetic disks storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to computing devices. According to the definition herein, computer-readable media do not include transitory computer-readable media, such as modulated data signals and carrier waves.

[0287] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part or all of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A memory access method, characterized by, The method comprises: receiving a memory access request, the memory access request carrying a first virtual page address; obtaining a first page table entry according to the first virtual page address, the first page table entry being a page table entry in a page table with a virtual page address of the first virtual page address; obtaining a storage state identifier of the first page table entry, the storage state identifier being used to indicate a storage location of a physical page corresponding to the first page table entry; when the storage state identifier is a first identifier or a second identifier, the first identifier indicating that the physical page corresponding to the first page table entry is stored in a dynamic random access memory (DRAM), and the second identifier indicating that the physical page corresponding to the first page table entry is stored in a persistent memory (PMEM), determining a first physical page according to a physical page address of the first page table entry, and accessing the first physical page; wherein the DRAM and the PMEM are parallel physical memory spaces supporting application use; when the storage state identifier is a third identifier, the third identifier indicating that the physical page corresponding to the first page table entry is stored in a disk swap space, determining whether there is a free physical page in the PMEM; if a second physical page in the PMEM is a free physical page, migrating data in the first physical page to the second physical page, updating the first page table entry, and accessing the second physical page according to the updated first page table entry; if there is no free physical page in the PMEM, determining whether there is a free physical page in the DRAM; if a third physical page in the DRAM is a free physical page, migrating data in the first physical page to the third physical page, updating the first page table entry, and accessing the third physical page according to the updated first page table entry.

2. The method of claim 1, wherein, The method further comprises: if there is no free physical page in the DRAM, determining whether there is a first access hotness physical page in the PMEM; the first access hotness physical page being a physical page with a number of accesses in a corresponding page table entry less than an average number of accesses of physical pages in the DRAM and the PMEM by a first multiple; if a fourth physical page in the PMEM is the first access hotness physical page, migrating data in the fourth physical page to a fifth physical page in the disk swap space, migrating data in the first physical page to the fourth physical page, updating the first page table entry and a second page table entry, and accessing the fourth physical page according to the updated first page table entry; wherein the second page table entry is a page table entry with a physical page address of an address of the fourth physical page; if there is no first access hotness physical page in the PMEM, determining whether there is a first access hotness physical page in the DRAM; If the sixth physical page in the dynamic random access memory is the physical page of the first access frequency, data in the sixth physical page is migrated to a seventh physical page in the disk swap space, data in the first physical page is migrated to the sixth physical page, the first page table entry and a third page table entry are updated, and the sixth physical page is accessed according to the updated first page table entry; wherein the third page table entry is a page table entry with a physical page address being an address of the sixth physical page.

3. The method of claim 2, wherein, The method further comprises: If there is no physical page of the first access frequency in the dynamic random access memory, an eighth physical page is randomly selected from the persistent memory; Data in the eighth physical page is migrated to a ninth physical page in the disk swap space, data in the first physical page is migrated to the eighth physical page, the first page table entry and a fourth page table entry are updated, and the eighth physical page is accessed according to the updated first page table entry; Wherein, the fourth page table entry is a page table entry with a physical page address being an address of the eighth physical page.

4. The method of claim 1, wherein, The method further comprises: When the storage state of the first page table entry is identified as the first identification or the second identification, the access frequency of the first page table entry is increased by one, and the average access frequency of the physical pages in the dynamic random access memory and the persistent memory is updated; It is judged whether the first physical page is a physical page of a second access frequency; the physical page of the second access frequency is a physical page with an access frequency in the corresponding page table entry being greater than a second multiple of the average access frequency of the physical pages in the dynamic random access memory and the persistent memory; If yes, it is judged whether there is a free physical page in the dynamic random access memory; If a ninth physical page in the dynamic random access memory is a free physical page, data in the first physical page is migrated to the ninth physical page, and the first page table entry is updated.

5. The method of claim 4, wherein, The method further comprises: If there is no free physical page in the dynamic random access memory, it is judged whether there is a physical page of a third access frequency in the dynamic random access memory; the physical page of the third access frequency is a physical page with an access frequency in the corresponding page table entry being less than a third multiple of the average access frequency of the physical pages in the dynamic random access memory and the persistent memory; If a tenth physical page in the dynamic random access memory is the physical page of the third access frequency, it is judged whether there is a free physical page in the persistent memory; If an eleventh physical page in the persistent memory is a free physical page, data in the tenth physical page is migrated to the eleventh physical page, data in the first physical page is migrated to the tenth physical page, and the first page table entry and a fifth page table entry are updated; the fifth page table entry is a page table entry with a physical page address being an address of the tenth physical page. If there is no free physical page in the persistent memory, migrating data in the tenth physical page into a twelfth physical page in a disk swap space, migrating data in the first physical page into the tenth physical page, and updating the first page table entry and the fifth page table entry.

6. The method of claim 1, wherein, The memory access request is used to request reading target data; the accessing the first physical page comprises: reading the target data from the first physical page; writing the target data into a last level cache (LLC).

7. The method of claim 1, wherein, The memory access request is used to request writing target data into a memory; the accessing the first physical page comprises: reading placeholder data from the first physical page, the placeholder data being data in a storage location in the first physical page configured to write the target data; writing the placeholder data into an LLC; modifying the placeholder data in the LLC into the target data, and writing the target data in the LLC into the first physical page when a preset condition is met.

8. The method of claim 7, wherein, Before obtaining the first page table entry according to the first virtual page address, the method further comprises: allocating the first physical page for the target data from the dynamic random access memory or the persistent memory, and creating the first page table entry.

9. The method of claim 8, wherein, The allocating the first physical page for the target data from the dynamic random access memory or the persistent memory comprises: allocating the first physical page for the target data from the dynamic random access memory based on a first probability, and allocating the first physical page for the target data from the persistent memory based on a second probability; wherein the first probability is positively related to a capacity of the dynamic random access memory, and the second probability is positively related to a capacity of the persistent memory.

10. A memory access device, comprising: comprises: a receiving unit configured to receive a memory access request, the memory access request carrying a first virtual page address; an obtaining unit configured to obtain a first page table entry according to the first virtual page address, the first page table entry being a page table entry in a page table with a virtual page address being the first virtual page address; a processing unit configured to obtain a storage state identifier of the first page table entry, the storage state identifier being used to indicate a storage location of a physical page corresponding to the first page table entry; an accessing unit configured to, when the storage state identifier is a first identifier or a second identifier, the first identifier indicating that the physical page corresponding to the first page table entry is stored in a dynamic random access memory (DRAM), and the second identifier indicating that the physical page corresponding to the first page table entry is stored in a persistent memory (PMEM), determine a first physical page according to a physical page address of the first page table entry, and access the first physical page; wherein the DRAM and the PMEM are parallel physical memory spaces supporting application use. The access unit is further configured to, when the storage state identifier is a third identifier, the third identifier indicating that the physical page corresponding to the first page table entry is stored in a disk swap space, determine whether there is a free physical page in the persistent memory; if a second physical page in the persistent memory is a free physical page, migrate data in the first physical page to the second physical page, update the first page table entry, and access the second physical page according to the updated first page table entry; if there is no free physical page in the persistent memory, determine whether there is a free physical page in the dynamic random access memory; if a third physical page in the dynamic random access memory is a free physical page, migrate data in the first physical page to the third physical page, update the first page table entry, and access the third physical page according to the updated first page table entry.

11. An electronic device, comprising: Comprising: a memory and a processor, the memory being configured to store a computer program; the processor being configured to execute the memory access method of any one of claims 1-9 when the computer program is invoked.

12. A computer-readable storage medium, characterized in that, a computer program product, which has stored thereon a computer program, the computer program being executable by a processor to implement the memory access method of any one of claims 1-9.

13. A computer program product, characterised in that, a computer program product, which has stored thereon a computer program, the computer program being executable by a processor to implement the memory access method of any one of claims 1-9. when the computer program product is run on a computer, causing the computer to implement the memory access method of any one of claims 1-9.