MEMORY MANAGEMENT TECHNIQUE AND COMPUTER SYSTEM

The method dynamically adjusts DRAM row management policies based on access types and hit statuses to optimize memory access, reducing latency and improving efficiency by minimizing conflicts.

JP7553062B2Active Publication Date: 2024-09-18HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
JP2023503053
Authority / Receiving Office
JP · JP
Patent Type
Patents
Current Assignee / Owner
Priority Date
2020-10-28
Filing Date
2021-05-15
Publication Date
2024-09-18
Estimated Expiration
2041-05-15

AI Technical Summary

Technical Problem

Existing DRAM row management policies often lead to increased memory access latency due to inappropriate closing of memory rows, either too early or too late, resulting in row conflicts and inefficiencies.

Method used

A memory management method that dynamically adjusts DRAM row management policies based on the type of memory access (read or write) and the row hit status, using separate indicators for read and write accesses to optimize when to close memory rows, thereby improving accuracy and reducing latency.

Benefits of technology

The method reduces memory access latency and improves efficiency by accurately managing DRAM rows based on access types and hit statuses, minimizing row conflicts and contention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 0007553062000014
    Figure 0007553062000014
  • Figure 0007553062000001
    Figure 0007553062000001
  • Figure 0007553062000008
    Figure 0007553062000008
Patent Text Reader

Abstract

A memory management technique and a computer system are provided. The memory management technique can be applied to a computer system equipped with a dynamic random access memory (DRAM). According to the memory management technique, a corresponding row management policy can be implemented based on the access type of the memory access, where the access type of the memory access includes a read access or a write access. In this memory management technique, different locality factors of different access types are fully taken into account, so that memory row management can be more accurate, memory access latency caused by an inappropriate row management policy can be reduced, and memory access efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present application relates to the field of computer technology, and more particularly to memory management technology and computer systems. [Background technology]

[0002] Dynamic Random Access Memory (DRAM) is a semiconductor memory. The main function principle of dynamic random access memory is to use the amount of charge stored in a capacitor to indicate whether a binary bit (or bits) is 1 or 0. DRAM is usually used as a computer's memory (also called main storage) and is an internal memory that directly exchanges data with a central processing unit (CPU). DRAM row buffer policy or DRAM row policy is a management policy for a row buffer of a DRAM. Specifically, the policy is a policy of certain conditions that triggers closing a row in a memory bank of a DRAM after the row is opened. Alternatively, DRAM row management policy is a policy of certain conditions that triggers closing a row buffer of a corresponding bank after the data of the row enters the row buffer of the bank.

[0003] During a memory access, the impact of the status of a row in memory on the memory access may include row hit and row conflict. A row hit indicates that the row to be accessed matches exactly with an open row in the bank to be accessed. In the case of a row hit, data can be read or written by sending only one column access command (e.g., a read or write command). A row conflict indicates that a row in the bank to be accessed is open, but the currently open row is not identical to the row to be accessed. In this case, the currently open row needs to be closed first, then the row to be accessed needs to be opened, and then the column access is performed. Typically, the latency of a row hit is about 1 / 3 of the latency of a row conflict. Therefore, during a memory access, if a memory row is closed too early, the access latency increases. If a memory row is closed too late, a row conflict occurs and the latency increases. Therefore, the DRAM row management policy is one of the major factors that affect the latency and bandwidth of accessing a DRAM. Summary of the Invention

[0004] The present application provides memory management techniques and computer systems to reduce memory access latency and improve memory access efficiency.

[0005] According to a first aspect, an embodiment of the present invention provides a memory management method. The memory management method may be applied to a computer system including a dynamic random access memory DRAM. The method may be implemented by a memory controller in the computer system. In the method, after obtaining a memory access, the memory controller may determine an access type of the memory access and execute a row management policy corresponding to the access type of the memory access. The access type of the memory access includes a read access and a write access.

[0006] According to the memory management method provided in this embodiment of the present invention, the differences between the localities of different types of memory accesses are fully taken into account, and corresponding row management policies are implemented based on the types of memory accesses, so that memory row management can be made more accurate, the memory access latency caused by inappropriate row management policies can be reduced, and memory access efficiency can be improved.

[0007] Referring to the first aspect, in a possible implementation, a memory access is used to access a target row in a target memory bank in a memory. Executing a row management policy corresponding to an access type of the memory access includes executing a row management policy of the target memory bank corresponding to the access type of the memory access. The memory includes one or more memory banks, and the target memory bank is any one of the one or more memory banks. In this case, different row management policies may be executed for different target memory banks, resulting in smaller management granularity and more precise management.

[0008] In a possible implementation, the row management policy may be further adjusted based on the access type of the memory access and the row hit status of the target row, which may include at least one of the following states: row hit, row conflict, and row idle.

[0009] In a possible implementation, when the row management policy of the target memory bank is adjusted based on the access type of the memory access and the row hit status of the target row, and when the memory access is a read access, the memory controller may adjust a first indicator of the target memory bank based on the row hit status of the target row, the first indicator indicating a first row management policy of the target memory bank, and the first row management policy indicating whether to close the target row after the read access is performed.

[0010] In this manner, a first indicator is specified that indicates the row management policy to be used after a read access is performed, and the first indicator is adjusted based only on the read access and the row hit status of the target row, resulting in a more accurate adjustment and a more accurate row management policy indicated by the first indicator, thereby reducing memory access latency.

[0011] In another possible implementation, when the row management policy of the target memory bank is adjusted based on the access type of the memory access and the row hit status of the target row, and if the memory access is a write access, the second indicator of the target memory bank may be adjusted based on the row hit status of the target row. The second indicator indicates a second row management policy of the target memory bank, and the second row management policy indicates whether to close the target row after the write access is performed. In this case, a second indicator is specified that indicates a row management policy to be used after the write access is performed, and the second indicator is adjusted based only on the write access and the row hit status of the target row. Thus, after the read access and the write access are performed, different row management policies may be performed based on the indications of the different indicators, resulting in more accurate adjustment and reduced memory access latency.

[0012] In another possible implementation, adjusting the row management policy of the target memory bank based on the access type of the memory access and the row hit status of the target row may further include determining that if the memory access is a write access, the row management policy of the target memory bank is a preset row management policy corresponding to the write access. The preset row management policy indicates whether to close the target row after the write access is executed. In this case, only a first indicator indicating a row management policy to be used after the read access is executed may be specified for the target memory bank, and the first indicator is adjusted based only on the read access of the target memory bank. Since the locality of the write access is poor, even if the adjustment is performed, the effect is hard to notice. Therefore, the preset row management policy may be used, and the adjustment is not performed during the memory access. For example, in practical application, considering the poor locality of the write access, the preset row management policy may indicate to close the target row after the write access is completely executed. In other words, in this case, only the row management policy to be used after the read access is executed may be adjusted, and the row management policy to be used after the write access is executed is not adjusted.

[0013] In another possible implementation, the row hit status includes a row hit or a row conflict. Adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row includes adjusting the first indicator or the second indicator to a first indication if the memory access causes a row hit, or adjusting the first indicator or the second indicator to a second indication if the memory access causes a row conflict. The first indication indicates that the target row is not closed or that the target row is maintained in an open state, and the second indication indicates that the target row is closed.

[0014] In another possible implementation, the row hit status includes a row idle. Adjusting the first indicator or the second indicator based on the row hit status of the target row includes determining whether the memory access will cause a row hit if the memory access will cause a row idle, and adjusting the first indicator or the second indicator to a first indication if the memory access will cause a row hit, where the first indication indicates that the target row is not closed or that the target row is kept open, and where a row hit may be caused means that a row hit will be caused if the last open row in the target memory bank is not closed, or adjusting the first indicator or the second indicator to a second indication if the memory access will cause a row conflict, where the second indication indicates that the target row is closed, and where a row conflict may be caused means that a row conflict will be caused if the last open row in the target memory bank is not closed.

[0015] In another possible implementation, the method further comprises determining an access type of the memory access prior to the memory access. Adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row includes adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row and the access type of the memory access prior to the memory access.

[0016] In another possible implementation, the initial value of the first indicator is greater than the initial value of the second indicator.

[0017] In another possible implementation, when the first indicator is adjusted, a first adjustment range of the adjustment to the first indication is greater than a second adjustment range of the adjustment to the second indication, and when the second indicator is adjusted, a third adjustment range of the adjustment to the first indication is less than a fourth adjustment range of the adjustment to the second indication.

[0018] In the above-mentioned adjustment methods, the difference between the locality of the read access and the locality of the write access are fully taken into account, and the first indicator or the second indicator of the target memory bank is adjusted based on the type of memory access of the target memory bank, the type of memory access before the current memory access, and the row hit status of the target row, so that the adjustment of the value of the first indicator or the value of the second indicator of the target memory bank is more accurate. Therefore, the memory controller can more accurately determine when to close a row in the target memory bank based on the indication of the first indicator or the second indicator of the target memory bank. This reduces the memory access latency caused by the inappropriate row management policy and improves the memory access efficiency.

[0019] In another possible implementation, the memory access belongs to the first batch of memory accesses. When the first batch of memory accesses is completely executed and it is determined that the second batch of memory accesses is to be executed, if the access type of the first batch of memory accesses is different from the access type of the second batch of memory accesses, the target row is closed, if both the first batch of memory accesses and the second batch of memory accesses are read accesses, the target row is kept in an open state, or if both the first batch of memory accesses and the second batch of memory accesses are write accesses, the target row is closed. In this manner of scheduling memory accesses in batches, memory accesses of the same type can be scheduled in the same batch, so that the number of read-write switches is reduced and memory access efficiency is improved.

[0020] In another possible implementation, adjusting the row management policy of the target memory bank based on an indication of the first indicator or the second indicator may include maintaining the target row in an open state after the read access is fully executed when the value of the first indicator or the value of the second indicator is greater than a preset threshold, and closing the target row until a time for maintaining the target row in an open state reaches a time indicated by the value of the first indicator or a time indicated by the value of the second indicator.

[0021] In another possible implementation, adjusting the row management policy of the target memory bank based on an indication of the first indicator or the second indicator may include maintaining the target row in an open state when the value of the first indicator or the value of the second indicator is greater than or equal to a first threshold, or closing the target row when the value of the first indicator or the value of the second indicator is less than the first threshold.

[0022] According to a second aspect, the present application provides a memory management apparatus, the apparatus including at least one processor and a memory controller configured to implement the memory management method of the first aspect or any one of the implementations of the first aspect.

[0023] According to a third aspect, the present application provides a memory controller, the memory controller including a communications interface and logic circuitry configured to perform the memory management method of the first aspect or any one of the implementations of the first aspect, the communications interface configured to receive memory accesses transmitted by a processor of the computer system.

[0024] According to a fourth aspect, the present application provides a computer system comprising a memory and a memory management device according to the second aspect.

[0025] According to a fifth aspect, the present application provides a memory management device, comprising a functional module configured to implement the memory management method of the first aspect or any one of the implementations of the first aspect.

[0026] According to a sixth aspect, the present application further provides a computer program product, the computer program product comprising program code, the instructions of which, when executed by a computer, implement the memory management method of the first aspect or any one of the implementations of the first aspect.

