Search

WO-2026091662-A1 - DATA PROCESSING METHOD AND APPARATUS

WO2026091662A1WO 2026091662 A1WO2026091662 A1WO 2026091662A1WO-2026091662-A1

Abstract

A data processing method. The method comprises: performing a first page-in/page-out operation on memory pages of a file in a first cache space, wherein the first cache space is a cache space divided from a cache for a first file in a hard disk drive; and performing a second page-in/page-out operation on memory pages of a file in a second cache space, wherein the second cache space is a cache space divided from the cache for a second file in the hard disk drive, the first cache space is different from the second cache space, the first page-in/page-out operation is performed on the basis of the priorities of the memory pages of the file in the first cache space, and the second page-in/page-out operation is performed on the basis of the priorities of the memory pages of the file in the second cache space. In the present application, each set uses an independent cache area and an independent priority structure, so that memory resources can be allocated to files of a plurality of types and different scenarios as required, thereby reducing the page fault frequency.

Inventors

  • QIN, LIANG
  • SUN, Chumin
  • SUN, Zhaoyi
  • CAO, Xumeng
  • AO, Ziqiao
  • ZHANG, Shuo
  • SUN, JIE

Assignees

  • 华为技术有限公司

Dates

Publication Date
20260507
Application Date
20250703
Priority Date
20241030

Claims (20)

  1. A data processing method, characterized in that the method includes: Perform a first swap-in/swap-out operation on the memory pages of the file in the first cache space; wherein, the first cache space is the cache space allocated from the cache for the first file on the hard disk; A second swap-in/swap-out operation is performed on the memory pages of the file in the second cache space; wherein, the second cache space is the cache space allocated from the cache for the second file in the hard disk; The first cache space and the second cache space are different. The first swap-in and swap-out operation is performed according to the priority between memory pages of files in the first cache space, and the second swap-in and swap-out operation is performed according to the priority between memory pages of files in the second cache space.
  2. The method according to claim 1 is characterized in that the first file is more important than the second file, and the size ratio between the first cache space and the first file is greater than the size ratio between the second cache space and the second file.
  3. The method according to claim 1 or 2 is characterized in that the importance is related to the performance improvement of the system when memory pages of files are not swapped out.
  4. The method according to any one of claims 1 to 3, characterized in that, the first swap-in/swap-out operation on the memory pages of the file in the first cache space includes: performing the first swap-in/swap-out operation on the memory pages of the file in the first cache space using a first algorithm. The second swap-in/swap-out operation on the memory pages of the file in the second cache space includes: performing the second swap-in/swap-out operation on the memory pages of the file in the second cache space using a second algorithm; wherein the execution overhead or algorithm precision of the first algorithm is different from that of the second algorithm.
  5. The method according to any one of claims 1 to 4 is characterized in that the first document is of higher importance than the second document; The execution cost of the first algorithm is greater than the execution cost of the second algorithm; or, The accuracy of the first algorithm is greater than that of the second algorithm.
  6. The method according to claim 4 or 5, characterized in that the first file is a oscillation file; the oscillation file is determined based on whether at least one of the following characteristics satisfies a preset condition: Page fault frequency; How much page faults are reduced after file protection is implemented; File size; Fluctuations in page fault frequency.
  7. The method according to claim 4 or 5, wherein the first file is a file related to the target application; The first swap-in/swap-out operation on the memory pages of the file in the first cache space includes: When the target application is running, a first swap-in/swap-out operation is performed on the memory pages of the file in the first cache space.
  8. The method according to any one of claims 1 to 7, characterized in that the method further comprises: When memory pressure exceeds a threshold, files in the second cache space are swapped out first, rather than the first cache space; or... When the pressure on the memory space exceeds a threshold, swapping out of files in both the first cache space and the second cache space is performed, and the proportion of memory pages swapped out in the first cache space is lower than the proportion of memory pages swapped out in the second cache space.
  9. An apparatus for processing requests, characterized in that the apparatus comprises: The memory management module is used to perform a first swap-in and swap-out operation on the memory pages of the file in the first cache space; wherein, the first cache space is the cache space allocated from the cache for the first file on the hard disk; A second swap-in/swap-out operation is performed on the memory pages of the file in the second cache space; wherein, the second cache space is the cache space allocated from the cache for the second file in the hard disk; The first cache space and the second cache space are different. The first swap-in and swap-out operation is performed according to the priority between memory pages of files in the first cache space, and the second swap-in and swap-out operation is performed according to the priority between memory pages of files in the second cache space.
  10. The apparatus according to claim 9 is characterized in that the first file is more important than the second file, and the size ratio between the first cache space and the first file is greater than the size ratio between the second cache space and the second file.
  11. The apparatus according to claim 9 or 10 is characterized in that the importance is related to the performance improvement of the system when memory pages of files are not swapped out.
  12. The apparatus according to any one of claims 9 to 11, wherein the memory management module is configured to: perform a first swap-in/swap-out operation on memory pages of a file in a first cache space using a first algorithm; The second algorithm is used to perform a second swap-in/swap-out operation on the memory pages of the file in the second cache space; wherein the execution overhead or algorithm precision of the first algorithm is different from that of the second algorithm.
  13. The apparatus according to any one of claims 9 to 12 is characterized in that the first document is of higher importance than the second document; The execution cost of the first algorithm is greater than the execution cost of the second algorithm; or, The accuracy of the first algorithm is greater than that of the second algorithm.
  14. The apparatus according to claim 12 or 13, characterized in that the first file is an oscillation file; the oscillation file is determined based on whether at least one of the following characteristics satisfies a preset condition: Page fault frequency; How much page faults are reduced after file protection is implemented; File size; Fluctuations in page fault frequency.
  15. The apparatus according to claim 12 or 13, wherein the first file is a file related to the target application; The memory management module is used for: When the target application is running, a first swap-in/swap-out operation is performed on the memory pages of the file in the first cache space.
  16. The apparatus according to any one of claims 9 to 15, wherein the memory management module is further configured to: When memory pressure exceeds a threshold, files in the second cache space are swapped out first, rather than the first cache space; or... When the pressure on the memory space exceeds a threshold, swapping out of files in both the first cache space and the second cache space is performed, and the proportion of memory pages swapped out in the first cache space is lower than the proportion of memory pages swapped out in the second cache space.
  17. A chip, characterized in that the chip includes a processing circuit and an interface circuit, the interface circuit being interconnected with the processing circuit via a line, the interface circuit being used to receive signals from a storage medium and send the signals to the processor, the signals including computer instructions stored in the storage medium; when the computer instructions are executed by the processing circuit, the chip performs the data processing method as described in any one of claims 1-8.
  18. A data processing apparatus, characterized in that the apparatus comprises: a storage medium, a processing circuit, and a memory management unit (MMU), wherein the storage medium is coupled to the processing circuit, the storage medium is used to store computer program code, the computer program code including computer instructions, and when the computer instructions are executed by the processing circuit, the data processing method as described in any one of claims 1-8 is executed.
  19. A computer storage medium, characterized in that it includes computer instructions, which, when executed on a computer, cause the computer to perform the data processing method as described in any one of claims 1-8.
  20. A computer program product, characterized in that it comprises a computer program, which, when executed by one or more processors, is used to implement the method as described in any one of claims 1-8.

