Read cache management for data storage devices
The cache management system in DSDs optimizes cache usage by determining data retention based on access history, addressing inefficiencies in LRU policies and enhancing read performance through reduced cache misses and memory usage.
Patent Information
- Application Number
- US19/213877
- Authority / Receiving Office
- US · United States
- Patent Type
- Applications(United States)
- Current Assignee / Owner
- Filing Date
- 2025-05-20
- Publication Date
- 2026-11-26
AI Technical Summary
Conventional Least Recently Used (LRU) cache management policies in data storage devices (DSDs) lead to inefficient use and decreased performance due to discarding older cached data for one stream to make room for newer data, especially in multi-stream read workloads, resulting in increased cache misses and lower overall read performance.
A cache management system that determines the amount of data to retain in each cache area based on its access history, using cache hit pointers and prior data amounts to optimize cache usage by releasing portions of the cache area that are less likely to be accessed, thereby improving read performance.
Enhances the efficiency of the read cache by reducing the amount of memory needed for caching and minimizing cache misses, leading to improved overall read performance in DSDs.
Smart Images

Figure US20260377319A1-D00000_ABST
Abstract
Description
BACKGROUND
[0001] Data Storage Devices (DSDs) are often used to record data onto or to reproduce data from storage media. One type of storage media includes a rotating disk, such as in a Hard Disk Drive (HDD). In such DSDs, data is magnetically stored in sectors arranged in concentric circular tracks on the disk surfaces. In such DSDs, a head is positioned in relation to a recording surface on the disk to magnetically read and write data in the concentric tracks on the recording surface.
[0002] One way to improve read performance for DSDs including disk media includes caching data read from the disk in a faster access memory, such as a Dynamic Random Access Memory (DRAM) of the DSD. In some cases, the data may be cached using “read-ahead” prefetching to continue reading data from a data track on the disk after performing a read command and caching the additional data in the read cache in anticipation of the prefetched data being requested by a host. Since data for a particular file or object is likely to be stored in the same track or in an adjacent track, a host requesting data related to previously-requested data may send an additional read command for the related data, which may be cached or prefetched in the read cache from read-ahead prefetching. The prefetched data can then be provided to the host more quickly from the read cache to improve the read performance of the DSD. In other cases, data already provided to the host may remain in the read cache in case the data is requested again, so that the requested data can be more quickly provided from the read cache than from rereading the data from the disk.
[0003] The storage capacity of the read cache is generally limited and is conventionally managed by a Least Recently Used (LRU) cache management policy that discards or overwrites the data related to the oldest cached data in the read cache. However, such LRU cache management policies can cause performance penalties for cache read workloads that tend to request older cached data and for multi-stream read workloads that are becoming more common for disk-based DSDs.
[0004] Multi-stream read workloads include receiving read commands for data or streams of data corresponding to different, non-sequential ranges of logical addresses (e.g., Logical Block Addresses (LBAs)) that are requested by one or more hosts and concurrently caching data for such multiple read streams. With such multi-stream read workloads, DSDs often end up discarding older cached data for a first stream to make room in the read cache for data related to a second read stream, even though the host may still send a new cache read command for the discarded data for the first stream. In such cases, the DSD rereads the requested data from the disk that was discarded from the read cache, which decreases read performance and causes an inefficient use of the read cache by increasing cache misses that occur when requested data is not stored in the read cache.
[0005] In addition, the DSD may keep data in the read cache for a read stream, even though this data may be unlikely to be requested again by the host due to, for example, the particular application requesting the data. The retention of such data in the read cache limits the amount of data stored in the read cache for other streams that may be more likely to be requested, and, as a result, contributes to a lower overall read performance and inefficient use of the read cache.BRIEF DESCRIPTION OF THE DRAWINGS
[0006] The features and advantages of the embodiments of the present disclosure will become more apparent from the detailed description set forth below when taken in conjunction with the drawings. The drawings and the associated descriptions are provided to illustrate embodiments of the disclosure and not to limit the scope of what is claimed.
[0007] FIG. 1 is a plan view of an example Data Storage Device (DSD) according to one or more embodiments.
[0008] FIG. 2 illustrates an example of determining a prior data amount to retain in a cache area according to one or more embodiments.
[0009] FIG. 3 illustrates releasing portions of a cache area at two different times based on the logical locations of a cache hit pointer and the prior data amount to retain in the cache area according to one or more embodiments.
[0010] FIG. 4 illustrates a memory pool including released cache area portions according to one or more embodiments.
[0011] FIG. 5 is a flowchart for a cache area management process according to one or more embodiments.
[0012] FIG. 6 is a flowchart for a multiple cache area management process according to one or more embodiments.
[0013] FIG. 7 is a flowchart for a prior data amount determination process according to one or more embodiments.
[0014] FIG. 8 is a flowchart for a new cache area creation process according to one or more embodiments.DETAILED DESCRIPTION
[0015] In the following detailed description, numerous specific details are set forth to provide a full understanding of the present disclosure. It will be apparent, however, to one of ordinary skill in the art that the various embodiments disclosed may be practiced without some of these specific details. In other instances, well-known structures and techniques have not been shown in detail to avoid unnecessarily obscuring the various embodiments.Example Data Storage Device
[0016] FIG. 1 is a plan view of an example Data Storage Device (DSD) 100 according to one or more embodiments to illustrate an exemplary operating environment. In some implementations, DSD 100 can include a Hard Disk Drive (HDD) or other type of DSD including a rotating magnetic disk as a data recording medium, such as a Solid-State Hybrid Drive (SSHD) that can include solid-state non-volatile memory in addition to one or more disks.
[0017] As shown in the example of FIG. 1, DSD 100 includes slider 114 that includes magnetic reading / recording head 112. Collectively, slider 114 and head 112 may be referred to as a head slider. DSD 100 further includes at least one Head Gimbal Assembly (HGA) 110 including the head slider, lead suspension 116 attached to the head slider typically via a flexure, and load beam 118 attached to lead suspension 116.
[0018] DSD 100 also includes at least one disk 120 rotatably mounted on spindle 124 using disk clamp 128. A drive motor (not visible) is attached to spindle 124 for rotating disk 120. Head 112 includes a writer or write element and a reader or read element for respectively writing and reading data stored on a recording surface of disk 120. In some implementations, disk 120 can include a second recording surface on the opposite side of disk 120 beneath the recording surface shown in FIG. 1. In such implementations, HGA 110 can include an additional head slider spaced apart from slider 114 and head 112 to read and write data on the other recording surface of disk 120. In addition, and as appreciated by those of ordinary skill in the art, additional disks with recording surfaces may be stacked below disk 120 and affixed to spindle 124 with disk clamp 128, and HGA 110 can include additional spaced-apart head sliders for reading and writing data from respective recording surfaces.
[0019] As shown in FIG. 1, DSD 100 further includes arm 132 attached to HGA 110, carriage 134, a Voice-Coil Motor (VCM) that includes armature 136 and voice coil 140 attached to carriage 134, and stator 144 including a voice-coil magnet (not visible). Armature 136 of the VCM is attached to carriage 134 and is configured to move arm 132 and HGA 110, to access portions of disk 120, being mounted on pivot shaft 148 with interposed pivot-bearing assembly 152. In the case of multiple disks, carriage 134 is called an “E-block,” or comb, because the carriage is arranged to carry a ganged array of arms that gives it the appearance of a comb.
[0020] An assembly comprising a head gimbal assembly (e.g., HGA 110) including a flexure to which the head slider is coupled, an actuator arm (e.g., arm 132) and / or load beam to which the flexure is coupled, and an actuator (e.g., the VCM) to which the actuator arm is coupled, may be collectively referred to as a Head Stack Assembly (HSA). An HSA may, however, include more or fewer components than those described. For example, an HSA may refer to an assembly that further includes electrical interconnection components. Generally, an HSA is the assembly configured to move the head slider to access portions of the disk 120 for read and write operations.
[0021] With further reference to FIG. 1, electrical signals (e.g., current to voice coil 140 of the VCM) comprising a write signal to and a read signal from head 112 are provided by flexible interconnect cable 156 (“flex cable”). Arm-Electronics (AE) module 160, which may have an on-board pre-amplifier for the read signal, as well as other read-channel and write-channel electronic components, provides connection between flex cable 156 and head 112. AE module 160 may be attached to carriage 134 as shown or may be included as part of circuitry 166 of controller 170. Flex cable 156 is coupled to electrical connector block 164, which provides electrical communication to controller 170 located beneath electrical connector block 164 through electrical feedthroughs provided by base or housing 168. In conjunction with a cover, housing 168 provides a sealed, protective enclosure for the data storage components of DSD 100.
[0022] Other electronic components, including a disk controller and servo electronics that can further include a Digital Signal Processor (DSP), provide electrical signals to the drive motor, voice coil 140 of the VCM, and head 112 of the HGA 110. The electrical signal provided to the drive motor enables the drive motor to spin, providing a torque to spindle 124, which is in turn transmitted to disk 120 that is affixed to spindle 124. As a result, disk 120 spins in direction 172. The disk 120 creates a gas cushion that acts as a gas-bearing on which the Gas-Bearing Surface (GBS) of slider 114 rides so that slider 114 flies above the surface of disk 120 without contacting a thin magnetic-recording layer in which data is recorded.
[0023] The electrical signal provided to voice coil 140 of the VCM enables head 112 of HGA 110 to access tracks, such as track 176, in which data is recorded. Thus, armature 136 of the VCM swings through an arc 180, which enables head 112 of HGA 110 to access various tracks on disk 120. Data is stored on disk 120 in a plurality of radially-nested tracks arranged in sectors on disk 120, such as sector 188 of track 176 within wedge 184. Each track on the disk surface is composed of a plurality of sectors, such as sector 188, that may store recorded data and a header containing a servo-burst-signal pattern. The servo-burst signal pattern may include, for example, an ABCD-servo-burst-signal pattern, which is information that identifies track 176, and error correction code information. In accessing track 176, the read element of head 112 of HGA 110 reads the servo-burst-signal pattern, which provides a Position-Error-Signal (PES) to the servo electronics, which controls the electrical signal provided to voice coil 140 of the VCM, enabling head 112 to follow track 176. Upon finding track 176 and identifying sector 188, head 112 either reads data from track 176 or writes data to track 176 depending on instructions, such as instructions received by controller 170 from an external host 101, such as a microprocessor of a computer system.
[0024] In the example of FIG. 1, controller 170 is shown with dashed lines connected to electrical connector block 164 to indicate that controller 170 is in electrical communication with electrical connector block 164. As will be appreciated by those of ordinary skill in the art, controller 170 in some implementations can include a Printed Circuit Board (PCB) coupled to the bottom side of DSD 100, such as to housing 168. As shown in the example of FIG. 1, controller 170 includes circuitry 166 and at least one memory 174, which can include a Dynamic Random Access Memory (DRAM) or other solid-state memory, such as flash memory or a Storage Class Memory (SCM) used to access data quickly.
[0025] While the description herein refers to solid-state memory generally, it is understood that solid-state memory may comprise one or more of various types of memory devices such as flash integrated circuits, NAND memory (e.g., Single-Level Cell (SLC) memory, Multi-Level Cell (MLC) memory (i.e., two or more levels), or any combination thereof), NOR memory, Electrically Erasable Programmable Read-Only Memory (EEPROM), Chalcogenide RAM (C-RAM), Phase Change Memory (PCM), Programmable Metallization Cell RAM (PMC-RAM or PMCm), Ovonic Unified Memory (OUM), Resistive RAM (RRAM), Ferroelectric Memory (FeRAM), Magnetoresistive RAM (MRAM), and / or other discrete Non-Volatile Memory (NVM) chips, or any combination thereof.
[0026] Circuitry 166 can comprise electronic components for performing different functions for operation of the DSD, such as an interface controller, a Read / Write Integrated Circuit (R / W IC), an AE module, a motor driver, a servo processor, and other digital processors and associated memory. In this regard, circuitry 166 can include one or more processors for executing instructions, such as a microcontroller, a DSP, an Application-Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a Graphics Processing Unit (GPU), hard-wired logic, analog circuitry, and / or a combination thereof. In some implementations, circuitry 166 can include a System on a Chip (SoC), which may also include one or more memories of at least one memory 174.
[0027] As shown in FIG. 1, at least one memory 174 stores (individually or in combination) cache manager 10, one or more cache areas 12, one or more cache hit pointers 14, cache area information 16, and memory pool 18. Cache manager 10 can include computer-executable instructions executed by circuitry 166 for managing cache area(s) 12 used to store data read from disk 120. As discussed in more detail below, each cache area 12 can correspond to a different read stream including a range of logical addresses (e.g., Logical Block Addresses (LBAs)) requested by one or more hosts 101. In this regard host(s) 101 can request different read streams by sending read commands to DSD 100 to retrieve data from disk 120 corresponding to different ranges of LBAs.
[0028] Cache manager 10 may use a cache hit pointer 14 for each cache area 12 to point to at least one last requested logical address (e.g., an LBA) for last-requested cached data in the cache area 12 for a most recent cache read command. Unlike the original read commands from host(s) 101 that fill cache area(s) 12 with data read from disk 120, cache read commands request cached data that has already been stored in a cache area 12. The cache hit pointer 14 for each cache area 12 and / or cache area information 16 for each cache area 12 can be used by cache manager 10 to determine how much cached data to retain in a particular cache area 12. The released or discarded portions of the cache area can be made available for storing other data, such as for caching data read from disk 120 for a new read stream, by releasing the portions to memory pool 18.
[0029] Cache area information 16 can include, for example, statistical information representing a cache access history of the particular cache area 12. Cache area information 16 can include, for example, a data structure stored in at least one memory 174 correlating different cache areas 12 to their cache area information. In some implementations, cache hit pointer(s) 14 and cache area information 16 may be stored in the same data structure.
[0030] As discussed in more detail below, the individualized determination of how much data to retain and which data to retain in a particular cache area 12 based on the cache area's specific cache access history can improve the overall efficiency of the read cache and an overall read performance of DSD 100, as compared to a Least Recently Used (LRU) cache management policy or other conventional read cache management policy. The efficiency of the read cache can be measured, for example, in terms of reducing the amount of memory needed for caching data and / or the number of cache hits or cache misses indicating whether requested data is stored in the read cache (i.e., in all of the cache areas). In some implementations, cache area information 16 may also include cache hit or cache miss information indicating a usage or performance of each cache area.
[0031] As will be appreciated by those of ordinary skill in the art with reference to the present disclosure, other implementations of DSD 100 may differ from the example shown in FIG. 1. For example, cache manager 10 may include multiple modules that control different aspects of cache management, such as by including a module for determining cache area information 16, a module for updating cache hit pointer(s) 14, a module for creating new cache areas 12, and / or a module for releasing or discarding portions of cache area(s) 12 into memory pool 18. Those of ordinary skill in the art will also appreciate that disk 120 is shown in FIG. 1 for the purposes of illustration and that the recording surface of disk 120 can include many more tracks and sectors at a much smaller scale with the recording surface including, for example, tens of thousands of tracks. As noted above, DSD 100 will typically include more than a single recording surface and may include multiple concentrically aligned disks.
[0032] FIG. 2 illustrates an example of determining a prior data amount to retain in a cache area according to one or more embodiments. As discussed in more detail below, the prior data amount is determined for a particular cache area based on its cache access history. In response to a cache read command requesting cached data from the cache area, a portion of the cache area is released to make the portion available to store other data based, at least in part, on the determined prior data amount to retain in the cache area. The example of commands received in FIG. 2 can represent an initial series of cache read commands to retrieve data already stored in cache area 12A or can represent an adjustment to a previously-determined prior data amount, such as a default prior data amount.
[0033] As shown in FIG. 2, cache area 12A stores cached data indicated by the cross-hatching in cache area 12A. A series of cache read commands (i.e., Cmd1, Cmd2, and Cmd3 in FIG. 2) are received at different points in time to retrieve cached data stored in cache area 12A at the logical locations or LBAs indicated by the relative horizontal positions shown under cache area 12A. As indicated in FIG. 2, the LBAs corresponding to the cached data in cache area 12 increase from left to right in cache area 12A.
[0034] In the example of FIG. 2, the logical addressing of the cached data also corresponds to the time at which the data was stored in cache area 12A, such that earlier-cached data is shown to the left of later-cached data that is shown to the right of the earlier-cached data. The cached data can include data that has been read from a disk of DSD 100 (e.g., from disk 120 in FIG. 1) to perform a read command received from a host (e.g., a host 101 in FIG. 1). In some cases, the cached data in cache area 12A can also include data that may have been prefetched in addition to data requested by a read command received from a host.
[0035] The logical location or logical address(es) (e.g., LBAs) for the cached data requested by the cache read commands are identified by respective cache hit pointer locations shown in FIG. 2 as P1, P2, P3, and P4 for cache read commands Cmd1, Cmd2, Cmd3, and Cmd4, respectively. In some implementations, a memory (e.g., at least one memory 174 in FIG. 1) may store the most recent cache hit pointer location as a cache hit pointer 14 for cache area 12A. The cache hit pointer location may then be updated to a new location or new logical address(es) in response to receiving a new cache read command for cached data already stored in cache area 12A. In this regard, the cache hit pointer locations shown in FIG. 2 are shown with dashed lines to indicate that the cache hit pointer location changes or updates with each new cache read command for cache area 12.
[0036] A logical distance, such as a difference in logical addresses pointed to by the cache hit pointer, is measured or calculated in FIG. 2 between the cached data requested by each cache read command and a next cache read command. for example, the logical distance +D1 represents the logical distance between the cached data requested by cache read command Cmd1 and the cached data requested by cache read command Cmd2. This calculation can include subtracting the logical address for the second-requested cached data from the logical address for the first-requested cached data. The logical distances can be stored as part of cache area information 16 for cache area 12A to determine a prior data amount to retain in cache area 12A that was stored before last-requested cached data for a most recent cache read command. In some implementations, the prior data amount may characterize the cache access history of cache area 12A, such as by using the changes in logical addresses for requested cached data or the logical distances between successively-requested cached data to calculate statistical information for the changes in logical addresses or logical distances.
[0037] For example, the logical distances in FIG. 2 (i.e., +D1, −D2, and −D3) may be used to calculate an average change in logical addresses from each cache read command to a next cache read command for a plurality of cache read commands (e.g., Cmd1, Cmd2, Cmd3, and Cmd4 in FIG. 2), a standard deviation (e.g., two standard deviations) in the change in logical addresses from each cache read command to a next cache read command for the plurality of cache read commands, and / or a greatest change in logical addresses for one cache read command to a next cache read command (e.g., a greatest logical distance) for the plurality of cache read commands.
[0038] In some implementations, the number of backward cache hit pointer changes may be used to determine the prior data amount. For example, a ratio of the number of times the cache hit pointer is moved to an earlier logical address (i.e., a backward cache hit pointer change) of a total number of cache hit pointer changes may be used as a weight value that is multiplied with another statistical value for the cache area, such as the average change in logical addresses from each cache read command to a next cache read command for a set of recent cache read commands.
[0039] In the example of FIG. 2, logical distances +D1, −D2, and −D3 may be averaged or summed to provide first cache area information, such as to provide an average logical distance of Davg. For example, if +D1 equals positive 300 LBAs (i.e., 300 LBAs to the right in FIG. 2), −D2 equals negative 200 LBAs (i.e., 200 LBAs to the left in FIG. 2), and −D3 equals negative 400 LBAs, then Davg equals negative 100 LBAs. This value may then be further modified, such as by multiplying a weight value, such as the number of backward cache hit pointer changes divided by a total number of cache hit pointer changes (i.e., ⅔ in FIG. 2) to result in a prior data amount corresponding to negative 66 LBAs.
[0040] The prior data amount may correspond to, or may be rounded up or down to, a memory unit size, such as a standard sector size read from the disk (e.g., 4,096 bytes or 512 bytes) or other data unit size for the memory used for cache area 12A. In some implementations, a maximum prior data amount and / or a minimum prior data amount may replace a calculated prior data amount if the calculated prior data amount is greater than an upper threshold for the prior data amount or less than a lower threshold for the prior data amount.
[0041] Some implementations may enable or disable the read cache release policy disclosed herein for a particular cache area based on the number of backward cache hit pointer changes for the cache area. For example, if less than ten percent of the cache hit pointer changes are backward cache hit pointer changes, then the DSD may instead use an LRU cache management policy for that particular cache area since more than ninety percent of the cache read commands are moving the cache hit pointer forward to later-cached data. In such implementations, other cache areas may still follow a cache release policy based on a prior data amount determined for the other cache area. In some implementations, the prior data amount may not be used or may be set to retain no data (i.e., a prior data amount of zero). In such implementations, all of the cached data stored in the cache area that was stored before the last-requested logical addresses pointed to by the cache hit pointer may be released to become available to store other data. The disclosed cache management policy for the cache area then primarily depends on the logical location of the cache hit pointer.
[0042] Those of ordinary skill in the art will appreciate with reference to the present disclosure that the example of FIG. 2 is for the purposes of illustration and that other implementations of determining a prior data amount to retain in a cache area may differ. For example, the logical distances between commands may instead be measured or calculated from an ending logical address for the requested cached data of a cache read command, rather than from a beginning logical address for the requested cached data as shown in FIG. 2. As another example variation, only backward logical distances may be considered in some implementations, instead of using both forward and backward logical distances.
[0043] Those of ordinary skill in the art will also appreciate with reference to the present disclosure that a different number of cache read commands may be used to determine a prior data amount for cache area 12A, which may be based on, for example, a predetermined number of initial cache read commands or a number of cache read commands received for cached data stored in cache area 12A during an initial timeframe of using cache area 12A to cache data for a particular read stream.
[0044] FIG. 3 illustrates releasing portions of cache area 12A at two different times based on the logical locations of the cache hit pointer and the prior data amount according to one or more embodiments. As shown in the top portion of FIG. 3, portion 201 of cache area 12A1 is released at a first time or instance of cache area 12A. Portion 201 is made available to store other data based on the logical location of a cache read command, Cmd5, which is pointed to by cache hit pointer location P5. The released portion 201 is also determined or defined based on the prior data amount set for cache area 12A for an amount of earlier-cached data to retain in cache area 12A that was stored in cache area 12A before the cached data requested by the current cache read command, Cmd5.
[0045] As noted above, the prior data amount is based on a cache access history for the cache area, such as a statistic relating to changes made to a cache hit pointer for a set of previous cache read commands (e.g., Cmd1, Cmd2, Cmd3, and Cmd4 in FIG. 2). The prior data amount can be used to increase the likelihood that cached data requested by a cache read command is still stored in the cache area, while releasing a portion of the cache area that is less likely to be accessed by a cache read command. In this regard, the prior data amount can be based on a workload for the particular read stream assigned to the cache area. In addition, the prior data amount may be adjusted based on more recent cache read commands, in some implementations, to more closely follow changes in the cache access history for the cache area. In some cases, the cache access history may depend on, for example, cache read commands received from a host executing an application that is generating the read commands for the read stream assigned to the cache area.
[0046] At a later point in time or a second instance of cache area 12A shown in the bottom portion of FIG. 3, portion 202 of cache area 12A is released based on the logical address of data requested by a second cache read command, Cmd6. The cache area has changed since the first instance shown in the top portion of FIG. 3 and is represented as cache area 12A2. As shown in FIG. 3, some additional data corresponding to larger LBA values has been stored in cache area 12A2 at the right end of the cache area, which represents data that has been added to cache area 12A for the read stream since the first point in time. In response to receiving cache read command Cmd6, the cache hit pointer is updated to cache hit pointer location P6, and the prior data amount extends back to lower-valued, logically addressed data to define the temporal and logical cutoff for released portion 202.
[0047] In the example of FIG. 3, the sizes of released portions 201 and 202 differ from each other, since they are based on the logical locations of the cached data requested by the two different cache read commands, Cmd5 and Cmd6. Notably, the prior data amount remains the same for both instances of cache area 12A1 and cache area 12A2. In some implementations, the prior data amount may be adjusted or updated for a predetermined number of cache read commands, such as for every ten cache read commands received for the cache area.
[0048] Those of ordinary skill in the art will appreciate with reference to the present disclosure that the example of FIG. 3 is for the purposes of illustration and that other implementations of releasing a portion of a cache area may differ. For example, the prior data amount may be set to zero or may not be used for certain read streams or cache areas. In such cases, the cache hit pointer location may determine the released portion of the cache area. With reference to FIG. 3, released portions 201 and 202 would then increase to include the additional portions of the cache area immediately to the left of cache hit pointer locations P5 and P6, respectively.
[0049] FIG. 4 illustrates memory pool 18 including released cache area portions according to one or more embodiments. As shown in FIG. 4, cache areas 12A, 12B, 12C, and 12D include released portions 20A, 20B, 20C, and 20D, respectively. Memory pool 18 includes the released portions, which are depicted in FIG. 4 as released portions 20A′, 20B′, 20C′, and 20D′ after having been designated as part of memory pool 18.
[0050] As shown in FIG. 4, the sizes of the released portions for each of the cache areas can differ due to, for example, different cache hit pointer locations and / or different prior data amounts set for each of the cache areas. In this regard, each cache area is assigned to a different read stream and stores data read for the read stream from at least one disk of the DSD corresponding to different non-sequential ranges of logical addresses.
[0051] When a new read stream is received for a new range of logical addresses, the DSD may use a set amount of memory from memory pool 18 to store cached data for the read stream. In some cases, the new read stream may be identified by one or more new read commands from a host for data corresponding to a range of logical addresses that is not sequential to any of the current ranges of logical addresses stored in cache areas 12A to 12D.
[0052] The physical memory locations for memory pool 18 may be scattered across different portions of one or memories of the DSD, such as in different banks of a DRAM or in different dies of a flash memory. In some cases, memory pool 18 may also include available memory from cache areas that may have been released in their entirety due to a read stream becoming inactive, such as by not having any new read commands for a predetermined time period.
[0053] Those of ordinary skill in the art will appreciate with reference to the present disclosure that the example of FIG. 4 is for the purposes of illustration and that other implementations of using a memory pool may differ. For example, the number of cache areas and released portions may vary depending on the number of active read streams and cache access activity.Example Processes
[0054] FIG. 5 is a flowchart for a cache area management process according to one or more embodiments. The process of FIG. 5 can be performed by, for example, circuitry 166 of DSD 100 executing cache manager 10 in FIG. 1. In this regard, circuitry 166 and / or other circuitry of DSD 100 such as AE module 160 can, in some implementations, comprise a means for performing the functions of the cache area management process of FIG. 5.
[0055] In block 502, at least one read command is received from one or more hosts requesting data stored on at least one disk of the DSD. The read command may, for example, specify a starting logical address and a range of logical addresses following the starting logical address, or may provide beginning and ending logical addresses for the range.
[0056] In block 504, data read for the at least one read command is stored in a cache area of at least one memory of the DSD. In this regard, the circuitry may designate or otherwise establish the cache area, which may correspond to a predetermined amount of storage capacity allocated to each read stream or may be based on a priority of the read stream or the size of the data requested by the at least one read command. Read commands may continue to be received for the read stream. Typically, such read commands will be for data corresponding to logical addresses that sequentially follow requested data for the read stream and can be stored in the same cache area in the order that the data is requested or prefetched.
[0057] In block 506, a cache read command is received requesting cached data stored in the cache area that corresponds to at least one logical address. The cache read command is considered a cache hit since the requested data is stored in the cache area and can be returned to the host faster than reading the data from the at least one disk. In some implementations, a cache hit pointer for the cache area is updated to point to the at least one logical address for the cached data requested by the cache read command.
[0058] In block 508, a portion of the cache area is released in response to the cache read command to make the released portion available to store other data. The determination of how much of the cache area to release is based, at least in part, on at least one of a prior data amount set for the cache area and the at least one logical address for the cached data requested by the cache read command. The released portion may be added to a memory pool that can be repurposed for a new cache area for a new thread or read stream.
[0059] As discussed above, the prior data amount can be based on a cache access history for the cache area. The cache access history may be determined using cache access information collected over multiple cache read commands for the cache area or read stream to indicate a particular workload for the read stream or cache area.
[0060] The prior data amount may be based on the changes to logical addresses pointed to by a cache hit pointer for a most recent cache read command for the cache area. Such changes can include, for example, an average change in logical addresses for cache data requested from each cache read command to a next cache read command, a standard deviation in the change in logical addresses for cached data requested from each cache read command to a next cache read command, and / or a greatest change in logical addresses for cached data requested for one cache read command to a next cache read command of a plurality of previous cache read commands. The number of backward cache hit pointer changes may also be used to determine the prior data amount, such as by providing a weight factor to be multiplied with a statistical value. The number of backward cache hit pointer changes may also be used to enable or disable use of a prior data amount in releasing portions of the cache area.
[0061] Those of ordinary skill in the art will appreciate with reference to the present disclosure that other implementations of the cache area management process of FIG. 5 are possible. For example, the storing of cached data in the cache area in block 504 may overlap with the performance of block 506 as more read commands are received for the read stream. In addition, a portion of the cache area, such as a fixed LRU portion, may be released without receiving any cache read commands if the cache area reaches a threshold amount of data and more memory is needed to cache data for the read stream.
[0062] FIG. 6 is a flowchart for a multiple cache area management process according to one or more embodiments. The process of FIG. 6 can be performed by, for example, circuitry 166 of DSD 100 executing cache manager 10 in FIG. 1. In this regard, circuitry 166 and / or other circuitry of DSD 100 such as AE module 160 can, in some implementations, comprise a means for performing the functions of the multiple cache area management process of FIG. 6. In some implementations, the cache area management process of FIG. 5 discussed above for a single cache area can be a sub-process of the multiple cache area management process of FIG. 6.
[0063] In block 602 of FIG. 6, a plurality of read commands is received from one or more hosts. Each read command requests data corresponding to different logical address ranges that are stored on at least one disk of the DSD. The different read commands can come at different times and result in the establishment or designation of different cache areas at different times.
[0064] In block 604, the data corresponding to the different ranges of logical addresses or different read streams is stored in different respective cache areas. As noted above, additional read commands may be received for one or more of the established read streams to request additional data stored on the at least one disk. This data may be read from the at least one disk and stored in the cache area for that read stream as the cache area becomes filled with cached data.
[0065] In block 606, a cache hit pointer is provided for each cache area to point to at least one last-requested logical address for last-requested cached data that is requested by a most recent cache read command for the cache area. The logical addresses pointed to by the cache hit pointers for the cache areas may be stored in a memory of the DSD with other cache area information, such as a prior data amount for each cache area or statistical information representing a cache access history for each cache area.
[0066] In block 608, a respective prior data amount to retain in each cache area that was stored before the last requested cached data is determined based on a cache access history of the cache area. In some implementations, a predetermined number of previous cache read commands may be received for the cache area before determining the prior data amount for the cache area. In such implementations, a fixed prior data amount may be used until it can be updated or adjusted based on the predetermined number of previous cache read commands.
[0067] As noted above, the prior data amount for the cache area can be determined using, for example, an average change in logical addresses for cached data requested from each cache read command to a next cache read command of the previous cache read commands, a standard deviation in the change in logical addresses for cached data requested from each cache read command to a next cache read command of the previous cache read commands, and / or a greatest change in logical addresses for cached data requested for one cache read command to a next cache read command of the previous cache read commands. The number of backward cache hit pointer changes may also be used to determine the prior data amount, such as by providing a weight factor multiplied with a statistical value. The number of backward cache hit pointer changes may also be used to enable or disable the use of the prior data amount.
[0068] In block 610, a cache read command is received requesting cached data stored in a first cache area of the different cache areas of block 604. The cache hit pointer for the first cache area is updated to point to at least one logical address for the cached data requested by the cache read command, which is referred to in block 610 as the at least one last-requested logical address. The cache read command requests cached data that has already been stored in the first cache area, either as part of previously-requested data by a read command or as prefetched data cached in the first cache area in anticipation of this data being requested.
[0069] In block 612, a portion of the first cache area is released to a memory pool to make the released portion available for storing other data. The released portion is determined based, at least in part, on the prior data amount determined for the first cache area and / or the at least one last-requested logical address for the first cache area, which corresponds to the logical address(es) pointed to by the cache hit pointer for the first cache area.
[0070] As noted above, the use of cache access history for each cache area, which can include the logical addresses pointed to by cache hit pointers for the cache areas, can better tailor management of the different cache areas to the particular cache read requests received for the cache area. This can provide a more efficient use of the cache areas and improve the read performance of the DSD by discarding or reusing portions of the cache areas that are least likely to store cached data that will be requested again by a cache read command.
[0071] Those of ordinary skill in the art will appreciate with reference to the present disclosure that other implementations of the multiple cache area management process of FIG. 6 are possible. For example, multiple cache read commands may be received for one or more of the cache areas. As another example, the performance of any of the blocks of FIG. 6 may overlap with the performance of other blocks in FIG. 6.
[0072] FIG. 7 is a flowchart for a prior data amount determination process according to one or more embodiments. The process of FIG. 7 can be performed by, for example, circuitry 166 of DSD 100 executing cache manager 10 in FIG. 1. In this regard, circuitry 166 and / or other circuitry of DSD 100 such as AE module 160 can, in some implementations, comprise a means for performing the functions of the prior data amount determination process of FIG. 7.
[0073] The prior data amount determination process may be performed after creating a new cache area, after a predetermined amount of data has been cached in the cache area, after a predetermined period of time, or after a predetermined number of cache read commands. In some implementations, a default value may be used for the prior data amount until enough cache read commands have been received to determine a cache access history for the cache area. The predetermined data amount may then be updated or adjusted to better represent a current workload for the read cache.
[0074] In block 702, a cache hit pointer is updated to point to at least one last logical address for last-requested cached data in a cache area. The last-requested cached data is for a most recent cache read command received by the circuitry from a plurality of cache read commands received for the cache area. As noted above, a cache read command refers to a request for cached data that is already stored in the cache area.
[0075] In block 704, the number of backward cache hit pointer changes is determined for the plurality of cache read commands. As discussed above, a backward cache hit pointer change is in response to receiving a cache read command for cached data that was stored in the cache area before cached data requested by an immediately-preceding cache read command received for the cache area. The circuitry may keep track of the number of backward cache hit pointer changes for the plurality of cache read commands, such as by storing the number of backward changes in a data structure stored in the DSD (e.g., as part of cache area information 16 in FIG. 1).
[0076] In some implementations, the circuitry may also keep track of the number of forward cache hit pointer changes for the plurality of cache read commands. A forward cache hit pointer change is in response to receiving a cache read command for cached data that was stored in the cache area after cached data requested by an immediately-preceding cache read command received for the cache area.
[0077] In block 706, a prior data amount is set for the cache area based, at least in part, on the determined number of backward cache hit pointer changes. In some implementations, the number of backward cache hit pointer changes may be divided by a total number of the plurality of cache read commands to provide a percentage of the amount of cache read commands that move the cache hit pointer backwards. In such implementations, this ratio may be used to weight a statistical value calculated based on the cache access history represented by the plurality of cache read commands (e.g., an average logical distance, a standard deviation in logical distance, or a greatest logical distance covered by successive cache read commands). In other cases, the ratio may be used to set a default prior data amount, such as if the ratio falls below a lower threshold or exceeds an upper threshold.
[0078] In other implementations, a ratio of the number of backward cache hit pointer changes to the number of forward cache hit pointer changes may be used to weight a statistical value calculated based on the cache access history. In other cases, the ratio may be used to set a default prior data amount, such as if the ratio falls below a lower threshold or exceeds an upper threshold.
[0079] Those of ordinary skill in the art will appreciate with reference to the present disclosure that other implementations of the prior data amount determination process of FIG. 7 are possible. For example, the process of FIG. 7 may be performed repeatedly or may not be performed in implementations where the prior data amount may be a set default amount or where a prior data amount is not used to determine how much of a cache area to release before a cache hit pointer location.
[0080] FIG. 8 is a flowchart for a new cache area creation process according to one or more embodiments. The process of FIG. 8 can be performed by, for example, circuitry 166 of DSD 100 executing cache manager 10 in FIG. 1. In this regard, circuitry 166 and / or other circuitry of DSD 100 such as AE module 160 can, in some implementations, comprise a means for performing the functions of the new cache area creation process of FIG. 8.
[0081] In block 802, at least a portion of a cache area (e.g., a portion of a cache area 12 in FIG. 4) is released to a memory pool (e.g., memory pool 18 in FIG. 4) that is made available for storing data. The released portion can include a portion released based on the cache management policy discussed above that is in response to a change in a cache hit pointer location, or may include an entire cache area due to a read stream assigned to the cache area becoming inactive or otherwise timing out.
[0082] In block 804, at least one new read command is received from one or more hosts requesting data stored on at least one disk of the DSD. The data requested by the at least one new read command corresponds to a new range of logical addresses that is different from a range of logical addresses that may be related to a currently-active read stream assigned to a current cache area. In some implementations, there may not be any currently-active read streams that are assigned to cache areas, and the at least one new read command may form the only active read stream.
[0083] In block 806, at least a portion of the memory pool is used to designate a new cache area assigned to the new read stream. The data read from the at least one disk for the at least one new read command can be stored in the newly created or designated cache area for the new read stream. As noted above with reference to the example of FIG. 4, different physical memory locations in the memory pool can be logically grouped together, such as through a logical addressing of the new cache area to designate the new cache area. In some implementations, the initial size of the cache area can be based on a predetermined default size for cache areas. In other cases, the initial size of the new cache area may be based on a priority of the at least one new read command, which may be indicated by the one or more hosts sending the at least one new read command, or the initial size may be based on the amount of data requested by the at least one new read command. If there is not enough memory available in the memory pool, the circuitry may release a LRU portion from each current cache area or may release a LRU cache area in its entirety.
[0084] Those of ordinary skill in the art will appreciate with reference to the present disclosure that other implementations of the new cache area creation process of FIG. 8 are possible. For example, block 802 may be omitted in cases where there may not be any active read streams assigned to a cache area.
[0085] The foregoing cache management policies based on the cache access history of individual cache areas improve the efficiency of read cache usage, as compared to using only conventional LRU cache policies. The foregoing cache management policies can also improve the overall read performance of the DSD since the data stored in the cache areas is more likely to be accessed for cache read commands, as compared to data that is retained in a read cache that is unlikely to be accessed based on a particular read stream workload.Other Embodiments
[0086] Those of ordinary skill in the art will appreciate that the various illustrative logical blocks, modules, and processes described in connection with the examples disclosed herein may be implemented as electronic hardware, computer software, or combinations of both. Furthermore, the foregoing processes can be embodied on a computer readable medium, which causes processor or controller circuitry to perform or execute certain functions.
[0087] To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, and modules have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Those of ordinary skill in the art may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
[0088] The various illustrative logical blocks, units, modules, processor circuitry, and controller circuitry described in connection with the examples disclosed herein may be implemented or performed with a general purpose processor, a GPU, a DSP, an ASIC, an FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof designed to perform the functions described herein. A general-purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. Processor or controller circuitry may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, an SoC, one or more microprocessors in conjunction with a DSP core, or any other such configuration.
[0089] The activities of a method or process described in connection with the examples disclosed herein may be embodied directly in hardware, in a software module executed by processor or controller circuitry, or in a combination of the two. The steps of the method or algorithm may also be performed in an alternate order from those provided in the examples. A software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, hard disk, removable media, optical media, or any other form of storage medium known in the art. An exemplary storage medium is coupled to processor or controller circuitry such that the processor or controller circuitry can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to processor or controller circuitry. The processor or controller circuitry and the storage medium may reside in an ASIC or an SoC.
[0090] The foregoing description of the disclosed example embodiments is provided to enable any person of ordinary skill in the art to make or use the embodiments in the present disclosure. Various modifications to these examples will be readily apparent to those of ordinary skill in the art, and the principles disclosed herein may be applied to other examples without departing from the spirit or scope of the present disclosure. The described embodiments are to be considered in all respects only as illustrative and not restrictive. In addition, the use of language in the form of “at least one of A and B” in the following claims should be understood to mean “only A, only B, or both A and B.”
Claims
1. A Data Storage Device (DSD), comprising:at least one disk configured to store data;at least one head configured to read data from the at least one disk;at least one memory configured to store data read from the at least one disk in a cache area of the at least one memory; andcircuitry configured to:receive at least one read command from one or more hosts requesting data stored on the at least one disk;store, in the cache area of the at least one memory, data read from the at least one disk for the at least one read command;determine a prior data amount to retain in the cache area based on a cache access history of the cache area;receive a cache read command requesting cached data stored in the cache area; andrelease a portion of the cache area to make the portion available to store other data based, at least in part, on the determined prior data amount to retain that was stored in the cache area before the requested cached data for the cache read command.
2. The DSD of claim 1, wherein the circuitry is further configured to:receive a plurality of read commands from the one or more hosts, each read command of the plurality of read commands requesting data stored on the at least one disk corresponding to different ranges of logical addresses;store the data corresponding to the different ranges of logical addresses in respective cache areas of the at least one memory; andfor each cache area of the respective cache areas:determine a respective prior data amount to retain in the cache area that was stored in the cache area before last-requested cached data that was most recently requested by a most recent cache read command for the cache area, wherein the respective prior data amount is determined based on a cache access history of the cache area.
3. The DSD of claim 2, wherein the circuitry is further configured to:receive a first cache read command requesting cached data stored in a first cache area of the respective cache areas; andrelease a portion of the first cache area to make the portion available for storing other data based, at least in part, on the respective prior data amount determined for the first cache area.
4. The DSD of claim 1, wherein the at least one read command requests data corresponding to a first range of logical addresses; andwherein the circuitry is further configured to:release the portion of the cache area to a memory pool made available for storing data;receive at least one new read command from the one or more hosts requesting data stored on the at least one disk corresponding to a second range of logical addresses different from the first range of logical addresses; anduse at least a portion of the memory pool for a new cache area to store the data for the at least one new read command.
5. The DSD of claim 1, wherein the circuitry is further configured to:determine the prior data amount based, at least in part, on changes in logical addresses for cached data requested for a plurality of previous cache read commands.
6. The DSD of claim 5, wherein the prior data amount is determined based on at least one of:an average change in logical addresses for cached data requested from each cache read command to a next cache read command of the plurality of previous cache read commands,a standard deviation in the change in logical addresses for cached data requested from each cache read command to a next cache read command of the plurality of previous cache read commands, anda greatest change in logical addresses for cached data requested for one cache read command to a next cache read command of the plurality of previous cache read commands.
7. The DSD of claim 1, wherein the circuitry is further configured to:receive a second cache read command requesting cached data stored in the cache area; andrelease a second portion of the cache area to make the second portion available to store other data based, at least in part, on the prior data amount to retain in the cache area that was stored in the cache area before the cached data requested for the second cache read command.
8. The DSD of claim 1, wherein the circuitry is further configured to adjust the prior data amount based on recent cache read commands requesting cached data stored in the cache area.
9. The DSD of claim 1, wherein the circuitry is further configured to:update, for each cache read command of a plurality of cache read commands, a cache hit pointer to point to at least one last logical address for last-requested cached data stored in the cache area that was requested by a most recent cache read command of the plurality of cache read commands;determine, for the plurality of cache read commands, a number of backward cache hit pointer changes, wherein each backward cache hit pointer change updates the cache hit pointer to point to at least one earlier logical address for earlier-cached data stored in the cache area; andset the prior data amount based, at least in part, on the determined number of backward cache hit pointer changes.
10. A method for a Data Storage Device (DSD) including at least one disk configured to store data, the method comprising:receiving at least one read command from one or more hosts requesting data stored on the at least one disk;storing, in a cache area of at least one memory of the DSD, data read from the at least one disk for the at least one read command;receiving a cache read command requesting cached data stored in the cache area that corresponds to at least one logical address;determining a prior data amount to retain in the cache area that precedes the at least one logical address in terms of logical addresses; andreleasing a portion of the cache area to make the portion available to store other data based, at least in part, on the at least one logical address and the determined prior data amount.
11. The method of claim 10,wherein the prior data amount is determined based on a cache access history of the cache area.
12. The method of claim 10, further comprising:receiving a plurality of read commands from the one or more hosts, each read command of the plurality of read commands requesting data stored on the at least one disk corresponding to different ranges of logical addresses;storing the data corresponding to the different ranges of logical addresses in respective cache areas of the at least one memory; andfor each cache area of the respective cache areas:providing a cache hit pointer to point to at least one last-requested logical address for last-requested cached data stored in the cache area that is most recently requested by a most recent cache read command for the cache area; anddetermining a respective prior data amount to retain in the cache area that was stored in the cache area before the last-requested cached data, wherein the respective prior data amount is determined based on a cache access history of the cache area.
13. The method of claim 12, further comprising:receiving a first cache read command requesting cached data stored in a first cache area of the respective cache areas; andreleasing a portion of the first cache area to make the portion available for storing other data based, at least in part, on the respective prior data amount determined for the first cache area and the at least one last-requested logical address pointed to by the cache pointer for the first cache area.
14. The method of claim 10, wherein the at least one read command requests data corresponding to a first range of logical addresses; andwherein the method further comprises:releasing the portion of the cache area to a memory pool made available for storing data;receiving at least one new read command from the one or more hosts requesting data stored on the at least one disk corresponding to a second range of logical addresses different from the first range of logical addresses; andusing at least a portion of the memory pool for a new cache area to store the data for the at least one new read command.
15. The method of claim 10, further comprising:determining the released portion of the cache area based, at least in part, on changes in logical addresses for cached data requested for a plurality of previous cache read commands.
16. The method of claim 15, wherein the released portion of the cache area is determined based on at least one of:an average change in logical addresses for cached data requested from each cache read command to a next cache read command of the plurality of previous cache read commands,a standard deviation in the change in logical addresses for cached data requested from each cache read command to a next cache read command of the plurality of previous cache read commands, anda greatest change in logical addresses for cached data requested from one cache read command to a next cache read command of the plurality of previous cache read commands.
17. The method of claim 10, further comprising:receiving a second cache read command requesting cached data stored in the cache area that corresponds to at least one other logical address; andreleasing a second portion of the cache area to make the second portion available to store other data, wherein the released second portion is determined based, at least in part, on the at least one other logical address.
18. The method of claim 10, further comprising:adjusting the prior data amount based on recent cache read commands requesting cached data stored in the cache area.
19. The method of claim 10, further comprising:updating, for each cache read command of a plurality of cache read commands, a cache hit pointer to point to at least one last logical address for last-requested cached data stored in the cache area that was requested by a most recent cache read command of the plurality of cache read commands;determining, for the plurality of cache read commands, a number of backward cache hit pointer changes, wherein each backward cache hit pointer change updates the cache hit pointer to point to at least one earlier logical address for earlier-cached data stored in the cache area; andsetting the prior data amount based, at least in part, on the determined number of backward cache hit pointer changes.
20. A Data Storage Device (DSD), comprising:at least one disk configured to store data;at least one head configured to read data from the at least one disk;at least one memory configured to store data read from the at least one disk in a cache area of the at least one memory; andmeans for:receiving at least one read command from one or more hosts requesting data stored on the at least one disk;storing, in the cache area of the at least one memory, data read from the at least one disk for the at least one read command;determining a prior data amount to retain in the cache area based on a cache access history of the cache area;receiving a cache read command requesting cached data stored in the cache area; andreleasing a portion of the cache area to make the portion available to store other data based, at least in part, on the determined prior data amount to retain in the cache area that was stored in the cache area before the requested cached data for the cache read command.