[0027] According to a seventh aspect, the present application further provides a computer readable storage medium, the computer readable storage medium being configured to store program code, the program code including instructions which, when executed by a computer, implement the memory management method of the first aspect or any one of the implementations of the first aspect. [Brief description of the drawings]

[0028] In order to describe the technical solutions in the embodiments of the present invention more clearly, the following will briefly describe the accompanying drawings to describe the embodiments. It is clear that the accompanying drawings in the following description only illustrate some embodiments of the present invention.

[0029] [Figure 1] FIG. 2 is a schematic diagram of the architecture of a computer system according to an embodiment of the present invention.

[0030] [Diagram 2] 1 is a schematic diagram of a structure of a memory chip according to an embodiment of the present invention;

[0031] [Diagram 3] FIG. 2 is a schematic diagram of memory access latency according to an embodiment of the present invention.

[0032] [Figure 4A] 4 is a flowchart of a memory management method according to an embodiment of the present invention.

[0033] [Figure 4B] 4 is a flowchart of another memory management method according to an embodiment of the present invention.

[0034] [Figure 5A-1] 4 is a flowchart of a method for adjusting a row management policy according to an embodiment of the present invention. [Figure 5A-2] 4 is a flowchart of a method for adjusting a row management policy according to an embodiment of the present invention. [Figure 5B] 4 is a flowchart of a method for adjusting a row management policy according to an embodiment of the present invention. [Figure 5C-1] 4 is a flowchart of a method for adjusting a row management policy according to an embodiment of the present invention. [Figure 5C-2] 4 is a flowchart of a method for adjusting a row management policy according to an embodiment of the present invention. [Figure 5D] 4 is a flowchart of a method for adjusting a row management policy according to an embodiment of the present invention.

[0035] [Figure 6] 4 is a flowchart of a method for enforcing a memory line management policy according to an embodiment of the present invention.

[0036] [Figure 7] 4 is a flowchart of another memory management method according to an embodiment of the present invention.

[0037] [Figure 8] FIG. 2 is a schematic diagram of scheduling memory accesses according to an embodiment of the present invention;

[0038] [Figure 9] 4 is a flowchart of another memory management method according to an embodiment of the present invention.

[0039] [Figure 10]1 is a schematic diagram of a memory management device according to an embodiment of the present invention; DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0040] In order to allow those skilled in the art to more fully understand the technical solutions in the present invention, the following will clearly describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. It is clear that the described embodiments are only a part, but not all, of the embodiments of the present invention.

[0041] Dynamic Random Access Memory (DRAM) is a semiconductor memory. The main function principle of dynamic random access memory is to use the amount of charge stored in a capacitor to indicate whether a binary bit (or bits) is 1 or 0. DRAM is usually used as the memory (or called main storage) of a computer system, and is an internal memory that directly exchanges data with a central processing unit (CPU). FIG. 1 is a schematic diagram of the architecture of a computer system 100 according to an embodiment of the present invention. The computer system provided in this embodiment of the present invention may include a server, a desktop computer, and various dedicated computers. As shown in FIG. 1, the computer system 100 may include at least a processor 102, a memory controller 106, and a memory 108. Typically, the memory controller 106 may be integrated into the processor 102. It should be noted that in addition to the components shown in FIG. 1, the computer system 100 may further include other components, such as a communication interface and a disk used as an external storage device. This is not limited here.

[0042] The processor 102 is a computing and control core of the computer system 100. The processor 102 may include one or more processor cores 104. The processor 102 may be a hyperscale integrated circuit. An operating system and other software programs are installed on the processor 102, so that the processor 102 can access the memory 108, cache, and magnetic disk. In this embodiment of the present invention, it can be understood that the cores 104 in the processor 102 may be, for example, a central processing unit (CPU) or another application-specific integrated circuit (ASIC). In practical applications, the computer system 100 may alternatively include multiple processors.

[0043] The memory controller 106 is a bus circuit controller configured to control the memory 108 in the computer system 100 and manage and schedule data transfer from the memory 108 to the core 104. Data can be exchanged between the memory 108 and the core 104 through the memory controller 106. The memory controller 106 can be a separate chip and connected to the core 104 through a system bus. Those skilled in the art can recognize that the memory controller 106 can be integrated into the processor 102 (as shown in FIG. 1), can be built into the north bridge, or can be an independent memory controller chip. The specific location and existence form of the memory controller 106 is not limited in the embodiment of the present invention. In practical application, the memory controller 106 can control the necessary logic to write data to the memory 108 or read data from the memory 108. The memory controller 106 can be a memory controller in a processor system such as a general-purpose processor, a dedicated accelerator, a GPU, an FPGA, or an embedded processor.

[0044] The memory 108 is the main storage of the computer system 100. The memory 108 is connected to the memory controller 106 through a double data rate (DDR) bus. The memory 108 is usually configured to store various types of software running in an operating system, input and output data, information exchanged with external storage devices, and the like. In order to increase the access speed of the processor 102, the memory 108 needs to have the advantage of a high access speed. In a conventional computer system architecture, a dynamic random access memory (DRAM) is usually used as the memory 108. By using the memory controller 106, the processor 102 can access the memory 108 at high speed and perform read and write operations on any memory cell in the memory 108.

[0045] In practical applications, memory 108 may include one or more dual in-line memory modules (DIMMs) 110. t DIMM 110. t DIMM is 1 t 1 can be used as a memory module entity; t The memory module is 2 t For high-end memory modules, Two Sides but Both Each side has memory chips, called a rank. t The DIMM has rank 0 and rank 1. As shown in FIG. t The DIMM 110 may include one or more ranks 112. Each rank 112 may include multiple memory chips 114.

[0046] Those skilled in the art will recognize that data is stored in memory 108. Specifically, data is stored in memory cells in memory chip 114. In the present embodiment, a memory cell refers to the smallest memory cell used to store data. Typically, one t A memory cell may store one bit of data. Of course, some memory cells can also implement multi-level storage. When a DRAM is used as the memory 108, the memory cells in the DRAM (which may also be referred to as DRAM cells) are arranged in a matrix, and the matrix is ​​referred to as a memory bank or DRAM bank. In this manner, the memory cells in the memory chip 114 may be logically grouped into multiple memory banks, and each memory bank may be considered as a memory array including multiple memory cells. Each memory cell in a memory bank is identified by using a row address and a column address where the memory cell is located. The memory controller may locate any memory cell in the memory bank by using a corresponding row decoder and a corresponding column decoder. In an embodiment of the present invention, the memory bank may also be referred to as a bank for short.

[0047] FIG. 2 is a schematic diagram of a structure of a memory chip 114 according to an embodiment of the present invention. t1 shows an example of a DRAM chip including a bank of 1142. The memory chip 114 may include a control and refresh circuit 1140, a plurality of memory banks 1142, a row address buffer 1143, a column address buffer 1144, a row decoder 1145, and a column decoder 1146. The control and refresh circuit 1140 is configured to control refresh operations on the memory cells. Those skilled in the art may recognize that DRAM is a volatile memory that uses the amount of charge stored in a capacitor to indicate data 0 and 1. The charge can only be maintained for a very short time because leakage phenomenon may occur in the capacitor. If the charge in the capacitor is insufficient, errors may occur in the stored data. Therefore, in order to store data, the control and refresh circuit 1140 needs to automatically perform a refresh operation to charge the memory cells whose stored data is "1", thereby preventing the DRAM 108 from losing data.

[0048] During memory access, after receiving a memory access request, the memory controller 106 generates address signals and control signals based on the received memory access request, and the generated address signals and control signals of The control signals may include a row address signal and a column address signal. The control signals may include a chip select (CS) signal, a write enable (WE) signal, a column address strobe (CAS), a row address strobe (RAS), and the like. These signals may be received by a control and refresh circuit 1140. The row address signal is buffered in a row address buffer 1143. The column address signal is buffered in a column address buffer 1144. The control signals are forwarded to a bank corresponding to the row address specified by the address signals.

[0049] The row address buffer 1143 is configured to buffer a row address signal sent by the memory controller 106. The column address buffer 1144 is configured to buffer a column address signal sent by the memory controller 106. The row decoder 1145 is coupled to the row address buffer 1143 and the plurality of banks 1142, and the column decoder 1146 is coupled to the column address buffer 1144 and the plurality of banks 1142. The row decoder 1145 is configured to decode the row address signal, and the column decoder 1146 is configured to decode the column address signal, such that corresponding memory cells in the banks 1142 are located based on the decoded row address signal and the decoded column address signal. identification It can be done.

[0050] When the memory controller accesses the DRAM, the memory controller 106 must first identify the memory row that corresponds to the data to be accessed, determine which bank the memory row to be accessed belongs to, and then the memory controller 106 "opens" the bank and the memory row. In some implementations, a memory row may also be referred to as a "page," where a "page" is a logical concept. In this case, t A page is a single page in DRAM. t A memory cell array includes a memory row of memory cells. One The size of a memory page can contain 512, 1024 (1K), 2048 (2K), 4098 (4K), 8196 (8K), 16392 (16K) or 32,768 (32K) bits of data.

[0051] Normally, during memory access, the memory line to be accessed is divided into the following three t A row hit occurs when the memory line to be accessed is open and the memory is in a non-volatile state. Is Specifically, the data in the memory row to be accessed is The The row buffer corresponding to the bank storing the data in the row has been loaded, and the data can be read from or written to the memory cells of the row by directly sending a column access command. The column access command can include a read command or a write command. Row idle indicates that the bank corresponding to the memory row to be accessed is in an idle state, there is no memory row open, and the memory row to be accessed needs to be opened by using an "activate" command, and then accessed. In other words, the data in the memory row to be accessed can be read from or written to the memory cells of the row by using an "activate" command. The The row buffer corresponding to the bank needs to be loaded before a column access command can be sent for access. A row conflict indicates that the currently opened memory row is different from the memory row that is to be accessed. In case of a row conflict, the currently opened memory row must first be "closed". This is done by using the "precharge" command. The The method includes writing the data in the opened memory row back to the memory array, and then loading the data in the row to be accessed into the corresponding row buffer by using an activate command, and then sending a column access command for access. t may be referred to as the row hit status of the memory row. A "memory row" may also be referred to as "row" for short, and the memory row to be accessed may also be referred to as the target row.

[0052] From the above description, it can be seen that during memory access, different states of a row to be accessed may cause different access latencies. FIG. 3 is a schematic diagram of memory access latency according to an embodiment of the present invention. As shown in FIG. 3, in row hit state (indicated by 302 in FIG. 3), the row to be accessed is in an open state, so the memory controller can directly send a column access command. After the column access command is sent, data can be read from or written to the memory. When the column access command is a read command, the read data can be obtained after a latency 303. In the case of row idle (indicated by 304 in FIG. 3), there is no row opened in the bank, so the row to be accessed needs to be opened by using an "activate" command, and then it is accessed. Therefore, the memory controller 106 needs to first send a row activate command, and then send a column access command after a latency 303 to access the opened row. When the column access command is a read command, the read data can be obtained only after a latency 305. In case of row conflict (denoted by 306 in FIG. 3), since the currently opened row is not the row to be accessed, a pre-charge command needs to be sent first to close the currently opened row, then a row activation command is sent to open the row to be accessed after a latency 307, and then a column access command is sent to access the row to be accessed after a latency 305. When the column access command is a read command, after the column access command is sent, the read data can be obtained only after a latency 303.

