File page processing method and device and electronic equipment

By identifying and locking the most frequently accessed key file pages in the foreground application, the problem of UI lag caused by the release of file pages during memory reclamation was solved, resulting in smoother UI response and lower IO latency.

CN121785767APending Publication Date: 2026-04-03VIVO MOBILE COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-09
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In existing technologies, critical file pages of the foreground application are released during memory reclamation, leading to frequent I/O operations, causing interface lag and affecting user experience.

Method used

By identifying and locking the most frequently accessed critical file pages in the foreground application based on IO data, and preventing them from being reclaimed, the lifecycle of file pages is managed using a popularity value assessment and an LRU linked list to ensure that hot file pages reside in memory.

Benefits of technology

It effectively alleviates interface lag caused by I/O operations, improves interface response performance, reduces page fault frequency, and enhances system smoothness and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785767A_ABST
    Figure CN121785767A_ABST
Patent Text Reader

Abstract

The invention discloses a file page processing method and device and electronic equipment, and belongs to the technical field of memory management. The method comprises the steps of determining a target file page meeting a locking condition based on IO data corresponding to an input and output IO request; and executing a memory locking operation on the target file page to prohibit execution of a recovery operation on the target file page.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of memory management technology, specifically relating to a method, apparatus, and electronic device for processing file pages. Background Technology

[0002] One of the main reasons for application lag in current systems is input / output (I / O) performance issues. Specifically, when an application accesses a segment of a file, if that segment is not in memory, a page fault occurs, and the system must read the corresponding file page from storage via I / O operations. These I / O operations occur during critical paths in UI rendering (such as UI transitions), potentially causing rendering delays and resulting in lag.

[0003] The current system primarily controls file page reclamation based on memory page type and process priority, prioritizing the reclamation of clean pages or terminating lower-priority processes to free up system resources. Simultaneously, the system uses a keep-alive mechanism to increase the priority of target processes or add them to a whitelist to prevent them from being reclaimed by the system.

[0004] However, even if some applications are regarded as foreground or important processes by the system in the existing keep-alive mechanism, their critical file pages may still be released during memory reclamation, thus triggering IO operations again when accessed later, causing the interface to freeze. Summary of the Invention

[0005] The purpose of this application is to provide a method, apparatus, and electronic device for processing file pages, which can alleviate interface lag caused by I / O operations and improve interface response performance.

[0006] In a first aspect, embodiments of this application provide a method for processing document pages, including: Based on the IO data corresponding to the input / output IO requests, determine the target file page that meets the locking conditions; A memory locking operation is performed on the target file page to prevent the target file page from being reclaimed.

[0007] Secondly, embodiments of this application provide a document page processing apparatus, including: The determination module is used to determine the target file page that meets the locking conditions based on the IO data corresponding to the input / output IO requests; The locking module is used to perform a memory locking operation on the target file page to prevent the target file page from being reclaimed.

[0008] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0009] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0010] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0011] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0012] In this embodiment, IO data corresponding to input / output IO requests is obtained. Based on the IO data corresponding to the IO requests, target file pages that meet the locking conditions are determined, and memory locking operations are performed on the target file pages to prevent them from being reclaimed. That is, each file page is evaluated through IO data, and the target file pages that meet the locking conditions are locked in physical memory to avoid being reclaimed. This can reduce the frequency of page faults while ensuring minimal memory overhead, effectively alleviate the interface lag caused by IO operations, and improve the interface response performance. Attached Figure Description

[0013] Figure 1 This is a flowchart illustrating a method for processing file pages provided in some embodiments of this application; Figure 2 This is a diagram showing the relationship between I / O latency generated by using existing technologies and using this application for I / O requests; Figure 3 This is a schematic flowchart illustrating the specific process of a file page processing method provided in some embodiments of this application; Figure 4 This is a schematic diagram of the structure of a document page processing apparatus provided in some embodiments of this application; Figure 5 These are structural block diagrams of electronic devices provided in some embodiments of this application; Figure 6 These are structural block diagrams of electronic devices provided in some embodiments of this application. Detailed Implementation

[0014] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0015] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0016] Existing file page reclamation strategies primarily rely on page type and system memory pressure for scheduling, lacking a mechanism to determine whether a file page is a critical resource for the foreground application from the user space or application level. When performing reclamation, the system cannot differentiate the importance of file pages, potentially reclaiming file pages that are currently being used or about to be used by the foreground application incorrectly. This can trigger I / O operations during subsequent accesses, resulting in lag.

