IP Library Granted Patent US 12,481,598
Granted Patent B2
US 12,481,598 · App. 18/685,135 · Granted Nov 25, 2025

Memory scanning method and apparatus

Inventor: Hao Zheng (Hangzhou, CN)
Assignee: HANGZHOU ALICLOUD FEITIAN INFORMATION TECHNOLOGY CO., LTD.
G06F12/1009G06F12/0873G06F2212/657
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12,481,598
App. No.
18/685,135
Granted
Nov 25, 2025
Kind
B2
Abstract

Provided in the embodiments of the present specification are a memory scanning method and apparatus, wherein the method includes: determining a reserved memory scanning range at a preset time interval; scanning reserved memory to be scanned within the reserved memory scanning range and determining a current cold and hot state of the reserved memory to be scanned; and determining a target record table for the current cold and hot state of the reserved memory to be scanned according to the current cold and hot state of the reserved memory to be scanned and recording the current cold and hot state of the reserved memory to be scanned into the target record table.

Claims (59)

1 . A memory scanning method applied to a host, comprising:

determining a scanning range of reserved memory to be scanned at a preset time interval, wherein the reserved memory is a part of host memory reserved therefrom;

scanning the reserved memory within the scanning range and determining a current state of the reserved memory, wherein the state comprises a hot state or a cold state; and

determining a target record table corresponding to the current state of the reserved memory according to the current state of the reserved memory, wherein the target record table comprises a target hot page record table and a target cold page record table, and recording the current state of the reserved memory into the corresponding target hot page record table or the target cold page record table;

wherein the scanning the reserved memory within the scanning range and determining the current state of the reserved memory comprises:

determining a physical memory address of the reserved memory within the scanning range;

determining a virtual address corresponding to the physical memory address of the reserved memory by a preset query method, if there is a virtual page table; and

traversing and querying an access bit of the corresponding virtual page table through the virtual address and determining the current state of the reserved memory according to a current state of the access bit.

2 . The memory scanning method of claim 1 , wherein the determining the physical memory address of the reserved memory comprises:

determining the target hot page record table and the target cold page record table corresponding to the scanning range;

determining the physical memory address of the reserved memory to be scanned in the target cold page record table; and

determining the physical memory address of the reserved memory to be scanned in the target hot page record table, if all the reserved memory to be scanned in the target cold page record table has been scanned and the target cold page record table or the target hot page record table meets a preset scanning condition.

3 . The memory scanning method of claim 1 , wherein the determining the virtual address corresponding to the physical memory address of the reserved memory by the preset query method comprises:

determining, if there is a cache memory mapping structure corresponding to the physical memory address of the reserved memory, the virtual address corresponding to the physical memory address of the reserved memory according to the cache memory mapping structure; or

acquiring a linked list of a memory mapping structure for allocating the reserved memory and adding a linked list lock to the linked list of the memory mapping structure, if there is no cache memory mapping structure corresponding to the physical memory address of the reserved memory;

traversing the linked list of the memory mapping structure to determine the memory mapping structure corresponding to the physical memory address of the reserved memory; and

determining the virtual address corresponding to the physical memory address of the reserved memory according to the memory mapping structure and adding the memory mapping structure to a cache.

4 . The memory scanning method of claim 2 , wherein the traversing and querying the access bit of the corresponding virtual page table through the virtual address and determining the current state of the reserved memory according to the current state of the access bit comprises:

traversing and querying the access bit of the corresponding virtual page table through the virtual address;

determining the current state of the access bit, if that the query is successful; and

determining whether the current state has been set,

if true, clearing the current state of the access bit and determining that the current state of the reserved memory is a hot state; and

if false, traversing and querying an access bit of a corresponding kernel page table through the virtual address and determining the current state of the reserved memory according to the current state of the access bit of the kernel page table.

5 . The memory scanning method of claim 4 , wherein the traversing and querying the access bit of the corresponding kernel page table through the virtual address and determining the current state of the reserved memory according to the current state of the access bit of the kernel page table comprises:

traversing and querying the access bit of the corresponding virtual page table through the virtual address and determining the current state of the access bit of the kernel page table; and

determining whether the current state has been set,

if true, clearing the current state of the access bit and determining that the current state of the reserved memory is a hot state; and

if false, determining that the current state of the reserved memory is a cold state.

6 . The memory scanning method of claim 5 , wherein the determining the target record table corresponding to the current state of the reserved memory according to the current state of the reserved memory and recording the current state of the reserved memory into the corresponding target hot page record table or the target cold page record table comprises:

if the current state of the reserved memory in the target hot page record table is a hot state, determining the target hot page record table corresponding to the hot state of the reserved memory and recording the hot state of the reserved memory into the target hot page record table;

if the current state of the reserved memory in the target hot page record table is a cold state, determining the target cold page record table corresponding to the cold state of the reserved memory, deleting the reserved memory in the target hot page record table and recording the cold state of the reserved memory into the target cold page record table; or

if the current state of the reserved memory in the target cold page record table is a hot state, determining the target hot page record table corresponding to the hot state of the reserved memories to be scanned, deleting the reserved memory in the target cold page record table and recording the hot state of the reserved memory into the target hot page record table; and

if the current state of the reserved memory in the target cold page record table is a cold state, determining the target cold page record table corresponding to the cold state of the reserved memory and recording the cold state of the reserved memory into the target cold page record table.

7 . The memory scanning method of claim 1 , wherein the determining the target record table corresponding to the current state of the reserved memory according to the current state of the reserved memory and recording the current state of the reserved memory into the corresponding target hot page record table or the target cold page record table comprises:

if the current state of the reserved memory is a hot state, determining the target hot page record table corresponding to the hot state of the reserved memory and recording the hot state of the reserved memory into the target hot page record table; and

if the current state of the reserved memory is a cold state, determining the target cold page record table corresponding to the cold state of the reserved memory and recording the cold state of the reserved memory into the target cold page record table.

8 . The memory scanning method of claim 1 , further comprising:

adding, if there is new reserved memory and the scanning of the reserved memory within the scanning range has been finished, the new reserved memory to the scanning range.

9 . The memory scanning method of claim 1 , further comprising:

acquiring a scanning range lock and suspending the scanning of the reserved memory within the scanning range, if there is reserved memory within the scanning range being released; and

deleting the released reserved memory from the scanning range and deleting a memory mapping structure corresponding to the released reserved memory and the cold and hot state of the released reserved memory in the target record table.

10 . The memory scanning method of claim 6 , wherein the recording the cold state of the reserved memory into the target cold page record table comprises:

recording the cold state of the reserved memory to an end of the target cold page record table; and

the recording the hot state of the reserved memory into the target hot page record table comprises:

recording the hot state of the reserved memory to an end of the target hot page record table.

11 . A computing device, comprising:

a memory and a processor;

wherein the memory is configured for storing computer-executable instructions, and the processor is configured for executing the computer-executable instructions that, when executed by the processor, implement the steps of the memory scanning method of claim 1 .

12 . A computer-readable storage medium having computer-executable instructions stored thereon that, when executed by a processor, implement the steps of the memory scanning method of claim 1 .

13 . The memory scanning method of claim 2 , wherein the determining the virtual address corresponding to the physical memory address of the reserved memory by the preset query method comprises:

determining, if there is a cache memory mapping structure corresponding to the physical memory address of the reserved memory, the virtual address corresponding to the physical memory address of the reserved memory according to the cache memory mapping structure; or

acquiring a linked list of a memory mapping structure for allocating the reserved memory and adding a linked list lock to the linked list of the memory mapping structure, if there is no cache memory mapping structure corresponding to the physical memory address of the reserved memory;

traversing the linked list of the memory mapping structure to determine the memory mapping structure corresponding to the physical memory address of the reserved memory; and

determining the virtual address corresponding to the physical memory address of the reserved memory according to the memory mapping structure and adding the memory mapping structure to a cache.

14 . A computer-readable storage medium having computer-executable instructions stored thereon that, when executed by a processor, implement the steps of the memory scanning method of claim 5 .

15 . A computer-readable storage medium having computer-executable instructions stored thereon that, when executed by a processor, implement the steps of the memory scanning method of claim 2 .

16 . A computer-readable storage medium having computer-executable instructions stored thereon that, when executed by a processor, implement the steps of the memory scanning method of claim 3 .

17 . A computer-readable storage medium having computer-executable instructions stored thereon that, when executed by a processor, implement the steps of the memory scanning method of claim 13 .

18 . A computer-readable storage medium having computer-executable instructions stored thereon that, when executed by a processor, implement the steps of the memory scanning method of claim 4 .

Assignments (2)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 30, 2026
From: HANGZHOU ALICLOUD FEITIAN INFORMATION TECHNOLOGY CO., LTD.
To: CLOUD INTELLIGENCE ASSETS HOLDING (SINGAPORE) PRIVATE LIMITED
Reel/Frame 075366/0376 →
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Feb 26, 2024
From: ZHENG, HAO
To: HANGZHOU ALICLOUD FEITIAN INFORMATION TECHNOLOGY CO., LTD
Reel/Frame 066556/0697 →
Priority Claims (1)
CN 202210176634.7 · Feb 24, 2022 · national
Continuity (1)
Related Publication 20240354258A1 · Oct 24, 2024
References Cited (22)
US 10810037B1 · Liu · 2020 [cited by examiner]
US 11237981B1 · Habusha · 2022 [cited by examiner]
US 20180024750A1 · Hassan · 2018 [cited by applicant]
US 20190114272A1 · Dubey · 2019 [cited by examiner]
US 20200285391A1 · Sun · 2020 [cited by examiner]
US 20200334067A1 · Liu et al. · 2020 [cited by applicant]
US 20210064535A1 · Han · 2021 [cited by examiner]
US 20220050722A1 · Dugast · 2022 [cited by examiner]
US 20220137860A1 · Zhuo · 2022 [cited by examiner]
US 20230127449A1 · Kim · 2023 [cited by examiner]
US 20240311297A1 · Ammari · 2024 [cited by examiner]
US 20250027681A1 · Moon · 2025 [cited by examiner]
CN 108021442A · 2018 [cited by applicant]
CN 108628663A · 2018 [cited by applicant]
CN 110134492B · 2021 [cited by applicant]
CN 113296886A · 2021 [cited by applicant]
CN 113296940A · 2021 [cited by applicant]
CN 113434371A · 2021 [cited by applicant]
CN 114579253A · 2022 [cited by applicant]
PCT International Search Report for PCT/CN2023/074446 entitled “Memory Scanning Method and Apparatus”, mailed on May 11, 2023, (6 pages including English-language translation). [cited by applicant]
Chinese First Office Action issued Jan. 8, 2025 in CN Application No. 202210176634.7, entitled “Memory scanning method and device” (13 pages including English-language translation). [cited by applicant]
Extended European Search Report of European Patent Application No. 23758983.3 based on PCT/CN2023/074446, entitled “Memory Scanning Method and Apparatus,” dated Jun. 10, 2025 (11 pages). [cited by applicant]