Page recycling method and device, electronic equipment and storage medium

CN115454884BActive Publication Date: 2026-11-03GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211097731.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-08
Publication Date
2026-11-03
Estimated Expiration
2042-09-08

AI Technical Summary

Technical Problem

In Linux systems, excessive reverse mapping of shared pages can severely consume CPU resources and negatively impact system performance.

Method used

When a page is in a shared state, the number of visits is obtained, and if the number of visits exceeds the threshold, the page is migrated to a storage space outside the native kernel to avoid reverse mapping operations.

Benefits of technology

It reduces CPU load during page reclamation, improves memory reclamation speed, and avoids system lag.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115454884B_ABST
    Figure CN115454884B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a page recycling method and device, electronic equipment and a storage medium. The method comprises: obtaining an access quantity of a page in a shared state; and if the access quantity is greater than a first threshold, migrating the page to a storage space outside a native kernel. Through the method, when the user quantity of the shared page is greater than the first threshold, the shared page is migrated to the storage space outside the native kernel, so that the shared page is protected by migration, and repeated reverse mapping of the shared page can be avoided to deteriorate the CPU load of the system, that is, the overall CPU load in the page recycling process is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and more specifically, to a page recycling method, apparatus, electronic device, and storage medium. Background Technology

[0002] When Linux reclaims pages, it typically follows the LRU (Least Recently Used) algorithm, prioritizing the reclamation of the least recently used pages. This process involves reverse mapping, which aims to find all page table entries mapped to a particular page, allowing operations to be performed on the target page, such as breaking the mapping.

[0003] However, if a page is shared by hundreds of processes, reclaiming the page and reversing the page requires traversing the page table hundreds of times. If there are many such pages, the load of reverse mapping will be very high. Furthermore, when memory is tight, repeatedly reversing such pages may continuously worsen the system's CPU load, causing CPU resources to be severely consumed, resulting in other threads being unable to obtain CPU resources and causing them to freeze. Summary of the Invention

[0004] In view of the above problems, this application proposes a page reclamation method, apparatus, electronic device, and storage medium to improve the above problems.

[0005] In a first aspect, embodiments of this application provide a page recycling method applied to an electronic device. The method includes: when a page is in a shared state, obtaining the number of accesses to the page; if the number of accesses is greater than a first threshold, migrating the page to a storage space outside the native kernel.

[0006] Secondly, embodiments of this application provide a page recycling device, which operates in an electronic device. The device includes: an access count acquisition module, used to acquire the access count of the page when the page is in a shared state; and a page recycling module, used to migrate the page to a storage space outside the native kernel if the access count is greater than a first threshold.

[0007] Thirdly, this application provides an electronic device including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method described in the first aspect above.

[0008] Fourthly, this application provides a computer-readable storage medium storing program code, wherein the method described in the first aspect is executed when the program code is run.

[0009] This application provides a page reclamation method, apparatus, electronic device, and storage medium. By acquiring the number of accesses to a page while it is in a shared state, and if the number of accesses exceeds a first threshold, the page is migrated to storage space outside the native kernel. This method protects shared pages from repeated reverse mapping, which would worsen the system's CPU load, thus reducing the overall CPU load during page reclamation. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 A flowchart of a page reclamation method according to an embodiment of this application is shown.

[0012] Figure 2 A flowchart of a page reclamation method according to another embodiment of this application is shown.

[0013] Figure 3 A flowchart of a page reclamation method according to another embodiment of this application is shown.

[0014] Figure 4 A flowchart of a page reclamation method according to another embodiment of this application is shown.

[0015] Figure 5 A schematic diagram of the memory reclamation process provided in an embodiment of this application is shown.

[0016] Figure 6 A structural block diagram of a page recycling device according to an embodiment of this application is shown.

[0017] Figure 7 A structural block diagram of an electronic device for performing a page reclamation method according to an embodiment of the present application is shown.

[0018] Figure 8 This is a storage unit in this application embodiment for storing or carrying program code that implements a page reclamation method according to this application embodiment. Detailed Implementation

[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0020] With the rapid development of mobile terminal technology, consumers' demands for mobile terminals are no longer limited to simple functions; they now require smooth operation of multiple functions to satisfy their needs. The smoothness of mobile terminals has become a necessary factor for users' purchasing decisions. Memory performance is even more crucial in this regard, as current mobile terminals have increasingly higher memory requirements for applications. For example, a single large mobile game can occupy 2GB of memory space. Therefore, the key to better managing memory performance lies in memory reclamation technology.

