The present disclosure relates to the field of computer storage technologies, and in particular, to a memory system, a method for processing a memory access request, and a computer system.
Requirements for a processing speed of a processor and a read speed of data storage increase as computer technologies rapidly develop. A multi-core processor refers to that two or more complete computing engines (cores) are integrated into one processor. Referring to
As data that needs to be processed in a data center is scaling up, to store data in memories as much as possible and thereby accelerate a processing speed, a requirement of the data center for a memory capacity also increases. One or more memory channels may exist in a conventional memory system, and these memory channels are managed by a memory controller. Each memory channel may support one or more memory slots, and a memory module is mounted to each memory slot. A path for interaction exists between the memory controller and one memory channel, and between the memory channel and the memory module. Different memory channels are independent of each other and different memory modules are independent of each other. A conventional memory uses a dynamic random-access memory (DRAM) of a double data rate (DDRx) (such as a DDR3) protocol that is based on synchronous timing; however, the DRAM has disadvantages such as low bit density, and high static power consumption (because the DRAM needs to be refreshed regularly); and a research shows that power consumption consumed by memories in a data center accounts for more than 25 percent (%) of total power consumption of an entire system. In recent years, a plurality of new memory materials have emerged, such as non-volatile memories (NVMs) like a phase change memory (PCM), a magnetic random access memory (MRAM), and a flash memory. These NVMs have advantages such as high bit density, and low static power consumption, and furthermore, even if there is a power failure, data can be retained (which is non-volatile). Although read access latency of some NVMs (such as a PCM) may be merely a little inferior to a DRAM, their write access latency is much higher than the DRAM, and write endurance of an NVM is limited. Due to these disadvantages, an NVM serves as an extended memory of a DRAM instead of a memory that completely replaces the DRAM. An extended memory includes but is not limited to an NVM, and also includes another storage type.
Using hybrid memories of a DRAM and an extended memory becomes a trend in the future, and a DRAM is generally used as a cache for an extended memory, and frequently accessed data is placed in the DRAM to reduce access latency. However, a conventional DDR is based on synchronous fetch timing and cannot directly process this type of heterogeneous non-uniform fetch latency, and requires software (such as an operating system (OS) or a virtual machine monitor (VMM)) to be responsible for processing. Hybrid memories are not transparent to software.
A synchronous access interface of a conventional DDR memory requires that an access command has an inherent latency; and therefore, the DDR memory cannot directly process this type of non-uniform fetch latency characteristic brought by hybrid memories, and requires software (such as an operating system or a virtual machine monitor) to be responsible for processing non-uniform latency.
To optimize performance, software is further responsible for collecting access frequency information of a page, and the frequency information is usually stored in a page table entry to guide a page migration strategy, for example, if a page that is frequently written to is stored in a DRAM, software overheads are relatively large. In addition, for a large-scale system using hybrid memories, Checkpoint protection further needs to be regularly performed on software, to write a machine status back into the extended memory.
The objectives of embodiments of the present disclosure are to provide a memory system and a method for processing a memory access, so as to improve a memory access speed.
According to a first aspect, a memory system is provided, including a first memory and a second memory separately configured to store operating data of a processor, where the first memory and the second memory are of different types; a buffer configured to store a memory indexing table, where the memory indexing table includes a fetch address of a data unit block located in the first memory; and a buffer scheduler configured to receive a memory access request sent by a memory controller, where the memory access request includes a fetch address and a fetch operation; determine, according to the fetch address and the memory indexing table, whether a data unit block corresponding to the fetch address is stored in the first memory or the second memory; perform the fetch operation of the memory access request in the determined first memory or second memory; and return a result of the fetch operation of the memory access request to the memory controller.
In a first possible implementation manner, the buffer scheduler is further configured to, when it is determined that the data unit block corresponding to the fetch address is stored in the second memory, send a notification of updating access information of the data unit block; and the memory system further includes a migration scheduler configured to receive the notification sent by the buffer scheduler and update the access information of the data unit block; determine, according to the access information of the data unit block, whether to migrate the data unit block in the second memory to the first memory; and update the memory indexing table after migration.
With reference to the first aspect or the first possible implementation manner of the first aspect, in a second possible implementation manner, the buffer scheduler is configured to, when it is determined that the data unit block is located in the first memory, complete the memory access request in the first memory; and when it is determined that the data unit block is located in the second memory, complete the memory access request in the second memory.
With reference to the first aspect or the first possible implementation manner of the first aspect, in a third possible implementation manner, the buffer scheduler is configured to, when it is determined that the data unit block is located in the first memory, complete the memory access request in the first memory; and when it is determined that the data unit block is located in the second memory, migrate the data unit block in the second memory to the first memory, and complete the memory access request in the first memory.
With reference to the first aspect or the second possible implementation manner of the first aspect or the third possible implementation manner of the first aspect, in a fourth possible implementation manner, the buffer scheduler includes a parsing module configured to parse a memory access request packet sent by the memory controller, to extract the memory access request, where the memory access request includes the fetch address and the fetch operation; a first request queue configured to store a memory access request for accessing the first memory; a second request queue configured to store a memory access request for accessing the second memory; a determining module configured to query the memory indexing table using the fetch address, to determine whether a data unit block requested by a memory access request is in the first memory; store the memory access request in the first request queue if the data unit block is in the first memory; and store the memory access request in the second request queue if the data unit block is not in the first memory; a first return queue configured to store a result of a fetch operation of the memory access request for accessing the first memory; a second return queue configured to store a result of a fetch operation of the memory access request for accessing the second memory; a scheduling module configured to schedule the memory access request in the first request queue to the first memory to execute the fetch operation corresponding to the memory access request, and schedule the memory access request in the second request queue to the second memory to execute the fetch operation corresponding to the memory access request; and a packaging module configured to package a result of a fetch operation of at least one memory access request into a packet, and return the packet to the memory controller.
With reference to the first aspect or the second possible implementation manner of the first aspect or the third possible implementation manner of the first aspect or the fourth possible implementation manner of the first aspect, in a fifth possible implementation manner, the access information includes a quantity of access operations, and the migration scheduler includes a register configured to store a migration threshold; a migration determining logical module configured to compare the quantity of access operations with the migration threshold, and determine whether to migrate a data unit block in the second memory to the first memory according to a comparison result; a command buffer configured to store a migration command when the migration determining logical module outputs a result that migration is required; a data buffer configured to temporarily store stored data that is in the second memory and of a data unit block corresponding to the migration command; and an updating module configured to update the quantity of access operations corresponding to the data unit block, and update the memory indexing table when the migration determining logical module outputs the result that migration is required.
With reference to the first aspect or the second possible implementation manner of the first aspect or the third possible implementation manner of the first aspect or the fourth possible implementation manner of the first aspect or the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner, the first memory is a volatile memory module, and the second memory is a non-volatile memory module.
With reference to the first aspect or the second possible implementation manner of the first aspect or the third possible implementation manner of the first aspect or the fourth possible implementation manner of the first aspect or the fifth possible implementation manner of the first aspect, in a seventh possible implementation manner, an access speed of the first memory is faster than an access speed of the second memory.
According to a second aspect, a memory system is provided, including a volatile memory and a non-volatile memory separately configured to store operating data of a processor; a buffer configured to store a tag table, where the tag table is used to indicate access information of a data unit block and includes a fetch address, a memory location, and a quantity of fetch operations of the data unit block, and the memory location indicates whether the data unit block is stored in the volatile memory or the non-volatile memory; and a buffer scheduler configured to receive a memory access request of a memory controller, where the memory access request includes a fetch address and a fetch operation; query the tag table using the fetch address, to determine whether the data unit block is stored in the volatile memory or the non-volatile memory; complete the fetch operation of the memory access request in the determined volatile memory or non-volatile memory; and return a result of the memory access request to the memory controller.
In a first possible implementation manner of the second aspect, the buffer scheduler is further configured to send a notification of updating the access information of the data unit block, and the memory system further includes a migration scheduler configured to receive the notification and update the access information of the data unit block in the tag table; determine, according to the access information of the data unit block, whether to migrate the data unit block in the non-volatile memory to the volatile memory; and update the tag table after migration.
In a second possible implementation manner of the second aspect, the buffer scheduler includes a parsing module configured to parse a memory access request packet sent by the memory controller, to extract the memory access request; a first request queue configured to store a memory access request for accessing the volatile memory; a second request queue configured to store a memory access request for accessing the non-volatile memory; a determining module configured to query a memory indexing table using the fetch address, to determine whether a data unit block requested by each memory access request is in the volatile memory; store the memory access request in the first request queue if the data unit block is in the volatile memory, and store the memory access request in the second request queue if the data unit block is not in the volatile memory; and send a notification of updating the access information of the data unit block; a first return queue configured to store a result of the memory access request for accessing the volatile memory; a second return queue configured to store a result of the memory access request for accessing the non-volatile memory; a scheduling module configured to schedule the memory access request in the first request queue to the volatile memory to execute a fetch operation corresponding to the memory access request, and schedule the memory access request in the second request queue to the non-volatile memory to execute a fetch operation corresponding to the memory access request; and a packaging module configured to package a result of a fetch operation of at least one memory access request into a packet, and return the packet to the memory controller.
With reference to the second aspect or the first possible implementation manner of the second aspect, in a third possible implementation manner, the access information includes the quantity of access operations, and the migration scheduler includes a register configured to store a migration threshold; a migration determining logical module configured to compare the quantity of access operations with the migration threshold to determine whether to migrate a page in the non-volatile memory to the volatile memory; a command buffer configured to store a migration command when the migration determining logical module outputs a result that migration is required; a data buffer configured to temporarily store stored data that is in the non-volatile memory and of a data unit block corresponding to the migration command; and a tag updating module configured to update the quantity of access operations corresponding to the data unit block, and update the memory indexing table when the migration determining logical module outputs the result that migration is required.
With reference to the second aspect or the first possible implementation manner of the second aspect or the second possible implementation manner of the second aspect or the third possible implementation manner of the second aspect, in a fourth possible implementation manner, the volatile memory is a DRAM, and the non-volatile memory is an NVM.
According to a third aspect, a method for processing a memory access request is provided, including receiving a memory access request packet, and obtaining a fetch address and a fetch operation of a memory access request from the request packet; querying a memory indexing table using the fetch address in the memory access request, to determine whether a data unit block corresponding to the memory access request is stored in a first memory or a second memory, and instructing a migration scheduler to update access information of the data unit block, where the first memory and the second memory are of different types; and completing the fetch operation of the memory access request in the first memory if the data unit block is stored in the first memory, and returning a result of the memory access request to an initiator of the memory access request; or completing the fetch operation of the memory access request in the second memory if the data unit block is stored in the second memory, and returning a result of the memory access request to an initiator of the memory access request.
In a first possible implementation manner, the completing the fetch operation of the memory access request in the second memory if the data unit block is stored in the second memory, and returning a result of the memory access request to an initiator of the memory access request includes migrating the data unit block to be accessed to the first memory if the data unit block is stored in the second memory, and then completing the fetch operation of the memory access request in the first memory, and returning a result of the memory access request to the initiator of the memory access request.
In a second possible implementation manner, the completing the fetch operation of the memory access request in the second memory if the data unit block is stored in the second memory, and returning a result of the memory access request to an initiator of the memory access request includes accessing the second memory directly if the data unit block is in the second memory, completing the fetch operation of the memory access request, and returning a result of the memory access request to the initiator of the memory access request.
With reference to the third aspect or the first possible implementation manner of the third aspect or the second possible implementation manner of the third aspect, in a third possible implementation manner, the method further includes determining, by the migration scheduler according to the access information of the data unit block, whether to migrate the data unit block located in the second memory to the first memory.
With reference to the third possible implementation manner of the third aspect, in a fourth possible implementation manner, the access information includes a quantity of access operations, and the determining, by the migration scheduler according to the access information of the data unit block, whether to migrate the data unit block located in the second memory to the first memory includes comparing, by the migration scheduler, a recorded quantity of access operations of the data unit block with a migration threshold, and determining that migration is required if the quantity of access operations is greater than or equal to the migration threshold, and that migration is not required if the quantity of access operations is less than the migration threshold.
With reference to the fourth possible implementation manner of the third aspect, in a fifth possible implementation manner, the method further includes updating, by the migration scheduler, information of the memory indexing table when determining that migration is required.
According to a fourth aspect, a method for processing a memory access request is provided, including receiving a memory access request packet, and obtaining a fetch address and a fetch operation of a memory access request from the request packet; querying a tag table using the fetch address in the memory access request, to determine whether a data unit block corresponding to the memory access request is stored in a volatile memory or a non-volatile memory, where the tag table is used to indicate access information of the data unit block and includes a fetch address, a memory location, and a quantity of fetch operations of the data unit block, and the memory location indicates whether the data unit block is stored in the volatile memory or the non-volatile memory; and completing the fetch operation of the memory access request in the volatile memory if the data unit block is stored in the volatile memory, and returning a result of the memory access request to an initiator of the memory access request; or completing the fetch operation of the memory access request in the non-volatile memory if the data unit block is stored in the non-volatile memory, and returning a result of the memory access request to an initiator of the memory access request.
In a first possible implementation manner, the completing the fetch operation of the memory access request in the non-volatile memory if the data unit block is stored in the non-volatile memory, and returning a result of the memory access request to an initiator of the memory access request includes migrating the data unit block to be accessed to the volatile memory if the data unit block is stored in the non-volatile memory, and then completing the fetch operation of the memory access request in the volatile memory, and returning a result of the memory access request to the initiator of the memory access request.
In a second possible implementation manner, the completing the fetch operation of the memory access request in the non-volatile memory if the data unit block is stored in the non-volatile memory, and returning a result of the memory access request to an initiator of the memory access request includes accessing the non-volatile memory directly if the data unit block is in the non-volatile memory and completing the fetch operation of the memory access request, and returning a result of the memory access request to the initiator of the memory access request.
With reference to the fourth aspect or the first possible implementation manner of the fourth aspect or the second possible implementation manner of the fourth aspect, in a third possible implementation manner, the access information includes the quantity of access operations, the method further includes comparing a recorded quantity of access operations of the data unit block with a migration threshold, and determining that migration is required if the quantity of access operations is greater than or equal to the migration threshold, and that migration is not required if the quantity of access operations is less than the migration threshold.
With reference to the fourth aspect or the first possible implementation manner of the fourth aspect or the second possible implementation manner of the fourth aspect or the third possible implementation manner of the fourth aspect, in a fourth possible implementation manner, the method further includes updating the access information of the data unit block in the tag table; and determining, according to the access information of the data unit block, whether to migrate the data unit block located in the non-volatile memory to the volatile memory, and updating the tag table after migration.
According to a fifth aspect, a computer system is provided, including a multi-core processor, including a memory controller that is configured to initiate a memory access request; and a memory system provided according to any possible implementation manners of the first aspect or the second aspect.
In the embodiments of the present disclosure, management of different types of memories is implemented by hardware. There is a first memory and a second memory that are of different types in a memory system. A memory access request may be separately completed in the first memory and the second memory, which is transparent to an OS, does not cause page fault, and can improve a memory access speed.
To describe the technical solutions in the embodiments of the present disclosure more clearly, the following briefly introduces the accompanying drawings required for describing the embodiments. The accompanying drawings in the following description show merely some embodiments of the present disclosure, and a person of ordinary skill in the art may still derive other drawings from these accompanying drawings without creative efforts.
The following clearly describes the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure.
To facilitate understanding of the technical solutions of the present disclosure, some technical terms that appear in the embodiments of the present disclosure are explained first. A CPU mentioned in the embodiments of the present disclosure is a type of processor, and the processor may also be an application specific integrated circuit (ASIC), or one or more other integrated circuits configured to implement the embodiments of the present disclosure. A person skilled in the art may understand that another implementation manner of the processor may also replace the CPU in the embodiments of the present disclosure.
A memory controller is an important part for controlling memory module (or referred to as a memory) and exchanging data between the memory and a processor inside a computer system. Currently, a common practice is to integrate the memory controller into a CPU. However, the memory controller and the CPU may also be separately implemented independently and communicate using a connection.
A memory module is configured to store operating data of a processor (for example, a CPU). Generally, a memory module includes one or more storage units (or referred to as memory chips). A memory channel interface is an interface that is on a memory module and used to connect a memory channel. A memory channel is a channel connecting a memory module to a memory controller.
Several commonly used memory modules are described below as examples. A dual inline memory module (DIMM) is a new memory module emerging after a release of a Pentium CPU. The DIMM provides a 64-bit data channel; and therefore, it can be used alone on a Pentium motherboard. The DIMM is longer than a slot of a single in-line memory module (SIMM), and the DIMM also supports a new 168-pin extended data output random access memory (EDORAM) memory. A DRAM is a most common memory chip, and a DIMM or a SIMM may include one or more DRAMs. The DRAM can retain data for only a very short time. To retain data, the DRAM uses a capacitor for storage; and therefore, refresh is required every period of time, and if a storage unit is not refreshed, stored information is lost. Data stored in the DRAM is also lost after power-off or a power failure. An NVM is another type of memory granule that can be used as a memory chip, and a DIMM or a SIMM may include one or more NVMs. Generally, the NVM is used to store a program and data, and data stored in the NVM is not lost after power-off or a power failure, which is different from a characteristic of the DRAM. Each time when a memory reads or writes data, the operation is performed based on a certain data unit, where the data unit is a page or a memory page, which generally represents 4 kilobytes (k) of data.
In addition, it should be noted that a “connection” described in the embodiments of the present disclosure indicates that there is a communication connection among two or more virtual modules, among two or more entity modules, or between an entity module and a virtual module, and its implementation may be one or more communication lines or signal lines. Unless otherwise specified, the “connection” may be a direct connection, may be a connection using an interface or a port, or may be a connection using another virtual module or entity module. Unless otherwise specified, a “first” and a “second” in the embodiments of the present disclosure are only for differentiation but not for indicating a particular order.
Referring to
Further, in an embodiment, the buffer scheduler 304 is further configured to, when it is determined that the data unit block corresponding to the fetch address is stored in the second memory 302, send a notification of updating access information of the data unit block. The memory system further includes a migration scheduler 305 configured to receive the notification sent by the buffer scheduler 304 and update the access information of the data unit block; determine, according to the access information of the data unit block, whether to migrate the data unit block in the second memory 302 to the first memory 301; and update the memory indexing table after migration.
The first memory 301 and the second memory 302 may separately be a memory module, or may separately be at least one memory chip, and their granularities are not restricted, provided that they can store the operating data of the processor. The first memory 301 and the second memory 302 are of different types, which may be that storage media of the two memories are of different types or storage speeds of the two memories are different. In an embodiment, the first memory 301 is a volatile memory module, and the second memory 302 is a non-volatile memory module (a read/write speed of the first memory 301 is faster than that of the second memory 302). In another embodiment, both the first memory 301 and the second memory 302 are volatile memory modules, where a read/write speed of the first memory 301 is faster than that of the second memory 302. In another embodiment, both the first memory 301 and the second memory 302 are non-volatile memory modules, where a read/write speed of the first memory 301 is faster than that of the second memory 302.
In an embodiment, the buffer scheduler 304 may directly complete the memory access request in the second memory 302. The buffer scheduler 304 is configured to, when it is determined that the data unit block is located in the first memory 301, complete the memory access request in the first memory 301; and when it is determined that the data unit block is located in the second memory 302, complete the memory access request in the second memory 302.
In another embodiment, the buffer scheduler 304 does not directly complete the memory access request in the second memory 302. The buffer scheduler 304 is configured to, when it is determined that the data unit block is located in the first memory 301, complete the memory access request in the first memory 301; and when it is determined that the data unit block is located in the second memory 302, migrate the data unit block in the second memory 302 to the first memory 301, and complete the memory access request in the first memory 301. In an embodiment, the data unit block may be replicated to the first memory 301, and then deleted after access is completed.
In an embodiment, the access information includes a quantity of access operations, and the migration scheduler 305 is configured to compare a recorded quantity of access operations of the data unit block with a migration threshold, and determine that migration is required if the quantity of access operations is greater than or equal to the migration threshold, and that migration is not required if the quantity of access operations is less than the migration threshold. The migration threshold may be set as required.
The memory indexing table 303 is used to indicate a data unit block in the first memory 301. In an embodiment, the memory indexing table 303 stores only a fetch address of a data unit block located in the first memory 301. In another embodiment, the memory indexing table 303 stores fetch addresses of data unit blocks corresponding to all memory access requests, and includes a fetch address, a memory location, and a quantity of fetch operations of a data unit block, where the memory location indicates whether the data unit block is stored in the first memory 301 or the second memory 302. In another embodiment, the memory indexing table 303 stores fetch addresses of data unit blocks corresponding to all memory access requests, and includes a fetch address, a memory location, a quantity of fetch operations, and a data update flag of a data unit block, where the memory location indicates whether the data unit block is stored in the first memory 301 or the second memory 302, and the data update flag indicates that content of the data unit block is updated. When the fetch operation of the received memory access request is a write operation, the content of the data unit block is updated. The memory indexing table 303 may also store other information. A buffer that stores the memory indexing table 303 may be physically implemented using storage media such as a static random-access memory (SRAM) and a DRAM. An SRAM is recommended because its access speed is faster. As for a physical location, the buffer may be located inside or outside the buffer scheduler 304, or located inside or outside the migration scheduler 305.
Referring to
Referring to
When the quantity of access operations is greater than or equal to the migration threshold, the migration determining logical module 502 outputs a result that a page in the second memory needs to be migrated to the first memory; and when the quantity of access operations is less than the migration threshold, the migration determining logical module 502 outputs a result that a page in a second memory does not need to be migrated to the first memory.
When the memory indexing table stores only a fetch address of a data unit block located in the first memory, the migration scheduler further includes a second register configured to store operation information of the data unit block, where the operation information includes a quantity of access operations. In another embodiment, the memory indexing table stores fetch addresses of data unit blocks corresponding to all memory access requests, and the migration scheduler directly updates the quantity of access operations of the data unit block in the memory indexing table. The register 501 and the second register 506 may physically be one unit or two units; and the command buffer 503 and the data buffer 504 may also physically be one unit or two units. The register 501 may be physically located inside or outside the migration determining logical module 502.
The access operations include a read operation and a write operation. The register 501 may separately store a migration threshold of the read operation and a migration threshold of the write operation. The second register 506 may separately store a quantity of read operations and a quantity of write operations of a data unit block. When determining, the migration determining logical module 502 separately determines the read operation and the write operation.
Migration in the foregoing embodiment refers that data in a memory is moved from a memory module to another memory module, and migration herein may also be replaced with moving or replication. The data unit block in the foregoing embodiment refers to a unit of data stored by a memory module or a smallest unit of data migration between memories. In an embodiment, the data unit block is a page, and generally, a page represents 4k of memory data.
In the foregoing embodiment, a memory system that uses hardware to implement heterogeneity implements management of memories of different types. A first memory and a second memory that are of different types exist in the memory system, and memory access requests may be completed in the first memory and the second memory, respectively, which requires no OS or other software for processing, does not cause page fault, and can improve a memory access speed; and implementation by hardware can reduce software overheads.
Referring to
Further, in another embodiment, the buffer scheduler 604 is further configured to send a notification of updating the access information of the data unit block. The memory system further includes a migration scheduler 605 configured to receive the notification and update the access information of the data unit block in the tag table; determine, according to the access information of the data unit block, whether to migrate the data unit block in the non-volatile memory 602 to the volatile memory 601; and update the tag table after migration.
In this embodiment, the tag table stores fetch addresses of data unit blocks corresponding to all memory access requests. In an embodiment, the tag table includes a fetch address, a memory location, and a quantity of fetch operations of a data unit block, where the memory location indicates whether the data unit block is stored in the volatile memory or the non-volatile memory. In another embodiment, the tag table includes a fetch address, a memory location, a quantity of fetch operations, and a data update flag of a data unit block, where the memory location indicates whether the data unit block is stored in the volatile memory or the non-volatile memory, and the data update flag indicates that content of the data unit block is updated. When the fetch operation of the received memory access request is a write operation, the content of the data unit block is updated. The tag table may also store other information. A buffer 603 that stores the tag table may be physically implemented using storage media such as an SRAM and a DRAM. An SRAM is recommended because its access speed is faster. As for a physical location, the buffer may exist independently, or may be located inside or outside the buffer scheduler, or located inside or outside the migration scheduler.
In an embodiment, the data unit block is a page.
Compared with the foregoing embodiment, in this embodiment, a first memory is specifically a volatile memory, a second memory is specifically a non-volatile memory, a memory indexing table is specifically a tag table, and a data unit block is specifically a page. The volatile memory and the non-volatile memory may separately be a memory module, or may separately be at least one memory chip, and their granularities are not restricted. The embodiments of the buffer scheduler and the migration scheduler in the foregoing embodiment may also be used in this embodiment, a difference lies in that the first memory in the foregoing embodiment is specifically the volatile memory in this embodiment, the second memory in the foregoing embodiment is specifically the non-volatile memory in this embodiment, and the data unit block in the foregoing embodiment is specifically a page in this embodiment.
In an embodiment, the volatile memory is a DRAM, and the non-volatile memory is an NVM.
In this embodiment, management of hybrid memories is implemented using hardware in the memory system. A page that is frequently operated is stored in the volatile memory, and a page that is not frequently operated is stored in the non-volatile memory. Memory access requests may be completed in the volatile memory and the non-volatile memory, respectively, so as to reduce interference from a randomly accessed page to access performance of a page with good locality of reference, which can improve a memory access speed; and page migration from the non-volatile memory to the volatile memory can be implemented, which improves access performance.
Referring to
Referring to
Information stored in the tag table includes an address of a page, which memory the page is located in, and a quantity of page access. Further, a major function of the tag table may be included, where the major function is to maintain which physical address space is currently located in the DRAM, and to maintain an access count of each page. The tag table may use direct addressing, or may use another manner such as a hash table to accelerate a search process and reduce space overheads. Update of the tag table is completed by the migration scheduler, which is completely transparent to software (for example, an OS, or a Hypervisor).
Referring to
Referring to
When it is determined in steps (2) and (3) that the quantity of write access or the quantity of read access exceeds the threshold, step (4) may be not performed, the page migration is directly started, and information of the tag table is updated. Another migration policy may also be set.
Checkpoint protection that is transparent to software can further be implemented on the memory system in the foregoing embodiment. For example, the migration scheduler regularly backs up rewritten data in the DRAM to the NVM. A part of area in the NVM may be reserved for specially storing a checkpoint. For each page in the DRAM, a flag byte dirty is correspondingly set in the tag, to indicate whether the page is rewritten. The migration scheduler regularly examines a page in the DRAM, and backs up only rewritten data in the DRAM to the NVM.
Further, to reduce checkpoint overheads, checkpoint may be performed when the DRAM is being refreshed or when memory scrubbing is being performed. When the DRAM is being refreshed, the buffer scheduler needs to read data out from the DRAM to a row buffer, and then write the data back. When the memory scrubbing is being performed, data needs to be read out to the buffer scheduler, and corrected data is written back to the DRAM after error checking is performed and an error is found. These two operations both need to read data from the DRAM, and the read-out data herein may be used to perform regular checkpoint, so as to reduce overheads without affecting normal operations of the DRAM.
For hybrid memories including a DRAM and an NVM, it is also possible to implement, in the buffer scheduler, hardware prefetch for the DRAM. The hardware learns a page access mode, generates a prefetch command, and migrates in advance a page that is predicated to be accessed in a short time to the DRAM, so as to improve performance. It is also possible to implement a hardware Victim in the buffer scheduler. A page replaced out from in the DRAM is very likely to be accessed again soon; and therefore, to place the replaced-out page in a Victim buffer can improve performance.
The present disclosure further discloses a computer system, including a multi-core processor and a memory system, where the multi-core processor includes a memory controller that is configured to initiate a memory access request, and the memory system may be any memory system in the foregoing embodiments and internal module components thereof, for example, the embodiments corresponding to
Referring to
S1401: Receive a memory access request packet, and obtain a fetch address and a fetch operation of a memory access request from the request packet.
S1402: Query a memory indexing table using the fetch address in the memory access request, to determine whether a data unit block corresponding to the memory access request is stored in a first memory or a second memory, and instruct a migration scheduler to update access information of the data unit block, where the first memory and the second memory are of different types.
S1403: Complete the fetch operation of the memory access request in the first memory if the data unit block is stored in the first memory, and return a result of the memory access request to an initiator of the memory access request.
S1404: Complete the fetch operation of the memory access request in the second memory if the data unit block is stored in the second memory, and return a result of the memory access request to an initiator of the memory access request.
In an embodiment, step S1404 includes migrating the data unit block to be accessed to the first memory if the data unit block is stored in the second memory, and then completing the fetch operation of the memory access request in the first memory, and returning a result of the memory access request to the initiator of the memory access request.
In another embodiment, step S1404 includes accessing the second memory directly if the data unit block is in the second memory and completing the fetch operation of the memory access request, and returning a result of the memory access request to the initiator of the memory access request.
In an embodiment, the method further includes the following steps.
S1405: The migration scheduler updates access information of the data unit block.
S1406: The migration scheduler determines, according to the access information of the data unit block, whether to migrate the data unit block located in the second memory to the first memory.
In an embodiment, the access information includes a quantity of access operations, and step S1405 includes comparing, by the migration scheduler, a recorded quantity of access operations of the data unit block with a migration threshold, and determining that migration is required if the quantity of access operations is greater than or equal to the migration threshold, and that migration is not required if the quantity of access operations is less than the migration threshold. Optionally, step S1405 further includes upgrading, by the migration scheduler, information of the memory indexing table when determining that migration is required.
In this embodiment, management of a memory system that includes a first memory and a second memory that are of different types is implemented. Memory access requests may be completed in the first memory and the second memory, respectively, without interrupting processing, which can improve a memory access speed.
Referring to
S1501: Receive a memory access request packet, and obtain a fetch address and a fetch operation of a memory access request from the request packet.
S1502: Query a tag table using the fetch address in the memory access request, to determine whether a data unit block corresponding to the memory access request is stored in a volatile memory or a non-volatile memory, where the tag table is used to indicate access information of the data unit block, and includes a fetch address, a memory location, and a quantity of fetch operations of the data unit block, and the memory location indicates whether the data unit block is stored in the volatile memory or the non-volatile memory.
S1503: Complete the fetch operation of the memory access request in the volatile memory if the data unit block is stored in the volatile memory, and return a result of the memory access request to an initiator of the memory access request.
S1504: Complete the fetch operation of the memory access request in the non-volatile memory if the data unit block is stored in the non-volatile memory, and return a result of the memory access request to an initiator of the memory access request.
In an embodiment, step S1504 includes migrating the data unit block to be accessed to the volatile memory if the data unit block is stored in the non-volatile memory, and then completing the fetch operation of the memory access request in the volatile memory, and returning a result of the memory access request to the initiator of the memory access request.
In another embodiment, step S1504 includes accessing the non-volatile memory directly if the data unit block is in the non-volatile memory, completing the fetch operation of the memory access request, and returning a result of the memory access request to the initiator of the memory access request.
Further, in an embodiment, the method for processing a memory access request further includes the following steps.
S1505: Update the access information of the data unit block in the tag table.
S1506: Determine, according to the access information of the data unit block, whether to migrate the data unit block located in the non-volatile memory to the volatile memory, and update the tag table after migration.
In an embodiment, the access information includes a quantity of access operations, and step S1506 includes comparing a recorded quantity of access operations of the data unit block with a migration threshold, and determining that migration is required if the quantity of access operations is greater than or equal to the migration threshold, and that migration is not required if the quantity of access operations is less than the migration threshold.
When it is determined that migration is required, an operation of migrating the data unit block stored in the non-volatile memory to the volatile memory is performed, and the tag table is updated after migration.
In an embodiment, the data unit block is a page.
In this embodiment, management of a memory system that includes a volatile memory and a non-volatile memory is implemented. Memory access requests may be completed in the volatile memory and the non-volatile memory, respectively, without interrupting processing, which can improve a memory access speed.
A person of ordinary skill in the art may understand that all or some of the processes of the methods in the embodiments may be implemented by a computer program instructing relevant hardware. The program may be stored in a computer readable storage medium. When the program runs, the processes of the methods in the embodiments are performed. The foregoing storage medium may include a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM).
The foregoing are merely exemplary embodiments of the present disclosure. A person skilled in the art may make various modifications and variations to the present disclosure without departing from the spirit and scope of the present disclosure.
Number | Date | Country | Kind |
---|---|---|---|
201310213533.3 | May 2013 | CN | national |
This application is a continuation of International Application No. PCT/CN2013/087840, filed on Nov. 26, 2013, which claims priority to Chinese Patent Application No. 201310213533.3, filed on May 31, 2013, both of which are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2013/087840 | Nov 2013 | US |
Child | 14954245 | US |