[0053] From Figure 3, we can see that the latency is minimal for a row hit. In this case, closing a currently open row too early will cause a row idle state, increasing latency. Closing a currently open row too late may result in row contention, also increasing latency. Thus, when a row in the DRAM is opened, attitude When The Open Is The policy of the particular conditions under which row closure is triggered is an important factor affecting the latency and bandwidth for accessing the DRAM.

[0054] The memory row management policy may also be referred to as a DRAM row management policy or a DRAM row policy, and is a policy used to manage the row buffer of a DRAM. Specifically, the policy is a policy of a certain condition that triggers the closing of a row in a bank of a DRAM after the row is opened. Alternatively, the DRAM row management policy is a policy of a certain condition that triggers the closing of a row buffer of a corresponding bank after the data of the row enters the row buffer of the bank. Thus, the DRAM row management policy affects the latency and bandwidth of accessing the DRAM.

[0055] The embodiment of the present invention provides a memory management technique, so that the row management policy of each bank in a DRAM can be dynamically adjusted, reducing memory access latency and improving memory access efficiency. For ease of explanation, in the embodiment of the present invention, the memory row management policy can also be referred to as a row management policy. The memory management technique provided in the embodiment of the present invention can be applied to the computer system shown in FIG. 1. In the embodiment of the present invention, an independent policy indicator is specified for each memory bank, and the memory controller can adjust the row management policy of the memory bank based on the policy indicator specified for the bank. Considering the difference between the locality of access by using a read command and the locality of access by using a write command, in the embodiment of the present invention, a first indicator and a second indicator can be specified for the same bank. The first indicator indicates the row management policy to be used after a read access is performed, and the second indicator indicates the row management policy to be used after a write access is performed. The memory controller can determine the row management policy of the corresponding bank based on both the first indicator and the second indicator. FIG. 4A is a flowchart of a memory management method according to the embodiment of the present invention. The method can be performed by a memory controller in the computer system shown in FIG. 1, and the method can include the following steps.

[0056] Step 401: Obtain a memory access for a target memory bank. In this embodiment of the present invention, the memory 110 includes one or more memory banks, and the target memory bank may be any bank in any memory chip 114 in the memory 110. The memory access may be used to access a target row in the target memory bank. It may be understood that the obtained memory access may include information such as a read / write identifier, an address, and a request ID. In addition, if the memory access is a write access, the write access may further hold data to be written to the memory. The read / write identifier indicates the access type of the memory access. The address indicates the address to be accessed, and an identifier of the bank to be accessed by the memory access may be obtained based on the address. The request ID is used to identify the memory access.

[0057] Step 403: The memory controller determines an access type of the memory access. The memory access includes a read access or a write access. In this step, the access type of the memory access may be determined based on a read / write identifier in the memory access.

[0058] Step 405: Execute a row management policy corresponding to the access type of the memory access. In this embodiment of the present invention, considering the difference in locality characteristics between read access and write access, the locality of the read access is usually better than the locality of the write access. Therefore, in this embodiment of the present invention, different row management policies are used for read access and write access. Note that good locality means that multiple consecutive commands are used to repeatedly access the same row. Bad locality means that multiple consecutive commands are not used to repeatedly access the same row. Bad locality can also be referred to as high randomness. In this step, a row management policy corresponding to the access type of the memory access can be executed. In practical application, the management can alternatively be executed at the granularity of the memory bank. In this case, different row management policies can be set for different types of access of each memory bank. Therefore, in this step, a row management policy of the target memory bank corresponding to the access type of the memory access can be executed.

[0059] Specifically, when the memory access is a read access, the line management policy of the target memory bank may be executed based on the instruction of the specified first indicator. When the memory access is a write access, the line management policy of the target memory bank may be executed based on the instruction of the specified second indicator. The first indicator indicates the line management policy to be used after the read access is executed, and the second indicator indicates the line management policy to be used after the write access is executed. In other words, the first indicator indicates whether to close the target row after the read access is executed, and the second indicator indicates whether to close the target row after the write access is executed. It should be noted that in this embodiment of the present invention, the first indicator is adjusted based only on the read access, and the second indicator is adjusted based only on the write access.

[0060] Specifically, when the row management policy of the target memory bank is executed based on the indication of the first indicator or the indication of the second indicator, the following implementations may be included: In one case, the target row may be closed or kept open based on the indication of the first indicator or the indication of the second indicator. For example, the value of the first indicator may be or A value of the second indicator of "1" indicates opening the target row, or a value of the first indicator or the second indicator of "0" indicates closing the target row.

[0061] In other cases, whether to close the target row depends on the value of the first indicator. also teeth No. The first indicator may be determined based on the value of the first indicator and a preset threshold. For example, when the value of the first indicator is greater than or equal to the first threshold, the target row is kept open after the read access is fully executed, or when the value of the first indicator is less than the first threshold, the target row is closed after the read access is fully executed. When the value of the second indicator is greater than or equal to the second threshold, the target row is kept open after the write access is fully executed, or when the value of the second indicator is less than the second threshold, the target row is closed after the write access is fully executed. In practical applications, the first threshold and the second threshold may be the same or different. In practical applications, alternatively, when the value of the first indicator is less than the first threshold, the target row may be kept open after the read access is fully executed, or when the value of the first indicator is greater than the first threshold, the target row may be closed after the read access is fully executed. Similarly, when the value of the second indicator is less than the second threshold, the target row is kept open after the write access has been fully executed, or when the value of the second indicator is greater than the second threshold, the target row is closed after the write access has been fully executed.

[0062] In yet another case, the row management policy of the target row may alternatively be executed based on the value of the first indicator or the time indicated by the value of the second indicator. For example, if the memory access is a read access and the value of the first indicator is greater than or equal to the third threshold, the target row may be kept open after the read access is fully executed, and the target row is closed until the time to keep the target row open reaches the time indicated by the value of the first indicator. If the memory access is a write access and the value of the second indicator is greater than or equal to the fourth threshold, the target row may be kept open after the write access is fully executed, and the target row is closed until the time to keep the target row open reaches the time indicated by the value of the second indicator. The third and fourth thresholds may be the same or different, and both the third and fourth thresholds may be integers greater than or equal to 0.

[0063] In yet another case, the method may further include stage 407. The memory controller may adjust a corresponding line management policy based on the access type of the memory access and the line hit status of the target line. The line hit status of the target line may include a line hit, a line conflict, or a line idle. Specifically, the memory controller may determine the line hit status of the target line based on the address of the memory access. When the address of the memory access matches the address of an open line in the target bank, the memory access is deemed to cause a line hit. When it is determined based on the address of the memory access that there is no open line in the target bank, the memory access is deemed to cause a line idle. When the address of the memory access does not match the address of an open line in the target bank, the memory access is deemed to cause a line conflict.

[0064] In practical application, the row management policy of the target bank can be adjusted by adjusting the policy indicator corresponding to the row management policy. In this embodiment of the present invention, considering the difference in locality between read access and write access, the corresponding policy indicator can be adjusted based on different access types to adjust the corresponding row management policy. For example, t In this case, the target bank finger The policy indicators that may be set may include a first indicator and a second indicator. The first indicator indicates whether to close the target row after a read access is performed, and the second indicator indicates whether to close the target row after a write access is performed. In other words, the first indicator indicates a row management policy corresponding to a read access, and the second indicator indicates a row management policy corresponding to a write access. When the memory access is determined to be a read access in stage 403, the first indicator of the target memory bank may be adjusted based on a row hit status of the target row in this stage. When the memory access is determined to be a write access in stage 403, the second indicator of the target memory bank may be adjusted based on a row hit status of the target row in this stage. During the particular adjustment, for example, if the memory access causes a row hit, the first indicator or the second indicator is adjusted to a first indication, where the first indication indicates that the target row is closed and the second indicator is adjusted to a second indication. N or the target row is kept open R If the memory access causes a row conflict, the first indicator or the second indicator is adjusted to a second indication, where the second indication indicates that the target row is closed. R It is shown that. For specific adjustment methods, please refer to the following description in Figures 5A-1 and 5A-2 to 5D. Details will not be described here. In another case, at this stage, the first indicator of the target bank can alternatively be adjusted based on only read access, and the row management policy corresponding to write access is not adjusted.

[0065] It should be noted that in practical application, the order of performing steps 405 and 407 is not limited. The row management policy of the target bank may be adjusted based on the hit status of the target row first, and then the adjusted row management policy corresponding to the type of memory access is executed. Alternatively, the row management policy corresponding to the type of memory access may be executed first, and then the row management policy is adjusted based on the row hit status of the target row accessed during the memory access.

[0066] In this embodiment of the present invention, when the row management policy of the memory row in the DRAM is executed, the difference between the locality of different access types is fully taken into consideration, and the corresponding row management policy is executed based on the access type, so that the memory row management can be made more accurate, the memory access latency caused by the inappropriate row management policy can be reduced, and the memory access efficiency can be improved.

[0067] As shown in FIG. 4A, an embodiment of the present invention includes: t In the following, a description is provided in terms of a memory access of one or more memory accesses. As shown in FIG. 4B, the following description is provided in terms of a plurality of memory accesses. FIG. 4B is a flowchart of another memory management method according to an embodiment of the present invention. The method may further be performed by a memory controller in the computer system shown in FIG. 1, and the method may include the following steps.

[0068] Step 402: Monitor a plurality of memory accesses of the target memory bank. The plurality of memory accesses may include read accesses or write accesses. In this embodiment of the present invention, monitoring the plurality of memory accesses of the target bank includes obtaining a plurality of memory accesses of the target bank and determining an access type and a row hit status of each memory access of the target bank, where the row hit status includes whether a row hit, a row idle, or a row conflict is caused. Specifically, the access type of the memory access may be determined based on a read / write identifier in the memory access. The status of the line to be accessed may be determined based on an address of each memory access. When the address of the memory access matches the address of an open line in the target bank, the memory access is deemed to cause a row hit. When it is determined based on the address of the memory access that there is no open line in the target bank, the memory access is deemed to cause a row idle. When the address of the memory access does not match the address of an open line in the target bank, the memory access is deemed to cause a row conflict.

[0069] Stage 404: Separately adjust the row management policy of the target bank based on the multiple memory accesses. For example, the first indicator may be adjusted based on the read access in the multiple memory accesses, and the second indicator may be adjusted based on the write access in the multiple memory accesses. The first indicator indicates the row management policy to be used after the read access is performed, and the second indicator indicates the row management policy to be used after the write access is performed. In this embodiment of the present invention, considering the difference in locality characteristics between the read access and the write access, the row management policy of the same bank is adjusted. fart The second indicator and the first indicator of are separately designated. For ease of explanation, in this embodiment of the present invention, a bank in a memory chip 114 is used as an illustrative example.

[0070] In this embodiment of the present invention, the second indicator and the first indicator may each exist in the form of a counter or a register. In the following, the second indicator will be described by using a counter as an example. During initialization, different initial values ​​may be assigned to the first indicator and the second indicator. Considering that the locality of read access is better than the locality of write access, the initial value of the first indicator is larger than the initial value of the second indicator. It is good .