[0017] Furthermore, current process keep-alive mechanisms primarily prevent target processes from being terminated by the system by elevating process priority or adding them to a whitelist. However, this mechanism only operates at the process lifecycle management level and does not involve memory page reclamation control. Therefore, even if the foreground application is successfully kept alive, its critical file pages may still be released during memory reclamation, making it impossible to avoid IO latency and UI stuttering issues caused by missing file pages. IO latency refers to the total time elapsed from when an application initiates a read / write request to when it receives the response data.

[0018] Both of these techniques have drawbacks that cause critical file pages in the foreground application to be recycled. When the application is accessed again, I / O operations are generated again, resulting in interface switching lag. Under normal system memory conditions, this may increase I / O latency by nearly 100ms; under normal system memory conditions, it may even increase I / O latency by 300ms-500ms, seriously affecting the user experience.

[0019] Therefore, embodiments of this application provide a method, apparatus, and electronic device for processing file pages. From the perspective of the application layer, the most frequently accessed key file pages in the foreground application are identified and locked through IO data and / or the popularity value of each file page to prevent them from being recycled, effectively alleviating interface lag caused by IO operations and improving interface response performance.

[0020] The document page processing method provided in this application will be described below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0021] like Figure 1 As shown in the figure, this application embodiment provides a method for processing file pages, which may specifically include the following steps: Step 101: Based on the IO data corresponding to the input / output IO requests, determine the target file page that meets the locking conditions.

[0022] Specifically, upon detecting a page switching request initiated by the target application, the system identifies the file page to be loaded. If it determines that the file page to be loaded is not residing in DRAM (Dynamic Random Access Memory), an I / O request for the file page to be loaded is sent to Universal Flash Storage (UFS) to load the file page from UFS into DRAM. DRAM is a high-speed flash memory used to store system and application data. UFS is a high-speed volatile memory used for temporary storage of running data and program instructions.

[0023] Furthermore, instrumentation is performed on system calls such as `read` and `mmap` at the kernel level to collect real-time data on file page access behavior (i.e., IO data) during critical paths such as UI switching in the foreground application. This data includes the file accessed by the IO request, the file page offset, the access length, and the timestamp of the IO request. The file page accessed by the IO request can be determined by its file page offset and access length, and the number of accesses for each file page can be counted. Additionally, if multiple file pages accessed by the same IO request are adjacent, these adjacent file pages are merged to reduce system overhead.

[0024] Here, `read` represents accessing file data through the "read cache" path, where instrumentation can capture file I / O read requests. `mmap` represents accessing file data through the "memory-mapped" path, where instrumentation can capture the behavior of the file being mapped into the process's address space. Kernel instrumentation (i.e., kernel instrumentation) refers to a technique of injecting tracepoints or hook functions into the operating system kernel code.

[0025] It should be noted that a file page refers to a copy of the file content loaded into memory. The operating system caches the file content in DRAM through a page caching mechanism. Each file page typically corresponds to a 4KB memory block, and each file page corresponds to a contiguous byte region in the file.

[0026] The file page offset refers to the starting position of a specific file page within the entire file data stream it is associated with.

[0027] Based on the IO data corresponding to the IO request, determine whether each file page meets the locking conditions, and identify the file page that meets the locking conditions as the hot file page (i.e. the target file page).

[0028] Among them, hot file pages refer to the memory copies of file data that are accessed frequently, and are core resources that should be given priority protection from the user's perspective.

[0029] Step 102: Perform a memory locking operation on the target file page to prevent the target file page from being reclaimed.

[0030] Specifically, a memory locking operation is performed on the target file page that meets the locking conditions, that is, it is locked in memory to prevent the target file page from being released during the file page reclamation process. Steps 101 to 102 above are executed repeatedly to ensure accurate identification and protection of hot file pages.

[0031] File page reclamation refers to the process of releasing the space occupied by file data that has been cached in memory.

[0032] In this embodiment, IO data corresponding to input / output IO requests is obtained. Based on the IO data corresponding to the IO requests, target file pages that meet the locking conditions are determined, and memory locking operations are performed on the target file pages to prevent them from being reclaimed. That is, each file page is evaluated through IO data, and the target file pages that meet the locking conditions are locked in physical memory to avoid being reclaimed. This can reduce the frequency of page faults while ensuring minimal memory overhead, effectively alleviate the interface lag caused by IO operations, and improve the interface response performance.

