# US 2022/0035655 A1 · Method and Device for Anonymous Page Management, Terminal Device, and Readable Storage Medium

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

- Number: US 2022/0035655 A1
- Document ID: US20220035655A1
- Status: Published application
- Kind: A1
- Application number: 17/501,994
- Filed: 2021-10-14
- Published: 2022-02-03
- Earliest claimed: 2019-04-15
- Assignees: Oneplus Technology (Shenzhen) Co., Ltd.
- Applicants: OnePlus Technology (Shenzhen) Co., Ltd.
- Inventors: Kengyu Lin
- Web page: https://patentgrep.com/patent/US20220035655A1

## CPC

- G06F 9/4818: {Priority circuits therefor}
- G06F 12/08: in hierarchically structured memory systems, e.g. virtual memory systems
- G06F 9/4881: {Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues}
- G06F 9/5022: {Mechanisms to release resources}
- G06F 12/0253: {Garbage collection, i.e. reclamation of unreferenced memory}
- G06F 12/0862: with prefetch
- G06F 12/1009: using page tables, e.g. page table structures
- G06F 12/126: with special data handling, e.g. priority of data or instructions, handling errors or pinning
- G06F 2209/484: Precedence
- G06F 2212/1024: Latency reduction
- G06F 2212/1044: Space efficiency improvement
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A method, and a terminal device therefor. The method includes: monitoring whether a process of which a priority changes exists in the terminal device, and obtaining information indicating a priority change of each process; determining a target to-be-executed process according to the information indicating the priority change of each process; detecting whether a target anonymous page corresponding to the target to-be-executed process is stored in a swap space, wherein the swap space is configured to recycle anonymous pages; and prefetching the target anonymous page from the swap space in response to the target anonymous page being stored in the swap space.

## Claims

### Claim 1

A method for anonymous page management for a terminal device, comprising:
monitoring whether a process of which a priority changes exists in the terminal device, and obtaining information indicating a priority change of each process;
determining a target to-be-executed process according to the information indicating the priority change of each process;
detecting whether a target anonymous page corresponding to the target to-be-executed process is stored in a swap space, wherein the swap space is configured to recycle anonymous pages; and
prefetching the target anonymous page from the swap space in response to the target anonymous page being stored in the swap space.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the determining the target to-be-executed process according to the information indicating the priority change of each process comprises:
filtering out all to-be-executed processes, each of which has a current priority becoming higher, according to the information indicating the priority change of each process; and
for each to-be-executed process:
detecting whether a raised priority of a to-be-executed process is not lower than a first preset priority; and
determining the to-be-executed process as the target to-be-executed process in response to the raised priority of the to-be-executed process being not lower than the first preset priority.

### Claim 3 (depends on 1)

The method according to claim 1, further comprising:
determining a target to-be-recycled process according to the information indicating the priority change of each process;
detecting whether target anonymous pages corresponding to the target to-be-recycled process are stored in a memory space; and
recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space in response to the target anonymous pages being stored in the memory space.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the determining the target to-be-recycled process according to the information indicating the priority change of each process comprises:
according to the information indicating the priority change of each process, filtering out all to-be-recycled processes, each of which has a current priority becoming lower and an anonymous page required to be recycled; and
for each to-be-recycled process:
comparing a lowered priority of a to-be-recycled process with a second preset priority; wherein the second preset priority is less than or equal to a first preset priority;
determining the to-be-recycled process as the target to-be-recycled process in response to the lowered priority of the to-be-recycled process being lower than the second preset priority; and
comparing a not-yet-lowered priority of the to-be-recycled process with the first preset priority and comparing the lowered priority of the to-be-recycled process with the first preset priority, in response to the lowered priority of the to-be-recycled process being not lower than the second preset priority; and determining the to-be-recycled process as the target to-be-recycled process in response to the not-yet-lowered priority of the to-be-recycled process being not lower than the first preset priority and the lowered priority of the to-be-recycled process being lower than the first preset priority.

### Claim 5 (depends on 4)

The method according to claim 4, wherein the recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space comprises:
detecting whether each target anonymous page, currently stored in the memory space, of the target to-be-recycled process is occupied by the target to-be-executed process, and obtaining a detection result; and
according to the detection result, selecting at least one of the target anonymous pages that is not occupied by the target to-be-executed process from all the target anonymous pages, currently stored in the memory space, of the target to-be-recycled process; and recycling the selected at least one of the target anonymous pages into the swap space.

### Claim 6 (depends on 4)

The method according to claim 4, wherein the recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space comprises:
directly recycling all the target anonymous pages, currently stored in the memory space, of the target to-be-recycled process into the swap space.

### Claim 7 (depends on 1)

The method according to claim 1, wherein the determining the target to-be-executed process according to the information indicating the priority change of each process comprises:
filtering out all to-be-executed processes, each of which has a current priority becoming higher, according to the information indicating the priority change of each process; and
directly taking each of the filtered to-be-executed processes as the target to-be-executed processes.

### Claim 8 (depends on 3)

The method according to claim 3, wherein the determining the target to-be-recycled process according to the information indicating the priority change of each process comprises:
according to the information indicating the priority change of each process, filtering out all to-be-recycled processes, each of which has a current priority becoming lower and an anonymous page required to be recycled; and
directly taking each of the filtered to-be-recycled processes as the target to-be-recycled processes.

### Claim 9

A method for anonymous page management for a terminal device, comprising:
monitoring whether a process of which a priority changes exists in the terminal device, and obtaining information indicating a priority change of each process;
determining a target to-be-recycled process according to the information indicating the priority change of each process;
detecting whether target anonymous pages corresponding to the target to-be-recycled process are stored in a memory space; and
recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into a swap space in response to the target anonymous page being stored in the memory space; wherein the swap space is configured to recycle anonymous pages.

