# US 9,436,606 B2 · System and method to defragment a memory

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

- Number: US 9,436,606 B2
- Document ID: US9436606B2
- Status: Granted
- Kind: B2
- Application number: 14/146,576
- Filed: 2014-01-02
- Published: 2015-07-02
- Granted: 2016-09-06
- Earliest claimed: 2014-01-02
- Assignees: QUALCOMM Incorporated
- Applicants: QUALCOMM Incorporated
- Inventors: Xiangyu Dong; Jungwon Suh
- Web page: https://patentgrep.com/patent/US9436606B2

## CPC

- G06F 12/0833: {in combination with broadcast means (e.g. for invalidation or updating)}
- G06F 3/0608: {Saving storage space on storage systems}
- G06F 12/0873: Mapping of cache memory to specific storage devices or parts thereof
- G06F 12/0895: of parts of caches, e.g. directory or tag array
- G06F 12/12: Replacement control
- G06F 2206/1004: Defragmentation
- Y02D 10/00: Energy efficient computing, e.g. low power processors, power management or thermal management
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- Y02D: CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE

## Abstract

A system and method to defragment a memory is disclosed. In a particular embodiment, a method includes loading data stored at a first physical memory address of a memory from the memory into a cache line of a data cache. The first physical memory address is mapped to a first virtual memory address. The method further includes initiating modification, at the data cache, of lookup information associated with the first virtual memory address so that the first virtual memory address corresponds to a second physical memory address of the memory. The method also includes modifying, at the data cache, information associated with the cache line to indicate that the cache line corresponds to the second physical memory address instead of the first physical memory address.

## Claims

### Claim 1

A method comprising:
loading data stored at a first physical memory address of a memory from the memory into a cache line of a data cache, wherein the first physical memory address is mapped to a first virtual memory address;
initiating modification, of lookup information stored in a page table, the page table associated with a virtual memory, the lookup information associated with the first virtual memory address, wherein the modification of the lookup information remaps the first virtual memory address from the first physical memory address to a second physical memory address of the memory; and
modifying, at the data cache, information associated with the cache line to indicate that the cache line corresponds to the second physical memory address instead of the first physical memory address.

### Claim 2 (depends on 1)

The method of claim 1, further comprising:
receiving, at the data cache, a request from a processor to perform a defragmentation operation;
in response to the data being evicted from the data cache, writing the data to the second physical memory address based on the modified information; and
sending a response to the processor after writing the data to the second physical memory address, the response indicating that the defragmentation operation is complete.

### Claim 3 (depends on 2)

The method of claim 2, wherein the request is received in response to a load and remap instruction, and wherein an instruction set of the processor includes the load and remap instruction.

### Claim 4 (depends on 1)

The method of claim 1, wherein the memory is organized into pages, wherein a page of the memory spans multiple sets of the cache, and wherein the cache includes multiple segments for each page, the method further comprising:
loading, responsive to a cache hit associated with the first physical memory address, the data from a first segment of the cache corresponding to the first physical address to a second segment of the cache corresponding to the second physical address; and
loading, based on a cache miss associated with the first physical memory address, the data from the memory into the second segment corresponding to the second physical address.

### Claim 5 (depends on 1)

The method of claim 1, wherein modifying the information associated with the cache line comprises modifying tag information in a tag array associated with the cache line.

### Claim 6 (depends on 1)

The method of claim 1, wherein modifying the information associated with the cache line comprises overwriting first tag information in a tag array corresponding to the first physical memory address with second tag information corresponding to the second physical memory address.

### Claim 7 (depends on 1)

The method of claim 1, further comprising triggering writing of the data to the second physical memory address.

### Claim 8 (depends on 7)

The method of claim 7, wherein triggering the writing of the data to the second physical memory address comprises marking the cache line as dirty.

### Claim 9 (depends on 1)

The method of claim 1, wherein the first physical memory address corresponds to a memory fragment, and wherein the second physical memory address corresponds to a defragmentation destination.

### Claim 10 (depends on 9)

The method of claim 9, wherein the defragmenting destination corresponds to a free physical address in the memory that is located between physical addresses that store data.

### Claim 11 (depends on 1)

The method of claim 1, further comprising:
copying the data from the cache line to a second cache line; and
invalidating the cache line, wherein the cache line is associated with a first segment of the memory, and wherein the second cache line is associated with a second segment of the memory.

### Claim 12 (depends on 1)

The method of claim 1, further comprising entering a partial array self-refresh mode that includes reducing power to a portion of dynamic random access memory (DRAM) that corresponds to the first physical memory address.

### Claim 13 (depends on 1)

The method of claim 1, further comprising modifying the lookup information included in the page table, wherein the lookup information comprises a pointer of the page table.

### Claim 14 (depends on 1)