[0033] In an optional specific embodiment, step 101, based on the IO data corresponding to the input / output IO request, determines the target file page that meets the locking conditions, including: Based on the IO data, the popularity value of each file page is calculated; Based on the popularity value of each file page, the target file page that meets the locking conditions is determined.

[0034] Specifically, based on the IO data corresponding to each IO request, the popularity value of each file page that needs to be accessed is calculated. This popularity value is used to characterize the access frequency of the file page. The popularity value of each file page is used to determine whether each file page meets the locking conditions. File pages that meet the locking conditions are identified as hot files (i.e., target file pages). Memory locking operations are performed on target file pages that meet the locking conditions, that is, they are locked in memory to prevent the target file pages from being released during file page reclamation.

[0035] In an optional specific embodiment, the step of calculating the popularity value of each file page based on the IO data specifically includes: Upon detecting a user interface switching request for a target application, an IO data acquisition operation for a target duration is performed to obtain the IO data corresponding to the IO request, wherein the IO request corresponds to the switching request; Statistical analysis is performed based on the collected IO data and historical IO data to determine the number of times each file page is accessed and the time interval between the two most recent adjacent IO requests to access the file page. The popularity value of each file page is calculated based on the number of times each file page is accessed and the time interval between the two most recent adjacent I / O requests to the file page.

[0036] Specifically, upon detecting a user interface switching request for a target application, a read operation for a target duration (e.g., 0.5 seconds) is enabled. This involves performing an IO data read operation for the target duration. After the read operation is complete, the read IO data (i.e., the collected IO data) is combined with historically read IO data for statistical analysis to update the access count of each file page and the time interval between the two most recent adjacent IO requests to that file page. The popularity value of each file page is calculated based on the access count and the time interval between the two most recent adjacent IO requests to that file page.

[0037] The time interval between the two most recent adjacent IO requests to access the file page is the time difference calculated from the timestamps of the two most recent adjacent IO requests to access the file page.

[0038] Furthermore, the popularity value of the file page is calculated using the following formula:

[0039] in, This indicates the popularity value of the file page; This indicates the number of times the file page has been accessed; and Two preset weight values ​​that sum to 1 are used to balance access frequency and timeliness; This represents the time interval between the two most recent consecutive I / O requests to access the file page.

[0040] Let file page c be the file page. The number of times each file page is accessed can be determined by the file page accessed by each IO request. The time interval can be obtained by the difference between the timestamps of the two most recent IO requests that access the same file page. The number of accesses is multiplied by the first preset weight value to obtain the first value. The second preset weight value is divided by the time interval to obtain the second value. The first value and the second value are added together to obtain the popularity value of file page c.

[0041] In an optional specific embodiment, the step of determining the target file page that meets the locking condition based on the popularity value of each file page specifically includes: The type of each file page is determined based on its popularity score. If the file page is of type locked, then the file page is determined as the target file page that satisfies the locking condition.

[0042] Specifically, the type of each file page is determined based on its popularity value. If the file page is a locked type, it can be determined that the file page meets the locking conditions, and a memory locking operation is performed on the file page to avoid file page reclamation. When the target application is accessed again, a large number of I / O operations can be reduced.

[0043] It should be noted that for any file page A, the popularity value of file page A increases with the number of accesses and decreases as multiple consecutive IO requests access file pages other than file page A. In an optional specific embodiment, determining the type of each file page based on its popularity value includes: If the file page is of inactive type and the popularity value is greater than or equal to a first popularity threshold, the file page type is determined to be updated from inactive type to active type. If the file page type is the active type and the popularity value is greater than or equal to the second popularity threshold, the file page type is determined to be updated from the active type to the locked type, and the second popularity threshold is greater than the first popularity threshold; If the file page type is the locked type and the popularity value is less than the third popularity threshold, the file page type is determined to be updated from the locked type to the temporary type, where the third popularity threshold is greater than the first popularity threshold and less than the second popularity threshold. If the file page type is the temporary type and the popularity value is less than the fourth popularity threshold, the file page type is determined to be updated from the temporary type to the inactive type, and the fourth popularity threshold is less than the third popularity threshold. The file page is of the temporary type and the popularity value is greater than the fifth popularity threshold. In the case where the file page type is updated from the temporary type to the active type, the fifth popularity threshold is greater than the third popularity threshold; Specifically, file pages of the inactive type, the temporary type, and the active type are released in order of type priority from low to high.