[0071] After the initialization is complete, the value of the first indicator is fart The value of the first indicator may be adjusted based on read accesses to the bank, and the value of the second indicator may be adjusted based on write accesses to the bank. It should be noted that in this embodiment of the present invention, for any bank, the first indicator of the bank is adjusted based only on read accesses to the bank, and the second indicator of the bank is adjusted based only on write accesses to the bank. For details on how to adjust the value of the first indicator or the value of the second indicator of the target bank based on memory accesses of the target bank, please refer to the embodiments shown in Figures 5A-1 and 5A-2 to 5D.

[0072] Step 406: Execute the row management policy of the target bank. Specifically, for details on how to execute the row management policy of the target bank based on the indication of the first indicator or the indication of the second indicator, please refer to the description of step 405 in FIG. 4A. For example, the rows in the target bank are closed based on the time indicated by the first indicator or the time indicated by the second indicator. It is okay Alternatively, rows in the target bank are closed based on an indication of the first indicator or an indication of the second indicator. Well Or, the row in the target bank is closed based on the preset threshold and the value of the first indicator or the value of the second indicator. It is okayFor details on how to dynamically adjust the row management policy of the target bank based on the value of the second indicator or the value of the first indicator, see the discussion in FIG.

[0073] 5A-1 and 5A-2 are flow charts of a method for adjusting a line management policy according to an embodiment of the present invention. It can be understood that a line management policy can be adjusted by adjusting a corresponding policy counter. In FIG. 5A-1 and FIG. 5A-2, t The target bank is 2 t In the example shown in FIG. 5A-1 and FIG. 5A-2, the first indicator and the second indicator are used. t The memory access of is used as an example for explanation. It can be understood that for any memory access obtained by the memory controller in Figures 4A and 4B, the corresponding row management policy can be adjusted according to the method shown in Figures 5A-1 and 5A-2. Specifically, the method may include the following steps.

[0074] Step 502: The memory controller receives a memory access. As described above, the received memory access may include information such as a read / write identifier, an address, and a request ID. Step 504: The memory controller determines whether the memory access is a read access or a write access. If the memory access is a read access, the method proceeds to step 506. If the memory access is a write access, the method proceeds to step 520. Steps 502 and 504 correspond to steps 401 and 403 in FIG. 4A. average It can be understood that the steps 502 and 504 are similar to step 402 in FIG. 4A and step 403 in FIG. 4B. In this embodiment, a description is provided again for clarity. In practical application, step 502 and step 504 do not need to be performed after step 401 and step 403 in FIG. 4A are performed, or after step 402 in FIG. 4B is performed.

[0075] When the memory access is a read access, in step 506, it is further determined whether the previous memory access of the target memory bank (memory bank or bank for short) is a read access or a write access. If the previous memory access is a read access, the method proceeds to step 508. If the previous memory access of the memory access is a write access, the method proceeds to step 519 to reduce improper closing of rows in the target bank due to read-write switching caused by random operations. Step 508: The memory controller determines whether the target bank is in an open state or an idle state. If the target bank is in an open state, the method proceeds to step 510. If the target bank is in an idle state, the method proceeds to step 516.

[0076] Target bank opens Ouch R case In stage 510, the memory controller may determine whether the memory access causes a row hit. Specifically, the memory controller may determine whether an open row in the target bank is hit based on a row address of the memory access. If the row address of the memory access is identical to the address of the open row in the target bank, the memory access is deemed to cause a row hit. Otherwise, the memory access is deemed to cause a row conflict. If the memory access causes a row hit, indicating that the decision to keep the row open is correct, the method proceeds to stage 514. Stage 514: The memory controller may adjust a first indicator to a first indication, where the first indication indicates that the target row is closed. N or the target row is kept open R For example, the memory controller may To keep the target row open, 1Indicator value First preset value only Increase Well or adjust the first indicator of the target bank No need to The first preset value may be one or another value.

[0077] If the memory access causes a row conflict, indicating that a currently open row in the target bank should be closed as soon as possible, the method proceeds to step 512. Step 512: The memory controller adjusts a first indicator of the target bank to a second indication, where the second indication indicates that the target row should be closed. R For example, in step 512, the memory controller may decrease the value of the first indicator of the target bank by a second preset value. For example, the second preset value may be one or another value. The first preset value may also be referred to as a first adjustment width, and the second preset value may also be referred to as a second adjustment width.

[0078] If the target bank is idle, then in step 516 the memory controller further determines whether the memory access may cause a row hit. and teeth, if The last open row in the target bank has not been closed. If not, This means that a row hit is caused. As explained above, when a target bank is idle, it indicates that the target bank has no rows open. The idle state of a target bank indicates that a row in the target bank is closed after the previous memory access of the target bank has been fully executed. For this reason Specifically, at this stage, the memory controller may compare the row address of the memory access with the row address of a previous memory access to determine whether the memory access may cause a row hit.

[0079] If the row address of a memory access is identical to the row address of a previous memory access, it is determined that the memory access may cause a row hit. In this case, the last opened row in the target bank should be opened for a longer period, but was previously closed. attitudeThus, the method proceeds to step 518. Step 518: The memory controller adjusts the first indicator of the target bank to the first instruction, for example, by increasing the value of the first indicator by a first preset value. For example, the first preset value may be 1 or another value. death profit do not have If it is determined that the memory access may cause a row conflict, indicating that the policy of closing the last open row in the target bank is correct, the method proceeds to step 519. Step 519: The memory controller does not adjust the first indicator of the target bank. The last open row in the target bank may also be referred to as the row accessed by using the memory access prior to the memory access.

[0080] The method returns to step 504. In step 504, the memory access but If it is determined to be a write access, in step 520, the memory controller further determines whether the memory access preceding the memory access is a read access or a write access. If the memory access preceding the memory access is a read access, the method proceeds to step 531. The memory controller does not adjust the write counter of the target bank. If the memory access preceding the memory access is a write access, the method proceeds to step 522. Step 522: The memory controller determines whether the target bank is in an open state or an idle state. If the target bank is in an open state, the method proceeds to step 524. If the target bank is in an idle state, the method proceeds to step 526. It should be noted that in an embodiment of the present invention, the target bank being in an open state means that a row in the target bank is opened.

[0081] When the target bank is in an open state, in stage 524, the memory controller further determines whether the memory access causes a row hit. Specifically, the memory controller may determine whether a row hit is caused based on a row address of the memory access. If the memory access causes a row hit, indicating that the policy of keeping the current row in the target bank open is correct, the method proceeds to stage 530. Stage 530: The memory controller may adjust the second indicator to a first indication, where the first indication indicates that the target row is closed. N or the target row is kept open R For example, as shown in FIGS. 5A-1 and 5A-2, in step 530, the memory controller increases the value of the second indicator of the target bank by a third preset value. good Or adjust the second indicator. It is good If the memory access causes a row conflict, in other words, if the memory access does not hit an open row in the target bank, indicating that a currently open row in the target bank should be closed as soon as possible, the method proceeds to step 528. Step 528: The memory controller may adjust the second indicator to a second indication, where the second indication indicates that the target row should be closed. R For example, the memory controller may decrease the value of the second indicator of the target bank by a fourth preset value. It is okay The third preset value or the fourth preset value may be one or another value. The third preset value may also be referred to as a third adjustment range, and the fourth preset value may also be referred to as a fourth adjustment range.

[0082] If the target bank is idle, then in step 526 the memory controller further determines whether the memory access may cause a row hit. As explained above, a row hit may occur if the last open row in the target bank has not been closed. If not,This means that a row hit will be caused. Specifically, at this stage, the memory controller may compare the row address of the memory access with the row address of the last opened row to determine whether the memory access may cause a row hit. If the row address of the memory access is identical to the row address of the last opened row, it is determined that a row hit may be caused. If not, it is deemed that a row conflict may be caused. If it is determined that the memory access may cause a row hit, the last opened row in the target bank is closed beforehand. Wait , indicating that the last opened row in the target bank should be opened for a longer period. It may be understood that the last opened row in the target bank is the row accessed by using the memory access prior to the memory access. In this case, the method proceeds to step 532. In step 532, the memory controller adjusts the second indicator corresponding to the target bank to the first indication. For example, the memory controller may increase the value of the second indicator of the target bank by a fourth preset value. The fourth preset value may be 1 or another value. If it is determined that the memory access may cause a row conflict, indicating that the policy of closing the last opened row in the target bank is correct, the method proceeds to step 531. Step 531: The memory controller does not adjust the second indicator of the target bank.

[0083] It should be noted that the first, second, third and fourth preset values ​​in this embodiment of the present invention may be the same or different. No limitation is made here. When the first, second, third and fourth preset values ​​are different, considering the difference in locality between read access and write access, the continuity of read access may be increased. For those Better and lower latency of Further reduction To ,Rows accessed using read accesses can be kept open for a longer time.,Write accesses are more random and have lower latency. of Reduction ToTherefore, the rows accessed by using write access need to be kept open for a shorter time, thereby avoiding more row contention. Therefore, in this embodiment of the present invention, the first preset value is set to be larger than the second preset value. Good and easy , the third preset value is smaller than the fourth preset value. It is good In other words, when the first indicator is adjusted, the first adjustment amount of the adjustment to the first indication is greater than the second adjustment amount of the adjustment to the second indication. It is good When the second indicator is adjusted, the third adjustment range of the adjustment to the first indication is smaller than the fourth adjustment range of the adjustment to the second indication. It is good .

[0084] In the embodiment shown in FIG. 5A-1 and FIG. 5A-2, the locality difference between read accesses and write accesses is fully taken into account, and the row management policy of the target bank is adjusted separately based on the types of memory accesses of the target bank, the types of memory accesses preceding the current memory access, and the current status of the target bank. For example, the first indicator is adjusted based on the read accesses. hand ,adjust the row management policy corresponding to the read access. Well The second indicator is adjusted based on the write access to adjust the row management policy corresponding to the write access. Well As a result, the adjustment of the first indicator of the target bank and the adjustment of the second indicator of the target bank are more accurate. Thus, the memory controller may determine when to close a row in the target bank based on an indication of the first indicator of the target bank and an indication of the second indicator of the target bank. This reduces memory access latency caused by an inappropriate row management policy and improves memory access efficiency.

[0085] In another case, when the row management policy is adjusted based on the access type and row hit status of the memory access, in the row idle state teeth,It can be appreciated that since there are no open rows, the impact of row idle on access latency can be considered small. teeth The effect of row idle states on access latency is not taken into account. Good and easy ,The row management policy is adjusted based on only two cases: row hits and row conflicts. By doing 5A-1 and 5A-2, steps 508, 516, 518, 522, 526 and 532 are not performed in the method for adjusting a line management policy shown in FIG. 5B. In the method for adjusting a line management policy shown in FIG. 5B, different memory access types are considered to be in the same order. In other words, in this case, the line hit status of the memory access can be considered to include only two types, namely, line hit and line conflict, and the case of line idle is not considered. Specifically, as shown in FIG. 5B, compared with the adjustment methods shown in FIG. 5A-1 and FIG. 5A-2, steps 508, 516, 518, 522, 526 and 532 are not performed in the method for adjusting a line management policy shown in FIG. 5B. In the method for adjusting a line management policy shown in FIG. 5B, different memory access types are considered to be in the same order. In the method for adjusting still The first indicator and the second indicator are separately specified for the target bank, and the value of the first indicator or the value of the second indicator is adjusted based on different types of memory accesses. In this way, the difference between read accesses and write accesses is taken into account during the adjustment, thereby reducing memory access latency.