[0021] Linux system memory reclamation types can be broadly categorized as follows:

[0022] Kill background applications: Killing applications will reclaim the memory used by them during the process destruction process, thus achieving the purpose of memory reclamation.

[0023] Reclaiming pages: For mobile devices, users have requirements regarding the number of background cached applications. The first choice for memory reclamation is generally not to kill applications, but to reclaim pages, such as pages used by applications, which can be reclaimed at certain stages.

[0024] The methods for page recycling can include:

[0025] For files and pages read by the application, such as some loaded images, they may not be used for a long time after being read. In this case, they can be recycled first and then read back from the disk when the application uses them again. This can alleviate memory pressure for a period of time.

[0026] For anonymous pages used by the application, such as some application data, these pages cannot be discarded at will, because discarding them will cause data corruption during user use. In this case, you can choose to compress the page. For example, if the user originally used 12kbytes of memory to store user data, the page can be compressed to 4kbytes through compression algorithms, thus saving 8kbytes of memory. When the user uses it again, the page can be decompressed and given to the user.

[0027] However, for pages shared by multiple users, where a single page is used by multiple processes, reclaiming such pages may require traversing the page table multiple times, resulting in a high load on reverse mapping, severe CPU resource consumption, causing other threads to freeze due to lack of CPU resources, and untimely memory reclamation.

[0028] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0029] Please see Figure 1 One embodiment of this application provides a page recycling method, which can be applied to electronic devices. The method includes:

[0030] Step S110: When the page is in a shared state, obtain the number of visits to the page.

[0031] In this context, a page being in a shared state can be understood as a page being accessed by multiple users (including the page being accessed by multiple users currently or having already been accessed by multiple users). Such pages can be called shared pages. Optionally, the specific number of multiple users is not limited; for example, it could be 5 users, 10 users, 100 users, etc.

[0032] During page reclamation, to avoid excessive CPU load caused by repeatedly performing reverse mapping on a shared page (i.e., repeatedly traversing the page table in a shared page), pages shared by multiple users can be protected before page reclamation. One approach is to determine if a page is in a shared state, obtain the number of page accesses, and then protect the pages shared by multiple users based on the number of page accesses. This reduces the number of shared pages entering the memory reclamation process, thereby significantly reducing the load caused by repeatedly performing reverse mapping on shared pages.

[0033] One approach is to set a cumulative user count event on the page. When a user visits the page, this event is triggered to automatically increment the number of users who have visited the page. The value of this incremented event can then be used to determine whether the page is in a shared state and to obtain the page's visit count. For example, if a page is considered shared when the number of users visiting it exceeds 10, then if the incremented event value is 15, then the page is indeed in a shared state, and the page's visit count is 15.

[0034] Step S120: If the number of accesses is greater than the first threshold, the page is migrated to a storage space outside the native kernel.

[0035] In this embodiment, the first threshold represents the critical number of accesses required to protect a page shared by multiple users. The specific value of the first threshold is not limited. For example, the first threshold can be 20, 50, 100, etc.

[0036] As one approach, if the number of accesses exceeds a first threshold, the page can be migrated to storage outside the native kernel to protect it. It's important to note that once the page is migrated, it cannot be directly reverse-mapped (i.e., reclaimed) during memory reclamation. This protects pages with a higher probability of being accessed from being reclaimed. Furthermore, because the system cannot directly reclaim these protected pages, the CPU load from repeated reverse mapping during reclamation is reduced, thus improving memory reclamation speed.

[0037] This application provides a page reclamation method that, when a page is in a shared state, obtains the number of accesses to the page; if the number of accesses exceeds a first threshold, the page is migrated to storage space outside the native kernel. This method protects shared pages from repeated reverse mapping, which degrades the system's CPU load and reduces the overall CPU load during page reclamation. It also improves the speed of memory reclamation.

[0038] Please see Figure 2 Another embodiment of this application provides a page recycling method, which can be applied to electronic devices, the method comprising:

[0039] Step S210: Construct a linked list, which is stored in the software driver.

[0040] Optionally, the linked list can be a doubly linked list. The tail of the linked list can be used to store the least recently accessed pages, and the head of the linked list can be used to store the most recently accessed pages.

[0041] One approach is to construct a new linked list when the system kernel starts up to store the protected shared pages; this linked list is stored in the software driver.

[0042] Step S220: When the page is in a shared state, obtain the number of visits to the page.

[0043] Step S230: If the number of visits is greater than the first threshold, the page is migrated to the linked list.