[0044] Specifically, the Least Recently Used (LRU) algorithm is used to determine the type of each file page, with each type corresponding to an LRU linked list. The core idea of ​​LRU is to prioritize the removal of data that has not been accessed for the longest time. The LRU linked lists for each type are as follows: Inactive LRU (i.e., LRU list of inactive types): Stores newly loaded file pages or file pages with low access frequency. It has the lowest priority, that is, when memory needs to be freed, file pages of this type are freed first.

[0045] Staging LRU (i.e., a temporary LRU list): used to cache file pages that are no longer actively accessed but may still be accessed again. It serves as a buffer and rollback mechanism. It has the third priority, meaning that if memory needs to be released after releasing inactive file pages, file pages of this type will be released first.

[0046] Active LRU (i.e., the LRU list of active types): Stores file pages that have been accessed frequently recently. It has the second priority. That is, if memory needs to be freed after releasing inactive file pages, file pages of this type will be released first.

[0047] Locked LRU (i.e., a linked list of LRUs based on lock type): Stores file pages that have been identified as hot files and locked by mlock. These pages have the highest priority, meaning they are released first, while file pages of other types will not be released.

[0048] If a file page is of type Inactive and its popularity value is greater than or equal to the first popularity threshold H1, update the file page's type from Inactive to Active, that is, promote the file page from the Inactive LRU list to the Active LRU list.

[0049] If the file page is of type Active and its popularity value is greater than or equal to the second popularity threshold H2 (H2 is greater than H1), update the file page's type from Active to Locked, that is, promote the file page from the Active LRU list to the Locked LRU list.

[0050] If a file page is of type Locked and its popularity value is less than the third popularity threshold H3 (H3 is greater than H1 and less than H2), the file page type is updated from Locked to Staging. That is, the file page is moved down from the Locked LRU list to the Staging LRU list. This area serves as a buffer pool for hot file pages and is not immediately unlocked or reclaimed to prevent recently deactivated file pages from being released prematurely.

[0051] If the file page is of type Staging and its popularity value is less than the fourth popularity threshold H4 (H4 is less than H3), update the file page type from Staging to Inactive, that is, move the file page down from the Staging LRU list to the Inactive LRU list.

[0052] If the file page is of type Staging and its popularity value is greater than the fifth popularity threshold H5 (H5 is greater than H3), update the file page type from Staging to Active, that is, promote the file page from the StagingLRU list to the Active LRU list.

[0053] By using the four LRU linked lists and the dynamic migration algorithm based on hotness values, fine-grained management of the lifecycle of file pages is achieved. This ensures that hot file pages reside in memory while avoiding frequent locking and unlocking operations, thus balancing IO performance optimization and memory usage efficiency.

[0054] like Figure 3 As shown, the processing procedure for the aforementioned file page is explained through a specific workflow: Step 301: Initiate a user interface switching request for the target application.

[0055] Step 302: The file page to be loaded is not in DRAM. Load the file page to be loaded from UFS to DRAM through an IO request.

[0056] Specifically, when a user interface switching request for a target application is detected, the file page to be loaded is determined. If it is determined that the file page to be loaded is not residing in DRAM, an IO request for the file page to be loaded is sent to UFS to load the file page from UFS into DRAM.

[0057] Step 303: Perform the read operation of IO data for the target duration using read kernel instrumentation and mmap kernel instrumentation.

[0058] Specifically, when a user interface switching request for the target application is detected, the reading action for the target duration is enabled, that is, the reading operation of IO data for the target duration is performed. The access behavior of the foreground application to file pages in critical paths such as interface switching is collected in real time through read kernel instrumentation and mmap kernel instrumentation, that is, the IO data is obtained.

[0059] Step 304: Based on the read IO data and historical IO data, determine the number of accesses to each file page and the time interval between the timestamps of the two most recent adjacent IO requests to access the file page.

[0060] Specifically, the file page accessed by the IO request, its offset, and the access length can be used to determine the file page accessed by the IO request. The number of times each file page is accessed can be determined by the file page accessed by each IO request. For a single file page, the time interval between the two most recent adjacent IO requests accessing that file page is calculated.

[0061] Step 305: Calculate the popularity value of each file page based on the number of accesses to each file page and the time interval between the timestamps of the two most recent adjacent IO requests to access the file page.

[0062] Step 306: Determine the type of each file page based on its popularity value.

