Computer systems often utilize a cache to improve computing performance and throughput by reducing the apparent time delay or latency normally associated with a processor accessing data in a main memory. Such a computer system may employ one or more caches, each including a cache memory in conjunction with control logic, such as a cache controller. Generally, each of the cache memories is smaller and faster than the main memory, so that a processor may access a copy of data from the cache memory more quickly and readily than from the main memory. To this end, computer systems often employ caches having memories that provide enough access bandwidth to handle the highest memory access rate (i.e. the “demand rate”) of the system processors.
Typically, different types of processor workloads dictate different demand rates. If a cache is not designed to handle the maximum demand rate of its associated processor, many of the requests for access to the cache memory must be queued for some period of time. If the memory requests continue at a high rate, the length of the access queue increases, possibly to a level at which the resulting latency for some of the queued memory accesses is longer than the latency associated with a direct access to the main memory. As a result, for those periods of time, the cache actually lengthens memory access latency, thus becoming a performance hindrance within the computer system.
To prevent such a decrease in performance, caches typically are designed to handle the maximum demand rate, as described above, which often may involve complex cache designs and correspondingly expensive cache memories, due to the high access bandwidth they need to provide. Moreover, in some systems, various physical or design constraints, such as integrated circuit (IC) pinout, printed circuit board (PCB) layout, thermal characteristics, design complexity, time-to-market, and manufacturing costs, may prevent the system designer from implementing a cache providing the necessary bandwidth, thus leaving the designer with no option but to forego the implementation of a cache in the computer system altogether.
Similarly,
In
The cache 304 includes a cache memory 308 configured to store copies of a portion of the data residing in the main memory 306. The cache memory 308 is typically organized as a group of cache lines, wherein each cache line is capable of storing a copy of a number of contiguous addressable locations in the main memory 306. Also provided in the cache 304 is a cache tag array 316 enabling random-access to cache line tags. Each tag is associated with a cache line in the cache memory 308, and indicates which locations of the main memory 306 are stored at that particular cache line.
The cache 304 also includes a cache controller 310, which controls several functions of the cache 304. For example, the cache controller 310 keeps track of the state of each cache line of the cache memory 308 by way of the cache tag array 316. For example, an invalid cache line is one that currently does not hold valid data. A valid unmodified cache line holds a copy of the data that matches the corresponding data in the main memory 306, while a valid modified cache line has been updated so that the data in the cache line no longer matches the corresponding data in the main memory 306. In that case, the data in the cache line should be written back to the main memory 306 before another cache or processor reads that data from the main memory 306.
The cache controller 310 also modifies the state of each cache line in the cache memory 308 based on access activity involving the cache memory 308 and other portions of the system 300. For example, if the cache controller 310 purges a valid modified cache line, thus writing back the cache line to the main memory 306 and making room in the cache memory 308 for another cache line, the cache controller 310 changes the status of that cache line from valid and modified to invalid. Typically, the cache controller 310 controls the state changes of the cache lines according to a predetermined cache coherency protocol, such as the Modified-Owned-Exclusive-Shared-Invalid (MOESI) protocol. Other cache coherency protocols involving these or other cache line states may be utilized in other embodiments. Use of a cache coherency protocol helps ensure that each copy of the same memory address of the main memory 306 holds the same value in the cache 304 and other caches of the computer system 300 so that the entire address space of the system 300 remains consistent throughout.
In
In addition to processing memory read and write requests, the cache controller 310 may also “snoop,” or monitor, activity on the buses to which it is attached, such as the bus 318 coupling the cache 304 with the processor 302 or the higher-level cache 320. A second bus 322 coupling the cache 304 with the main memory 306, to which other caches may be coupled, may be snooped in a similar manner. Snooping allows the cache controller 310 to detect other memory access activity with the computer system 300 that may affect the state of the cache lines in the cache memory 308. To this same end, the cache controller 310 may also send and receive broadcast messages with the various components of the computer system 300. In another implementation, the cache controller 310 may access a cache coherency directory (not shown in
The cache controller 310 also includes a cache memory overload detection module 314, which acts as a control module configured to detect or predict an overload condition of the cache memory 308. Based on the detection or prediction of such an overload, the control module 314 directs the cache controller 310 to cause one or more incoming memory requests to bypass the cache memory 308 and be directed to the main memory 306. The control module 314 may be incorporated within the cache controller 310, or be implemented as a separate circuit configured to be accessed by the cache controller 310.
In one implementation, the control module 314 detects or predicts an overload of the cache memory 308 by way of cache activity information, which may be any information indicating the amount or percentage of the maximum bandwidth provided by the cache memory 308 being consumed. For example, the control module 314 may monitor the portion of the bus 318 coupling the cache memory 318 with the processor 302 or the higher-level cache 320 to determine if any free bus cycles are available. If not, the utilization of the cache memory 308 may be at or near its maximum sustainable level. In another embodiment, the control module 314 may monitor the length of the cache tag queue 312 holding, for example, read operations from the processor 302 or data update operations from the processor 302 or the main memory 306, to determine whether the cache memory 308 is able to keep up with the memory requests being received by way of the queue 312. In one implementation, read operation requests and data update operation requests are held in separate cache tag queues 312, such as a data read queue and a data update queue. The higher the number of active requests waiting in the queue 312, the further the cache memory 308 is falling behind in servicing those requests, and the longer each one of the requests must wait before being serviced. The control module 314 may monitor other aspects or characteristics of the operation of the cache 304 to yield cache activity information in other embodiments.
Further, the cache activity information may be processed to generate one or more cache activity statistics, such as a maximum value or a running average of a monitored value. For example, one cache activity statistic may be a running average of the length of the cache tag queue 312, averaged over the last minute. Another could be a maximum value of the utilization of the bus 318 coupled with the cache memory 308 over the last thirty seconds. Many other types of statistics may also be generated. In another example, statistics of various cache activity information may be combined to yield an indication as to whether the cache memory 308 is, or soon will become, overloaded, thus delaying the servicing of one or more memory requests being received from the processor 302, the higher-level cache 320, or another component of the computer system 300.
Generally, once the cache activity information or statistics reach some predetermined level, the control module 314 may deduce that an overload condition of the cache memory 308 does or will exist, and that one or more incoming requests should bypass the cache memory 308 at that point. In one example, read requests bypassing the cache memory 308 may be routed directly to the main memory 306 so that the cache memory 308 does not service the request, even if the data is held therein. In another example, data update requests involving data being read from the main memory 306 that are not resident in the cache memory 308 may bypass the cache memory 308 so that the data is not stored in the cache memory 308. Further, data update requests which occur by way of data supplied by the processor 302 may bypass the cache memory 308 and be written directly to the main memory 306. Presuming that enough of the incoming requests bypass the cache memory 308, and the cache activity information or statistics indicate that the overload condition is alleviated, the control module 314 may indicate that future memory requests need not bypass the cache memory 308, thus returning the cache 304 to a more normal mode of operation. In one embodiment, the predetermined level employed to initiate bypassing the cache memory 308 may be the same level used to disable the bypassing mode. In another implementation, the level used to disable bypassing may represent a value lower than the predetermined level used to initiate bypassing. In that case, the use of two different statistical or informational levels for enabling and disabling the bypass mode may result in the control module 314 implementing a form of hysteresis to prevent unnecessary or unwarranted switching between the normal and bypass modes in the cache 304 in response to temporary surges or drops in cache memory 308 activity.
To maintain cache coherency, some embodiments may take into account the current state of a cache line, which is often determined by way of a tag lookup in the cache tag array 316, to decide whether a memory request involving the cache line is allowed to bypass the cache memory 308.
A similar situation applies regarding a read or write request of a valid and unmodified, or “clean,” cache line held in the cache memory 308. In the case of a read request (operation 406), the associated data may be read from the main memory 306 and passed directly to the requesting processor 302 or higher-level cache 320 while maintaining cache coherency (operation 408), since the data copies in the main memory 306 and the cache memory 308 agree. Similarly, for a write request involving a write of a valid and unmodified cache line (operation 410), the write request may bypass the cache memory 308 (operation 412). In addition, the cache controller 310 invalidates the corresponding cache line stored in the cache memory 308 (operation 414), as that data likely no longer matches the data just written to the main memory 306.
If a memory request involves a valid, but modified, or “dirty,” cache line, only a write request involving a complete line-write (operation 416), in which all of the data within the cache line is to be written, may bypass the cache memory 308 (operation 418), thus writing the associated data directly to the main memory 306. In that case, the cache controller 310 also invalidates the cache line in the cache memory 308 by way of updating the cache tag associated with the affected cache line in the cache tag array 316 (operation 420). Otherwise, if the memory request is a read or a partial write of the dirty and valid cache line, bypassing the cache memory 308 is not available (operation 422). More specifically, if such a read request is allowed to bypass the cache memory 308, the data forwarded to the processor 302 or the higher-level cache 320 will not match the updated data line in the cache memory 308. If the partial-write request is allowed to bypass the cache memory 308 and is forwarded directly to the main memory 306, the cache controller 310 does not know whether all of the modified data of the corresponding cache line in the cache memory 308 have been overwritten in the main memory 306. As a result, the data in the main memory 306 within that cache line likely will not represent the true state of the data as understood by the processor 302 or the higher-level cache 320.
In some computer systems 300, cache-inclusiveness is employed to reduce the amount of communication among the cache 304, the higher-level cache 320, the processor 302 and other components of the computer system 300. Cache-inclusiveness typically requires that the valid contents of a higher-level cache, such as the higher-level cache 320 of
The cache controller 310 of embodiments of the present invention may support cache-inclusiveness by indicating that one or more cache lines are allocated in the cache memory 308, but that the corresponding data in that cache line are not valid.
In one embodiment, the cache controller 310 is configured to bypass memory requests which are associated with a particular memory request classification. For example, for a period of time during which the cache controller 310 predicts or detects an overload condition of the cache memory 308, the cache controller 310 may bypass the cache memory 308 with respect to memory requests for certain types of data, or from certain programs, as opposed to all memory requests available for bypass mode. Such functionality may be beneficial it, for example, the computer system 300 benefits more from caching certain types of data compared to others. Furthermore, directing only a portion of the memory requests directly to the main memory 306 may reduce the load on the cache memory 308 appreciably, thus allowing the cache 304 to service other memory requests normally in non-bypass mode.
Under this particular implementation, the memory requests may be classified in a number of ways, such as into requests for instructions and requests for data. Further, the data requests may be further classified into local data requests and remote data requests. Local data may be data stored within a portion of the main memory 306 located proximate to the processor 302 of a multiprocessor system, such as a symmetric multi-processor (SMP) system, while remote data may be stored in a portion of the main memory 306 identified with another processor. The memory requests may also be classified by way of the address of the requested data within the main memory 306, so that memory requests for data within a certain range are serviced by the cache memory 308, while others bypass the cache memory 308.
Various embodiments of the present invention, as described above, allow a cache to direct one or more memory requests to bypass the cache memory and route the request directly to main memory. In one embodiment, the cache controller associated with the cache employs this bypass mode when an overload of its corresponding cache memory is predicted or detected. In implementing bypass mode, the cache controller reduces the workload of the cache memory so that performance of the computer system does not decrease below a performance level associated with a system not implementing a cache. This functionality allows lower-cost, lower-performance caching systems employing slower cache memories to be incorporated in computer systems while still providing a significant enhancement to system performance. Moreover, cache systems may be integrated into systems whose design or physical constraints previously prevented the use of a cache. While slower cache memories may thus be utilized to significant advantage under the systems and methods discussed herein, caching functionality may be enhanced in one embodiment by ensuring that the cache controller and associated tag array are designed to be responsive under maximum system workload conditions to all memory requests, snoop demands, and other tasks involved in controlling the cache and maintaining cache coherency.
While several embodiments of the invention have been discussed herein, other embodiments encompassed by the scope of the invention are possible. For example, while some embodiments of the invention are described above in reference to the specific computer system architecture presented in
Number | Name | Date | Kind |
---|---|---|---|
4075686 | Calle et al. | Feb 1978 | A |
4189770 | Gannon et al. | Feb 1980 | A |
4268907 | Porter et al. | May 1981 | A |
4317168 | Messina et al. | Feb 1982 | A |
4646233 | Weatherford et al. | Feb 1987 | A |
4851993 | Chen et al. | Jul 1989 | A |
4888679 | Fossum et al. | Dec 1989 | A |
4942518 | Weatherford et al. | Jul 1990 | A |
4998221 | Correale, Jr. | Mar 1991 | A |
5247639 | Yamahata | Sep 1993 | A |
5265232 | Gannon et al. | Nov 1993 | A |
5510934 | Brennan et al. | Apr 1996 | A |
5526500 | Tanksalvala et al. | Jun 1996 | A |
5625793 | Mirza | Apr 1997 | A |
5717894 | Vivio | Feb 1998 | A |
5854943 | McBride et al. | Dec 1998 | A |
6131155 | Alexander et al. | Oct 2000 | A |
6161208 | Dutton et al. | Dec 2000 | A |
6212603 | McInerney et al. | Apr 2001 | B1 |
6496902 | Faanes et al. | Dec 2002 | B1 |
6636949 | Barroso et al. | Oct 2003 | B2 |
6662273 | Wilkerson et al. | Dec 2003 | B1 |
6668308 | Barroso et al. | Dec 2003 | B2 |
6751705 | Solomon et al. | Jun 2004 | B1 |
6957305 | Ray et al. | Oct 2005 | B2 |
6973544 | Berg et al. | Dec 2005 | B2 |
6988170 | Barroso et al. | Jan 2006 | B2 |
7017011 | Lesmanne et al. | Mar 2006 | B2 |
7076612 | Emons | Jul 2006 | B2 |
7107410 | Yang | Sep 2006 | B2 |
20010032298 | Emons | Oct 2001 | A1 |
20020046324 | Barroso et al. | Apr 2002 | A1 |
20020112132 | Lesmanne et al. | Aug 2002 | A1 |
20020129208 | Barroso et al. | Sep 2002 | A1 |
20030065886 | Olarig et al. | Apr 2003 | A1 |
20030115402 | Dahlgren et al. | Jun 2003 | A1 |
20030131200 | Berg et al. | Jul 2003 | A1 |
20040044847 | Ray et al. | Mar 2004 | A1 |
20040078790 | Wu et al. | Apr 2004 | A1 |
20040088487 | Barroso et al. | May 2004 | A1 |
20040268044 | Heller, Jr. | Dec 2004 | A1 |
20050021913 | Heller, Jr. | Jan 2005 | A1 |
20050060126 | Coulson et al. | Mar 2005 | A1 |
20050216672 | Gschwind et al. | Sep 2005 | A1 |
20050216675 | Gschwind et al. | Sep 2005 | A1 |
20060026355 | Okawa et al. | Feb 2006 | A1 |
20060112233 | Hu et al. | May 2006 | A1 |
20060179240 | Chatterjee et al. | Aug 2006 | A1 |
20060224840 | Blumrich et al. | Oct 2006 | A1 |
20080104329 | Gaither et al. | May 2008 | A1 |
Number | Date | Country |
---|---|---|
5-233450 | Sep 1993 | JP |
8-137752 | May 1996 | JP |
2006-48182 | Feb 2006 | JP |
2007-505406 | Mar 2007 | JP |
WO 2005026965 | Mar 2005 | WO |
Entry |
---|
Japan Office action dated Mar. 9, 2010, 2 pages. |
Number | Date | Country | |
---|---|---|---|
20080104329 A1 | May 2008 | US |