A system and method for handling speculative read requests for a memory controller in a computer system are provided. In one example, a method includes the steps of providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and intermixing demand reads and speculative reads in accordance with the speculative read threshold. In another example, a computer system includes a cpu, a memory controller, memory, a bus connecting the cpu, memory controller and memory, circuitry for providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold. In another example, a method includes the steps of providing a speculative dispatch time threshold corresponding to a selected percentage of a period of time required to search a cache of the computer system, and intermixing demand reads and speculative reads in accordance with the speculative dispatch time threshold.

Patent
   7949830
Priority
Dec 10 2007
Filed
Dec 10 2007
Issued
May 24 2011
Expiry
Jul 30 2029

TERM.DISCL.
Extension
598 days
Assg.orig
Entity
Large
5
22
EXPIRED
1. A method for handling speculative read requests for a memory controller in a computer system comprising the steps of:
providing a speculative read threshold corresponding to a selected percentage of a total number of reads to be speculatively issued;
intermixing demand reads and speculative reads in accordance with the speculative read threshold; and
determining the speculative read threshold based on a percentage of read requests that pass coherency checking and require data from the memory controller.
8. A computer system comprising
a cpu;
a memory controller;
memory;
a bus connecting the cpu, memory controller and memory;
circuitry for providing a speculative read threshold corresponding to a selected percentage of a total number of reads that can be speculatively issued;
circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold; and
circuitry for determining the speculative read threshold based on a percentage of read requests that pass coherency checking and require data from the memory controller.
2. The method of claim 1, further comprising the steps of:
monitoring a selected computer system state; and
dynamically adjusting the speculative read threshold based on the selected computer system state.
3. The method of claim 2, further comprising the step of preventing a read request from dispatching as a speculative read request if a percentage of current memory controller resources being used for speculative reads is equal to or greater than the speculative read threshold.
4. The method of claim 3, further comprising the step of preventing the read from dispatching as a speculative read if the memory controller is full.
5. The method of claim 4, further comprising the step of preventing the read from dispatching as a speculative read if a time elapsed from when the memory controller receives the read request to when the memory controller has available resources is greater than a speculative dispatch time threshold.
6. The method of claim 5, further comprising the step of providing the speculative dispatch time threshold as a selected percentage of a period of time required to search a cache of the computer system.
7. The method of claim 6, further comprising the step of preventing the read request from dispatching as a speculative read if the read request is not a youngest available read request.
9. The computer system of claim 8, further comprising:
circuitry for monitoring a selected computer system state; and
circuitry for dynamically adjusting the speculative read threshold based on the selected computer system state.
10. The computer system of claim 9, further comprising circuitry for preventing a read request from dispatching as a speculative read request if a percentage of current memory controller resources being used for speculative reads is equal to or greater than the speculative read threshold.
11. The computer system of claim 10, further comprising circuitry for preventing the read from dispatching as a speculative read if the memory controller is full.

The present invention relates in general to computer systems and, more particularly, to handling data requests in computer systems.

In order to create a large computing system capable of running many tasks concurrently, it is usually necessary to provide multiple copies of data used by the tasks so that there is often one physically close to the processor running the task. These copies are stored in caches which can be constructed in a variety of sizes and organizations. When a particular process needs a data item, one or more of these caches are searched to see if they contain the desired data and if they do not, then the request will be passed to a memory controller which manages a much larger memory space known as main memory. The goal of maintaining multiple copies of data is to reduce the average amount of time is takes for a particular processor to access the data item that it needs. Searching the caches takes a certain amount of time and if the desired data is not located, that time is added to the total access time required to retrieve the data from the main memory. Thus is can be beneficial to start the access to main memory before it is known whether or not the desired data item is in one of the caches. This is known as a speculative read because if the data is found in a cache, that data will be used and the data retrieved from main memory will be discarded. The other case in which all caches that might possibly contain the desired data are searched before the access to main memory is started is known as a demand read. The drawback to speculative reads is that they consume memory and bus resources which are then not available for data requests other processes.

Accordingly, there is a need in the art for proper weighting between demand and speculative reads to minimize read latency and maximize performance of a memory subsystem.

The problems outlined above may at least in part be solved in some examples by the disclosed system and method for handling data requests.

In one example, a method for handling speculative read requests for a memory controller in a computer system is provided. The method includes the steps of providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and intermixing demand reads and speculative reads in accordance with the speculative read threshold.

In one example, a computer system includes a CPU, a memory controller, memory, a bus connecting the CPU, memory controller and memory, circuitry for providing a speculative read threshold corresponding to a selected percentage of the total number of reads that can be speculatively issued, and circuitry for intermixing demand reads and speculative reads in accordance with the speculative read threshold.

In one example, a method for handling speculative read requests for a memory controller in a computer system is provided. The method includes the steps of providing a speculative dispatch time threshold corresponding to a selected percentage of a period of time required to search a cache of the computer system, and intermixing demand reads and speculative reads in accordance with the speculative dispatch time threshold.

The foregoing has outlined rather generally the features and technical advantages of one or more examples of the present invention in order that the detailed description of the present invention that follows may be better understood. Additional features and advantages of the present invention will be described hereinafter which may form the subject of the claims of the present invention.