Description

A data processing method and apparatus This application claims priority to Chinese Patent Application No. 202411543333.9, filed with the State Intellectual Property Office of China on October 30, 2024, entitled “A Data Processing Method and Apparatus”, the entire contents of which are incorporated herein by reference. Technical Field This application relates to the field of communication technology, and in particular to data processing methods and apparatus. Background Technology Applications consume memory during runtime, but mobile devices have limited memory resources. Therefore, when a running application exceeds its memory limit, some memory pages need to be reclaimed to alleviate memory pressure. In Linux-based systems, reclaimable memory pages include file pages. File pages are memory pages associated with files, and their contents correspond to the files on the disk. Reclaiming file pages allows them to be released directly and then read from the disk when needed. Over the past few decades, numerous swapping algorithms have been developed to maintain the freshness of memory file pages in RAM. Common cache replacement algorithms include Belady's optimal strategy, random replacement strategy, Least Recently Used (LRU), Least Frequently Used (LFU), and Adaptive Replacement Cache (ARC). Different algorithms have different advantages and disadvantages, and are suitable for different data access patterns and cache sizes. For example, LRU is based on access frequency, LFU considers long-term use, while random replacement is simple to implement but its performance may be unstable. Choosing a suitable cache replacement algorithm helps balance cache management and data access performance in practical applications. In existing technologies, a single swap-in/swap-out strategy is often used for all memory pages in the cache, which makes it difficult to take into account the swap-in priority requirements of different scenarios and different types of stored data, resulting in severe page faults. Summary of the Invention This application provides a data processing method and apparatus that can reduce page fault frequency. To achieve the above objectives, the embodiments of this application adopt the following technical solutions: In a first aspect, embodiments of this application provide a data processing method, the method comprising: performing a first swap-in/swap-out operation on memory pages of a file in a first cache space; wherein the first cache space is a cache space allocated from the cache for a first file on the hard disk; and performing a second swap-in/swap-out operation on memory pages of a file in a second cache space; wherein the second cache space is a cache space allocated from the cache for a second file on the hard disk. The first cache space and the second cache space are different. The first swap-in and swap-out operation is performed according to the priority between memory pages of files in the first cache space, and the second swap-in and swap-out operation is performed according to the priority between memory pages of files in the second cache space. In this embodiment, the data on the hard disk can be divided into multiple different sets (e.g., a first file, a second file). Each set adopts an independent cache area and priority structure, enabling memory resources to be allocated on demand for files of various types and in different scenarios, thereby reducing the frequency of page faults. In one possible implementation, the first file is more important than the second file, and the size ratio between the first cache space and the first file is greater than the size ratio between the second cache space and the second file. For important and smaller collections, larger caches and more precise swapping algorithms are suitable; for ordinary and large collections, smaller caches and higher-performance swapping algorithms are suitable. The system can select appropriate memory size and swapping algorithms based on the collection's file size and frequency of use, reducing page faults while ensuring that memory usage and swapping algorithm complexity are kept as low as possible. In one possible implementation, the degree of importance is related to the performance improvement of the system (e.g., whether there is lag) when no memory pages of files are swapped out. For example, the importance is positively correlated with the page fault frequency; or, the importance is positively correlated with the protection benefit, which is the benefit when no page fault is performed; or, the importance is negatively correlated with the file size; and the fluctuation of the page fault frequency. In this embodiment, a better file protection set can be selected based on page fault frequency, protection benefits, and file size. Only general statistical information is needed to reduce the overall page fault rate. In one possible implementation, the first swap-in/swap-out operation on the memory pages of the file