[0044] When the number of visits to a shared page exceeds the first threshold, the shared page can be migrated to the newly constructed linked list. Since the linked list is stored in a different storage space than the native kernel, the pages in the linked list cannot be directly reclaimed during the page reclamation process, thus protecting the pages migrated to the linked list.

[0045] In one specific implementation, a new linked list named mapped_lru can be constructed when the system kernel starts (the specific naming method is not limited, this is just an example). Real-time monitoring is performed when the page is shared by users. If the number of users using the page (which can be understood as the number of page visits) exceeds (i.e. greater than) the first threshold, the page is migrated to mapped_lru.

[0046] Optionally, the linked list can include multiple pages, each of which is shared by multiple users. In this embodiment, although migrating a page to the linked list can protect that page, it may cause the system to malfunction if the remaining memory is low. To avoid this problem, the available memory of the system can be obtained under the premise of the above implementation. Specifically, if the available memory is less than a second threshold (the second threshold represents the critical value at which the system can run normally; when the available memory is greater than the second threshold, the system can run normally; when the available memory is less than the second threshold, the system cannot run normally), it indicates that the system's memory is tight. The page located at the end of the linked list can be removed, that is, the page located at the end of the linked list can be put back into the system so that the system can reclaim the page. By removing the page located at the end of the linked list when the available memory of the system is less than the second threshold, the system can reclaim memory in a timely manner, avoiding system lag caused by untimely memory reclamation.

[0047] Optionally, if the system's available memory is not less than (greater than or equal to) the second threshold, it indicates that the system's available memory is not extremely strained, and in this case, the number of pages in the linked list can be obtained. To avoid the system being unable to reclaim a sufficient number of pages in a timely manner due to an excessive number of pages in the same linked list, as a method, if the number of pages in the linked list is greater than the third threshold, the page located at the end of the linked list can be removed until the number of pages in the linked list is less than the third threshold. That is, the page located at the end of the linked list is put back into the system so that the page can be reclaimed. The third threshold can be a value such as 80, 100, 120, etc., and the specific value is not limited.

[0048] Alternatively, if the number of pages does not exceed the third threshold, the page recycling process can be terminated.

[0049] This application provides a page reclamation method that constructs a linked list stored in a software driver. When a page is in a shared state, the number of visits to the page is obtained. If the number of visits exceeds a first threshold, the page is migrated to the linked list. This method protects shared pages by migrating them to storage outside the native kernel when the number of users accessing them exceeds the first threshold. This avoids repeated reverse mapping of shared pages, which can worsen the system's CPU load, thus reducing the overall CPU load during page reclamation. By considering the available memory size and the number of pages in the linked list, removing pages from the list allows for timely memory reclamation, preventing system lag due to delayed memory reclamation.

[0050] Please see Figure 3 Another embodiment of this application provides a page recycling method, which can be applied to electronic devices, the method comprising:

[0051] Step S310: Construct a linked list, which is stored in the software driver.

[0052] Step S320: When the page is in a shared state, obtain the number of visits to the page.

[0053] Step S330: If the number of visits is greater than the first threshold, the page is migrated to the linked list.

[0054] Step S340: When a target page in the linked list is accessed, move the target page to the head of the linked list.

[0055] The target page can be any page in the linked list that is being accessed by the user. The target page can be understood as the page in the linked list that is currently being accessed.

[0056] For multiple pages in a linked list, some pages may be frequently accessed by users, while others may be rarely accessed. To facilitate more accurate page reclamation, the pages in the linked list in this implementation also follow the LRU principle. In one implementation, when a target page in the linked list is accessed, the target page can be moved to the head of the linked list. That is, when a page is found to be accessed, it is promptly moved to the head of the linked list. Then, the pages at the tail of the linked list are the least recently used pages among the user-shared pages. This can protect pages that are more likely to be accessed from being reclaimed and reduce the probability of page thrashing when reclaimed and reread.

[0057] This application provides a page reclamation method that constructs a linked list stored in a software driver. When a page is in a shared state, the number of visits to the page is obtained. If the number of visits exceeds a first threshold, the page is migrated to the linked list. When a target page in the linked list is accessed, the target page is moved to the head of the linked list. This method protects shared pages from being reclaimed when the number of users accessing them exceeds a first threshold by migrating the pages to storage outside the native kernel. This avoids repeatedly performing reverse mapping on these shared pages, which would worsen the system's CPU load, thus reducing the overall CPU load during page reclamation. Furthermore, by promptly moving the page to the head of the linked list when it is discovered to be accessed, pages with a higher probability of being accessed are protected from being reclaimed.