[0063] Step 307: If the file page is of type locked, determine that the file page meets the locking conditions, and perform a memory locking operation on the target file page that meets the locking conditions to prevent the target file page from being reclaimed.

[0064] In the embodiments described above, instrumentation of system calls such as read and mmap at the kernel layer enables real-time collection of file access behavior of foreground applications in critical paths such as interface switching. Based on the collected data, a time- and frequency-based LRU algorithm is used to prioritize file pages, identify the corresponding set of hot file pages, and perform an mlock action on the hot file pages to lock them in memory to prevent them from being reclaimed. While ensuring minimal memory overhead, this significantly reduces the probability of IO page faults in critical paths of foreground applications, thereby effectively alleviating interface lag caused by IO.

[0065] In one embodiment, such as Figure 2 As shown in the test data, when switching between contact interfaces, by pre-reserving and protecting critical file pages during the interface switching process, the IO latency before loading the first frame alone is optimized by more than 100ms, reducing IO latency jitter during the rendering stage and improving the smoothness of interface switching and user experience. In multiple common application scenarios, the embodiments of this application can optimize interface switching latency by up to 500ms or more, reduce overall frame rate fluctuation by more than 20%, and significantly improve the interactive smoothness and stability of the foreground application.

[0066] The file page processing method provided in this application can be executed by a file page processing device. This application uses an example of a file page processing device executing the file page processing method to illustrate the file page processing device provided in this application.

[0067] like Figure 4 As shown in the illustration, this application embodiment also provides a document page processing apparatus 400, specifically including: The determination module 401 is used to determine the target file page that meets the locking conditions based on the IO data corresponding to the input / output IO request; The locking module 402 is used to perform a memory locking operation on the target file page to prevent the target file page from being reclaimed.

[0068] Optionally, the determining module 401 is specifically used for: Based on the IO data, the popularity value of each file page is calculated; Based on the popularity value of each file page, the target file page that meets the locking conditions is determined.

[0069] Optionally, when calculating the popularity value of each file page based on the IO data, the determining module 401 is specifically used for: Upon detecting a user interface switching request for a target application, an IO data acquisition operation for a target duration is performed to obtain the IO data corresponding to the IO request, wherein the IO request corresponds to the switching request; Statistical analysis is performed based on the collected IO data and historical IO data to determine the number of times each file page is accessed and the time interval between the two most recent adjacent IO requests to access the file page. The popularity value of each file page is calculated based on the number of times each file page is accessed and the time interval between the two most recent adjacent I / O requests to the file page.

[0070] Optionally, the popularity value of the file page is calculated using the following formula:

[0071] in, This indicates the popularity value of the file page; This indicates the number of times the file page has been accessed; and This represents two preset weight values ​​that sum to 1; This represents the time interval between the two most recent consecutive I / O requests to access the file page.

[0072] Optionally, when determining the target file page that meets the locking condition based on the popularity value of each file page, the determining module 401 is specifically used for: The type of each file page is determined based on its popularity score. If the file page is of type locked, then the file page is determined as the target file page that satisfies the locking condition.

[0073] The file page processing device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0074] The file page processing device in this application embodiment can be a device with an operating system. The operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0075] The document page processing apparatus provided in this application embodiment can achieve Figures 1 to 3 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0076] Optionally, such as Figure 5 As shown, this application embodiment also provides an electronic device 500, including a processor 501 and a memory 502. The memory 502 stores a program or instructions that can run on the processor 501. When the program or instructions are executed by the processor 501, they implement the various steps of the above-described file page processing method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0077] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0078] Figure 6 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.

[0079] The electronic device 1000 includes, but is not limited to, components such as: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.

[0080] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0081] The processor 1010 is used to determine the target file page that meets the locking conditions based on the IO data corresponding to the input / output IO request; A memory locking operation is performed on the target file page to prevent the target file page from being reclaimed.

[0082] Optionally, when the processor 1010 determines a target file page that meets the locking conditions based on the IO data corresponding to the input / output IO request, it specifically performs the following: Based on the IO data, the popularity value of each file page is calculated; Based on the popularity value of each file page, the target file page that meets the locking conditions is determined.