[0086] In another case, Alternatively, When the policy counters are adjusted, before The type of memory access request is not taken into account. It is good Specifically, in the adjustment method shown in FIG. 5A-1 and FIG. 5A-2, after step 504 is performed, step 506 or step 520 is not performed. Good and easy The method then proceeds directly to step 508 or step 522. That's fine.In other words, in the adjustment method shown in FIG. 5A-1 and FIG. 5A-2, steps 506 and 520 are optional steps and may not be performed in practical application. For the description of other steps, please refer to the description of the embodiment shown in FIG. 5A-1 and FIG. 5A-2. This adjustment method may be specifically illustrated in FIG. 5C-1 and FIG. 5C-2. In this adjustment scheme shown in FIG. 5C-1 and FIG. 5C-2, different policy indicators are adjusted separately based on read access and write access. In this way, the locality difference between read access and write access is fully considered, the adjustment is more accurate, and the memory access latency can also be reduced. In addition, since the type of the previous memory access request is not considered, the adjustment scheme is simpler than the embodiment shown in FIG. 5A-1 and FIG. 5A-2. However, the read-write switch caused by the random operation may cause the row in the target bank to be closed improperly.

[0087] Another method of throttling does not take into account the type of previous memory access request, nor whether the target bank is idle. It is good However, the first indicator or the second indicator is adjusted based only on the type of memory access received and the hit status (including row hit and row conflict) of the memory access. Specifically, for example, in the adjustment method shown in Figures 5A-1 and 5A-2, only steps 502, 504, 510, 512, 514, 524, 528, and 530 may be performed. Like This allows the difference in locality between read and write accesses to be taken into account, and therefore the adjustment method is simpler. The details are shown in Figure 5D.

[0088] Based on the above description, it can be seen that in practical applications, steps 506, 508 and 516 in Fig. 5A-1 and Fig. 5A-2 are not necessarily performed. Based on specific requirements, These Steps may or may not be performed, or These Some of the steps are carried out It is okayWhen the line management policy is adjusted, different line management policy adjustment methods are not limited in the embodiments of the present invention, as long as different line management policies are adjusted separately based on different types of memory accesses and the hit status of the target line. t In this case, the hit status of the target row may include three types: row hit, row conflict, and row idle. In another case, the hit status of the target row may alternatively include only two types: row hit and row conflict.

[0089] Referring to FIG. 6, the following will describe in detail how the memory controller executes the memory line management policy based on the value of the second indicator or the value of the first indicator in step 405 or step 406. FIG. 6 is a flow chart of a method for executing a memory line management policy according to an embodiment of the present invention. In this embodiment of the present invention, the memory controller assigns a memory line management policy to each bank. Ta A timer may be set so that the memory controller determines when to close an open row in a bank based on the value of the first indicator or the value of the second indicator of the bank. hand , The For ease of explanation, in FIG. too , 1 t The bank Theory Used as an example for clarity, the method may include the following steps:

[0090] Step 602: The memory controller SendingThe memory controller monitors received memory access commands. Specifically, after the memory controller receives a memory access request, the memory controller accesses a target bank 1142 in the memory 114 based on the address of the memory access request. The memory controller may send a memory access command to the target bank based on the status of a row in the target bank. For example, when the target bank is in a row idle state, the memory controller sends an activate command. hand , The Use memory access do To be accessed Should Activate the row. In case of a row hit, the memory controller may directly send a read or write command based on the received memory access. In case of a row conflict, the memory controller sends a precharge command to the target bank to close the open row in the target bank, then sends an activate command to open the row to be accessed, and finally sends a read or write command for access. R It is understood that the command may include at least several types: an activate command, a precharge command, a read command, or a write command.

[0091] Step 604: The memory controller determines whether the memory access command is a read command or a write command. As described above, the command sent by the memory controller to the target bank may include at least multiple types, namely, an activate command, a precharge command, a read command, or a write command. Thus, in step 604, The memory controller The command is a read command or a write command. Decision If so, the method proceeds to step 606. If the command is not a read command or a write command, the method proceeds to step 620.

[0092] Step 606: The memory controller determines whether the memory access request to which the memory access command belongs is the last memory access request in the scheduling queue to access the target bank. As described above, the read command or write command sent by the memory controller to the target bank is obtained based on the currently processed memory access request. In practical application, the memory controller places multiple received memory access requests in a buffer queue, and schedules the memory access requests in the buffer queue according to a specific scheduling policy. Within Schedule the memory access request in a scheduling queue, and then schedule the memory access request in the scheduling queue. Individual Typically, the space of the buffer queue is larger than the space of the scheduling queue, and the number of memory access requests buffered in the buffer queue is greater than the number of memory access requests in the scheduling queue.

[0093] At this stage, the memory controller determines which memory access request the memory access command belongs to based on the addresses of the multiple memory access requests in the scheduling queue. (i.e. the access request currently being processed) But the scheduling queue Within ,The last memory access request to access the target bank. inIn other words, the memory controller may determine whether there is another memory access request to access the target bank in the scheduling queue based on the address of each memory access request. If the memory access request to which the command belongs (i.e., the currently processed memory access request) is the last memory access request to access the target bank in the scheduling queue, in other words, there is no other memory access request to access the target bank in the scheduling queue, the method proceeds to stage 608. If the memory access request to which the command belongs (i.e., the currently processed memory access request) is not the last memory access request to access the target bank in the scheduling queue, in other words, there is another memory access request to access the target bank in the scheduling queue, the method proceeds to stage 620.

[0094] Step 608: The memory controller further determines whether the memory access command is a read command or a write command. If the command is a read command, the method proceeds to step 610. If the memory access command is a write command, the method proceeds to step 612. Step 610: The memory controller reads the value of the first indicator of the target bank, and the method proceeds to step 614. Step 612: The memory controller reads the value of the second indicator of the target bank, and then the method proceeds to step 614. It can be understood that the value of the first indicator and the value of the second indicator of the target bank can be values ​​obtained after adjustment based on the method shown in FIG. 5A-1 and FIG. 5A-2 to FIG. 5D, or can be values ​​before adjustment. In other words, in practical application, after the memory access is completely executed, the row management policy corresponding to the target bank can be executed first, and then the first indicator or the second indicator indicating the row management policy of the target bank is adjusted based on the executed memory access. Alternatively, the first indicator or the second indicator indicating the row management policy of the target bank may be adjusted based on the memory access, and then the row management policy indicated by the adjusted first indicator or the second indicator may be selected and executed, although this is not limited thereto.

[0095] Step 614: The memory controller determines whether the value of the indicator read in step 610 or step 612 is less than a specified threshold. If the read value of the first indicator or the read value of the second indicator is not less than the threshold, the method proceeds to step 616. If the read value of the first indicator or the read value of the second indicator is less than the threshold, the method proceeds to step 620. In practical applications, the threshold can be set to 0 or another value. This is not limited here.

[0096] Step 616: The memory controller controls a timer corresponding to the target bank to start timing based on the read value of the first indicator or the read value of the second indicator, and then the method proceeds to step 618. Step 618: The memory controller closes the open row in the target bank when the timer reaches the timing time. Specifically, the memory controller may send a precharge command to the target bank to close the open row in the target bank. It may be understood that the timer may start timing based on the value of the first indicator or the value of the second indicator in an increment or decrement manner. For example, the timer may start timing from 0 and continue until the timer time is increased to the value of the first indicator or the value of the second indicator, or the timer may start timing in a decrement manner after the timer time is set to the value of the first indicator or the value of the second indicator. The timing manner is not limited in this specification.

[0097] The method of executing a row management policy shown in Figure 6 is to execute a row management policy of a target row based on the time indicated by the value of the first indicator or the value of the second indicator. This is just an example of a manner of executing a row management policy. In practical application, the corresponding row management policy can be directly executed based on the indication of the first indicator or the indication of the second indicator without setting a timer. For details, please refer to the related description of step 405.

[0098] The above embodiment provides an adjustment scheme when the first indicator and the second indicator are specified separately for each bank. In practical application, since the locality of the write access is poor, a fixed page policy may be used for the write access. For example, in the first scheme, a fixed row closing policy may be used, that is, the row accessed by using the write access is The The line is closed immediately after the write access has been fully executed. In other cases, a short line close time can be set and the line is closed immediately after the write access has been fully executed. do The row being accessed is The When the persistent row management policy is used for write access, the second indicator is set. Not necessary .this like , No. 1. Indicator One Only one is in each bank. finger Determined It is okay .

[0099] Specifically, FIG. 7 is a flowchart of another memory management method according to an embodiment of the present invention. still , may be executed by a memory controller in the computer system shown in Figure 1. The method may include the following steps.

[0100] Step 702: Obtain a memory access of the target memory bank. Similar to step 401, the memory access may include a read access or a write access. The obtained memory access may include information such as a read / write identifier, an address, and a request ID. In addition, if the memory access is a write access, the write access may further hold data to be written to the memory. Step 704: The memory controller may determine an access type of the memory access. The memory access includes a read access or a write access. In this step, the access type of the memory access may be determined based on the read / write identifier in the memory access. If the memory access is a read access, the method proceeds to step 706. If the memory access is a write access, the method proceeds to step 710.

[0101] Step 706: The memory controller adjusts the first indicator of the target bank based on the row hit status of the target row of the memory access. As described above, the row hit status may include row hit, row conflict, or row idle. In this embodiment of the present invention, the first indicator may be set to indicate the row management policy to be used after the read access is executed. In other words, whether to close the target row after the read access is executed may be determined based on the indication of the first indicator. In this step, the first indicator of the target bank may be adjusted based on the row hit status of the memory access, so that the row management policy of the target bank can be dynamically adjusted. For a specific adjustment method, please refer to the adjustment method for the first indicator in FIG. 5A-1 and FIG. 5A-2 to FIG. 5D. Details will not be described again in this specification.

[0102] Step 708: The memory controller executes the corresponding row management policy based on the indication of the first indicator. Specifically, after the memory access is completely executed, the corresponding row management policy can be executed based on the indication of the first indicator. For example, the target row can be closed or kept open based on the indication of the first indicator after the read access is executed, or the target row can be closed based on the time indicated by the first indicator. For this step, please refer to the description of step 405. This specification will not be described in detail. It can be understood that the execution of the corresponding row management policy based on the first indicator can be referred to the description of how to execute the corresponding row management policy based on the indication of the first indicator in FIG. 6. This specification will not be described in detail.

[0103] Step 710: The memory controller executes a preset row management policy. In this embodiment of the present invention, a fixed row management policy may be used in consideration of the high randomness of handling write accesses by the memory controller. For example, a row accessed by using a write access is closed after the write access is executed. It is okay Specifically, at this stage, the preset row management policies are not adjusted when a write access is received. It's fine, but ,When to close the target row is determined according to a ,preset row management policy after the write access is ,completely executed.

