Memory page reclamation in a user idle mode
US-2019370171-A1 · Dec 5, 2019 · US
US10698837B2 · US · B2
| Field | Value |
|---|---|
| Publication number | US-10698837-B2 |
| Application number | US-201816138439-A |
| Country | US |
| Kind code | B2 |
| Filing date | Sep 21, 2018 |
| Priority date | Dec 29, 2017 |
| Publication date | Jun 30, 2020 |
| Grant date | Jun 30, 2020 |
A practical reading order for non-experts. Skip the full description unless you need deep technical detail.
What the patent document calls the invention.
A short plain-language summary of the technical disclosure.
Who owns or filed the patent and who is credited as inventor.
Filing, priority, publication, and grant dates set the timeline.
The legal scope of protection — read this for what is actually claimed.
Technology tags used to group this patent with similar filings.
Prior art links and similar publications in this corpus.
Official abstract text for this publication.
The disclosure relates to a method for processing a memory and apparatus, an electronic device, and a computer-readable storage medium. The method includes acquiring reclaimable memory pages occupied by an application to be processed; acquiring an idle duration of the application to be processed for each reclaimable memory page; determining a duration threshold according to the idle durations for the reclaimable memory pages; and selecting from the reclaimable memory pages a memory page for which the idle duration exceeds the duration threshold and reclaiming the memory page. The above-mentioned method for processing a memory and apparatus, electronic device and computer-readable storage medium may minimize the adverse impact on each application, thereby maintaining the balance between reclaiming and operation of an application memory to be processed.
Opening claim text (preview).
The invention claimed is: 1. A method for processing a memory, the method being carried out by an electronic device, and comprising: acquiring a plurality of reclaimable memory pages occupied by an application to be processed; acquiring an idle duration of the application to be processed for each reclaimable memory page; acquiring correspondences between re-starting durations and reclaiming proportions corresponding to the application to be processed, the re-starting duration being a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed; determining a reclaiming proportion of reclaimable memory pages according to the correspondences between reclaiming proportions and re-starting durations; determining a reclaiming number according to the reclaiming proportion and the total number of the reclaimable memory pages; selecting the Kth-largest idle duration from the idle durations for the plurality of reclaimable memory pages according to the reclaiming number, and taking the Kth-largest idle duration as a duration threshold, the number of reclaimable memory pages each having an idle duration greater than the Kth-largest idle duration being the reclaiming number, K being a natural number not greater than the reclaiming number; and reclaiming at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages. 2. The method of claim 1 , wherein the acquiring an idle duration of the application to be processed for each reclaimable memory page comprises: acquiring update time recorded by a timestamp of each reclaimable memory page, the update time indicating time when the reclaimable memory page was used most recently; and calculating an idle duration for the reclaimable memory page according to the update time. 3. The method of claim 2 , wherein the acquiring update time recorded by a timestamp of each reclaimable memory page comprises: for each reclaimable memory page, creating, by a resource priority and limitation management module in the electronic device, a timestamp for recording an update time of the reclaimable memory page; and in responsive to that use of the reclaimable memory page is detected, updating the time stamp for the reclaimable memory page. 4. The method of claim 3 , wherein the use of the reclaimable memory page is detected when at least one of allocation of the reclaimable memory page, recovery of the reclaimable memory page, release of the reclaimable memory page, or querying of using condition of a cache in a processor of the electronic device is detected. 5. The method of claim 1 , wherein the acquiring an idle duration of the application to be processed for each reclaimable memory page comprises: providing a Least Recently Used (LRU) management unit in a memory management unit or a cache unit in a processor of the electronic device; recording, by the LRU management unit, a plurality of memory addresses and update time of each memory address; acquiring an update time of each of the plurality of reclaimable memory pages according to an update time of a memory address corresponding to the reclaimable memory page; and calculating an idle duration for the reclaimable memory page according to the update time of the reclaimable memory page. 6. The method of claim 1 , wherein the acquiring a plurality of reclaimable memory pages occupied by an application to be processed comprises: traversing a plurality of memory-mapped files of the application to be processed; querying, in the plurality of memory-mapped files, all memory pages occupied by the application to be processed; and eliminating a memory page carrying an occupation mark from all the memory pages to acquire reclaimable memory pages from memory pages other than the eliminated memory page. 7. The method of claim 1 , wherein before the acquiring a plurality of reclaimable memory pages occupied by an application to be processed, the method further comprises: detecting whether a foreground application depends on the application to be processed; if a foreground application depends on the application to be processed, adjusting the priority of the application to be processed to match the foreground application; and if a foreground application does not depend on the application to be processed, performing the operation of acquiring reclaimable memory pages occupied by an application to be processed. 8. An electronic device comprising a storage having stored thereon a computer program and a processor, the storage having stored thereon a computer program that when executed by the processor causes the processor to perform operations of: acquiring a plurality of reclaimable memory pages occupied by an application to be processed; acquiring an idle duration of the application to be processed for each reclaimable memory page; acquiring correspondences between re-starting durations and reclaiming proportions corresponding to the application to be processed, the re-starting duration being a duration for restarting the application to be processed after the reclaiming proportion of the reclaimable memory pages occupied by the application to be processed are reclaimed; determining a reclaiming proportion of reclaimable memory pages according to the correspondences between reclaiming proportions and re-starting durations; determining a reclaiming number according to the reclaiming proportion and the total number of the reclaimable memory pages; selecting the Kth-largest idle duration from the idle durations for the plurality of reclaimable memory pages according to the reclaiming number, and taking the Kth-largest idle duration as a duration threshold, the number of reclaimable memory pages each having an idle duration greater than the Kth-largest idle duration being the reclaiming number, K being a natural number not greater than the reclaiming number; and reclaiming at least one memory page, for which the idle duration exceeds the duration threshold, of the plurality of reclaimable memory pages. 9. The electronic device of claim 8 , wherein the acquiring an idle duration of the application to be processed for each reclaimable memory page comprises: acquiring update time recorded by a timestamp of each reclaimable memory page, the update time indicating time when the reclaimable memory page was used most recently; and calculating an idle duration for the reclaimable memory page according to the update time. 10. The electronic device of claim 9 , wherein the acquiring update time recorded by a timestamp of each reclaimable memory page comprises: for each reclaimable memory page, creating, by a resource priority and limitation management module in the electronic device, a timestamp for recording an update time of the reclaimable memory page; and in responsive to that use of the reclaimable memory page is detected, updating the time stamp for the reclaimable memory page. 11. The electronic device of claim 10 , wherein the use of the reclaimable memory page is detected when at least one of allocation of the reclaimable memory page, recovery of the reclaimable memory page, release of the reclaimable memory page, or querying of using condition of a cache in a processor of the electronic device is detected. 12. The electronic device of claim 8 , wherein the acquiring an idle duration of the application to be processed for each reclaimable memory page comprises: providing a Least Recently Used (LRU) management unit in a memory management unit or a cache unit in a processor of the electronic device; recording
Garbage collection, i.e. reclamation of unreferenced memory · CPC title
Mechanisms to release resources · CPC title
with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list · CPC title
by assessing time · CPC title
using adaptive policy · CPC title
Related publications grouped by family.
Answers are generated from the same data shown on this page.