### Claim 10 (depends on 9)

The method according to claim 9, wherein the determining the target to-be-recycled process according to the information indicating the priority change of each process comprises:
according to the information indicating the priority change of each process, filtering out all to-be-recycled processes, each of which has a current priority becoming lower and an anonymous page required to be recycled; and
for each to-be-recycled process:
comparing a lowered priority of a to-be-recycled process with a second preset priority;
wherein the second preset priority is less than or equal to a first preset priority;
determining the to-be-recycled process as the target to-be-recycled process in response to the lowered priority of the to-be-recycled process being lower than the second preset priority; and
comparing a not-yet-lowered priority of the to-be-recycled process with the first preset priority and comparing the lowered priority of the to-be-recycled process with the first preset priority, in response to the lowered priority of the to-be-recycled process being not lower than the second preset priority; and determining the to-be-recycled process as the target to-be-recycled process in response to the not-yet-lowered priority of the to-be-recycled process being not lower than the first preset priority and the lowered priority of the to-be-recycled process being lower than the first preset priority.

### Claim 11 (depends on 10)

The method according to claim 10, wherein the recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space comprises:
detecting whether each target anonymous page, currently stored in the memory space, of the target to-be-recycled process is occupied by a target to-be-executed process, and obtaining a detection result; and
according to the detection result, selecting at least one of the target anonymous pages that is not occupied by the target to-be-executed process from all the target anonymous pages, currently stored in the memory space, of the target to-be-recycled process; and recycling the selected at least one of the target anonymous pages into the swap space.

### Claim 12 (depends on 10)

The method according to claim 10, wherein the recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space comprises:
directly recycling all the target anonymous pages, currently stored in the memory space, of the target to-be-recycled process into the swap space.

### Claim 13 (depends on 9)

The method according to claim 9, wherein the determining the target to-be-recycled process according to the information indicating the priority change of each process comprises:
according to the information indicating the priority change of each process, filtering out all to-be-recycled processes, each of which has a current priority becoming lower and an anonymous page required to be recycled; and
directly taking each of the filtered to-be-recycled processes as the target to-be-recycled processes.

### Claim 14

A terminal device, comprising a processor and a non-volatile memory storing a computer instruction, wherein when the computer instruction is executed by the processor, the terminal device performs:
monitoring whether a process of which a priority changes exists in the terminal device, and obtaining information indicating a priority change of each process;
determining a target to-be-executed process according to the information indicating the priority change of each process;
detecting whether a target anonymous page corresponding to the target to-be-executed process is stored in a swap space, wherein the swap space is configured to recycle anonymous pages; and
prefetching the target anonymous page from the swap space in response to the target anonymous page being stored in the swap space.

### Claim 15 (depends on 14)

The terminal device according to claim 14, wherein the determining the target to-be-executed process according to the information indicating the priority change of each process comprises:
filtering out all to-be-executed processes, each of which has a current priority becoming higher, according to the information indicating the priority change of each process; and
for each to-be-executed process:
detecting whether a raised priority of a to-be-executed process is not lower than a first preset priority; and
determining the to-be-executed process as the target to-be-executed process in response to the raised priority of the to-be-executed process being not lower than the first preset priority.

### Claim 16 (depends on 14)

The terminal device according to claim 14, further comprising:
determining a target to-be-recycled process according to the information indicating the priority change of each process;
detecting whether target anonymous pages corresponding to the target to-be-recycled process are stored in a memory space; and
recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space in response to the target anonymous pages being stored in the memory space.

### Claim 17 (depends on 16)

The terminal device according to claim 16, wherein the determining the target to-be-recycled process according to the information indicating the priority change of each process comprises:
according to the information indicating the priority change of each process, filtering out all to-be-recycled processes, each of which has a current priority becoming lower and an anonymous page required to be recycled; and
for each to-be-recycled process:
comparing a lowered priority of a to-be-recycled process with a second preset priority; wherein the second preset priority is less than or equal to a first preset priority;
determining the to-be-recycled process as the target to-be-recycled process in response to the lowered priority of the to-be-recycled process being lower than the second preset priority; and
comparing a not-yet-lowered priority of the to-be-recycled process with the first preset priority and comparing the lowered priority of the to-be-recycled process with the first preset priority, in response to the lowered priority of the to-be-recycled process being not lower than the second preset priority; and determining the to-be-recycled process as the target to-be-recycled process in response to the not-yet-lowered priority of the to-be-recycled process being not lower than the first preset priority and the lowered priority of the to-be-recycled process being lower than the first preset priority.

### Claim 18 (depends on 17)

The terminal device according to claim 17, wherein the recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space comprises:
detecting whether each target anonymous page, currently stored in the memory space, of the target to-be-recycled process is occupied by the target to-be-executed process, and obtaining a detection result; and
according to the detection result, selecting at least one of the target anonymous pages that is not occupied by the target to-be-executed process from all the target anonymous pages, currently stored in the memory space, of the target to-be-recycled process; and recycling the selected at least one of the target anonymous pages into the swap space.

### Claim 19 (depends on 17)

The terminal device according to claim 17, wherein the recycling at least one of the target anonymous pages corresponding to the target to-be-recycled process into the swap space comprises:
directly recycling all the target anonymous pages, currently stored in the memory space, of the target to-be-recycled process into the swap space.

### Claim 20 (depends on 16)

The terminal device according to claim 16, wherein the determining the target to-be-recycled process according to the information indicating the priority change of each process comprises:
according to the information indicating the priority change of each process, filtering out all to-be-recycled processes, each of which has a current priority becoming lower and an anonymous page required to be recycled; and
directly taking each of the filtered to-be-recycled processes as the target to-be-recycled processes.