[0104] In the embodiment shown in FIG. too , read access and write access in memory access but Since only the first indicator, which indicates the row management policy to be used, is set after a read access has been fully executed, the value of the first indicator may be adjusted based only on the received read access. but expensive For this reason , preset row management policy but Used Well The preset row management policies are not adjusted when a write access is received. It is good It can be seen that, compared with the embodiment shown in FIG. 4B, in the embodiment shown in FIG. 7, when a read access is processed, the row management policy of the target bank can be dynamically adjusted based on the specified value of the first indicator, and the write access is processed according to the fixed row management policy. Since the fixed row management policy is used for the write access, the second indicator is used to dynamically adjust the row management policy of the target bank based on the specified value of the first indicator. finger It does not need to be determined Good and easy , the hardware structure can be made simpler and the adjustment method is made simpler.

[0105] Those skilled in the art will recognize that since switching between memory accesses of different target banks causes access latency, in the method provided in this embodiment of the present invention, the memory controller may continuously schedule multiple memory accesses to access the same bank in a scheduling queue. In addition, switching between multiple consecutive read and write accesses to the same row in the same bank. too Latency of Due to the difference in locality between read and write accesses, the row management policy different Considering the above requirement, in the following embodiment, the read accesses and write accesses are further scheduled in batches. FIG. 8 is a schematic diagram of memory access scheduling according to an embodiment of the present invention. Specifically, as shown in FIG. 8, the memory controller 106 may schedule memory accesses in batches. For example, read access 1 to read access N but , in the scheduling queue, No. 1 batch Access 802 and read access N+1 to read access 2N but , in the scheduling queue, No. 2 batches Access 804 and write access 1 to write access N. but , in the scheduling queue, No. K Batch Access 806 Each batch may include multiple read accesses to the same bank or multiple write accesses to the same bank.

[0106] In this scheduling mode, the row management policy of the bank is: different Naru batch Access can be further adjusted when executed to reduce access latency, Different types of access between This reduces the bus bandwidth waste caused by switching between different Naru batch access For a method for adjusting a row management policy during switching between, see Fig. 9. Specifically, Fig. 9 is a flowchart of another memory management method according to an embodiment of the present invention. As shown in Fig. 9, the method may include the following steps:

[0107] Step 902: The memory controller The i batch 8. The memory controller 100 executes the access. The initial value of i may be set to 1, where i is a natural number greater than or equal to 1. As described above, after receiving the memory access requests, the memory controller places the received memory access requests in a buffer queue, and then schedules the memory access requests in the buffer queue to a scheduling queue for separate execution. In this embodiment of the present invention, the memory controller may schedule the memory access requests in a batch to the scheduling queue based on the type of the memory access request. For example, the memory controller may schedule the memory access requests in a batch to the scheduling queue in the manner of batch-by-batch scheduling shown in FIG. 8. At this stage, The i batch access teeth , as shown in FIG. duty Badge of choice Access For example, the i-th batch access may refer to the 1st batch access 802, the 2nd batch access 804, or the Kth batch access 806.

[0108] Step 904: The memory controller determines whether the accesses of the i-th batch are completely executed. Specifically, the memory controller may determine whether the executed access is the last access of the i-th batch to determine whether the accesses of the i-th batch are completely executed. Alternatively, the memory controller may determine whether the accesses of the i-th batch are completely executed based on whether there is another access in the scheduling queue. In addition, the memory controller may alternatively determine whether the accesses of the i-th batch are completely executed in a counting manner. The method for the memory controller to determine whether the accesses of the i-th batch are completely executed is not limited in this specification. If the accesses of the i-th batch are not completely executed, the method returns to step 902 and continues executing the accesses of the i-th batch. If the memory controller determines that the accesses of the i-th batch are completely executed, the method proceeds to step 904, and the memory controller further determines whether to execute the accesses of the (i+1)-th batch. Specifically, the memory controller may determine whether it is necessary to execute the accesses of the (i+1)-th batch based on whether there is another access in the scheduling queue or the buffer queue. If the (i+1)th batch of accesses needs to be performed, the method proceeds to step 908. If it is determined that the (i+1)th batch of accesses does not need to be performed, indicating that no other memory accesses need to be performed, the method proceeds to step 914.

[0109] Step 908: The memory controller determines whether the accesses of the i-th batch and the (i+1)-th batch are the same type of memory access. In the embodiment shown in FIG. 9, the memory controller schedules and executes the memory accesses in batches based on the type of memory access. From the same batch Memory Access teeth If multiple memory access requests of the same type That's good.Thus, at this stage, the memory controller may determine whether the types of the accesses of the i th batch and the (i+1) th batch are the same, for example, whether both the accesses of the i th batch and the (i+1) th batch are read accesses or write accesses. If the accesses of the i th batch and the (i+1) th batch are the same type of memory accesses, the method proceeds to stage 910. If the accesses of the i th batch and the (i+1) th batch are different types of memory accesses, the method proceeds to stage 914.

[0110] Step 910: The memory controller further determines whether both the accesses of the i-th batch and the accesses of the (i+1)-th batch are read accesses. If both the accesses of the i-th batch and the accesses of the (i+1)-th batch are read accesses, the method proceeds to step 912. If the accesses of the i-th batch or the accesses of the (i+1)-th batch are write accesses, the method proceeds to step 914. In step 912, the memory controller keeps the currently opened row open. In this embodiment of the present invention, since both the accesses of the i-th batch and the accesses of the (i+1)-th batch are read accesses, the memory controller but Considering that there is a high probability that multiple commands will access the same row consecutively, it is necessary to have good locality in the processing of read accesses. Previous batch Read Access of If a row that was open in the executing process remains open during the switch, The The row is kept open. It is okay For example, during a switch between a first batch of accesses 802 and a second batch of accesses 804, if a row that was opened in the process performing the first batch of accesses 802 remains open, The The row is kept open. It is okay The method then proceeds to step 916.

[0111] If it is determined in step 908 that the accesses of the i-th batch and the accesses of the (i+1)-th batch are different types of memory accesses, for example, the accesses of the i-th batch are write accesses or the accesses of the (i+1)-th batch are write accesses, then the memory controller needs to switch between read accesses and write accesses. In this embodiment of the present invention, considering the difference in locality between read accesses and write accesses, the randomness of the write accesses is higher. In order to reduce latency, during the switch, the method proceeds to step 914, where all rows opened in the process of performing the accesses of the i-th batch are closed. It is okay For example, as shown in FIG. 8, after the second batch of accesses 804 is completely executed, a switch is performed to execute the next batch of accesses. If the next batch of accesses after the second batch of accesses 804 is a write access (e.g., when the next batch of accesses is the Kth batch of accesses 806), all rows opened in the process of executing the second batch of accesses 804 are closed after the second batch of accesses 804 is completely executed. It is okay The method then proceeds to step 916 to perform the next batch of accesses.

[0112] If it is determined in step 910 that both the i th batch of accesses and the (i+1) th batch of accesses are write accesses, since write accesses have high randomness and poor locality, in this case the method may alternatively proceed to step 914 and close all rows that were opened in the process of performing the i th batch of accesses. Then the method proceeds to step 916 and closes all rows that were opened in the process of performing the (i+1) th batch of accesses. of execution To Step 916: Let i=i+1. The method returns to step 902 to execute the next batch of memory accesses. This process is repeated until the multiple batches of accesses that need to be executed are completely executed. The value of i is the total number of the batches of accesses to be executed. number It can be seen that it cannot be larger.

[0113] According to the memory management method provided in Fig. 9, since the scheduling is performed in batches, the number of switching between read access and write access can be further reduced. In addition, since different row management policies can be used during switching between accesses of different batches, row contention that may be caused during switching between different batches can be further reduced, the latency caused by improperly closing memory rows can be reduced, and the waste of bus bandwidth can be reduced.

[0114] In practical application, In some designs, each bank Independent Policy Counters but Note that multiple address segments do not necessarily have to be specified. but , may be obtained through division, and a policy counter may be specified for each address segment. Alternatively, multiple banks may share the same group of policy counters. teeth , may contain addresses of multiple banks, or may contain a portion of an address in one bank. In designs where multiple banks share a group of policy counters, the row management policies are adjusted case , using memory access death Accessed via Should Performs an operation on the policy counter corresponding to the bank. before According to these methods, in practical applications, the same row management policy can be used for multiple banks, or The same row management policy Corresponds to at least one address segment Multiple It can be used for multiple target row accesses.

[0115] According to the memory management method provided in this embodiment of the present invention, the locality difference between read access and write access in memory access is taken into account in the process of executing a memory row management policy, so that the memory row management can better adapt to the characteristics of memory access, reduce memory access latency, reduce bandwidth waste, and improve memory access efficiency.

[0116] In addition, there are cases in practical applications where data is written to memory in a Direct Memory Access (DMA) manner. The embodiments of the present invention further provide how to manage memory rows in a DMA read / write scenario. A DMA read / write is usually a read / write of a large data block, and DMA is usually performed once in one direction. To ensure data consistency, the data block being accessed by using DMA is usually not accessed by another source. The DMA read and write operations have good locality and are independent of other requests. Therefore, the memory access policy in a DMA scenario is Separately For example, in practical applications, DMA memory accesses and non-DMA memory accesses can be scheduled in batches. In addition, DMA memory accesses can be further classified into DMA read accesses and DMA write accesses for scheduling in batches.

[0117] For switching between non-DMA accesses, please refer to the above embodiment. For switching between non-DMA accesses and DMA accesses, current Current batch Memory accesses After it has been fully executed, The batch The rows in the bank involved in the memory access are directly closed. It is okay Switching between DMA accesses is done by dividing the DMA accesses into two parts. Different batches Memory Access between If the switch is performed in Two adjacent batches DMA Access of Regardless of whether they are the same type or not, rows in the bank associated with the currently completed DMA access are kept open during the switch. It is okay . Two adjacent batches DMA Access but ,If the DMA accesses are not caused by the same DMA operation, 2 Two adjacent Batch DMA accesses of Ta Whether the types are the same Regardless Or the associated DMA access is a read access young Any rows in the bank that are associated with a currently completed DMA access, whether it is a write or write access, are closed during the switch. It is okay .

[0118] According to the memory management method provided in this embodiment of the present invention, the good locality characteristics of DMA access and the uncorrelation between DMA access and other memory access are taken into account, and DMA access and non-DMA memory access are distinguished and scheduled in batches, thereby avoiding mutual interference between DMA access and common memory access, ensuring the performance requirements of DMA access, and reducing memory access latency.

[0119] The embodiment of the present invention further provides a memory management device. Specifically, the memory management device provided in the embodiment of the present invention may include at least some of the components in the computer system shown in Fig. 1. For example, at least one processor 102 and a memory controller 106 may be included.

[0120] In addition, an embodiment of the present invention further provides a memory controller. The memory controller includes a communication interface and a logic circuit configured to execute the memory management method in the above-mentioned embodiment. The communication interface is configured to receive a memory access transmitted by a processor of the computer system. The memory controller provided in this embodiment of the present invention may be shown as memory controller 106 in FIG. 1.