The foregoing and other features and aspects of the present invention will be best understood with reference to the following detailed description of a specific example of the invention, when read in conjunction with the accompanying drawings, wherein:

FIG. 1 is an example of a computer system;

FIG. 2 is a sketch of a DRAM subsystem;

FIG. 3 is a graph showing the average access time for the DRAM subsystem shown in FIG. 2;

FIG. 4 is a graph showing the average delay caused by bank collisions for the DRAM subsystem shown in FIG. 2;

FIG. 5 is a Venn diagram showing the relationship between read types;

FIG. 6 is a graph showing the average read latency for a system with 25% demand reads;

FIGS. 7a-7f are graphs showing normalized read latency for systems with 10%, 25%, 40%, 55%, 70%, and 85% demand reads, respectively; and

FIG. 8 is an example of algorithm functions of the speculative read threshold algorithm.

In the following description, numerous specific details are set forth to provide a thorough understanding of the present invention. However, it will be apparent to those skilled in the art that the present invention may be practiced without such specific details. In other instances, well-known circuits have been shown in block diagram form in order not to obscure the present invention in unnecessary detail. For the most part, details considering timing considerations and the like have been omitted inasmuch as such details are not necessary to obtain a complete understanding of the present invention and are within the skills of persons of ordinary skill in the relevant art.

A system and method for dynamically adjusting the number of speculative read requests based upon the memory controller workload and rate of incoming requests to reduce memory read latency are provided. In one example, a system and method uses a speculative read threshold algorithm to dynamically intermix demand and speculative memory requests to improve latency. FIG. 1 and the associated description describe an example of a computer system for practicing the disclosed system and method. FIGS. 2-7, Equations 1-46, and the related description describe the derivation of an example of the speculative read threshold algorithm. FIG. 8, Equation 47, Table 1 and the associated description describe an example of the speculative read threshold algorithm.

FIG. 1—Computer System

FIG. 1 illustrates an example of a hardware configuration of computer system 100 which is representative of a hardware environment for practicing examples of the disclosed system and method. Computer system 100 may have a multi-processor system 110 coupled to various other components by system bus 112. An operating system 140 may run on multi-processor system 110 and provide control and coordinate the functions of the various components of computer system 100. Software programs or applications 150 in accordance with examples of the disclosed system and method may run in conjunction with operating system 140 and provide calls to operating system 140 where the calls implement the various functions or services to be performed by application 150.

Referring to FIG. 1, Read-Only Memory (ROM) 116 may be coupled to system bus 112 and include a basic input/output system (“BIOS”) that controls certain basic functions of computer system 100. Random access memory (RAM) 114 and disk adapter 118 may also be coupled to system bus 112. RAM 114 may comprise dynamic random access memory (DRAM), among other types of memory. It should be noted that software components including operating system 140 and application 150 may be loaded into RAM 114, which may be computer system's 100 main memory for execution. Disk adapter 118 may be an integrated drive electronics (“IDE”) adapter that communicates with a disk unit 120, e.g., disk drive.

Referring to FIG. 1, multi-processor system 110 may comprise a first processor 104 and a second processor 106. First and second processors 104 and 106 may each comprise CPU core 142, L1 cache 144 and L2 cache 146. Computer system 100 may comprise memory controller 108 to manage the flow of data to and from the memory of computer system 100, e.g., ROM 116 and RAM 114. Computer system 100 comprises coherency protocol interrogation logic 148 to maintain coherency between first and second processors 104 and 106. Computer system 100 may comprise speculative read threshold algorithm logic 160 to dynamically intermix demand and speculative memory requests in accordance with examples of the disclosed system and method. For example, first processor 104 may issue broadcast read request 152 which is received by logic 148 and logic 160. Logic 160 then outputs logic output 154 to memory controller 108 to indicate whether a speculative read will reduce memory read latency. If so, memory controller 108 may issue speculative read 156. Next, logic 148 issues coherency protocol interrogation 158 to second processor 106. Depending on the result of this interrogation, logic 148 may indicate, via signal 162, that a demand read 164 is needed. Memory controller 108 may recognize demand reads 164 that duplicate previous speculative reads 156. RAM 114 may return read data 166 to first processor 104 in response to either speculative read 156 or demand read 164. Memory controller 108 may provide feedback 168 to logic 160, e.g., to provide parameters for the speculative read threshold algorithm.

Referring to FIG. 1, computer system 100 may further include a communications adapter or network card 134 coupled to bus 112. Communications adapter 134 may interconnect bus 112 with network 102 enabling computer system 100 to communicate with other devices over network 102. I/O devices may also be connected to computer system 100 via a user interface adapter 122 and display adapter 136. Keyboard 124, mouse 126 and speaker 130 may all be interconnected to bus 112 through user interface adapter 122. Data may be inputted to computer system 100 through any of these devices. A display monitor 138 may be connected to system bus 112 by display adapter 136. In this manner, a user is capable of inputting to computer system 100 through keyboard 124 or mouse 126 and receiving output from computer system 100 via display 138 or speaker 130.

The various aspects, features, examples or implementations of the disclosed system and method described herein can be used alone or in various combinations. The disclosed methods can be implemented by software, hardware or a combination of hardware and software. The disclosed system and method can also be embodied as computer readable code on a computer readable medium. The computer readable medium is any data storage device that can store data which can thereafter be read by a computer system. Examples of the computer readable medium include read-only memory, random access memory, CD-ROMs, flash memory cards, DVDs, magnetic tape, optical data storage devices, and carrier waves. The computer readable medium can also be distributed over network-coupled computer systems so that the computer readable code is stored and executed in a distributed fashion.

