# US 2017/0371807 A1 · Cache data determining method and apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2017/0371807 A1
- Document ID: US20170371807A1
- Status: Published application
- Kind: A1
- Application number: 15/699,406
- Filed: 2017-09-08
- Published: 2017-12-28
- Earliest claimed: 2015-03-11
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Yunpeng CHAI; Dongwang SUN
- Web page: https://patentgrep.com/patent/US20170371807A1

## CPC

- G06F 12/121: using replacement algorithms
- G06F 12/0871: Allocation or management of cache space
- G06F 12/0888: using selective caching, e.g. bypass
- G06F 12/0891: using clearing, invalidating or resetting means
- G06F 12/0862: with prefetch
- G06F 12/0897: with two or more cache hierarchy levels (with multilevel cache hierarchies G06F12/0811)
- G06F 2212/1021: Hit rate improvement
- G06F 2212/1036: Life time enhancement
- G06F 2212/222: Non-volatile memory
- G06F 2212/502: using adaptive policy
- G06F 2212/60: Details of cache memory
- G06F 2212/6022: Using a prefetch buffer or dedicated prefetch cache
- G06F 2212/6024: History based prefetching
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

The present embodiments provide a cache data determining method and apparatus, and pertain to the field of computer technologies. The method includes: acquiring a data identifier of read cache miss data; selecting, based on the acquired data identifier, a data identifier of to-be-determined data; recording data identifiers by groups; collecting statistics on quantities of occurrence times, in each group, of the data identifiers; and selecting target to-be-determined data according to the quantities of occurrence times, and determining the target to-be-determined data as cache miss data to be written into a cache memory. Data identifiers are recorded by groups, and after statistics on quantities of occurrence times, in each group, of the data identifiers is collected, target to-be-determined data is selected according to the quantities of occurrence times, and the target to-be-determined data is determined as cache miss data to be written into a cache memory.

## Claims

### Claim 1

A cache data determining method, wherein the method comprises:
acquiring a data identifier of read cache miss data, wherein the data identifier is used to differentiate different cache miss data;
selecting, based on the acquired data identifier of the read cache miss data, a data identifier of to-be-determined data;
recording data identifiers of to-be-determined data by groups;
collecting statistics on quantities of occurrence times, in each group, of the data identifiers of the to-be-determined data; and
selecting target to-be-determined data according to the quantities of occurrence times, and determining the target to-be-determined data as cache miss data to be written into a cache memory.

### Claim 2 (depends on 1)

The method according to claim 1, wherein each group comprises a time window sequence, wherein the time window sequence comprises at least two time windows, each time window comprises a first preset quantity of first storage units, and there are a second preset quantity of second storage units between every two time windows;
the recording data identifiers of to-be-determined data by groups comprises:
sequentially recording the data identifiers of the to-be-determined data respectively into first storage units in the time window sequence; and
the collecting statistics on quantities of occurrence times, in each group, of the data identifiers of the to-be-determined data comprises:
collecting statistics on quantities of occurrence times, in each time window of the time window sequence, of the data identifiers of the to-be-determined data.

### Claim 3 (depends on 2)

The method according to claim 2, wherein the collecting statistics on quantities of occurrence times, in each time window of the time window sequence, of the data identifiers of the to-be-determined data comprises:
collecting statistics on a quantity of first storage units, in each time window of the time window sequence, that record a same data identifier; and
determining, according to the quantity of the first storage units that record a same data identifier, the quantities of occurrence times, in each time window of the time window sequence, of the data identifiers of the to-be-determined data.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the collecting statistics on a quantity of first storage units, in each time window of the time window sequence, that record a same data identifier comprises:
when all first storage units in the time window sequence are filled, collecting statistics on the quantity of the first storage units, in each time window of the time window sequence, that record a same data identifier.

### Claim 5 (depends on 3)

The method according to claim 3, after the collecting statistics on a quantity of first storage units, in each time window of the time window sequence, that record a same data identifier, further comprising:
clearing the data identifiers stored in the first storage units in the time window sequence, so as to record, using the time window sequence, a data identifier that is of to-be-determined data and is selected in a subsequent data reading process.

### Claim 6 (depends on 1)

The method according to claim 1, wherein the selecting target to-be-determined data according to the quantities of occurrence times, and determining the target to-be-determined data as cache miss data to be written into a cache memory comprises:
selecting to-be-determined data whose quantity of occurrence times is not less than a preset threshold, using the to-be-determined data whose quantity of occurrence times is not less than the preset threshold as target to-be-determined data, and determining the target to-be-determined data as the cache miss data to be written into the cache memory.