[0121] 10 is a schematic diagram of another memory management apparatus according to an embodiment of the present invention. As shown in FIG. 10, the memory management apparatus may include a receiving module 1002, a determining module 1004, and an executing module 1006. The receiving module 1002 is configured to receive a memory access, where the memory access may be used to access a target row in a target memory bank. The determining module 1004 is configured to determine an access type of the memory access. The executing module 1006 is configured to execute a row management policy corresponding to the access type.

[0122] Specifically, when possible, the memory management unit may further include an adjustment module 1005. The adjustment module 1005 is configured to adjust the line management policy based on an access type of the memory access and a line hit status of the target row. The line hit status includes at least one of the following states: line hit, line conflict, and line idle.

[0123] In a possible case, the memory management device may further include a first indicator 1008. When the memory access is a read access, the adjustment module 1005 is configured to adjust the first indicator 1008 of the target memory bank based on a line hit status of the target line, where the first indicator indicates whether to close the target line after the read access is executed. In other words, the first indicator indicates a line management policy of the target memory bank to be used after the read access is executed. Thus, the execution module 1006 may execute the line management policy of the target memory bank based on the first indicator 1008. Adjusting the first indicator 1008 may be understood as adjusting a line management policy to be used after the read access is executed.

[0124] In a possible case, the memory management device may further include a second indicator 1010. When the memory access is a write access, the adjustment module 1005 may adjust the second indicator 1010 of the target memory bank based on a line hit status of the target line, where the second indicator indicates whether to close the target line after the write access is executed. The execution module 1006 may execute a line management policy of the target memory bank based on an indication of the second indicator 1010. Adjusting the second indicator 1010 may be understood as adjusting a line management policy used after the write access is executed.

[0125] In another possible case, only the first indicator 1008 may be set, and the second indicator 1010 may not be set. The execution module 1006 may directly execute the preset row management policy for the received write access. In this case, the preset row management policy corresponding to the write access is not adjusted. It is good In another possible case, the second indicator 1010 may alternatively be set such that the second indicator 1010 indicates a preset row management policy corresponding to a write access, and the preset row management policy does not need to be adjusted based on the row hit status of the received write access.

[0126] In a possible case, when the adjustment module 1005 adjusts the first indicator 1008 or the second indicator 1010 based on the row hit status of the target row, if the memory access causes a row hit, the adjustment module 1005 adjusts the first indicator or the second indicator to a first indication, where the first indication indicates that the target row is closed. N stomach 、 Or the target row is kept open R If the memory access causes a row conflict, the adjustment module 1005 adjusts the first indicator or the second indicator to a second indication, where the second indication indicates that the target row is closed. R This indicates that.

[0127] In another possible case, when the adjustment module 1005 adjusts the first indicator 1008 or the second indicator 1010 based on the row hit status of the target row, if the memory access would cause a row idle, the adjustment module 1005 determines whether the memory access would cause a row hit. If the memory access would cause a row hit, the adjustment module 1005 adjusts the first indicator or the second indicator to a first indication, where the first indication indicates that the target row is closed. N or the target row is kept open R indicates that a row hit can occur if the last open row in the target memory bank has not been closed. If not, If the memory access may cause a row conflict, the adjustment module 1005 adjusts the first indicator or the second indicator to a second indication, where the second indication indicates that the target row is closed. R indicates that row contention can occur if the last opened row in the target memory bank has not been closed. If not, This means that a row conflict will occur.

[0128] In another case, when the adjustment module 1005 adjusts the first indicator 1008 or the second indicator 1010 based on the row hit status of the target row, the adjustment module 1005 may adjust the first indicator or the second indicator based on the row hit status of the target row and the access type of the memory access preceding the memory access.

[0129] For details of how the adjustment module 1005 adjusts the first indicator 1008 or the second indicator 1010, please refer to the description in the above method embodiment, and the details will not be described again in this specification.

[0130] In another case, the memory access No. 1 batch Memory accesses , the execution module 1006 is further configured to determine that the first batch of memory accesses has been completely executed and that the second batch of memory accesses is to be executed, close the target row if an access type of the first batch of memory accesses is different from an access type of the second batch of memory accesses, keep the target row open if both the first batch of memory accesses and the second batch of memory accesses are read accesses, or close the target row if both the first batch of memory accesses and the second batch of memory accesses are write accesses.

[0131] It can be understood that the memory management device provided in this embodiment of the present invention can be the memory controller shown in Fig. 1, or can be integrated into the memory controller shown in Fig. 1. For the implementation of each functional module in the memory management device, please refer to the corresponding description in the above embodiment. Details will not be described again in this specification.

[0132] According to the memory management device provided in this embodiment of the present invention, when the row management policy of the memory row in the DRAM is executed, the difference between the locality of different access types is fully taken into consideration, and the corresponding row management policy is executed based on the access type, and the corresponding row management policy can be adjusted based on the row hit status of the memory access, so that the characteristics of the memory access can be fully taken into consideration in the memory row management, the management can be more accurate, the memory access latency caused by the inappropriate row management policy can be reduced, and the memory access efficiency can be improved.

[0133] An embodiment of the present invention further provides a computer program product for executing a memory management method. The computer program product includes a computer-readable storage medium storing a program code. The instructions included in the program code are used to execute the method process described in any one of the above-mentioned method embodiments. Those skilled in the art can understand that the above-mentioned storage medium can include any non-transitory machine-readable medium that can store program code, such as a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a random-access memory (RAM), a solid state disk (SSD), or a non-volatile memory.

[0134] Please note that the embodiments provided in this application are merely examples. Those skilled in the art can clearly know that in the above embodiments, the embodiments emphasize different aspects for easy and concise description, and for parts not described in detail in one embodiment, the relevant description in another embodiment can be referred to. The features disclosed in the embodiments, claims and accompanying drawings of the present invention can exist independently or in combination. The features described in the form of hardware in the embodiments of the present invention can be implemented by software, and vice versa. There is no limitation here. Other possible items (Item 1) The stage of obtaining memory access; determining an access type of the memory access, where the access type of the memory access includes a read access or a write access; and executing a row management policy corresponding to the access type of the memory access. A memory management method comprising: (Item 2) The memory access is used to access a target row in a target memory bank in a memory, and the step of executing a row management policy corresponding to the access type of the memory access comprises: executing a row management policy of the target memory bank corresponding to the access type of the memory access, where the memory includes one or more memory banks, and the target memory bank is any one of the one or more memory banks; The method according to item 1, comprising: (Item 3) 3. The method of claim 1, further comprising adjusting the line management policy based on the access type of the memory access and a line hit status of the target row. (Item 4) adjusting the row management policy of the target memory bank based on the access type of the memory access and the row hit status of the target row, adjusting a first indicator of the target memory bank based on the row hit status of the target row when the memory access is a read access, where the first indicator indicates whether to close the target row after the read access is performed; The method according to item 3, comprising: (Item 5) The step of adjusting the row management policy of the target memory bank based on the access type of the memory access and the row hit status of the target row further comprises: adjusting a second indicator of the target memory bank based on the row hit status of the target row when the memory access is a write access, where the second indicator indicates whether to close the target row after the write access is performed; The method according to item 4, comprising: (Item 6) The step of adjusting the row management policy of the target memory bank based on the access type of the memory access and the row hit status of the target row further comprises: determining, when the access type of the memory access is a write access, that the row management policy of the target memory bank is a preset row management policy corresponding to the write access, where the preset row management policy indicates whether to close the target row after the write access is executed; The method according to item 4, comprising: (Item 7) The row hit status includes a row hit or a row conflict, and the step of adjusting a first indicator or a second indicator of the target memory bank based on the row hit status of the target row includes: adjusting the first indicator or the second indicator to a first indication if the memory access causes a row hit, where the first indication indicates that the target row is not closed or that the target row is maintained in an open state; or adjusting the first indicator or the second indicator to a second indication if the memory access causes a row conflict, where the second indication indicates that the target row is closed; 7. The method according to any one of items 4 to 6, comprising: (Item 8) the row hit status includes a row idle, and the step of adjusting a first indicator or a second indicator based on the row hit status of the target row includes: If the memory access causes a row idle, determining whether the memory access may cause a row hit; and adjusting the first indicator or the second indicator to the first indication if the memory access may cause a row hit, where the first indication indicates that the target row is not closed or that the target row is to be maintained in the open state, where a row hit may be caused means that the row hit will be caused if the last open row in the target memory bank is not closed; or adjusting the first indicator or the second indicator to the second indication if the memory access may cause a row conflict, where the second indication indicates that the target row is closed, and where a row conflict may be caused means that a row conflict will be caused if a last open row in the target memory bank is not closed; 8. The method according to any one of items 4 to 7, comprising: (Item 9) The method further comprises determining an access type of an access prior to the memory access; adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row, adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row and the access type of the previous access to the memory access. 9. The method according to any one of items 4 to 8, comprising: (Item 10) 10. The method according to any one of items 4 to 9, wherein the initial value of the first indicator is greater than the initial value of the second indicator. (Item 11) When the first indicator is adjusted, a first adjustment amount of the adjustment to the first indication is greater than a second adjustment amount of the adjustment to the second indication; When the second indicator is adjusted, a third adjustment range of the adjustment to the first indication is smaller than a fourth adjustment range of the adjustment to the second indication. 11. The method according to any one of items 4 to 10. (Item 12) The memory access belongs to a first batch of memory accesses, and the method further comprises: determining that the first batch of memory accesses has been completely executed and that a second batch of memory accesses is to be executed; and closing the target row if an access type of the first batch of memory accesses differs from an access type of the second batch of memory accesses; maintaining the target row in the open state if both the first batch of memory accesses and the second batch of memory accesses are read accesses; or closing the target row if both the first batch of memory accesses and the second batch of memory accesses are write accesses. 12. The method according to any one of items 1 to 11, comprising: (Item 13) a processor configured to transmit a memory access; and Obtaining said memory access; determining an access type of the memory access, where the access type of the memory access includes a read access or a write access; and Executes a row management policy corresponding to the access type of the memory access. The memory controller is configured as follows: A memory management device comprising: (Item 14) Item 14. The apparatus of item 13, wherein the memory access is used to access a target row in a target memory bank in a memory, the memory controller is configured to execute a row management policy of the target memory bank corresponding to the access type of the memory access, the memory includes one or more memory banks, and the target memory bank is any one of the one or more memory banks. (Item 15) Item 15. The apparatus of item 13 or 14, wherein the memory controller is further configured to adjust the line management policy based on the access type of the memory access and a line hit status of the target row. (Item 16) Item 16. The apparatus of item 15, wherein, in the step of adjusting the row management policy, the memory controller is configured to adjust a first indicator of the target memory bank based on the row hit status of the target row when the memory access is a read access, wherein the first indicator indicates whether to close the target row after the read access is executed. (Item 17) 17. The apparatus of claim 16, wherein, in the step of adjusting the row management policy, the memory controller is further configured to adjust a second indicator of the target memory bank based on the row hit status of the target row when the memory access is a write access, wherein the second indicator indicates whether to close the target row after the write access is performed. (Item 18) 17. The apparatus of claim 16, wherein, in the step of determining the row management policy, the memory controller is further configured to determine, when the access type of the memory access is a write access, that the row management policy of the target memory bank is a preset row management policy corresponding to the write access, wherein the preset row management policy indicates whether to close the target row after the write access is executed. (Item 19) The row hit status includes a row hit or a row conflict, and in the step of adjusting the first indicator or the second indicator of the target memory bank, the memory controller: if the memory access causes a row hit, adjusting the first indicator or the second indicator to a first indication, where the first indication indicates that the target row is not closed or that the target row is maintained in an open state; or adjusting the first indicator or the second indicator to a second indication if the memory access causes a row conflict, where the second indication indicates that the target row is closed; 19. The device according to any one of items 16 to 18, configured so as to (Item 20) The row hit status includes a row idle, and in the step of adjusting the first indicator or the second indicator of the target memory bank, the memory controller: If the memory access causes a row idle, determining whether the memory access may cause a row hit; and adjusting the first indicator or the second indicator to the first indication if the memory access may cause a row hit, where the first indication indicates that the target row is not closed or that the target row is maintained in the open state, and a row hit may be caused meaning that a row hit will be caused if the last open row in the target memory bank is not closed; or If the memory access may cause a row conflict, adjust the first indicator or the second indicator to the second indication, where the second indication indicates that the target row is closed, and where a row conflict may be caused means that a row conflict will be caused if the last open row in the target memory bank is not closed. 20. The device according to any one of items 16 to 19, configured as follows: (Item 21) The memory controller is further configured to determine an access type of a previous access to the memory access; In the step of adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row, the memory controller: and adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row and the access type of the previous access of the memory access. 21. Apparatus according to any one of items 16 to 20. (Item 22) 22. The apparatus of any one of items 16 to 21, wherein the initial value of the first indicator is greater than the initial value of the second indicator. (Item 23) When the first indicator is adjusted, a first adjustment amount of the adjustment to the first indication is greater than a second adjustment amount of the adjustment to the second indication; When the second indicator is adjusted, a third adjustment range of the adjustment to the first indication is smaller than a fourth adjustment range of the adjustment to the second indication. 23. Apparatus according to any one of items 16 to 22. (Item 24) The memory access belongs to a first batch of memory accesses, and the memory controller further comprises: determining that the first batch of memory accesses has been completely executed and that a second batch of memory accesses is to be executed; and close the target row if an access type of the memory accesses of the first batch is different from an access type of the memory accesses of the second batch; maintaining the target row in the open state if both the first batch of memory accesses and the second batch of memory accesses are read accesses; or If both the first batch of memory accesses and the second batch of memory accesses are write accesses, close the target row. 24. The device according to any one of items 13 to 23, configured so as to (Item 25) a communications interface configured to receive memory accesses transmitted by a processor of the computer system; and 13. A logic circuit configured to execute the memory management method according to any one of claims 1 to 12 based on the memory access. A memory controller comprising: (Item 26) 25. A computer system comprising a memory and a memory management device according to any one of items 13 to 24. (Item 27) 13. A computer-readable storage medium configured to store program code, the program code including instructions that, when executed by a computer, implement the memory management method according to any one of claims 1 to 12. (Item 28) 13. A computer program product comprising a program code, the instructions contained in said program code being executed by a computer to implement the memory management method according to any one of claims 1 to 12.