[0058] Please see Figure 4 Another embodiment of this application provides a page recycling method, which can be applied to electronic devices, the method comprising:

[0059] Step S410: Obtain the number of reclaimable pages during the memory reclamation process.

[0060] In this implementation, during memory reclamation, reclaimable pages in the native kernel are reclaimed first. Only if the number of reclaimable pages in the native kernel is insufficient will the reclaimed protected shared pages be attempted for reclamation. Therefore, as a method, the number of reclaimable pages during the memory reclamation process can be obtained, and then the decision on whether to reclaim protected shared pages can be made based on this number.

[0061] When a system (such as Linux) reclaims pages, it follows the LRU (Least Recently Used) algorithm, prioritizing the reclamation of the least recently used pages. Specifically, if a page has been recently used, its corresponding page table will be set (when a user accesses a page, the hardware automatically sets a flag in the page table to inform the system that the page has been accessed). Therefore, as a method, one can determine whether a page is the least recently used page by checking if its corresponding page table is set, thus obtaining the number of pages available for reclamation during the memory reclamation process.

[0062] Optionally, if the page table corresponding to the page is set, it can be determined that the page is not the least recently used page; if the page table corresponding to the page is not set, it can be determined that the page is the least recently used page, that is, the page is a recyclable page.

[0063] Step S421: If the number is lower than a preset threshold, execute the step of obtaining the number of page visits when the page is in a shared state.

[0064] The preset threshold can be used to characterize whether the number of recyclable pages in the system is sufficient. Optionally, if the number of recyclable pages in the system is higher than the preset threshold, it means that the number of recyclable pages in the system is sufficient; if the number of recyclable pages in the system is lower than the preset threshold, it means that the number of recyclable pages in the system is insufficient.

[0065] As one approach, if the number of recyclable pages in the system is lower than a preset threshold, the system will attempt to reclaim the protected shared pages. This can be achieved by executing the steps described in the foregoing embodiments for obtaining the number of accesses to the page when it is in a shared state. The specific implementation process can be referred to the description in the foregoing embodiments, and will not be repeated here.

[0066] Step S422: If the number is not lower than a preset threshold, recycle the recyclable pages.

[0067] Alternatively, if the number of recyclable pages in the system exceeds a preset threshold, the recyclable pages in the system can be reclaimed directly.

[0068] In a specific application scenario, please refer to Figure 5 This diagram illustrates the memory reclamation process provided in an embodiment of this application. Figure 5 As shown, during memory reclamation, the number of reclaimable pages can be obtained first. If there are enough pages, memory reclamation can proceed directly, thus ending the reclamation process. If there are not enough pages, the process can attempt to reclaim protected pages. Specifically, it first determines whether the available memory is below the available memory threshold. If the available memory is below the threshold, it indicates memory shortage, and the protected pages can be returned to the system so that the system can reclaim the pages in a timely manner, freeing up available memory space. If the available memory is not below the threshold, it indicates sufficient memory, and the process can continue to determine whether the number of pages in the linked list is greater than the page number threshold. Optionally, if the number of pages in the linked list is greater than the threshold, to avoid CPU load consumption caused by the inability to reclaim pages in a timely manner, the protected pages can be returned to the system so that the system can reclaim the pages in a timely manner. If the number of pages in the linked list is not greater than the threshold, it indicates that the protected pages do not yet meet the memory reclamation conditions, and the process of reclaiming protected pages can be terminated.

[0069] This application provides a page reclamation method that obtains the number of reclaimable pages during the memory reclamation process; if the number is lower than a preset threshold, the step of obtaining the number of accesses to the page while it is in a shared state is executed; if the number is not lower than the preset threshold, the reclaimable pages are reclaimed. Thus, by means of the above method, when the number of users on a shared page exceeds a first threshold, the shared page is migrated to a storage space outside the native kernel for migration protection. This avoids repeatedly performing reverse mapping on such shared pages, which would worsen the system's CPU load, thereby reducing the overall CPU load during the page reclamation process. By obtaining the number of reclaimable pages in the native kernel and then determining whether to reclaim the protected shared pages, the accuracy of memory reclamation is improved.

[0070] Please see Figure 6 This application provides a page recycling device 500, which operates in an electronic device. The device 500 includes:

[0071] The access count acquisition module 510 is used to acquire the access count of the page when the page is in a shared state.

[0072] The page recycling module 520 is used to migrate the page to a storage space outside the native kernel if the number of accesses exceeds a first threshold.

