# US 12,111,756 B2 · Systems, methods, and apparatus for wear-level aware memory allocation

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

- Number: US 12,111,756 B2
- Document ID: US12111756B2
- Status: Granted
- Kind: B2
- Application number: 17/396,550
- Filed: 2021-08-06
- Published: 2022-12-08
- Granted: 2024-10-08
- Earliest claimed: 2021-05-28
- Assignees: Samsung Electronics Co., Ltd.
- Applicants: Samsung Electronics Co., Ltd.
- Inventors: Heekwon Park; Yang Seok Ki
- Web page: https://patentgrep.com/patent/US12111756B2

## CPC

- G06F 12/023: {Free address space management}
- G06F 12/0246: {in block erasable memory, e.g. flash memory}
- G06F 2212/1036: Life time enhancement
- G06F 2212/2022: Flash memory
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method for memory allocation may include determining an amount of use for a first memory page, wherein the first memory page is mapped to a first page group of a first group level, a second memory page may be mapped to a second page group of the first group level, and the first memory page and the second memory page may be mapped to a third page group of a second group level, and selecting, based on an allocation request, the first memory page based on the amount of use. The amount of use may include a first amount of use, and the method may further include determining a second amount of use for the second memory page, wherein the first memory page may be selected based on the first amount of use and the second amount of use.

## Claims

### Claim 1

A method for memory allocation, the method comprising:
determining an amount of use for a first memory page, wherein the first memory page is mapped to a first page group of a first group level, a second memory page is mapped to a second page group of the first group level, and the first memory page and the second memory page are mapped to a third page group of a second group level;
selecting, based on an allocation request, the first memory page based on the amount of use, including searching a data structure based on the amount of use; and
selecting a free list based on searching the data structure, wherein the free list indicates a group of memory pages of a same wear out level and the selecting the first memory page from the free list is based on the group level of the first memory page.

### Claim 2 (depends on 1)

The method of claim 1, wherein the amount of use comprises a first amount of use, the method further comprising:
determining a second amount of use for the second memory page;
wherein the first memory page is selected based on the first amount of use and the second amount of use.

### Claim 3 (depends on 2)

The method of claim 2, wherein the first amount of use is based on a write count for the first memory page.

### Claim 4 (depends on 2)

The method of claim 2, wherein the first amount of use is based on an allocation count for the first memory page.

### Claim 5 (depends on 2)

The method of claim 2, further comprising associating the first memory page with the second group level based on the first amount of use and the second amount of use, wherein the second group level is a highest group level.

### Claim 6 (depends on 2)

The method of claim 2, wherein selecting the first memory page comprises:
searching a data structure based on the first amount of use; and
selecting a free list based on searching the data structure based on the first amount of use.

### Claim 7 (depends on 6)

The method of claim 6, wherein:
the data structure comprises a tree comprising a node for the first amount of use; and
the node comprises the free list.

### Claim 8 (depends on 6)

The method of claim 6, wherein selecting the first memory page further comprises selecting the first memory page from the free list based on the group level of the first memory page.

### Claim 9 (depends on 8)

The method of claim 8, wherein:
the first amount of use comprises a lowest amount of use; and
the group level of the first memory page comprises a highest group level.

### Claim 10 (depends on 9)

The method of claim 9, further comprising:
removing the first memory page from the free list; and
updating a page state map for the first memory page and the second memory page based on removing the first memory page from the free list.

### Claim 11 (depends on 10)

The method of claim 10, wherein an entry of the page state map comprises an amount of use.

### Claim 12 (depends on 2)

The method of claim 2, wherein the first memory page and the second memory page are consecutive memory pages, the method further comprising:
coalescing the first memory page and the second memory page to generate a group of coalesced memory pages based on the allocation request; and
allocating the group of coalesced memory pages to one or more processes.

### Claim 13 (depends on 12)

The method of claim 12, wherein selecting the first memory page and selecting the second memory page comprises:
searching a data structure based on the first amount of use; and
selecting a free list based on searching the data structure.

### Claim 14 (depends on 13)

The method of claim 13, wherein selecting the first memory page and selecting the second memory page further comprises:
selecting the first memory page from the free list based on the group level of the first memory page; and
selecting the second memory page comprises selecting a memory page that is consecutive with the first memory page.

### Claim 15 (depends on 13)

The method of claim 13, wherein selecting the free list comprises selecting a free list corresponding to a lowest amount of use having an available page corresponding to the group level for the first memory page.

### Claim 16 (depends on 2)

The method of claim 2, further comprising:
storing the first amount of use in a memory; and
reading, by a host memory allocator, the first amount of use;
wherein:
storing the first amount of use in the memory comprises storing, by a device, a first write count for the first memory page in the memory; and
the memory comprises a device-attached memory attached to the device.

### Claim 17

An apparatus comprising:
a memory allocator configured to:
select, based on an allocation request, a first memory page based on an amount of use, from a free list comprising a first entry for the first memory page at a group level and a second entry for a second memory page at the group level, wherein the selecting includes searching a data structure based on the amount of use and selecting the free list based on searching the data structure, wherein the free list indicates a group of memory pages of a same wear out level and the selecting the first memory page from the free list is based on the group level of the first memory page.

### Claim 18 (depends on 17)

The apparatus of claim 17, wherein the group level comprises a first group level, and the memory allocator is configured to:
allocate the first memory page at the first group level to one of one or more processes; and
allocate the second memory page and a third memory page at a second group level to the one or more processes, wherein the third memory page is consecutive with the second memory page.

### Claim 19

A system comprising:
a device comprising a first memory page and a second memory page; and
a host coupled to the device through an interconnect, the host comprising a memory allocator configured to:
determine an amount of use for the first memory page, wherein the first memory page is mapped to a first page group of a first group level, the second memory page is mapped to a second page group of the first group level, and the first memory page and the second memory page are mapped to a third page group of a second group level;
select, based on an allocation request, the first memory page based on the amount of use, including searching a data structure based on the amount of use; and
select a free list based on searching the data structure, wherein the free list indicates a group of memory pages of a same wear out level and the selection of the first memory page from the free list is based on the group level of the first memory page.

### Claim 20 (depends on 19)

The system of claim 19, wherein the amount of use comprises a first amount of use, and the memory allocator is further configured to:
determine a second amount of use for the second memory page;
wherein the first memory page is selected based on the first amount of use and the second amount of use.