[0083] Optionally, when the processor 1010 calculates the popularity value of each file page based on the IO data, it is specifically used for: Upon detecting a user interface switching request for a target application, an IO data acquisition operation for a target duration is performed to obtain the IO data corresponding to the IO request, wherein the IO request corresponds to the switching request; Statistical analysis is performed based on the collected IO data and historical IO data to determine the number of times each file page is accessed and the time interval between the two most recent adjacent IO requests to access the file page. The popularity value of each file page is calculated based on the number of times each file page is accessed and the time interval between the two most recent adjacent I / O requests to the file page.

[0084] Optionally, the popularity value of the file page is calculated using the following formula:

[0085] in, This indicates the popularity value of the file page; This indicates the number of times the file page has been accessed; and This represents two preset weight values ​​that sum to 1; This represents the time interval between the two most recent consecutive I / O requests to access the file page.

[0086] Optionally, when the processor 1010 determines the target file page that meets the locking condition based on the heat value of each file page, it specifically performs the following: The type of each file page is determined based on its popularity score. If the file page is of type locked, then the file page is determined as the target file page that satisfies the locking condition.

[0087] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.

[0088] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.

[0089] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.

[0090] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described file page processing method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0091] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0092] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described file page processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0093] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0094] This application provides a computer program product stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-described file page processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0095] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0096] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0097] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for processing file pages, characterized in that, include: Based on the IO data corresponding to the input / output IO requests, determine the target file page that meets the locking conditions; A memory locking operation is performed on the target file page to prevent the target file page from being reclaimed.

2. The method according to claim 1, characterized in that, The process of determining the target file page that meets the locking conditions based on the IO data corresponding to the input / output IO requests includes: Based on the IO data, the popularity value of each file page is calculated; Based on the popularity value of each file page, the target file page that meets the locking conditions is determined.

3. The method according to claim 2, characterized in that, The calculation of the popularity value of each file page based on the IO data includes: Upon detecting a user interface switching request for a target application, an IO data acquisition operation for a target duration is performed to obtain the IO data corresponding to the IO request, wherein the IO request corresponds to the switching request; Statistical analysis is performed based on the collected IO data and historical IO data to determine the number of times each file page is accessed and the time interval between the two most recent adjacent IO requests to access the file page. The popularity value of each file page is calculated based on the number of times each file page is accessed and the time interval between the two most recent adjacent I / O requests to the file page.

4. The method according to claim 3, characterized in that, The popularity value of the file page is calculated using the following formula: in, This indicates the popularity value of the file page; This indicates the number of times the file page has been accessed; and This represents two preset weight values ​​that sum to 1; This represents the time interval between the two most recent consecutive I / O requests to access the file page.

5. The method according to claim 2, characterized in that, The process of determining the target file page that meets the locking condition based on the popularity value of each file page includes: The type of each file page is determined based on its popularity score. If the file page is of type locked, then the file page is determined as the target file page that satisfies the locking condition.

6. A document page processing apparatus, characterized in that, include: The determination module is used to determine the target file page that meets the locking conditions based on the IO data corresponding to the input / output IO requests; The locking module is used to perform a memory locking operation on the target file page to prevent the target file page from being reclaimed.

7. The apparatus according to claim 6, characterized in that, The determining module is specifically used for: Based on the IO data, the popularity value of each file page is calculated; Based on the popularity value of each file page, the target file page that meets the locking conditions is determined.

8. The apparatus according to claim 7, characterized in that, When calculating the popularity value of each file page based on the IO data, the determining module is specifically used for: Upon detecting a user interface switching request for a target application, an IO data acquisition operation for a target duration is performed to obtain the IO data corresponding to the IO request, wherein the IO request corresponds to the switching request; Statistical analysis is performed based on the collected IO data and historical IO data to determine the number of times each file page is accessed and the time interval between the two most recent adjacent IO requests to access the file page. The popularity value of each file page is calculated based on the number of times each file page is accessed and the time interval between the two most recent adjacent I / O requests to the file page.

9. The apparatus according to claim 8, characterized in that, The popularity value of the file page is calculated using the following formula: in, This indicates the popularity value of the file page; This indicates the number of times the file page has been accessed; and This represents two preset weight values ​​that sum to 1; This represents the time interval between the two most recent consecutive I / O requests to access the file page.

10. The apparatus according to claim 7, characterized in that, When determining a target file page that meets the locking condition based on the popularity value of each file page, the determining module is specifically used for: The type of each file page is determined based on its popularity score. If the file page is of type locked, then the file page is determined as the target file page that satisfies the locking condition.

11. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions being executed by the processor to implement the steps of the file page processing method as described in any one of claims 1-5.