### Claim 7 (depends on 1)

The method according to claim 1, after the selecting target to-be-determined data according to the quantities of occurrence times, and determining the target to-be-determined data as cache miss data to be written into a cache memory, further comprising:
adding a data identifier of the target to-be-determined data to a preset whitelist, wherein the preset whitelist comprises a fourth preset quantity of third storage units, and each third storage unit may record one data identifier of to-be-determined data; and
when subsequently read cache miss data hits target to-be-determined data corresponding to any one data identifier in the preset whitelist, writing the hit target to-be-determined data into the cache memory.

### Claim 8 (depends on 7)

The method according to claim 7, wherein the writing the hit target to-be-determined data into the cache memory comprises:
when storage space of the cache memory is not full, directly writing, according to a data size of the hit target to-be-determined data, the hit target to-be-determined data into the cache memory; and
when the storage space of the cache memory is full, evicting, according to a preset cache replacement algorithm, data stored in storage space with a size equal to the data size in the cache memory, and writing the hit target to-be-determined data to a storage location corresponding to the evicted data.

### Claim 9

A cache data determining apparatus, wherein the apparatus comprises:
an acquiring module, configured to acquire a data identifier of read cache miss data, wherein the data identifier is used to differentiate different cache miss data;
a selecting module, configured to select, based on the acquired data identifier of the read cache miss data, a data identifier of to-be-determined data;
a recording module, configured to record data identifiers of to-be-determined data by groups;
a statistics collecting module, configured to collect statistics on quantities of occurrence times, in each group, of the data identifiers of the to-be-determined data; and
a determining module, configured to select target to-be-determined data according to the quantities of occurrence times, and determine the target to-be-determined data as cache miss data to be written into a cache memory.

### Claim 10 (depends on 9)

The apparatus according to claim 9, wherein each group comprises a time window sequence, wherein the time window sequence comprises at least two time windows, each time window comprises a first preset quantity of first storage units, and there are a second preset quantity of second storage units between every two time windows;
the recording module is configured to sequentially record the data identifiers of the to-be-determined data respectively into first storage units in the time window sequence; and
the statistics collecting module is configured to collect statistics on quantities of occurrence times, in each time window of the time window sequence, of the data identifiers of the to-be-determined data.

### Claim 11 (depends on 10)

The apparatus according to claim 10, wherein the statistics collecting module comprises:
a statistics collecting unit, configured to collect statistics on a quantity of first storage units, in each time window of the time window sequence, that record a same data identifier; and
a determining unit, configured to determine, according to the quantity of the first storage units that record a same data identifier, the quantities of occurrence times, in each time window of the time window sequence, of the data identifiers of the to-be-determined data.

### Claim 12 (depends on 11)

The apparatus according to claim 11, wherein the statistics collecting unit is configured to: when all first storage units in the time window sequence are filled, collect statistics on the quantity of the first storage units, in each time window of the time window sequence, that record a same data identifier.

### Claim 13 (depends on 11)

The apparatus according to claim 11, wherein the statistics collecting module further comprises:
a clearing unit, configured to clear the data identifiers stored in the first storage units in the time window sequence, so as to record, using the time window sequence, a data identifier that is of to-be-determined data and is selected in a subsequent data reading process.

### Claim 14 (depends on 9)

The apparatus according to claim 9, wherein the determining module is configured to select to-be-determined data whose quantity of occurrence times is not less than a preset threshold, use the to-be-determined data whose quantity of occurrence times is not less than the preset threshold as target to-be-determined data, and determine the target to-be-determined data as the cache miss data to be written into the cache memory.

### Claim 15 (depends on 9)

The apparatus according to claim 9, wherein the apparatus further comprises:
an adding module, configured to add a data identifier of the target to-be-determined data to a preset whitelist, wherein the preset whitelist comprises a fourth preset quantity of third storage units, and each third storage unit may record one data identifier of to-be-determined data; and
a writing module, configured to: when subsequently read cache miss data hits target to-be-determined data corresponding to any one data identifier in the preset whitelist, write the hit target to-be-determined data into the cache memory.

### Claim 16 (depends on 15)

The apparatus according to claim 15, wherein the writing module is configured to:
when storage space of the cache memory is not full, directly write, according to a data size of the hit target to-be-determined data, the hit target to-be-determined data into the cache memory; and
when the storage space of the cache memory is full, evict, according to a preset cache replacement algorithm, data stored in storage space with a size equal to the data size in the cache memory, and write the hit target to-be-determined data to a storage location corresponding to the evicted data.