The method of claim 1, further comprising:
loading second data stored at a third physical memory address of the memory from the memory into a second cache line of the data cache, wherein the third physical memory address is mapped to a third virtual memory address;
modifying, at the data cache, second information associated with the second cache line to indicate that the second cache line corresponds to a fourth physical memory address instead of the third physical memory address; and
writing the second data to the fourth physical memory address based on the modified second information.

### Claim 15 (depends on 1)

The method of claim 1, further comprising:
loading additional data stored at each of a first plurality of additional physical memory addresses corresponding to a page of the memory into additional cache lines of the data cache;
modifying, at the data cache, additional information associated with each of the additional cache lines to indicate that each additional cache line corresponds to a respective physical memory address of a second plurality of additional physical memory addresses instead of the first plurality of additional physical memory addresses; and
writing the additional data to the second plurality of additional physical memory addresses based on the modified additional information.

### Claim 16 (depends on 1)

The method of claim 1, wherein modifying the information associated with the cache is initiated by a processor integrated into an electronic device.

### Claim 17

A system comprising:
a memory comprising a plurality of physical memory addresses;
a memory management unit (MMU) configured to store a page table associated with a virtual memory, the page table including lookup information associated with a first virtual memory address; and
a data cache that includes a defragmentation circuit configured to perform a memory defragmentation operation comprising:
loading data stored at a first physical memory address of the memory from the memory into a cache line of the data cache, wherein the first physical memory address is mapped to the first virtual memory address;
initiating modification of the lookup information, wherein the modification of the lookup information remaps the first virtual memory address from the first physical memory address to a second physical memory address of the memory; and
modifying information associated with the cache line to indicate that the cache line corresponds to the second physical memory address instead of the first physical memory address.

### Claim 18 (depends on 17)

The system of claim 17, further comprising a processor, wherein the data cache is further configured to receive a request from the processor to perform the memory defragmentation operation and to send a response to the processor indicating that the memory defragmentation operation is complete.

### Claim 19 (depends on 18)

The system of claim 18, wherein the response includes an interrupt signal, and wherein the cache performs the defragmentation operation while the processor performs operations unrelated to the defragmentation operation.

### Claim 20 (depends on 18)

The system of claim 18, wherein the defragmentation circuit is configured to perform the memory defragmentation operation in response to the request.

### Claim 21 (depends on 18)

The system of claim 18, wherein the defragmentation circuit is configured to perform the memory defragmentation operation in response to a data request received from the processor.

### Claim 22 (depends on 17)

The system of claim 17, further comprising at least one additional cache, wherein the data cache is a last level cache coupled between a main memory and a second level cache, wherein initiating the modification includes issuing a command to the MMU, and wherein the MMU is configured to perform the modification responsive to the command.

### Claim 23 (depends on 17)

The system of claim 17, wherein the data cache comprises a dedicated defragmentation cache coupled to a main memory and to a processor.

### Claim 24 (depends on 17)

The system of claim 17, wherein the first physical memory address corresponds to a memory fragment, and wherein the second physical memory address corresponds to a defragmentation destination.

### Claim 25 (depends on 17)

The system of claim 17, further comprising an electronic device selected from a mobile phone, a tablet, a computer, a communications device, a set-top box, a music player, a video player, an entertainment unit, a navigation device, a personal digital assistant (PDA), and a fixed location data unit into which the memory and the data cache are integrated.

### Claim 26

A non-transitory computer-readable medium comprising instructions that, when executed by a processor, cause the processor to perform operations comprising:
loading data stored at a first physical memory address of a memory from the memory into a cache line of a data cache, wherein the first physical memory address is mapped to a first virtual memory address;
initiating modification of lookup information stored in a page table, the page table associated with a virtual memory, the lookup information associated with the first virtual memory address, wherein the modification of the lookup information remaps the first virtual memory address from the first physical memory address to a second physical memory address of the memory; and
modifying information associated with the cache line to indicate that the cache line corresponds to the second physical memory address instead of the first physical memory address.

### Claim 27 (depends on 26)

The non-transitory computer-readable medium of claim 26, wherein the first physical memory address corresponds to a memory fragment, and wherein the second physical memory address corresponds to a defragmentation destination.

### Claim 28

A system comprising:
means for storing data using a plurality of physical memory addresses; and
means for caching data, wherein the means for caching the data includes a defragmentation circuit configured to:
load data stored at a first physical memory address of a memory from the memory into a cache line of a data cache, wherein the first physical memory address is mapped to a first virtual memory address;
initiate modification of lookup information stored in a page table, the page table associated with a virtual memory, the lookup information associated with the first virtual memory address, wherein the modification of the lookup information remaps the first virtual memory address from the first physical memory address to a second physical memory address of the memory; and
modify information associated with the cache line to indicate that the cache line corresponds to the second physical memory address instead of the first physical memory address.

### Claim 29 (depends on 28)

The system of claim 28, integrated into at least one die.

### Claim 30 (depends on 29)

The system of claim 29, wherein the first physical memory address corresponds to a memory fragment, and wherein the second physical memory address corresponds to a defragmentation destination.