Claims

1. A memory management method by a memory controller, comprising: obtaining memory access; determining an access type of the memory access, where the access type of the memory access includes a read access or a write access; executing a row management policy corresponding to the access type of the memory access; adjusting the line management policy based on the access type of the memory access and a line hit status of a target line in a target memory bank within a memory; Equipped with The step of adjusting the row management policy further comprises: adjusting a first indicator of the target memory bank based on the row hit status of the target row when the memory access is the read access; adjusting a second indicator of the target memory bank based on the row hit status of the target row when the memory access is the write access; Including, wherein the first indicator indicates whether the target row is closed after the read access is performed, and the second indicator indicates whether the target row is closed after the write access is performed.

2. The method of claim 1 , wherein an initial value of the first indicator and an initial value of the second indicator are different.

3. The method of claim 1 , wherein the row management policy is implemented based on a time indicated by a value of the first indicator or a value of the second indicator.

4. The memory access is used to access the target row in the target memory bank in the memory, and the step of executing a row management policy corresponding to the access type of the memory access comprises: executing the row management policy of the target memory bank corresponding to the access type of the memory access, where the memory includes one or more memory banks, and the target memory bank is any one of the one or more memory banks; The method according to any one of claims 1 to 3, comprising:

5. The step of adjusting the row management policy based on the access type of the memory access and the row hit status of the target row further comprises: determining, when the access type of the memory access is the write access, that the row management policy of the target memory bank is a preset row management policy corresponding to the write access, where the preset row management policy indicates whether to close the target row after the write access is executed; The method of claim 1 , comprising:

6. The row hit status includes a row hit or a row conflict, and the step of adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row includes: adjusting the first indicator or the second indicator to a first indication if the memory access causes a row hit, where the first indication indicates that the target row is not to be closed or that the target row is to be maintained in an open state; or adjusting the first indicator or the second indicator to a second indication if the memory access causes a row conflict, where the second indication indicates that the target row is closed; The method of any one of claims 1 to 4, comprising:

7. the row hit status includes a row idle, and adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row includes: If the memory access causes a row idle, determining whether the memory access may cause a row hit; and adjusting the first indicator or the second indicator to the first indication if the memory access may cause a row hit, where the first indication indicates that the target row is not closed or that the target row is kept open, where a row hit may cause means that the row hit would be caused if the last open row in the target memory bank was not closed; or not adjusting the first indicator or the second indicator if the memory access may cause a row conflict, where a row conflict may be caused meaning that a row conflict would be caused if the last opened row in the target memory bank was not closed. The method of claim 6, comprising:

8. The method further comprises determining an access type of a memory access prior to the memory access; adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row, adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row and the access type of the memory access prior to the memory access.

8. The method of any one of claims 1 to 4 and 6 to 7, comprising:

9. The method of claim 1 , wherein the initial value of the first indicator is greater than the initial value of the second indicator.

10. When the first indicator is adjusted, a first adjustment amount of the adjustment to the first indication is greater than a second adjustment amount of the adjustment to the second indication; When the second indicator is adjusted, a third adjustment range of the adjustment to the first indication is smaller than a fourth adjustment range of the adjustment to the second indication. The method according to claim 6.

11. The memory access belongs to a first batch of memory accesses, and the method further comprises: determining that the first batch of memory accesses has been completely executed and that a second batch of memory accesses is to be executed; and closing the target row in the target memory bank in the memory if an access type of the first batch of memory accesses differs from an access type of the second batch of memory accesses; maintaining the target row open if both the first batch of memory accesses and the second batch of memory accesses are read accesses; or closing the target row if both the first batch of memory accesses and the second batch of memory accesses are write accesses. The method of any one of claims 1 to 10, comprising:

12. 1. A memory management device, comprising: A processor configured to transmit a memory access; obtaining said memory access; determining an access type of the memory access, where the access type of the memory access comprises a read access or a write access; executing a row management policy corresponding to the access type of the memory access; and adjusting the line management policy based on the access type of the memory access and a line hit status of a target line in a target memory bank within a memory. Equipped with In adjusting the row management policy, the memory controller is configured to adjust a first indicator of the target memory bank based on the row hit status of the target row when the memory access is the read access, and to adjust a second indicator of the target memory bank based on the row hit status of the target row when the memory access is the write access, where the first indicator indicates whether to close the target row after the read access is performed, and the second indicator indicates whether to close the target row after the write access is performed.

13. 13. The apparatus of claim 12, wherein the memory access is used to access the target row in the target memory bank in the memory, the memory controller is configured to execute the row management policy of the target memory bank corresponding to the access type of the memory access, the memory includes one or more memory banks, and the target memory bank is any one of the one or more memory banks.

14. 13. The apparatus of claim 12, wherein in adjusting the row management policy, the memory controller is further configured to determine, when the access type of the memory access is the write access, that the row management policy of the target memory bank is a preset row management policy corresponding to the write access, where the preset row management policy indicates whether to close a target row after the write access is performed.

15. The row hit status includes a row hit or a row conflict, and in adjusting the first indicator or the second indicator of the target memory bank, the memory controller: if the memory access causes a row hit, adjusting the first indicator or the second indicator to a first indication, where the first indication indicates that the target row is not closed or that the target row is to remain open; or adjusting the first indicator or the second indicator to a second indication if the memory access causes a row conflict, where the second indication indicates that the target row is closed; 14. The apparatus according to claim 12 or 13, configured so as to

16. The row hit status includes a row idle, and in adjusting the first indicator or the second indicator of the target memory bank, the memory controller: If the memory access causes a row idle, determining whether the memory access may cause a row hit; and adjusting the first indicator or the second indicator to the first indication if the memory access may cause a row hit, where the first indication indicates that the target row is not closed or that the target row is kept open, and a row hit may be caused meaning that a row hit would be caused if the last open row in the target memory bank was not closed; or not adjusting the first indicator or the second indicator if the memory access may cause a row conflict, where a row conflict may occur meaning that a row conflict will occur if the last open row in the target memory bank is not closed. The apparatus of claim 15 , configured as follows:

17. The memory controller is further configured to determine an access type of a previous access to the memory access; In adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row, the memory controller: and adjusting the first indicator or the second indicator of the target memory bank based on the row hit status of the target row and the access type of the previous access of the memory access.

17. Apparatus according to any one of claims 12 to 13 and 15 to 16.

18. 18. Apparatus according to any one of claims 12 to 17, wherein the initial value of the first indicator is greater than the initial value of the second indicator.

19. When the first indicator is adjusted, a first adjustment amount of the adjustment to the first indication is greater than a second adjustment amount of the adjustment to the second indication; When the second indicator is adjusted, a third adjustment range of the adjustment to the first indication is smaller than a fourth adjustment range of the adjustment to the second indication.

16. The apparatus of claim 15.

20. The memory access belongs to a first batch of memory accesses, and the memory controller further comprises: determining that the first batch of memory accesses has been completely executed and that a second batch of memory accesses is to be executed; and close the target row in the target memory bank in the memory if an access type of the first batch of memory accesses differs from an access type of the second batch of memory accesses; maintaining the target row open if both the first batch of memory accesses and the second batch of memory accesses are read accesses; or If both the first batch of memory accesses and the second batch of memory accesses are write accesses, close the target row.

20. The apparatus according to any one of claims 12 to 19, configured so as to

21. a communications interface configured to receive memory accesses transmitted by a processor of the computer system; and A logic circuit configured to perform the memory management method of any one of claims 1 to 11 based on the memory accesses. A memory controller comprising:

22. A computer system comprising a memory and a memory management unit according to any one of claims 12 to 20.

23. A computer program product for causing a computer to execute the memory management method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Pre-charging data access control device and method thereof

    CN101488117A

  • Method, device, software and apparatus for adjusting a system parameter value, such as a page closing time

    US20050060533A1

  • Adaptive precharge management for synchronous DRAM

    US5889714A

  • Controlling a paging policy based on a requestor characteristic

    US6212598B1

  • Memory paging control method

    US6219764B1