[0073] Optionally, the device 500 may further include a linked list construction module for constructing a linked list before obtaining the number of visits to the page when the page is in a shared state, the linked list being stored in a software driver. In this manner, the page recycling module 520 can be used to migrate the page to the linked list if the number of visits exceeds a first threshold.

[0074] The linked list may include multiple pages. Optionally, the device 500 may further include a page adjustment module, which can be used to obtain the available memory of the system; if the available memory is less than a second threshold, the page located at the end of the linked list is removed. The page adjustment module can also be used to obtain the number of pages in the linked list if the available memory is not less than the second threshold; if the number of pages is greater than a third threshold, the page located at the end of the linked list is removed. If the number of pages is not greater than the third threshold, the process ends.

[0075] Optionally, the page adjustment module can be used to move the target page to the head of the linked list when the target page in the linked list is accessed.

[0076] Optionally, the device 500 may further include a recyclable page count acquisition module, used to acquire the number of recyclable pages during the memory reclamation process before acquiring the page access count when the page is in a shared state. In this way, the page reclamation module 520 can be used to reclaim the recyclable pages if the number is not lower than a preset threshold; if the number is lower than the preset threshold, the step of acquiring the page access count when the page is in a shared state is executed.

[0077] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0078] In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or other forms.

[0079] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0080] Please see Figure 7 Based on the above-described page reclamation method and apparatus, this application also provides an electronic device 100 capable of executing the aforementioned page reclamation method. The electronic device 100 includes a memory 102 and one or more (only one shown in the figure) processors 104 coupled to each other, with communication lines connecting the memory 102 and the processors 104. The memory 102 stores programs capable of executing the contents of the aforementioned embodiments, and the processors 104 can execute the programs stored in the memory 102.

[0081] The processor 104 may include one or more processing cores. The processor 104 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 102, and by calling data stored in the memory 102. Optionally, the processor 104 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 104 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 104 and may be implemented separately using a communication chip.

[0082] The memory 102 may include random access memory (RAM) or read-only memory (ROM). The memory 102 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 102 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the aforementioned embodiments. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).

[0083] Please refer to Figure 8 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable storage medium 600 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0084] The computer-readable storage medium 600 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 600 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 600 has storage space for program code 610 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 610 may be compressed, for example, in a suitable form.

[0085] In summary, the page reclamation method, apparatus, electronic device, and storage medium provided in this application obtain the number of accesses to the page when it is in a shared state; if the number of accesses exceeds a first threshold, the page is migrated to a storage space outside the native kernel. Thus, by means of the above method, when the number of users on a shared page exceeds the first threshold, the page is migrated to a storage space outside the native kernel to protect the shared page. This avoids repeatedly performing reverse mapping on such shared pages, which would worsen the system's CPU load, thereby reducing the overall CPU load during the page reclamation process.

[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A page recycling method, characterized in that, Applied to electronic devices, the method includes: When the page is in a shared state, obtain the number of times the page has been accessed; If the number of accesses exceeds the first threshold, the page will be migrated to a linked list outside the system's native kernel so that the page cannot be reverse-mapped during memory reclamation. If the available memory of the system is less than a second threshold, the page at the end of the linked list is removed and moved to the native kernel.

2. The method according to claim 1, characterized in that, The method further includes: If the available memory is not less than the second threshold, obtain the number of pages in the linked list; If the number of pages exceeds the third threshold, the page at the end of the linked list will be removed.

3. The method according to claim 2, characterized in that, The method further includes: If the number of pages is not greater than the third threshold, the process ends.

4. The method according to claim 1, characterized in that, The method further includes: When a target page in the linked list is accessed, the target page is moved to the head of the linked list.

5. The method according to claim 1, characterized in that, Before obtaining the number of page visits when the page is in a shared state, the process also includes: Get the number of pages that can be reclaimed during the memory reclamation process; If the number is not less than a preset threshold, the recyclable pages are recycled; If the number is lower than a preset threshold, the step of obtaining the number of page visits when the page is in a shared state is executed.

6. A page recycling device, characterized in that, Operating in an electronic device, the device includes: The access count acquisition module is used to acquire the access count of the page when the page is in a shared state; The page recycling module is used to migrate the page to a linked list outside the system's native kernel if the number of accesses exceeds a first threshold, so that the page cannot be reverse-mapped during the memory reclamation process. The page adjustment module is used to remove the page located at the tail of the linked list when the available memory of the system is less than a second threshold, so as to move the page at the tail of the linked list into the native kernel.

7. An electronic device, characterized in that, Includes one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method of any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code, wherein the program code, when executed by a processor, performs the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Memory management method and electronic equipment

    CN114730288A