FIG. 2—DRAM Subsystem

FIG. 2 illustrates an example of a dynamic random access memory (DRAM) 114a. For the purposes of the following discussion concerning the calculation of access times (Tram_access), DRAM 114a may be viewed as a collection of multiple independent resources, banks 115. The example of DRAM 114a shown in FIG. 2 comprises sixteen banks 115, shown as B0-B15. The dynamic nature of the storage elements within each bank 115 results in a bank busy penalty whenever multiple reads to the same bank 115 occur within the bank busy window (Tbb). While the address space of memory controller 108a is divided evenly across all banks 115, the probability of multiple system read addresses mapping to the same bank 115 should be taken into account. Because the number of reads greatly exceeds the number of writes for the typical conventional system, the effect of writes on bank 115 accessibility may be ignored in the following analysis.

In the simple case where no bank access collisions occur, DRAM access times may be viewed as the sum of the minimum raw access time (Ta) and the read transfer time (Trd) as shown below in Equation 1:
Tramaccess=Ta+Trd≡Tramaccessmin  (1)

If bank collisions are considered, then additional factors may be considered, including the pattern of read address accesses; the total number of banks 164 in DRAM subsystem 162 (Nb); the current bandwidth utilization (UTILpercentage) and the bank busy precharge window (Tbb). Typically, bank access collisions only occur when multiple reads occur within the bank busy window (Tbb). Because each read transfer (Trd) takes a finite length of time, the average penalty due to the bank busy window (Tbb_delay_average) may be expressed as a probability. For example, a penalty is incurred only in cases where the current read, e.g., RD0 also matches a read access to the same bank 164 within the past bank busy window (Tbb). Accordingly, P(RDn) may be defined as the probability that another read to the same bank 164 as the current read occurred no earlier than n read transfer time slots ago, e.g., n is the number of time slots within the bank busy window (Tbb) that should be considered when looking for a bank access collision. As a result, the average penalty due to the bank busy window (Tbb_delay_average) may be expressed as shown below in Equation 2:

T bb _d elay _ average = T bb - ( P ( RD 1 ) × ( 1 × T rd ) ) - ( P ( RD 2 ) × ( 2 × T rd ) ) - ( P ( RD n ) × ( n × T rd ) ) ( 2 )
where n≦Tbb/Trd=number of “time slots” within the bank busy window that must be considered when looking for a bank access collision

The average access time (Tram_access_average) may be expressed as shown below in Equation 3:
Tramaccessaverage=Ta+Trd+Tbbdelayaverage  (3)

As discussed below, bandwidth utilization may affect the average access time (Tram_access_average). Bandwidth may be described as the number of reads processed in a given time period. Accordingly, bandwidth (BWbb_read) may be expressed in terms of the number of reads (RDbb_read) that occur on average during every bank busy window (Tbb) as shown below in Equation 4:
BWbbread=RDbbread/Tbb  (4)

The maximum bandwidth (BWbb_max_read) may be expressed in terms of the maximum number of reads (RDbb_max_read) as shown below in Equations 5-7:
RDbbread≦RDbbmaxread  (5)
RDbbmaxread=Tbb/Trd  (6)
BWbbmaxread=RDbbmaxread/Tbb  (7)

Current bandwidth utilization (UTILpercentage) may be expressed as shown below in Equation 8:

UTIL percentage = BW bb _ read / BW bb _ max _ read = RD bb _ read / RD bb _ max _ read ( 8 )

Assuming that the pattern of read accesses follows a uniform distribution, each read may be considered statistically independent from one another. The probability that (i) a second read occurs one read transfer time period (Trd) before the current read; and (ii) both the first and second reads map to the same bank 164 may be expressed as shown below in Equation 9:
P(B1)=(RDbbread/RDbbmaxread)×(1/Nb)  (9)

Similarly, the probability that (i) another read occurs two transfer time periods (Trd) before the current read; and (ii) both reads map to the same bank 164 may be expressed as shown below in Equation 10:
P(B2)=(RDbbread/RDbbmaxread)×(1(Nb−1))  (10)

The bank collision probability (Pbn), e.g., the probability that the current read maps to the same bank 164 as a read that occurred n read transfer time periods (Trd) ago, may be generalized as shown below in Equation 11:

P ( B n ) = { 0 , n < 1 , n RD bb _ max _ read , { UTIL percentage N b - n + 1 , 1 n , n < RD bb _ max _ read , n < N b { UTIL percentage , N b n < RD bb _ max _ read ( 11 )

For the purposes of Equation 2, e.g., Tbb_delay_average, P(RDn) should use non-overlapping probabilities. For example, the probability that (i) another read occurs two read transfer time periods (Trd) before the current read; (ii) both reads map to the same bank 164; and (iii) any read during the first read transfer time period (Trd) did not map to the same bank 164, may be expressed as shown below in Equation 12:
P(RD2)=P(B2)×(1−P(B1))  (12)

Accordingly, the probability P(RDn) may be expressed as shown below in Equation 13:

P ( RD n ) = { P ( B n ) × k = 1 n - 1 [ 1 - P ( B n - k ) ] , 1 n < RD bb _ max _ read { k = 1 n - 1 [ 1 - P ( B n - k ) ] , n = RD bb _ max _ read ( 13 )

FIG. 3—Access Time

With the definition of P(RDn) as expressed in Equation 13, Tram_access_average may be observed in terms of the average penalty due to the bank busy window (Tbb_delay_average) and the maximum number of reads that occur during a bank busy window (RDbb_max_read). For instance, in the example shown in FIG. 3, values of Tbb_delay_average are shown for RDbb_max_read=10. As shown in FIG. 3, as bandwidth utilization (UTILpercentage) approaches zero, the average DRAM access time (Tram_access_average) approaches the ideal minimum access time (Tram_access_min). As the number of banks in a memory subsystem (Nb) increases, the average DRAM access time (Tram_access_average) also approaches the ideal minimum access time (Tram_access_min). Generally, as long as Nb>>RDbb_max_read, Tram_access_min may be considered a good approximation of the average DRAM access time.

FIG. 4—Average Delay Caused by Bank Collisions

Typically, for systems at 100% utilization, e.g., UTILpercentage=100%, that have the same number of banks (Nb) as time slots within the bank busy window (RDbb_max_read), a read may be expected to incur, on average, about 50% of the bank busy window as an access delay. FIG. 4 is derived from FIG. 3 and shows an example of the average delay (Tbb_delay_average) caused by bank busy collisions as bandwidth utilization (UTILpercentage) varies, where Nb=RDbb_max_read=10. As shown in FIG. 4, however, the actual average delay is 4.5, and not 5, e.g., 50% of RDbb_max_read. Because the maximum bank busy delay that a read can experience is RDbb_max_read−1, the average delay will be about 50% of the maximum, e.g., in the example shown in FIG. 4, the average delay is 4.5. This “RDbb_max_read−1” factor may also be observed in FIG. 3, where the maximum average delay is shown as 9 when Nb=1, even though RDbb_max_read=10.

For the case of a simple demand-driven read access, the read latency (Tdemand_read) may be expressed as the sum of the latency incurred by a cache miss (Tcache_miss), the latency incurred by a memory space coherency protocol interrogation (Tcoherency_check), and the RAM latency (Tram_access), as shown below in Equation 14:
Tdemandread=Tcachemiss+Tcoherencycheck+Tramaccess  (14)

From the point of view of the memory controller, Tcache_miss appears to be a fixed value, contributing the same latency to each read. As discussed above, the contribution of Tram_access to latency requires an analysis of several factors, including the probability of certain types of address conflicts, bandwidth utilization, and DRAM constraints, for example. To the memory controller, both Tcache_miss and Tram_access are values over which the memory controller has little to no control. The memory controller can choose to start accessing RAM early, however, prior to receiving the results of the system's coherency protocol, e.g., a speculative read. In the best case scenario, a speculative read may reduce the read latency by effectively eliminating Tcoherency_check, as shown below in Equation 15:
Tspecread=Tcachemiss+Tramaccess  (15)

In an idealized system with infinite memory subsystem bandwidth, all reads could be dispatched speculatively to maximize performance. Unfortunately, in systems with large memory spaces, there are several practical considerations that place an upper limit on memory subsystem bandwidth (BWmc_read_max), e.g., finite transistor counts, limitations within RAM systems (e.g., open pages, bank activates, etc.), among other factors. The practical effect of limited bandwidth is that any read received by the memory controller, either demand based or speculative, cannot be serviced if resources are unavailable.

One implication of Equations 14 and 15 is that a read request speculatively dispatched immediately upon receipt tends to have the greatest potential to achieve the full Tcoherency_check latency savings shown by Equation 15. The longer the wait between receipt of a read request and the decision to dispatch speculatively, the lower the potential latency savings and the less dramatic the improvement of the effective latency relative to Equation 14. In some examples (e.g., discussed below in connection with FIG. 8, Equation 47, and Table 1), a system may achieve improved performance by prioritizing “new” read requests while effectively expiring “older” read requests from speculative read consideration. For example, an example may include a time expiration on read requests: read requests received recently are of higher value to a speculative read policy than older read requests. In some examples, read request are not speculatively dispatched greater than or equal to Tcoherency_check after initial receipt, e.g., the coherency logic's response may be expected at any moment, thereby eliminating any advantage of dispatching speculatively.

A speculative read that results in a miss, e.g., the coherency protocol indicates that the read was actually not needed, results in wasted bandwidth within the memory controller. A speculative read that the coherency protocol later validates is viewed as a “hit.” Instead of choosing to dispatch a read speculatively, the memory controller may wait for the results from the coherency protocol before issuing a read, e.g., a demand read. The memory subsystem bandwidth (BWmc_read_max) serves as the upper limit on the total bandwidth used by speculative hits and misses (BWmc_spec_read_hit and BWmc_spec_read_miss) plus the bandwidth used for demand reads (BWmc_demand_read), as shown below in Equation 16:
BWmcreadmax≧BWmcspecreadhit+BWmcspecreadmiss+BWmcdemandread  (16)

Bandwidth limitations may also be expressed in terms of the maximum number of reads that may be in-progress simultaneously. For example, the upper limit of the memory subsystem bandwidth (BWmc_read_max) may be expressed as the total number of reads that the memory system can process (RDmc_max) in a finite amount of time (Tmc_max), as shown below in Equations 17-22, where RDmc_current is the current count of reads, RDmc_spec_miss is the current number of speculative reads that result in hits, RDmc_spec_miss is the number of speculative reads that result in misses, and RDmc_demand is the current number of demand reads:

BW mc_read _max = RD mc_max T mc_max ( 17 ) RD mc_current = RD mc_spec _hit + RD mc_spec _miss + RD mc_demand ( 18 ) RD mc_max RD mc_current ( 19 ) BW mc_spec _read _hit = RD mc_spec _hit RD mc_max × BW mc_read _max ( 21 ) BW mc_demand _read = RD mc_demand RD mc_max × BW mc_read _max ( 22 )

Conventional computer systems typically implement an interconnect bus with a bandwidth (BWsystem_read_max) that exceed the memory subsystem's ability to access physical RAM (BWmc_read_max). This excess in the interconnect bus bandwidth provides the ability to implement a number of coherency protocol techniques, including grouping multiple L2 caches into a larger common cache space; and eliminating the need to access physical RAM in those cases where a cache-miss from one L2 cache can be satisfied by data within a different L2 cache. The capabilities of modern coherency protocols should be considered when implementing a memory controller based speculative read policy. Furthermore, because the rate of read requests presented to the systems' memory coherency protocol (BWsystem_read) changes dynamically under varying system loads, the speculative read policy should be capable of adapting to both changing read request patterns and available memory controller resources.

FIG. 5—Relationship Between Read Types

Read requests presented to the coherency protocol (RDtotal_System) represent the total pool of reads from which the memory controller must choose when making speculative dispatch decisions. Once the coherency protocol confirms which reads need to be handled by the memory controller, a subset of raw system reads becomes available (RDtotal_system_demand). Memory controller demand reads (RDtotal_mc_demand) always pull from the system demand read pool (RDtotal_system_demand). However, while all speculative reads (RDtotal_mc_spec) pull from the raw system reads pool (RDtotal_system), speculative reads that result in hits (RDtotal_mc_spec_hit) also share membership in the system demand read set (RDtotal_system_demand). The relationship between these read types are shown in FIG. 6, a Venn set diagram, and in Equations 23-28, as shown below:
RDtotalsystem≧RDtotalsystemdemand ∪RDtotalmespec  (23)
RDtotalmcspec=RDtotalmcspechit+RDtotalmcspecmiss  (24)
RDtotalmcspechit=RDtotalsystemdemand ∩RDtotalmespec  (25)
RDtotalmcspecmiss=RDtotalmcspec−RDtotalmcspechit  (26)
RDtotalmcdemand=RDtotalsystemdemand−RDtotalmcspechit  (27)
RDtotalmc=RDtotalmcspec+RDtotalmcdemand  (28)

As shown in FIG. 6, set 184 correspond to RDtotal_system, set 186 correspond to RDtotal_system_demand, set 188 corresponds to RDtotal_mc_spec, and set 190 corresponds to RDtotal_mc_spec_hit.

A goal of a speculative read policy is to reduce the average read latency to a value less than a normal demand read, as shown below in Equation 29:
Taverageread≦Tdemandread  (29)

Any speculative read algorithm resulting in the average read latency exceeding that of a demand read will typically adversely affect system performance. Three discrete scenarios may be considered in generating an optimal speculative read policy, as shown below in Equations 30-32:
1) BWsystemread≦BWmcmax  (30)
2) BWsystemreaddemand≦BWmcmax<BWsystemread  (31)
3) BWmcmax<BWsystemreaddemand≦BWsystemread  (32)

For each of the scenarios shown in Equations 30-32, a speculative read policy typically needs to consider only those reads that occur within a fixed time interval (Tmc_read_max). Because a read will complete within the memory controller every Tmc_read_max cycles, regardless of whether the read is a speculative hit, miss or demand read, only those reads that occurred during the previous window need to be examined. This window, e.g., a moving average, may be equivalent to the system read bandwidth as measured on a particular cycle (BWsystem_read[n]), as shown below in Equation 33:

BW system_read [ n ] = 1 T mc_read _max × k = 0 ( T mc_read _max - 1 ) RD system [ n - k ] , where RD system [ n ] = { 0 , when no read request occurred on cycle # n { 1 , read request occurred on cycle # n ( 33 )

In the event that the system's current status matches the scenario shown in Equation 30, all system reads may be dispatched speculatively by the memory controller without regard for speculative hit/miss ratios. The basis for this policy may be shown in the examination of average number of cycles per read as shown below in Equations 34-35:

T average_read = RD mc_spec _hit RD mc × T spec_read + RD mc_spec _miss RD mc × T spec_read + RD mc_demand RD mc × T demand_read ( 34 ) RD mc = RD mc_spec _hit + RD mc_spec _miss + RD mc_demand ( 35 )

If the memory controller speculatively dispatches all reads, Equation 34 may be simplified as shown below in Equation 36:

T average_read = ( ( 1 - RD mc_spec _miss ) + RD mc_spec _miss ) ( 1 - RD mc_spec _miss + RD mc_spec _miss + 0 ) × T spec_read + 0 ( 1 - RD mc_spec _miss + RD mc_spec _miss + 0 ) × T demand_read = T spec_read ( 36 )

The result shown in Equation 36 stems from the ability of the system to effectively ignore the wasted bandwidth of the speculative misses (BWmc_spec_read_miss). Accordingly, as long as sufficient bandwidth exists to absorb the loss from wasted speculative misses, all reads should be dispatched speculatively by the memory controller. This analysis assumes that the memory controller is able to handle the incoming rate of reads, as shown below in Equation 37:
BWsystemread≦BWmcspecreadhit+BWmcspecreadmiss≦BWmcreadmax  (37)

To evaluate a speculative read policy for general use, however, situations in which the system read requests exceed the memory controller's ability to process them should be considered. Because a memory controller can only process a finite number of reads (RDmc_max) in a given length of time (Tmc_read_max), any reads that exceed the memory controller's maximum rate will increase the average access time. Additionally, when a read cannot be accepted due to insufficient memory controller resources, the read incurs a retry penalty where the system waits for a period of time (Tmc_retry) before retrying the failed read operation. For a system where the retry period is less than the time required to complete a read, a read may need to be retried multiple times before the memory controller has capacity to accept it. The number of multiple retries increases as the requested reads increase and as the system retry period decreases. The effect of the retry penalty is shown below in Equations 38-42:

UTIL mc_excess _percentage = { 0 , BW mc_total BW mc_max { BW mc_total - BW mc_max BW mc_max , BW mc_total > BW mc_max ( 38 ) UTIL mc_retry _percentage = T mc_retry / T mc_read _max ( 39 ) N max_retries = UTIL mc_excess _percentage UTIL mc_retry _percentage ( 40 ) T mc_retry _total = k = 0 int ( N max_retries ) k × T mc_retry , k = 0 , 1 , 2 , , int ( N max_retries ) + ( int ( N max_retries ) + 1 ) × ( N max_retries - int ( N max_retries ) ) × T mc_retry ( 41 ) T mc_retry _avg = T mc_retry _total × UTIL mc_retry _percentage ( BW mc_total / BW mc_max ) ( 42 )

In addition to any retry penalty, the effect on Tram_access (in Equations 14 and 15) may be represented by the ratio of requested memory controller bandwidth (BWmc_total) to maximum memory controller bandwidth (BWmc_max), as shown below in Equations 43 and 44:

T spec_read = T cache_miss + T ram_access , { BW mc_total BW mc_max 100 % = T cache_miss + T ram_access × { BW mc_total BW mc_max > 100 % BW mc_total BW mc_max + T mc_retry _avg , ( 43 ) T demand_read = T coherency_check + T spec_read ( 44 )

By combining Equations 3, 28, 34, 43 and 44, a model may be defined to evaluate the effects of a speculative read policy on average read latency. These Equations include the following system-specific constants: Trd, Ta, Tbb, T cache_miss, Tcoherency_check, Tmc_read_max, Tmc_retry and BWmc_max. In addition, the following model parameters, BWmc_spec, BWsystem_read, and DEMAND_READpercent, may be used to define the requested memory controller bandwidth (BWmc_total) that will effect average read latency. BWmc_spec is the maximum bandwidth of the memory controller that is allowed for use on speculative read operations. Generally, BWmc_spec must be less then or equal to BWmc_max. BWsystemd_read is the bandwidth associated with system reads, e.g., read requests, prior to coherency a check and any resulting demand reads. DEMAND_READpercent is the percentage of system reads that, after undergoing a coherency check, are system demand reads that require data from the memory controller. The relationship between these parameters and BWmc_total is shown below in Equations 45 and 46.

BW mc_demand = { 0 , BW system_read BW mc_spec { ( BW system_read - BW mc_spec ) × BW system_read > BW mc_spec DEMAND_READ percent , ( 45 ) BW mc_total = { BW system_read , BW system_read BW mc_spec { BW mc_spec + BW mc_demand , BW system_read > BW mc_spec ( 46 )

FIG. 6—Average Read Latency with 25% System Demand Reads

FIG. 6 shows an example of a read latency graph. For the purposes of simplicity, units of time as used herein for the discussion of FIG. 6 are defined in terms of the read transfer time (Trd) and constants related to time will be defined as a multiple of Trd. To avoid the need to explicitly specify the maximum memory controller bandwidth (BWmc_max), all bandwidth variables as used herein will be graphed in terms of a percentage of BWmc_max, where (i) (BWmc_spec)/(BWmc_max)≦100%; and (ii) (BWsystem_read)/(BWmc_max)≦400%. FIG. 6 shows the average read latency (in Trd units) on the Z-axis, the allowed speculative bandwidth as a percentage of maximum memory controller bandwidth (BWmc_spec/BWmc_max) on the X-axis, and the total system read bandwidth as a percentage of maximum memory controller bandwidth (BWsystem_read/BWmc_max) on the Y-axis. For the example illustrated in FIG. 6, DEMAND_READpercent=25% (fixed), Trd=1, Ta=10Trd; Tbb=10Trd; Nb=2(Tbb/Trd)=20; Tcache_miss=Trd, Tcoherency_check=5Trd; Tmc_read_max=2Ta=20Trd; and Tmc_retry=Tmc_read_max=20Trd.

Referring to FIG. 6, there are three main regions of operation for the memory controller. Region 193 is where all reads are dispatched speculatively. Region 194 is where some reads are speculative but all reads may be handled by the memory controller. Region 196 is where the memory controller is overwhelmed and retries are issued. The absolute read latency may be normalized by dividing the read latency when no speculative reads are issued to provide a simple percentage. If the normalized read latency is less than 100%, e.g., less than one, then speculative reads will improve performance. Conversely, if the normalized read latency is greater than 100%, speculative reads will have a negative impact on performance.

FIGS. 7a-7f—Normalized Read Latency

FIGS. 7a-7f show normalized read latency graphs in which DEMAND_READpercentage has been varied from 10%, 25%, 40%, 55%, 70%, and 85%, respectively. In each FIG. 7a-7f, line 198 indicates the lowest possible read latency for a given (BWsystem_read/BWmc_max) ratio, shown on the X-axis, i.e., an ideal. Line 200 shows a linear approximation or linear curve fit of line 198 that would allow a system to improve read latency by adjusting speculative read threshold percentages. Line 200 substantially corresponds to Equation 47 for the approximated speculative read threshold, discussed below.

FIG. 8—Interconnect Schematic for Algorithm to Reduce Read Latency

Adjusting the allowed percentage of speculative read requests based upon selected computer system states, such as memory controller workload and the rate of incoming requests, allows for a reduction in memory read latency. In one example, shown in FIG. 8, a computer system may utilize an algorithm to dynamically intermix demand and speculative memory requests to reduce memory read latency, i.e., regularly updating or computing the percentage of speculative read requests by continuously monitoring memory controller resources and system read rates. FIG. 8 is an interconnect schematic 212 for the speculative read threshold algorithm functions suitable for computer system 100 (shown in FIG. 1). System read monitor 202 monitors the system read request rate being presented to the memory controller prior to the coherency check (BWsystem_read). Because the maximum read rate of the memory controller may be a constant (BWmc_max), system read monitor 202 may provide data as a percentage relative to the maximum memory controller read rate (BWsystem_read/BWmc_max). System demand read monitor 204 monitors the percentage of system read requests that pass coherency checking and require data from the memory controller (DEMAND_READpercent). Memory controller speculative read monitor 206 monitors the percentage of memory controller resources currently being used for speculative reads (BWmc_spec_current/BWmc_max). Memory controller full monitor 208 monitors whether the memory controller can accept any more reads (BOOLEANmc_full). Speculative threshold decision function 210 receives data from monitors 202, 204, 206 and 208 and outputs BOOLEANspec_dispatch.

The speculative read threshold (BWmc_spec/BWmc_max) may be approximated by speculative threshold decision function 210 implementing the following equation:

BW mc_spec BW mc_max = - 1 × BW system_read BW mc_max × { BW system_read BW mc_max > 1 DEMAND_READ percent 1 - DEMAND_READ percent + 1 1 - DEMAND_READ percent , = 1. { BW system_read BW mx_max 1 ( 47 )

In some examples, computer system 100 may have the option of delaying the speculative decision. For example, memory controller 108 may be full when the read request is first received, but a speculative decision may be made at the point when memory controller 108 is no longer full. Typically, a computer system realizes the greatest benefit in latency reduction when a speculative read is dispatched immediately. As the time period between receiving the read request and dispatching the speculative read increases, the benefit decreases.

Accordingly, the decision to dispatch speculatively may also be based on the amount of time from the initial request until the memory resources needed to fulfill the request become available (Treq). In some examples, computer system 100 may place a time limit on requests using a threshold for how long after a request arrives it may be eligible for speculative dispatch, (Treq_expired). In one example, the speculative dispatch time threshold (Treq_expired) is a selected percentage of the amount of time required to search a cache system of the computer system. The speculative dispatch time threshold (Treq_expired) may also be programmed or dynamically adjusted based on system parameters, such as memory controller workload and the rate of incoming requests.

Read expiration timer 211 verifies that a read request is recent enough to be considered for speculative dispatch (BOOLEANreq_expired), and the current read request being considered is the youngest available (BOOLEANyounger_req_avail). For example, if Treq≧Treq_expired, then BOOLEANreq_expired=true. Logic 160 may include queue 161 for pending read requests.

The decision (BOOLEANspec_dispatch) as to whether a read, e.g., pre-coherency check, should be speculatively dispatched may be based on the truth table shown below in

TABLE 1
Inputs Output (BOOLEANspecdispatch)
BWmccurrentspec ≧ BWmcspec NO, do not dispatch speculatively
BWmcmax BWmcmax
BOOLEANmcfull = true NO, do not dispatch speculatively
BOOLEANreqexpired = true NO, do not dispatch speculatively
BOOLEANyoungerreqavail = true NO, do not dispatch speculatively
otherwise, YES, dispatch
speculatively

The speculative read threshold is regularly updated/computed by monitoring memory controller resources and system read rates. As different programs run in a computer, the pattern of read requests will change. The speculative read threshold algorithm may allow a hardware circuit to dynamically adapt to the constantly changing pattern of read requests as the system load changes over time. The speculative read threshold may be set based on the pattern of read requests (DEMAND_READpercent), system load (BWsystem_read/BWmc_max), and memory controller load (BWmc_spec_current/BWmc_max and BOOLEANmc_full). As a result, the disclosed system and method may remain effective as memory subsystems become more complex (e.g., multiple levels of memory hierarchy, multiple cores, multi-node/multi-bade systems, coherent memory space).

Because monitors 202, 204, 206 and 208 monitor various system and memory controller states, efficient function realization may require an examination in view of control system theory. Other examples may allow the output of the functions to either lead or lag the actual measured state to provide the ability to tune the total algorithm's effectiveness for a specific system and memory controller implementation or configuration. Some examples may use integer-only coding to simplify and minimize circuitry components. Conventional techniques for conversion of floating point algorithms to integer-only may be used.

Given the underlying non-linear nature of the “ideal” read threshold algorithm, the error term associated with linear-curve fit equation shown in Equation 47 may grow as the READ_DEMANDpercent approaches either 0% or 100%. For example, as shown in FIGS. 7a-7f, the example of the read threshold algorithm shown in Equation 47 has the greatest accuracy, i.e., compared to the ideal 198, over a READ_DEMANDpercent range of 25%-85%. To minimize the error term, various standard techniques may be used to generate a more discrete curve fit equation, such as additional linear segments, and table lookups, among other techniques.

From the foregoing detailed description of specific examples of the invention, it should be apparent that a system and method handling data requests based on available system resources has been disclosed. Although specific examples of the invention have been disclosed herein in some detail, this has been done solely for the purposes of describing various features and aspects of the invention, and is not intended to be limiting with respect to the scope of the invention. It is contemplated that various substitutions, alterations, and/or modifications, including but not limited to those implementation variations which may have been suggested herein, may be made to the disclosed examples without departing from the spirit and scope of the invention as defined by the appended claims which follow.

Allen, Jr., James Johnson, Jenkins, Steven Kenneth, Trombley, Michael Raymond, Mossman, James A.

Patent Priority Assignee Title
10048895, Dec 06 2013 XTREAMEDGE, INC System and method for dynamically load balancing storage media devices based on a mid-range performance level
10235096, Dec 06 2013 XTREAMEDGE, INC System and method for dynamically load balancing storage media devices based on an average or discounted average sustained performance level
9135112, Dec 11 2012 Seagate Technology LLC Policy for read operations addressing on-the-fly decoding failure in non-volatile memory
9274722, Dec 06 2013 XTREAMEDGE, INC System, method and article of manufacture for monitoring, controlling and improving storage media system performance
9436404, Dec 06 2013 XTREAMEDGE, INC System and method for dynamically load balancing across storage media devices having fast access rates
Patent Priority Assignee Title
5689499, Mar 26 1993 QPSX DEVELOPMENTS 5 PTY LTD Method and apparatus for managing the statistical multiplexing of data in digital communication networks
6233645, Nov 02 1998 Hewlett Packard Enterprise Development LP Dynamically disabling speculative prefetch when high priority demand fetch opportunity use is high
6625707, Jun 25 2001 Intel Corporation Speculative memory command preparation for low latency
6704842,
6804750, Jan 22 2002 U S BANK NATIONAL ASSOCIATION, AS COLLATERAL AGENT Technique for reducing memory latency during a memory request
7130967, Dec 10 2003 International Business Machines Corporation Method and system for supplier-based memory speculation in a memory subsystem of a data processing system
7584294, Mar 12 2007 Citrix Systems, Inc Systems and methods for prefetching objects for caching using QOS
7600078, Mar 29 2006 Intel Corporation Speculatively performing read transactions
20020087811,
20020095301,
20030005252,
20030079089,
20040098552,
20040148470,
20040162947,
20050117583,
20050155026,
20060174228,
20060179175,
20060294223,
20070214335,
20070294487,
/////
Executed onAssignorAssigneeConveyanceFrameReelDoc
Dec 10 2007International Business Machines Corporation(assignment on the face of the patent)
Dec 11 2007JENKINS, STEVEN KENNETHInternational Business Machines CorporationASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0202320169 pdf
Dec 11 2007MOSSMAN, JAMES A International Business Machines CorporationASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0202320169 pdf
Dec 11 2007TROMBLEY, MICHAEL RAYMONDInternational Business Machines CorporationASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0202320169 pdf
Dec 11 2007ALLEN, JAMES JOHNSON, JR International Business Machines CorporationASSIGNMENT OF ASSIGNORS INTEREST SEE DOCUMENT FOR DETAILS 0202320169 pdf
Date Maintenance Fee Events
Jan 02 2015REM: Maintenance Fee Reminder Mailed.
May 24 2015EXP: Patent Expired for Failure to Pay Maintenance Fees.


Date Maintenance Schedule
May 24 20144 years fee payment window open
Nov 24 20146 months grace period start (w surcharge)
May 24 2015patent expiry (for year 4)
May 24 20172 years to revive unintentionally abandoned end. (for year 4)
May 24 20188 years fee payment window open
Nov 24 20186 months grace period start (w surcharge)
May 24 2019patent expiry (for year 8)
May 24 20212 years to revive unintentionally abandoned end. (for year 8)
May 24 202212 years fee payment window open
Nov 24 20226 months grace period start (w surcharge)
May 24 2023patent expiry (for year 12)
May 24 20252 years to revive unintentionally abandoned end. (for year 12)