WO2021254200A1 - Page thrashing protection method and apparatus for memory reclaim of operating system - Google Patents

Page thrashing protection method and apparatus for memory reclaim of operating system Download PDF

Info

Publication number
WO2021254200A1
WO2021254200A1 PCT/CN2021/098652 CN2021098652W WO2021254200A1 WO 2021254200 A1 WO2021254200 A1 WO 2021254200A1 CN 2021098652 W CN2021098652 W CN 2021098652W WO 2021254200 A1 WO2021254200 A1 WO 2021254200A1
Authority
WO
WIPO (PCT)
Prior art keywords
thrashing
page
list
memory
common
Prior art date
Application number
PCT/CN2021/098652
Other languages
French (fr)
Chinese (zh)
Inventor
黄朝阳
Original Assignee
北京紫光展锐通信技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京紫光展锐通信技术有限公司 filed Critical 北京紫光展锐通信技术有限公司
Publication of WO2021254200A1 publication Critical patent/WO2021254200A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • G06F12/0882Page mode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Definitions

  • This application relates to the field of communication technology, and in particular to a page thrashing protection method and device for operating system memory recovery.
  • the android system (linux kernel) adopts the principle of "usable and usable, recycling when busy" for memory.
  • the recycling of memory caused some frequently used file pages to be scanned twice in succession, and the activity was quickly reduced to INACTIVE, which was finally recycled to the buddy system.
  • Subsequent applications access the corresponding location of the file, so that the action of allocating physical pages/reading file content occurs again, and this process is generally referred to as page thrashing.
  • Too many page bumps will cause the performance of the system to decline, affect the use of users, and reduce user experience.
  • the embodiment of the present application discloses a page thrashing protection method for operating system memory recovery, which can reduce the physical memory protection capacity of thrashed pages, improve system performance, and improve user experience.
  • the first aspect of the embodiments of the present application provides a page thrashing protection method for operating system memory recovery.
  • the method is applied to a user equipment UE, and the method includes the following steps:
  • UE performs data collection on multiple application scenarios to obtain a bump page data set
  • the UE calculates the intersection of each element in the thrashing page data set to obtain the page set list_thrashing_common in the multiple application scenarios where thrashing occurs; and obtains the collection of all the elements in the thrashing page data set to obtain a set of all thrashing pages list_thrashing_all ;
  • the UE protects the list_thrashing_common and the list_thrashing_all with block as the basic unit
  • the second aspect of the embodiments of the present application provides a page thrashing protection device for operating system memory recovery.
  • the device is applied to user equipment UE, and the device includes:
  • the collection unit is used to collect data from multiple application scenarios to obtain a set of bumpy page data
  • a processing unit configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps have occurred in the multiple application scenarios; obtain a collection of all elements in the bumpy page data set to obtain all bumps that have occurred
  • the page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
  • a terminal including a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor,
  • the program includes instructions for executing the steps in the method described in the first aspect.
  • a fourth aspect of the embodiments of the present application discloses a computer-readable storage medium, which is characterized by storing a computer program for electronic data exchange, wherein the computer program causes a computer to execute the method described in the first aspect.
  • the fifth aspect of the embodiments of the present application discloses a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute operations as in the embodiments of the present application. Some or all of the steps described in the first aspect.
  • the computer program product may be a software installation package.
  • the technical solution provided by the present application is that the UE collects data from multiple application scenarios to obtain a bumpy page data set; the UE calculates the intersection of each element in the bumpy page data set to obtain all of the multiple application scenarios.
  • the basic unit of protection in this application is a block
  • the granularity of block protection is smaller compared to the protection of a page as the basic unit, so that multiple bumped pages can have the same block, and because the capacity of the block is smaller than the capacity of the page,
  • the memory capacity of the physical memory lock is smaller, which prevents excess physical memory from being locked, improves system performance, and improves user experience.
  • FIG. 1 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • FIG. 2 is a schematic flowchart of a page thrashing protection method for operating system memory recovery provided by an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of a page thrashing protection device for operating system memory recovery provided by an embodiment of the present application
  • FIG. 4 is a schematic structural diagram of a terminal provided by an embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a device provided by an embodiment of the present application.
  • the "plurality” appearing in the embodiments of the present application refers to two or more than two.
  • the descriptions of the first, second, etc. appearing in the embodiments of this application are only used for illustration and distinguishing the description objects, and there is no order, and it does not mean that the number of devices in the embodiments of this application is particularly limited, and does not constitute a reference to this application. Any limitations of the embodiment.
  • the "connection” appearing in the embodiments of this application refers to various connection modes such as direct connection or indirect connection to realize communication between devices, which is not limited in the embodiments of this application.
  • the terminal in the embodiments of this application may refer to various forms of UE, access terminal, user unit, user station, mobile station, MS (English: mobile station, Chinese: mobile station), remote station, remote terminal, mobile device, User terminal, terminal equipment (English: terminal equipment), wireless communication equipment, user agent, or user device.
  • Terminal devices can also be cellular phones, cordless phones, SIP (English: session initiation protocol, Chinese: Session Initiation Protocol) phones, WLL (English: wireless local loop, Chinese: wireless local loop) stations, PDA (English: personal digital) assistant, Chinese: personal digital processing), handheld devices with wireless communication functions, computing devices or other processing devices connected to wireless modems, in-vehicle devices, wearable devices, terminal devices in the future 5G network or future evolution of PLMN (English : Public land mobile network, Chinese: public land mobile communication network), which is not limited in the embodiment of the present application.
  • Operating systems such as Android, UNIX in enhanced mode, Windows
  • virtual memory is a technology that simulates RAM (random access memory) by using disk space to make the machine behave as if it has more memory than it actually is.
  • RAM random access memory
  • MMU memory management unit
  • MMU treats memory as a series of "pages" composed of continuous bytes of a certain size, usually 4096 or 8192 bytes.
  • the operating system sets up and maintains a table called Process Memory Map (PMM) for each running program.
  • PMM Process Memory Map
  • the PMM contains all the memory pages that the program can access, as well as the actual location of each memory page.
  • MMU Each time a program accesses any part of the memory, the MMU will process the address (called a "virtual address”). MMU finds the actual location of the memory in the PMM (called “physical address”). The physical address can be any location in the memory or disk allocated by the operating system. If the location to be accessed by the program is on the disk, it must contain Its pages are read from disk into memory, and the PMM must be updated to reflect this operation (this is called a "page fault").
  • the operating system guesses which memory areas are unlikely to be used in a period of time (usually based on the past memory usage), if it guesses wrong, or if the current program accesses a large amount of memory in many places, it is called out in order to read in Page, there will be many page errors. Because all RAM is in use, to access each page read in, another page must be called out, which may cause more page faults, because another page of memory has now been moved to disk, in a short time There are many page faults in the system, called “page jitter", which will greatly reduce the performance of the system.
  • the operating system will reclaim the memory that is being used due to the size of the physical memory. If the recovered target page is a frequently used document page (the so-called hot page), it will be read again quickly due to abnormal page faults. This situation is called “page thrashing" or “page jitter”. It will greatly reduce system performance.
  • FIG. 1 is a schematic structural diagram of a terminal disclosed in an embodiment of the present application.
  • the terminal 100 includes a storage and processing circuit 110, and a sensor 170 connected to the storage and processing circuit 110.
  • the sensor 170 may include a camera, Distance sensor, gravity sensor, etc.
  • the electronic device of the present application may include two transparent display screens, which are arranged on the back and front of the electronic device, and some or all of the parts between the two transparent display screens may also be Transparent, so the electronic device can be a transparent electronic device in terms of visual effects. If some parts are transparent, the electronic device can be a hollowed-out electronic device. in:
  • the terminal 100 may include a control circuit, and the control circuit may include a storage and processing circuit 110.
  • the storage and processing circuit 110 can be memory, such as hard disk drive memory, non-volatile memory (such as flash memory or other electronic programmable read-only memory used to form a solid-state drive, etc.), volatile memory (such as static or dynamic random access memory). Access to memory, etc.), etc., are not limited in the embodiment of the present application.
  • the processing circuit in the storage and processing circuit 110 may be used to control the operation of the terminal 100.
  • the processing circuit can be implemented based on one or more microprocessors, microcontrollers, digital signal processors, baseband processors, power management units, audio codec chips, application specific integrated circuits, display driver integrated circuits, etc.
  • the storage and processing circuit 110 can be used to run software in the terminal 100, such as Internet browsing applications, Voice over Internet Protocol (VOIP) phone call applications, email applications, media playback applications, operating system functions, etc. .
  • These software can be used to perform some control operations, for example, camera-based image capture, ambient light measurement based on ambient light sensors, proximity sensor measurement based on proximity sensors, and information based on status indicators such as the status indicator of light-emitting diodes.
  • Operations, control operations associated with the collection and processing of button press event data, and other functions in the terminal 100 are not limited in the embodiment of the present application.
  • the terminal 100 may include an input-output circuit 150.
  • the input-output circuit 150 can be used to enable the terminal 100 to input and output data, that is, to allow the terminal 100 to receive data from an external device and also allow the terminal 100 to output data from the terminal 100 to an external device.
  • the input-output circuit 150 may further include a sensor 170.
  • the sensor 170 vein recognition module may also include an ambient light sensor, a proximity sensor based on light and capacitance, a fingerprint recognition module, and a touch sensor (for example, a light-based touch sensor and/or a capacitive touch sensor, where the touch sensor may It is a part of the touch screen, and can also be used independently as a touch sensor structure), acceleration sensor, camera, and other sensors, etc.
  • the camera can be a front camera or a rear camera, and the fingerprint recognition module can be integrated under the display , Used to collect fingerprint images, the fingerprint recognition module can be: optical fingerprint module, etc., which is not limited here.
  • the aforementioned front camera can be arranged below the front display screen, and the aforementioned rear camera can be arranged below the rear display screen.
  • the foregoing front camera or rear camera may not be integrated with the display screen.
  • the foregoing front camera or rear camera may also have a lifting structure.
  • the specific embodiments of this application do not limit the foregoing front camera. Or the specific structure of the rear camera.
  • the input-output circuit 150 may also include one or more display screens. In the case of multiple display screens, for example, two display screens, one display screen may be set in front of the electronic device, and the other display screen may be set in the electronic device. , Such as the display screen 130.
  • the display screen 130 may include one or a combination of a liquid crystal display screen, a transparent display screen, an organic light emitting diode display screen, an electronic ink display screen, a plasma display screen, and a display screen using other display technologies.
  • the display screen 130 may include a touch sensor array (ie, the display screen 130 may be a touch display screen).
  • the touch sensor can be a capacitive touch sensor formed by an array of transparent touch sensor electrodes (such as indium tin oxide (ITO) electrodes), or it can be a touch sensor formed using other touch technologies, such as sonic touch, pressure-sensitive touch, and resistance. Touch, optical touch, etc., are not limited in the embodiment of the present application.
  • transparent touch sensor electrodes such as indium tin oxide (ITO) electrodes
  • touch sensor formed using other touch technologies such as sonic touch, pressure-sensitive touch, and resistance. Touch, optical touch, etc., are not limited in the embodiment of the present application.
  • the terminal 100 may also include an audio component 140.
  • the audio component 140 may be used to provide audio input and output functions for the terminal 100.
  • the audio component 140 in the terminal 100 may include a speaker, a microphone, a buzzer, a tone generator, and other components for generating and detecting sounds.
  • the communication circuit 120 may be used to provide the terminal 100 with the ability to communicate with external devices.
  • the communication circuit 120 may include analog and digital input-output interface circuits, and wireless communication circuits based on radio frequency signals and/or optical signals.
  • the wireless communication circuit in the communication circuit 120 may include a radio frequency transceiver circuit, a power amplifier circuit, a low noise amplifier, a switch, a filter, and an antenna.
  • the wireless communication circuit in the communication circuit 120 may include a circuit for supporting Near Field Communication (NFC) by transmitting and receiving near-field coupled electromagnetic signals.
  • the communication circuit 120 may include a near field communication antenna and a near field communication transceiver.
  • the communication circuit 120 may also include a cellular phone transceiver and antenna, a wireless local area network transceiver circuit and antenna, and so on.
  • the terminal 100 may further include a battery, a power management circuit, and other input-output units 160.
  • the input-output unit 160 may include buttons, joysticks, click wheels, scroll wheels, touch pads, keypads, keyboards, cameras, light emitting diodes, and other status indicators.
  • the user can control the operation of the terminal 100 by inputting commands through the input-output circuit 150, and can use the output data of the input-output circuit 150 to receive status information and other outputs from the terminal 100.
  • Figure 2 provides a page thrashing protection method for operating system memory recovery. This method can be applied to the user equipment UE shown in Figure 1, and the specific structure of the UE may be the terminal structure shown in Figure 1. , The method is shown in Figure 2 and includes the following steps:
  • Step S201 The UE performs data collection on multiple application scenarios to obtain a bumpy page data set
  • the multiple application scenarios in step S201 can be implemented in multiple ways.
  • one application can correspond to one application scenario
  • multiple application scenarios can correspond to multiple applications, for example, Multiple apps, each app running corresponds to an application scenario.
  • multiple applications can correspond to one application scenario.
  • other methods may correspond to an application scenario, for example, different network connection methods correspond to one application scenario, for example, the wifi mode corresponds to one application scenario, and the 5G mode corresponds to one application scenario. etc.
  • the implementation method of the foregoing step S201 may specifically include:
  • the method of its realization may specifically include:
  • the UE runs multiple application scenarios. For each application scenario, the system extracts pagecache addition records and pagecache deletion records in the ftrace information, so that multiple pagecache addition records and multiple pagecache deletion records are obtained, and records are added from multiple pagecaches.
  • a pagecache delete record searches for the same page of the same type. The same page is included in multiple pagecache addition records and multiple pagecache delete records.
  • Step S202 The UE intersects each element in the bumpy page data set to obtain a page set list_thrashing_common that has bumps in the multiple application scenarios; obtains a collection of all elements in the bumpy page data set to obtain all bumps that have occurred. Page collection list_thrashing_all;
  • the implementation method of step S202 may specifically include:
  • the UE calculates the intersection of the elements in the thrashing page data set, and has the ability to gather the thrashing pages in all application scenarios into list_thrashing_common. For the elements in list_thrashing_common, that is, pages where thrashing occurs in all application scenarios.
  • the UE sums up each element in the thrashing page data set, and has the ability to aggregate the thrashing pages (the thrashing pages that have occurred one or more times) in all application scenarios into list_thrashing_all. For the elements in list_thrashing_all, that is, the page where thrashing occurs in at least one application scenario.
  • Step S203 The UE protects the list_thrashing_common and the list_thrashing_all by using a block as a basic unit.
  • the implementation method of the above step S203 may specifically include:
  • the UE protects each element in the list_thrashing_common and the list_thrashing_all with a block as a basic unit.
  • a bump page is the basic element.
  • Each bump page may contain one or more blocks.
  • all the bump pages contain a small number of blocks (for example, less than Quantity threshold)
  • all blocks are protected (that is, the UE locks all blocks in the physical memory).
  • some blocks are protected. For example, blocks with a large number of bumps are protected, that is, the UE is in Blocks with more lock bumps in physical memory.
  • the UE performs data collection on multiple application scenarios to obtain a bumpy page data set; UE takes the intersection of each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps occur in the multiple application scenarios; Collect all elements in the thrashing page data set to obtain all thrashing page sets list_thrashing_all; the UE protects the list_thrashing_common and the list_thrashing_all using block as a basic unit.
  • the basic unit of protection in this application is a block
  • the granularity of block protection is smaller compared to the protection of a page as the basic unit, so that multiple bumped pages can have the same block, and because the capacity of the block is smaller than the capacity of the page,
  • the memory capacity of the physical memory lock is smaller, which prevents excess physical memory from being locked, improves system performance, and improves user experience.
  • the above UE protecting the list_thrashing_common and the list_thrashing_all using a block as a basic unit specifically includes:
  • the UE extends the PinnerService function of the operating system, and the extended PinnerService function is used for block-wise protection in the list_thrashing_common and the list_thrashing_all.
  • step S203 the above method may further include:
  • step S203 the above method may further include:
  • the UE starts the dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
  • FIG. 3 provides a page bump protection device for operating system memory recovery, the device is applied to user equipment UE, and the device includes:
  • the collection unit 301 is configured to collect data from multiple application scenarios to obtain a set of bumpy page data
  • the processing unit 302 is configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which thrashing occurs in the multiple application scenarios; and obtain a collection of all the elements in the bumpy page data set to obtain all occurrences.
  • the thrashing page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
  • the technical solution provided by the present application is the page bump protection device recovered by operating system memory to collect data from multiple application scenarios to obtain a bump page data set; the page bump protection device recovered by operating system memory obtains the intersection of each element in the bump page data set Obtain the page set list_thrashing_common where thrashing occurs in the multiple application scenarios; collect all the elements in the thrashing page data set to obtain all the page set list_thrashing_all that has experienced thrashing; use the block block as the list_thrashing_common and the list_thrashing_all The basic unit is protected.
  • the basic unit of protection in this application is a block
  • the granularity of block protection is smaller compared to the protection of a page as the basic unit, so that multiple bumped pages can have the same block, and because the capacity of the block is smaller than the capacity of the page,
  • the memory capacity of the physical memory lock is smaller, which prevents excess physical memory from being locked, improves system performance, and improves user experience.
  • the processing unit 302 is specifically configured to extend the PinnerService function of the operating system, and the extended PinnerService function is used to protect the list_thrashing_common and the list_thrashing_all block by block.
  • the processing unit 302 is further configured to update the list_thrashing_common or the list_thrashing_all to the device resource file of the operating system for compilation.
  • the processing unit 302 is also configured to start dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
  • the collection unit 301 is specifically used to extract pagecache add/delete records in the ftrace information in multiple application scenarios, and find the add/delete records that meet the principle of equality from the add/delete records as one of the bumped page data sets element;
  • Figure 4 provides a terminal, including:
  • the collection module 401 is configured to perform data collection on multiple application scenarios to obtain a bump page data set
  • the processing module 402 is configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps have occurred in the multiple application scenarios; and obtain a collection of all the elements in the bumpy page data set to obtain all occurrences.
  • the thrashing page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
  • FIG. 5 is a device 70 provided by an embodiment of the present application.
  • the device 70 includes a processor 701, a memory 702, and a communication interface 703.
  • the processor 701, the memory 702, and the communication interface 703 communicate with each other through a bus 704. connect.
  • the memory 702 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or Portable read-only memory (compact disc read-only memory, CD-ROM), the memory 702 is used for related computer programs and data.
  • the communication interface 703 is used to receive and send data.
  • the processor 701 may be one or more central processing units (CPU).
  • CPU central processing units
  • the CPU may be a single-core CPU or a multi-core CPU.
  • the processor 701 in the device 70 is configured to read the computer program code stored in the memory 702, and perform the following operations:
  • Calculating the intersection of each element in the bumping page data set obtains a page set list_thrashing_common in the multiple application scenarios where thrashing occurs; calculating a collection of each element in the bumping page data set obtains a set of all thrashing pages list_thrashing_all;
  • the list_thrashing_common and the list_thrashing_all are protected with a block as a basic unit.
  • the above-mentioned stored computer program code may also perform the following operations:
  • the above-mentioned stored computer program code may also perform the following operations:
  • the above-mentioned stored computer program code may also perform the following operations:
  • the UE starts the dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
  • the above-mentioned stored computer program code may also perform the following operations:
  • the UE extracts pagecache add/delete records in the ftrace information in multiple application scenarios, and finds the add/delete records that meet the principle of equality from the add/delete records as an element in the bump page data set;
  • An embodiment of the present application also provides a chip system.
  • the chip system includes at least one processor, a memory, and an interface circuit.
  • the memory, the transceiver, and the at least one processor are interconnected by wires, and the at least one memory
  • a computer program is stored therein; when the computer program is executed by the processor, the method flow shown in FIG. 2 is realized.
  • the embodiment of the present application also provides a computer-readable storage medium in which a computer program is stored.
  • a computer program is stored.
  • the method flow shown in FIG. 2 is implemented.
  • the embodiment of the present application also provides a computer program product.
  • the computer program product runs on a terminal, the method flow shown in FIG. 2 is realized.
  • An embodiment of the present application also provides a terminal, including a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor
  • the program includes instructions for executing the steps in the method of the embodiment shown in FIG. 2.
  • the electronic device includes a hardware structure and/or software template corresponding to each function.
  • this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
  • the embodiment of the present application may divide the electronic device into functional units according to the foregoing method examples.
  • each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
  • the units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory.
  • a number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application.
  • the aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
  • the program can be stored in a computer-readable memory, and the memory can include: a flash disk , Read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disc, etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Storage Device Security (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

A page thrashing protection method and apparatus for reclaiming the memory of an operating system. The method comprises: a UE performing data collection on a plurality of application scenarios so as to obtain a thrashing page data set (S201); the UE solving intersections of each element in the thrashing page data set so as to obtain a set list_thrashing_common of pages that have been thrashed in all the plurality of application scenarios, and solving collections of each element in the thrashing page data set so as to obtain a set list_thrashing_all of all the pages that have been thrashed (S202); and the UE protecting list_thrashing_common and list_thrashing_all by using a block as a basic unit (S203). The method has the advantage of a good user experience.

Description

操作系统内存回收的页颠簸保护方法及装置Method and device for page bumping protection of operating system memory recovery 技术领域Technical field
本申请涉及通信技术领域,尤其涉及一种操作系统内存回收的页颠簸保护方法及装置。This application relates to the field of communication technology, and in particular to a page thrashing protection method and device for operating system memory recovery.
背景技术Background technique
android系统(linux内核)对于内存采用了“能用且用,忙时回收”的使用原则。内存的回收造成一些频繁使用的文件页被连续的扫描了两次,从而活动性快速降低为INACTIVE,最终被回收到buddy系统。后续应用又访问了文件的对应位置,使得分配物理页/读入文件内容的动作再次发生,一般将这个过程为页颠簸。The android system (linux kernel) adopts the principle of "usable and usable, recycling when busy" for memory. The recycling of memory caused some frequently used file pages to be scanned twice in succession, and the activity was quickly reduced to INACTIVE, which was finally recycled to the buddy system. Subsequent applications access the corresponding location of the file, so that the action of allocating physical pages/reading file content occurs again, and this process is generally referred to as page thrashing.
页颠簸的数量过多会导致系统的性能下降,影响用户的使用,降低用户体验度。Too many page bumps will cause the performance of the system to decline, affect the use of users, and reduce user experience.
发明内容Summary of the invention
本申请实施例公开了一种操作系统内存回收的页颠簸保方法,能够减少颠簸页的物理内存保护容量,提高系统的性能,提高用户体验度。The embodiment of the present application discloses a page thrashing protection method for operating system memory recovery, which can reduce the physical memory protection capacity of thrashed pages, improve system performance, and improve user experience.
本申请实施例第一方面提供一种操作系统内存回收的页颠簸保护方法,所述方法应用于用户设备UE,所述方法包括如下步骤:The first aspect of the embodiments of the present application provides a page thrashing protection method for operating system memory recovery. The method is applied to a user equipment UE, and the method includes the following steps:
UE对多个应用场景进行数据采集得到颠簸页数据集合;UE performs data collection on multiple application scenarios to obtain a bump page data set;
UE对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;The UE calculates the intersection of each element in the thrashing page data set to obtain the page set list_thrashing_common in the multiple application scenarios where thrashing occurs; and obtains the collection of all the elements in the thrashing page data set to obtain a set of all thrashing pages list_thrashing_all ;
UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护The UE protects the list_thrashing_common and the list_thrashing_all with block as the basic unit
本申请实施例第二方面提供一种操作系统内存回收的页颠簸保护装置,所述装置应用于用户设备UE,所述装置包括:The second aspect of the embodiments of the present application provides a page thrashing protection device for operating system memory recovery. The device is applied to user equipment UE, and the device includes:
采集单元,用于对多个应用场景进行数据采集得到颠簸页数据集合;The collection unit is used to collect data from multiple application scenarios to obtain a set of bumpy page data;
处理单元,用于对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合 中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。A processing unit, configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps have occurred in the multiple application scenarios; obtain a collection of all elements in the bumpy page data set to obtain all bumps that have occurred The page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
第三方面,提供一种终端,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行第一方面所述的方法中的步骤的指令。In a third aspect, a terminal is provided, including a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor, The program includes instructions for executing the steps in the method described in the first aspect.
本申请实施例第四方面公开了一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行第一方面所述的方法。A fourth aspect of the embodiments of the present application discloses a computer-readable storage medium, which is characterized by storing a computer program for electronic data exchange, wherein the computer program causes a computer to execute the method described in the first aspect.
本申请实施例第五方面公开了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。The fifth aspect of the embodiments of the present application discloses a computer program product, wherein the above-mentioned computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the above-mentioned computer program is operable to cause a computer to execute operations as in the embodiments of the present application. Some or all of the steps described in the first aspect. The computer program product may be a software installation package.
通过实施本申请实施例,本申请提供的技术方案UE对多个应用场景进行数据采集得到颠簸页数据集合;UE对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。由于本申请的保护基本单元为block,相对于页为基本单元的保护,block保护的粒度更小,这样对于多个颠簸页可以具有相同的block,并且由于block的容量比页的容量小,因此物理内存锁定的内存容量更小,避免了多余的物理内存被锁定,提高了系统性能,提高了用户体验度。By implementing the embodiments of the present application, the technical solution provided by the present application is that the UE collects data from multiple application scenarios to obtain a bumpy page data set; the UE calculates the intersection of each element in the bumpy page data set to obtain all of the multiple application scenarios. The thrashing page set list_thrashing_common; all elements in the thrashing page data set are collected to obtain all the thrashing page sets list_thrashing_all; the UE protects the list_thrashing_common and the list_thrashing_all using block as a basic unit. Since the basic unit of protection in this application is a block, the granularity of block protection is smaller compared to the protection of a page as the basic unit, so that multiple bumped pages can have the same block, and because the capacity of the block is smaller than the capacity of the page, The memory capacity of the physical memory lock is smaller, which prevents excess physical memory from being locked, improves system performance, and improves user experience.
附图说明Description of the drawings
以下对本申请实施例用到的附图进行介绍。The following describes the drawings used in the embodiments of the present application.
图1是本申请实施例提供的一种终端的结构示意图;FIG. 1 is a schematic structural diagram of a terminal provided by an embodiment of the present application;
图2是本申请实施例提供的一种操作系统内存回收的页颠簸保护方法的流程示意图;2 is a schematic flowchart of a page thrashing protection method for operating system memory recovery provided by an embodiment of the present application;
图3是本申请实施例提供的一种操作系统内存回收的页颠簸保护装置的结构示意图;FIG. 3 is a schematic structural diagram of a page thrashing protection device for operating system memory recovery provided by an embodiment of the present application;
图4是本申请实施例提供的终端的结构示意图;FIG. 4 is a schematic structural diagram of a terminal provided by an embodiment of the present application;
图5是本申请实施例提供的一种设备的结构示意图。Fig. 5 is a schematic structural diagram of a device provided by an embodiment of the present application.
具体实施方式detailed description
下面结合本申请实施例中的附图对本申请实施例进行描述。The embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
本申请中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/“,表示前后关联对象是一种“或”的关系。The term "and/or" in this application is only an association relationship that describes associated objects, indicating that there can be three types of relationships. For example, A and/or B can mean: A alone exists, and both A and B exist at the same time. There are three cases of B. In addition, the character "/" in this document indicates that the associated objects before and after are in an "or" relationship.
本申请实施例中出现的“多个”是指两个或两个以上。本申请实施例中出现的第一、第二等描述,仅作示意与区分描述对象之用,没有次序之分,也不表示本申请实施例中对设备个数的特别限定,不能构成对本申请实施例的任何限制。本申请实施例中出现的“连接”是指直接连接或者间接连接等各种连接方式,以实现设备间的通信,本申请实施例对此不做任何限定。The "plurality" appearing in the embodiments of the present application refers to two or more than two. The descriptions of the first, second, etc. appearing in the embodiments of this application are only used for illustration and distinguishing the description objects, and there is no order, and it does not mean that the number of devices in the embodiments of this application is particularly limited, and does not constitute a reference to this application. Any limitations of the embodiment. The "connection" appearing in the embodiments of this application refers to various connection modes such as direct connection or indirect connection to realize communication between devices, which is not limited in the embodiments of this application.
本申请实施例中的终端可以指各种形式的UE、接入终端、用户单元、用户站、移动站、MS(英文:mobile station,中文:移动台)、远方站、远程终端、移动设备、用户终端、终端设备(英文:terminal equipment)、无线通信设备、用户代理或用户装置。终端设备还可以是蜂窝电话、无绳电话、SIP(英文:session initiation protocol,中文:会话启动协议)电话、WLL(英文:wireless local loop,中文:无线本地环路)站、PDA(英文:personal digital assistant,中文:个人数字处理)、具有无线通信功能的手持设备、计算设备或连接到无线调制解调器的其它处理设备、车载设备、可穿戴设备,未来5G网络中的终端设备或者未来演进的PLMN(英文:public land mobile network,中文:公用陆地移动通信网络)中的终端设备等,本申请实施例对此并不限定。The terminal in the embodiments of this application may refer to various forms of UE, access terminal, user unit, user station, mobile station, MS (English: mobile station, Chinese: mobile station), remote station, remote terminal, mobile device, User terminal, terminal equipment (English: terminal equipment), wireless communication equipment, user agent, or user device. Terminal devices can also be cellular phones, cordless phones, SIP (English: session initiation protocol, Chinese: Session Initiation Protocol) phones, WLL (English: wireless local loop, Chinese: wireless local loop) stations, PDA (English: personal digital) assistant, Chinese: personal digital processing), handheld devices with wireless communication functions, computing devices or other processing devices connected to wireless modems, in-vehicle devices, wearable devices, terminal devices in the future 5G network or future evolution of PLMN (English : Public land mobile network, Chinese: public land mobile communication network), which is not limited in the embodiment of the present application.
操作系统(例如安卓系统、处于增强模式的UNIX、Windows)使用虚拟内存。事实上的内存是一种技术,通过使用磁盘空间来模拟RAM(随机存取 内存),使机器的行为就像拥有比实际更多的内存一样。在终端中,都存在一种称为内存管理单元(MMU)的硬件。Operating systems (such as Android, UNIX in enhanced mode, Windows) use virtual memory. Actual memory is a technology that simulates RAM (random access memory) by using disk space to make the machine behave as if it has more memory than it actually is. In the terminal, there is a kind of hardware called a memory management unit (MMU).
MMU把内存当作是由一系列“页”组成的一定大小的连续字节,通常为4096或8192字节。操作系统为每个运行的程序设置并维护一个称为进程内存映射(PMM)的表。PMM包含程序可以访问的所有内存页,以及每个内存页的实际位置。MMU treats memory as a series of "pages" composed of continuous bytes of a certain size, usually 4096 or 8192 bytes. The operating system sets up and maintains a table called Process Memory Map (PMM) for each running program. The PMM contains all the memory pages that the program can access, as well as the actual location of each memory page.
每次程序访问内存的任何部分时,MMU都会处理该地址(称为“虚拟地址”)。MMU在PMM中查找内存的实际位置(称为“物理地址”),物理地址可以是操作系统为其分配的内存或磁盘中的任何位置,如果程序要访问的位置在磁盘上,则必须将包含它的页面从磁盘读取到内存中,并且必须更新PMM以反映此操作(这称为“页面错误”)。Each time a program accesses any part of the memory, the MMU will process the address (called a "virtual address"). MMU finds the actual location of the memory in the PMM (called "physical address"). The physical address can be any location in the memory or disk allocated by the operating system. If the location to be accessed by the program is on the disk, it must contain Its pages are read from disk into memory, and the PMM must be updated to reflect this operation (this is called a "page fault").
因为访问磁盘要比访问RAM慢得多,所以操作系统试图将尽可能多的虚拟内存保存在RAM中。如果正在运行一个足够大的程序(或同时运行几个小程序),则可能没有足够的RAM来保存程序使用的所有内存,因此必须将其中一些内存移出RAM并移到磁盘上(此操作称为“分页”)。Because access to disk is much slower than access to RAM, the operating system tries to store as much virtual memory as possible in RAM. If you are running a large enough program (or running several small programs at the same time), you may not have enough RAM to hold all the memory used by the program, so some of it must be moved out of RAM and to disk (this operation is called "Paging").
操作系统猜测哪些内存区域在一段时间内不太可能被使用(通常基于过去内存的使用方式),如果它猜错了,或者如果当前程序在很多地方访问了大量内存,为了读入被调出的页面,会出现很多页面错误。因为所有的RAM都在使用,所以要访问读入的每一页,必须调出另一页,这可能会导致更多的页面错误,因为现在已将另一页内存移到磁盘,在短时间内出现许多页面错误的问题,称为“页面抖动”,会大大降低系统的性能。The operating system guesses which memory areas are unlikely to be used in a period of time (usually based on the past memory usage), if it guesses wrong, or if the current program accesses a large amount of memory in many places, it is called out in order to read in Page, there will be many page errors. Because all RAM is in use, to access each page read in, another page must be called out, which may cause more page faults, because another page of memory has now been moved to disk, in a short time There are many page faults in the system, called "page jitter", which will greatly reduce the performance of the system.
操作系统会因为物理内存的大小限制,对于新出现的内存需求而去回收正在使用的内存。如果回收的目标页是经常被用到的文件页(即所谓的热页),则会很快的因为缺页异常而重新读入,这种情况称为“页颠簸”或者“页面抖动”,它会大大的降低系统性能。The operating system will reclaim the memory that is being used due to the size of the physical memory. If the recovered target page is a frequently used document page (the so-called hot page), it will be read again quickly due to abnormal page faults. This situation is called "page thrashing" or "page jitter". It will greatly reduce system performance.
请参阅图1,图1是本申请实施例公开的一种终端的结构示意图,终端100包括存储和处理电路110,以及与所述存储和处理电路110连接的传感器170 ,传感器170可以包括摄像头、距离传感器、重力传感器等,本申请电子设备可以包括两块透明显示屏,该透明显示屏设置在电子设备的背面和正面,两块透明显示屏之间的部件中的部分或全部部件也可以为透明的,因此该电子设备从视觉效果上可以是一种透明电子设备,如果为部分部件为透明的,则该电子设备可以为镂空电子设备。其中:Please refer to FIG. 1, which is a schematic structural diagram of a terminal disclosed in an embodiment of the present application. The terminal 100 includes a storage and processing circuit 110, and a sensor 170 connected to the storage and processing circuit 110. The sensor 170 may include a camera, Distance sensor, gravity sensor, etc., the electronic device of the present application may include two transparent display screens, which are arranged on the back and front of the electronic device, and some or all of the parts between the two transparent display screens may also be Transparent, so the electronic device can be a transparent electronic device in terms of visual effects. If some parts are transparent, the electronic device can be a hollowed-out electronic device. in:
终端100可以包括控制电路,该控制电路可以包括存储和处理电路110。该存储和处理电路110可以存储器,例如硬盘驱动存储器,非易失性存储器(例如闪存或用于形成固态驱动器的其它电子可编程只读存储器等),易失性存储器(例如静态或动态随机存取存储器等)等,本申请实施例不作限制。存储和处理电路110中的处理电路可以用于控制终端100的运转。该处理电路可以基于一个或多个微处理器,微控制器,数字信号处理器,基带处理器,功率管理单元,音频编解码器芯片,专用集成电路,显示驱动器集成电路等来实现。The terminal 100 may include a control circuit, and the control circuit may include a storage and processing circuit 110. The storage and processing circuit 110 can be memory, such as hard disk drive memory, non-volatile memory (such as flash memory or other electronic programmable read-only memory used to form a solid-state drive, etc.), volatile memory (such as static or dynamic random access memory). Access to memory, etc.), etc., are not limited in the embodiment of the present application. The processing circuit in the storage and processing circuit 110 may be used to control the operation of the terminal 100. The processing circuit can be implemented based on one or more microprocessors, microcontrollers, digital signal processors, baseband processors, power management units, audio codec chips, application specific integrated circuits, display driver integrated circuits, etc.
存储和处理电路110可用于运行终端100中的软件,例如互联网浏览应用程序,互联网协议语音(Voice over Internet Protocol,VOIP)电话呼叫应用程序,电子邮件应用程序,媒体播放应用程序,操作系统功能等。这些软件可以用于执行一些控制操作,例如,基于照相机的图像采集,基于环境光传感器的环境光测量,基于接近传感器的接近传感器测量,基于诸如发光二极管的状态指示灯等状态指示器实现的信息显示功能,基于触摸传感器的触摸事件检测,与在多个(例如分层的)显示屏上显示信息相关联的功能,与执行无线通信功能相关联的操作,与收集和产生音频信号相关联的操作,与收集和处理按钮按压事件数据相关联的控制操作,以及终端100中的其它功能等,本申请实施例不作限制。The storage and processing circuit 110 can be used to run software in the terminal 100, such as Internet browsing applications, Voice over Internet Protocol (VOIP) phone call applications, email applications, media playback applications, operating system functions, etc. . These software can be used to perform some control operations, for example, camera-based image capture, ambient light measurement based on ambient light sensors, proximity sensor measurement based on proximity sensors, and information based on status indicators such as the status indicator of light-emitting diodes. Display functions, touch event detection based on touch sensors, functions associated with displaying information on multiple (for example, layered) display screens, operations associated with performing wireless communication functions, associated with collecting and generating audio signals Operations, control operations associated with the collection and processing of button press event data, and other functions in the terminal 100 are not limited in the embodiment of the present application.
终端100可以包括输入-输出电路150。输入-输出电路150可用于使终端100实现数据的输入和输出,即允许终端100从外部设备接收数据和也允许终端100将数据从终端100输出至外部设备。输入-输出电路150可以进一步包括传感器170。传感器170静脉识别模组,还可以包括环境光传感器,基于光和电容的接近传感器,指纹识别模组,、触摸传感器(例如,基于光触摸传感器和/或电容式触摸传感器,其中,触摸传感器可以是触控显示屏的一部分,也可以作为一个触摸传感器结构独立使用),加速度传感器,摄像头,和其它 传感器等,摄像头可以为前置摄像头或者后置摄像头,指纹识别模组可集成于显示屏下方,用于采集指纹图像,指纹识别模组可以为:光学指纹模组等等,在此不作限定。上述前置摄像头可以设置前面显示屏的下方,上述后置摄像头可以设置在后面显示屏的下方。当然上述前置摄像头或后置摄像头也可以不和显示屏集成设置,当然在实际应用中,上述前置摄像头或后置摄像头还可以为升降结构,本申请具体实施方式并不限制上述前置摄像头或后置摄像头的具体结构。The terminal 100 may include an input-output circuit 150. The input-output circuit 150 can be used to enable the terminal 100 to input and output data, that is, to allow the terminal 100 to receive data from an external device and also allow the terminal 100 to output data from the terminal 100 to an external device. The input-output circuit 150 may further include a sensor 170. The sensor 170 vein recognition module may also include an ambient light sensor, a proximity sensor based on light and capacitance, a fingerprint recognition module, and a touch sensor (for example, a light-based touch sensor and/or a capacitive touch sensor, where the touch sensor may It is a part of the touch screen, and can also be used independently as a touch sensor structure), acceleration sensor, camera, and other sensors, etc. The camera can be a front camera or a rear camera, and the fingerprint recognition module can be integrated under the display , Used to collect fingerprint images, the fingerprint recognition module can be: optical fingerprint module, etc., which is not limited here. The aforementioned front camera can be arranged below the front display screen, and the aforementioned rear camera can be arranged below the rear display screen. Of course, the foregoing front camera or rear camera may not be integrated with the display screen. Of course, in practical applications, the foregoing front camera or rear camera may also have a lifting structure. The specific embodiments of this application do not limit the foregoing front camera. Or the specific structure of the rear camera.
输入-输出电路150还可以包括一个或多个显示屏,当为多个显示屏时,例如2个显示屏时,一个显示屏可以设置在电子设备的前面,另一个显示屏可以设置在电子设备的后面,例如显示屏130。显示屏130可以包括液晶显示屏,透明显示屏,有机发光二极管显示屏,电子墨水显示屏,等离子显示屏,使用其它显示技术的显示屏中一种或者几种的组合。显示屏130可以包括触摸传感器阵列(即,显示屏130可以是触控显示屏)。触摸传感器可以是由透明的触摸传感器电极(例如氧化铟锡(ITO)电极)阵列形成的电容式触摸传感器,或者可以是使用其它触摸技术形成的触摸传感器,例如音波触控,压敏触摸,电阻触摸,光学触摸等,本申请实施例不作限制。The input-output circuit 150 may also include one or more display screens. In the case of multiple display screens, for example, two display screens, one display screen may be set in front of the electronic device, and the other display screen may be set in the electronic device. , Such as the display screen 130. The display screen 130 may include one or a combination of a liquid crystal display screen, a transparent display screen, an organic light emitting diode display screen, an electronic ink display screen, a plasma display screen, and a display screen using other display technologies. The display screen 130 may include a touch sensor array (ie, the display screen 130 may be a touch display screen). The touch sensor can be a capacitive touch sensor formed by an array of transparent touch sensor electrodes (such as indium tin oxide (ITO) electrodes), or it can be a touch sensor formed using other touch technologies, such as sonic touch, pressure-sensitive touch, and resistance. Touch, optical touch, etc., are not limited in the embodiment of the present application.
终端100还可以包括音频组件140。音频组件140可以用于为终端100提供音频输入和输出功能。终端100中的音频组件140可以包括扬声器,麦克风,蜂鸣器,音调发生器以及其它用于产生和检测声音的组件。The terminal 100 may also include an audio component 140. The audio component 140 may be used to provide audio input and output functions for the terminal 100. The audio component 140 in the terminal 100 may include a speaker, a microphone, a buzzer, a tone generator, and other components for generating and detecting sounds.
通信电路120可以用于为终端100提供与外部设备通信的能力。通信电路120可以包括模拟和数字输入-输出接口电路,和基于射频信号和/或光信号的无线通信电路。通信电路120中的无线通信电路可以包括射频收发器电路、功率放大器电路、低噪声放大器、开关、滤波器和天线。举例来说,通信电路120中的无线通信电路可以包括用于通过发射和接收近场耦合电磁信号来支持近场通信(Near Field Communication,NFC)的电路。例如,通信电路120可以包括近场通信天线和近场通信收发器。通信电路120还可以包括蜂窝电话收发器和天线,无线局域网收发器电路和天线等。The communication circuit 120 may be used to provide the terminal 100 with the ability to communicate with external devices. The communication circuit 120 may include analog and digital input-output interface circuits, and wireless communication circuits based on radio frequency signals and/or optical signals. The wireless communication circuit in the communication circuit 120 may include a radio frequency transceiver circuit, a power amplifier circuit, a low noise amplifier, a switch, a filter, and an antenna. For example, the wireless communication circuit in the communication circuit 120 may include a circuit for supporting Near Field Communication (NFC) by transmitting and receiving near-field coupled electromagnetic signals. For example, the communication circuit 120 may include a near field communication antenna and a near field communication transceiver. The communication circuit 120 may also include a cellular phone transceiver and antenna, a wireless local area network transceiver circuit and antenna, and so on.
终端100还可以进一步包括电池,电力管理电路和其它输入-输出单元160。输入-输出单元160可以包括按钮,操纵杆,点击轮,滚动轮,触摸板, 小键盘,键盘,照相机,发光二极管和其它状态指示器等。The terminal 100 may further include a battery, a power management circuit, and other input-output units 160. The input-output unit 160 may include buttons, joysticks, click wheels, scroll wheels, touch pads, keypads, keyboards, cameras, light emitting diodes, and other status indicators.
用户可以通过输入-输出电路150输入命令来控制终端100的操作,并且可以使用输入-输出电路150的输出数据以实现接收来自终端100的状态信息和其它输出。The user can control the operation of the terminal 100 by inputting commands through the input-output circuit 150, and can use the output data of the input-output circuit 150 to receive status information and other outputs from the terminal 100.
参阅图2,图2提供了一种操作系统内存回收的页颠簸保护方法,该方法可以应用于如图1所示的用户设备UE,该UE的具体结构可以为如图1所示的终端结构,该方法如图2所示,包括如下步骤:Referring to Figure 2, Figure 2 provides a page thrashing protection method for operating system memory recovery. This method can be applied to the user equipment UE shown in Figure 1, and the specific structure of the UE may be the terminal structure shown in Figure 1. , The method is shown in Figure 2 and includes the following steps:
步骤S201、UE对多个应用场景进行数据采集得到颠簸页数据集合;Step S201: The UE performs data collection on multiple application scenarios to obtain a bumpy page data set;
上述步骤S201中的多个应用场景的实现方式可以有多种,例如,在一种可选的实施方案中,一个应用程序可以对应一个应用场景,多个应用场景可以对应多个应用程序,例如多个app,每个app运行对应一个应用场景。在另一种可选的方式方案中,多个应用程序可以对应一个应用场景。当然在实际实施方案中,还可以为其他方式对应一个应用场景,例如,不同的网络连接方式对应一个应用场景,例如,wifi模式对应一个应用场景,5G模式对应一个应用场景。等等。The multiple application scenarios in step S201 can be implemented in multiple ways. For example, in an alternative embodiment, one application can correspond to one application scenario, and multiple application scenarios can correspond to multiple applications, for example, Multiple apps, each app running corresponds to an application scenario. In another optional scheme, multiple applications can correspond to one application scenario. Of course, in the actual implementation, other methods may correspond to an application scenario, for example, different network connection methods correspond to one application scenario, for example, the wifi mode corresponds to one application scenario, and the 5G mode corresponds to one application scenario. etc.
上述步骤S201的实现方法具体可以包括:The implementation method of the foregoing step S201 may specifically include:
抽取多个应用场景中的ftrace信息中的pagecache添加/删除记录,从添加/删除记录中查找出符合相等原则的添加/删除记录作为所述颠簸页数据集合中的一个元素;Extract pagecache add/delete records in the ftrace information in multiple application scenarios, and find out the add/delete records that meet the principle of equality from the add/delete records as an element in the bump page data set;
所述相等原则为:相同类型且添加/删除记录中相同页的添加记录以及删除记录。The principle of equality is: add records and delete records of the same type and the same page in the add/delete records.
其实现的方法具体可以包括:The method of its realization may specifically include:
UE运行多个应用场景,每运行一个应用场景,系统抽取ftrace信息中的pagecache添加记录以及pagecache删除记录,这样即得到多个pagecache添加记录以及多个pagecache删除记录,从多个pagecache添加记录以及多个pagecache删除记录查找相同类型的相同页,该相同页即包含在多个pagecache添加记录之中,也包含在多个pagecache删除记录之中。UE runs multiple application scenarios. For each application scenario, the system extracts pagecache addition records and pagecache deletion records in the ftrace information, so that multiple pagecache addition records and multiple pagecache deletion records are obtained, and records are added from multiple pagecaches. A pagecache delete record searches for the same page of the same type. The same page is included in multiple pagecache addition records and multiple pagecache delete records.
上述相同类型包括:pid、time、dev、ino或ofs。The same types mentioned above include: pid, time, dev, ino, or ofs.
步骤S202、UE对所述颠簸页数据集合中各个元素求交集得到所述多个应 用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;Step S202: The UE intersects each element in the bumpy page data set to obtain a page set list_thrashing_common that has bumps in the multiple application scenarios; obtains a collection of all elements in the bumpy page data set to obtain all bumps that have occurred. Page collection list_thrashing_all;
在一种可选的方案中,上述步骤S202的实现方法具体可以包括:In an optional solution, the implementation method of step S202 may specifically include:
UE对颠簸页数据集合中各元素求交集,具有将所有应用场景中均发生颠簸的页集合到list_thrashing_common。对于list_thrashing_common中的元素,即所有的应用场景中均发生颠簸的页。The UE calculates the intersection of the elements in the thrashing page data set, and has the ability to gather the thrashing pages in all application scenarios into list_thrashing_common. For the elements in list_thrashing_common, that is, pages where thrashing occurs in all application scenarios.
UE对颠簸页数据集合中各元素求和集,具有将所有应用场景中发生过颠簸的页(发生过一次或多次的颠簸页)集合到list_thrashing_all。对于list_thrashing_all中的元素,即至少一个应用场景中发生颠簸的页。The UE sums up each element in the thrashing page data set, and has the ability to aggregate the thrashing pages (the thrashing pages that have occurred one or more times) in all application scenarios into list_thrashing_all. For the elements in list_thrashing_all, that is, the page where thrashing occurs in at least one application scenario.
步骤S203、UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。Step S203: The UE protects the list_thrashing_common and the list_thrashing_all by using a block as a basic unit.
上述步骤S203的实现方法具体可以包括:The implementation method of the above step S203 may specifically include:
UE将所述list_thrashing_common以及所述list_thrashing_all中的每个元素以块block为基本单元进行保护。The UE protects each element in the list_thrashing_common and the list_thrashing_all with a block as a basic unit.
对于所述list_thrashing_common以及所述list_thrashing_all的元素以颠簸页为基本元素,每个颠簸页可能包含一个或多个block,在一种方案中,若所有颠簸页包含的block的数量较小(例如低于数量阈值),则对所有block进行保护(即UE在物理内存中锁定所有block)。在另一种可选方案中,若所有颠簸页包含的block的数量较大(例如大于等于数量阈值),则对部分block进行保护,例如,对颠簸次数较多的block进行保护,即UE在物理内存中锁定颠簸次数较多的block。For the elements of the list_thrashing_common and the list_thrashing_all, a bump page is the basic element. Each bump page may contain one or more blocks. In one solution, if all the bump pages contain a small number of blocks (for example, less than Quantity threshold), all blocks are protected (that is, the UE locks all blocks in the physical memory). In another alternative, if the number of blocks contained in all bump pages is large (for example, greater than or equal to the number threshold), some blocks are protected. For example, blocks with a large number of bumps are protected, that is, the UE is in Blocks with more lock bumps in physical memory.
本申请提供的技术方案UE对多个应用场景进行数据采集得到颠簸页数据集合;UE对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。由于本申请的保护基本单元为block,相对于页为基本单元的保护,block保护的粒度更小,这样对于多个颠簸页可以具有相同的block,并且由于block的容量比页的容量小,因此物理内存锁定的内存容量更小,避免了多余的物理 内存被锁定,提高了系统性能,提高了用户体验度。In the technical solution provided by this application, the UE performs data collection on multiple application scenarios to obtain a bumpy page data set; UE takes the intersection of each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps occur in the multiple application scenarios; Collect all elements in the thrashing page data set to obtain all thrashing page sets list_thrashing_all; the UE protects the list_thrashing_common and the list_thrashing_all using block as a basic unit. Since the basic unit of protection in this application is a block, the granularity of block protection is smaller compared to the protection of a page as the basic unit, so that multiple bumped pages can have the same block, and because the capacity of the block is smaller than the capacity of the page, The memory capacity of the physical memory lock is smaller, which prevents excess physical memory from being locked, improves system performance, and improves user experience.
在一种可选的方案中,上述UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护具体包括:In an optional solution, the above UE protecting the list_thrashing_common and the list_thrashing_all using a block as a basic unit specifically includes:
UE扩展操作系统的PinnerService功能,所述扩展PinnerService功能用于在所述list_thrashing_common以及所述list_thrashing_all按块进行保护。The UE extends the PinnerService function of the operating system, and the extended PinnerService function is used for block-wise protection in the list_thrashing_common and the list_thrashing_all.
在一种可选的方案中,上述方法在步骤S203之后,还可以包括:In an optional solution, after step S203, the above method may further include:
将所述list_thrashing_common或者所述list_thrashing_all更新到操作系统的设备资源文件中进行编译。Update the list_thrashing_common or the list_thrashing_all to the device resource file of the operating system for compilation.
在一种可选的方案中,上述方法在步骤S203之后,还可以包括:In an optional solution, after step S203, the above method may further include:
UE启动dumpsys pinner查看已经锁在物理内存中的文件页,若所述文件页包含进行保护的块,确定文件页已锁定。The UE starts the dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
参阅图3,图3提供了一种操作系统内存回收的页颠簸保护装置,所述装置应用于用户设备UE,所述装置包括:Referring to FIG. 3, FIG. 3 provides a page bump protection device for operating system memory recovery, the device is applied to user equipment UE, and the device includes:
采集单元301,用于对多个应用场景进行数据采集得到颠簸页数据集合;The collection unit 301 is configured to collect data from multiple application scenarios to obtain a set of bumpy page data;
处理单元302,用于对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。The processing unit 302 is configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which thrashing occurs in the multiple application scenarios; and obtain a collection of all the elements in the bumpy page data set to obtain all occurrences. The thrashing page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
本申请提供的技术方案操作系统内存回收的页颠簸保护装置对多个应用场景进行数据采集得到颠簸页数据集合;操作系统内存回收的页颠簸保护装置对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。由于本申请的保护基本单元为block,相对于页为基本单元的保护,block保护的粒度更小,这样对于多个颠簸页可以具有相同的block,并且由于block的容量比页的容量小,因此物理内存锁定的内存容量更小,避免了多余的物理内存被锁定,提高了系统性能,提高了用户体验度。The technical solution provided by the present application is the page bump protection device recovered by operating system memory to collect data from multiple application scenarios to obtain a bump page data set; the page bump protection device recovered by operating system memory obtains the intersection of each element in the bump page data set Obtain the page set list_thrashing_common where thrashing occurs in the multiple application scenarios; collect all the elements in the thrashing page data set to obtain all the page set list_thrashing_all that has experienced thrashing; use the block block as the list_thrashing_common and the list_thrashing_all The basic unit is protected. Since the basic unit of protection in this application is a block, the granularity of block protection is smaller compared to the protection of a page as the basic unit, so that multiple bumped pages can have the same block, and because the capacity of the block is smaller than the capacity of the page, The memory capacity of the physical memory lock is smaller, which prevents excess physical memory from being locked, improves system performance, and improves user experience.
在一种可选的方案中,In an alternative scheme,
处理单元302,具体用于扩展操作系统的PinnerService功能,所述扩展PinnerService功能用于在所述list_thrashing_common以及所述list_thrashing_all按块进行保护。The processing unit 302 is specifically configured to extend the PinnerService function of the operating system, and the extended PinnerService function is used to protect the list_thrashing_common and the list_thrashing_all block by block.
在一种可选的方案中,In an alternative scheme,
处理单元302,还用于将所述list_thrashing_common或者所述list_thrashing_all更新到操作系统的设备资源文件中进行编译。The processing unit 302 is further configured to update the list_thrashing_common or the list_thrashing_all to the device resource file of the operating system for compilation.
在一种可选的方案中,In an alternative scheme,
处理单元302,还用于启动dumpsys pinner查看已经锁在物理内存中的文件页,若所述文件页包含进行保护的块,确定文件页已锁定。The processing unit 302 is also configured to start dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
在一种可选的方案中,In an alternative scheme,
采集单元301,具体用于抽取多个应用场景中的ftrace信息中的pagecache添加/删除记录,从添加/删除记录中查找出符合相等原则的添加/删除记录作为所述颠簸页数据集合中的一个元素;The collection unit 301 is specifically used to extract pagecache add/delete records in the ftrace information in multiple application scenarios, and find the add/delete records that meet the principle of equality from the add/delete records as one of the bumped page data sets element;
所述相等原则为:相同类型且添加/删除记录中相同页的添加记录以及删除记录。The principle of equality is: add records and delete records of the same type and the same page in the add/delete records.
在如图3所示实施例中,上述处理单元以及采集单元的细化方案可以参见如图2所示实施例的描述,这里不再赘述。In the embodiment shown in FIG. 3, the detailed solution of the processing unit and the acquisition unit can be referred to the description of the embodiment shown in FIG. 2, which will not be repeated here.
参阅图4,图4提供了一种终端,包括:Referring to Figure 4, Figure 4 provides a terminal, including:
采集模块401,用于对多个应用场景进行数据采集得到颠簸页数据集合;The collection module 401 is configured to perform data collection on multiple application scenarios to obtain a bump page data set;
处理模块402,用于对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。The processing module 402 is configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps have occurred in the multiple application scenarios; and obtain a collection of all the elements in the bumpy page data set to obtain all occurrences. The thrashing page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
如图4所示的终端中的处理模块以及采集模块的具体处理方式可以参见如图2所示实施例的描述,这里不在赘述。For the specific processing methods of the processing module and the collection module in the terminal shown in FIG. 4, reference may be made to the description of the embodiment shown in FIG. 2, which will not be repeated here.
请参见图5,图5是本申请实施例提供的一种设备70,该设备70包括处理器701、存储器702和通信接口703,所述处理器701、存储器702和通信 接口703通过总线704相互连接。Please refer to FIG. 5, which is a device 70 provided by an embodiment of the present application. The device 70 includes a processor 701, a memory 702, and a communication interface 703. The processor 701, the memory 702, and the communication interface 703 communicate with each other through a bus 704. connect.
存储器702包括但不限于是随机存储记忆体(random access memory,RAM)、只读存储器(read-only memory,ROM)、可擦除可编程只读存储器(erasable programmable read only memory,EPROM)、或便携式只读存储器(compact disc read-only memory,CD-ROM),该存储器702用于相关计算机程序及数据。通信接口703用于接收和发送数据。The memory 702 includes but is not limited to random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), or Portable read-only memory (compact disc read-only memory, CD-ROM), the memory 702 is used for related computer programs and data. The communication interface 703 is used to receive and send data.
处理器701可以是一个或多个中央处理器(central processing unit,CPU),在处理器701是一个CPU的情况下,该CPU可以是单核CPU,也可以是多核CPU。The processor 701 may be one or more central processing units (CPU). In the case where the processor 701 is a CPU, the CPU may be a single-core CPU or a multi-core CPU.
该设备70中的处理器701用于读取所述存储器702中存储的计算机程序代码,执行以下操作:The processor 701 in the device 70 is configured to read the computer program code stored in the memory 702, and perform the following operations:
对多个应用场景进行数据采集得到颠簸页数据集合;Perform data collection on multiple application scenarios to obtain a data set of bumpy pages;
对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;Calculating the intersection of each element in the bumping page data set obtains a page set list_thrashing_common in the multiple application scenarios where thrashing occurs; calculating a collection of each element in the bumping page data set obtains a set of all thrashing pages list_thrashing_all;
将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。The list_thrashing_common and the list_thrashing_all are protected with a block as a basic unit.
在一种可选的方案中,上述存储的计算机程序代码还可以执行以下操作:In an optional solution, the above-mentioned stored computer program code may also perform the following operations:
扩展操作系统的PinnerService功能,所述扩展PinnerService功能用于在所述list_thrashing_common以及所述list_thrashing_all按块进行保护。Expand the PinnerService function of the operating system, and the expanded PinnerService function is used to protect the list_thrashing_common and the list_thrashing_all in blocks.
在一种可选的方案中,上述存储的计算机程序代码还可以执行以下操作:In an optional solution, the above-mentioned stored computer program code may also perform the following operations:
将所述list_thrashing_common或者所述list_thrashing_all更新到操作系统的设备资源文件中进行编译。Update the list_thrashing_common or the list_thrashing_all to the device resource file of the operating system for compilation.
在一种可选的方案中,上述存储的计算机程序代码还可以执行以下操作:In an optional solution, the above-mentioned stored computer program code may also perform the following operations:
UE启动dumpsys pinner查看已经锁在物理内存中的文件页,若所述文件页包含进行保护的块,确定文件页已锁定。The UE starts the dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
在一种可选的方案中,上述存储的计算机程序代码还可以执行以下操作:In an optional solution, the above-mentioned stored computer program code may also perform the following operations:
UE抽取多个应用场景中的ftrace信息中的pagecache添加/删除记录,从添加/删除记录中查找出符合相等原则的添加/删除记录作为所述颠簸页数据集 合中的一个元素;The UE extracts pagecache add/delete records in the ftrace information in multiple application scenarios, and finds the add/delete records that meet the principle of equality from the add/delete records as an element in the bump page data set;
所述相等原则为:相同类型且添加/删除记录中相同页的添加记录以及删除记录。The principle of equality is: add records and delete records of the same type and the same page in the add/delete records.
本申请实施例还提供一种芯片系统,所述芯片系统包括至少一个处理器,存储器和接口电路,所述存储器、所述收发器和所述至少一个处理器通过线路互联,所述至少一个存储器中存储有计算机程序;所述计算机程序被所述处理器执行时,图2所示的方法流程得以实现。An embodiment of the present application also provides a chip system. The chip system includes at least one processor, a memory, and an interface circuit. The memory, the transceiver, and the at least one processor are interconnected by wires, and the at least one memory A computer program is stored therein; when the computer program is executed by the processor, the method flow shown in FIG. 2 is realized.
本申请实施例还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当其在网络设备上运行时,图2所示的方法流程得以实现。The embodiment of the present application also provides a computer-readable storage medium in which a computer program is stored. When the computer program is run on a network device, the method flow shown in FIG. 2 is implemented.
本申请实施例还提供一种计算机程序产品,当所述计算机程序产品在终端上运行时,图2所示的方法流程得以实现。The embodiment of the present application also provides a computer program product. When the computer program product runs on a terminal, the method flow shown in FIG. 2 is realized.
本申请实施例还提供一种终端,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行图2所示实施例的方法中的步骤的指令。An embodiment of the present application also provides a terminal, including a processor, a memory, a communication interface, and one or more programs, the one or more programs are stored in the memory and configured to be executed by the processor The program includes instructions for executing the steps in the method of the embodiment shown in FIG. 2.
上述主要从方法侧执行过程的角度对本申请实施例的方案进行了介绍。可以理解的是,电子设备为了实现上述功能,其包含了执行各个功能相应的硬件结构和/或软件模板。本领域技术人员应该很容易意识到,结合本文中所提供的实施例描述的各示例的单元及算法步骤,本申请能够以硬件或硬件和计算机软件的结合形式来实现。某个功能究竟以硬件还是计算机软件驱动硬件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。The foregoing mainly introduces the solution of the embodiment of the present application from the perspective of the execution process on the method side. It can be understood that, in order to implement the above-mentioned functions, the electronic device includes a hardware structure and/or software template corresponding to each function. Those skilled in the art should easily realize that in combination with the units and algorithm steps of the examples described in the embodiments provided herein, this application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed by hardware or computer software-driven hardware depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
本申请实施例可以根据上述方法示例对电子设备进行功能单元的划分,例如,可以对应各个功能划分各个功能单元,也可以将两个或两个以上的功能集成在一个处理单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。需要说明的是,本申请实施例中对单元的划分是示意性的,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。The embodiment of the present application may divide the electronic device into functional units according to the foregoing method examples. For example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit. It should be noted that the division of units in the embodiments of the present application is illustrative, and is only a logical function division, and there may be other division methods in actual implementation.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模板并不一定是本申请所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that this application is not limited by the described sequence of actions. Because according to this application, some steps can be performed in other order or at the same time. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and templates involved are not necessarily required by this application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in an embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the above-mentioned units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or integrated. To another system, or some features can be ignored, or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器 (RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable memory. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory. A number of instructions are included to enable a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the foregoing methods of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by a program instructing relevant hardware. The program can be stored in a computer-readable memory, and the memory can include: a flash disk , Read-only memory (English: Read-Only Memory, abbreviation: ROM), random access device (English: Random Access Memory, abbreviation: RAM), magnetic disk or optical disc, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the application are described in detail above, and specific examples are used in this article to illustrate the principles and implementation of the application. The descriptions of the above examples are only used to help understand the methods and core ideas of the application; at the same time, for Persons of ordinary skill in the art, based on the idea of the application, will have changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as limiting the application.

Claims (16)

  1. 一种操作系统内存回收的页颠簸保护方法,其特征在于,所述方法应用于用户设备UE,所述方法包括如下步骤:A page thrashing protection method for operating system memory reclamation is characterized in that the method is applied to user equipment UE, and the method includes the following steps:
    UE对多个应用场景进行数据采集得到颠簸页数据集合;UE performs data collection on multiple application scenarios to obtain a bump page data set;
    UE对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;The UE calculates the intersection of each element in the thrashing page data set to obtain the page set list_thrashing_common in the multiple application scenarios where thrashing occurs; and obtains the collection of all the elements in the thrashing page data set to obtain a set of all thrashing pages list_thrashing_all ;
    UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。The UE protects the list_thrashing_common and the list_thrashing_all with a block as a basic unit.
  2. 根据权利要求1所述的方法,其特征在于,所述UE将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护具体包括:The method according to claim 1, wherein the UE protecting the list_thrashing_common and the list_thrashing_all using a block as a basic unit specifically comprises:
    UE扩展操作系统的PinnerService功能,所述扩展PinnerService功能用于在所述list_thrashing_common以及所述list_thrashing_all按块进行保护。The UE extends the PinnerService function of the operating system, and the extended PinnerService function is used for block-wise protection in the list_thrashing_common and the list_thrashing_all.
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    将所述list_thrashing_common或者所述list_thrashing_all更新到操作系统的设备资源文件中进行编译。Update the list_thrashing_common or the list_thrashing_all to the device resource file of the operating system for compilation.
  4. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, wherein the method further comprises:
    UE启动dumpsys pinner查看已经锁在物理内存中的文件页,若所述文件页包含进行保护的块,确定文件页已锁定。The UE starts the dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
  5. 根据权利要求1-4任意一项所述的方法,其特征在于,所述UE对多个应用场景进行数据采集得到颠簸页数据集合具体包括:The method according to any one of claims 1 to 4, wherein the data collection performed by the UE on multiple application scenarios to obtain the bump page data set specifically comprises:
    UE抽取多个应用场景中的ftrace信息中的pagecache添加/删除记录,从添加/删除记录中查找出符合相等原则的添加/删除记录作为所述颠簸页数据集 合中的一个元素;The UE extracts pagecache add/delete records in the ftrace information in multiple application scenarios, and finds the add/delete records that meet the principle of equality from the add/delete records as an element in the bump page data set;
    所述相等原则为:相同类型且添加/删除记录中相同页的添加记录以及删除记录。The principle of equality is: add records and delete records of the same type and the same page in the add/delete records.
  6. 根据权利要求5所述的方法,其特征在于,The method of claim 5, wherein:
    所述相同类型包括:pid、time、dev、ino或ofs。The same types include: pid, time, dev, ino or ofs.
  7. 一种操作系统内存回收的页颠簸保护装置,其特征在于,所述装置应用于用户设备UE,所述装置包括:A page thrashing protection device for operating system memory recovery, characterized in that the device is applied to user equipment UE, and the device includes:
    采集单元,用于对多个应用场景进行数据采集得到颠簸页数据集合;The collection unit is used to collect data from multiple application scenarios to obtain a set of bumpy page data;
    处理单元,用于对所述颠簸页数据集合中各个元素求交集得到所述多个应用场景中都发生颠簸的页集合list_thrashing_common;对所述颠簸页数据集合中各个元素求合集得到所有发生过颠簸的页集合list_thrashing_all;将所述list_thrashing_common以及所述list_thrashing_all以块block为基本单元进行保护。A processing unit, configured to intersect each element in the bumpy page data set to obtain a page set list_thrashing_common in which bumps have occurred in the multiple application scenarios; obtain a collection of all elements in the bumpy page data set to obtain all bumps that have occurred The page set list_thrashing_all; the list_thrashing_common and the list_thrashing_all are protected with block as the basic unit.
  8. 根据权利要求7所述的装置,其特征在于,The device according to claim 7, wherein:
    所述处理单元,具体用于扩展操作系统的PinnerService功能,所述扩展PinnerService功能用于在所述list_thrashing_common以及所述list_thrashing_all按块进行保护。The processing unit is specifically used to extend the PinnerService function of the operating system, and the extended PinnerService function is used to protect the list_thrashing_common and the list_thrashing_all block by block.
  9. 根据权利要求7所述的装置,其特征在于,The device according to claim 7, wherein:
    所述处理单元,还用于将所述list_thrashing_common或者所述list_thrashing_all更新到操作系统的设备资源文件中进行编译。The processing unit is also used to update the list_thrashing_common or the list_thrashing_all to the device resource file of the operating system for compilation.
  10. 根据权利要求7所述的装置,其特征在于,The device according to claim 7, wherein:
    所述处理单元,还用于启动dumpsys pinner查看已经锁在物理内存中的文件页,若所述文件页包含进行保护的块,确定文件页已锁定。The processing unit is also used to start dumpsys pinner to view the file page that has been locked in the physical memory, and if the file page contains a block to be protected, it is determined that the file page is locked.
  11. 根据权利要求7-10任意一项所述的装置,其特征在于,The device according to any one of claims 7-10, characterized in that:
    所述采集单元,具体用于抽取多个应用场景中的ftrace信息中的pagecache添加/删除记录,从添加/删除记录中查找出符合相等原则的添加/删除记录作为所述颠簸页数据集合中的一个元素;The collection unit is specifically configured to extract pagecache add/delete records in the ftrace information in multiple application scenarios, and find the add/delete records that meet the principle of equality from the add/delete records as the bump page data set An element
    所述相等原则为:相同类型且添加/删除记录中相同页的添加记录以及删除记录。The principle of equality is: add records and delete records of the same type and the same page in the add/delete records.
  12. 根据权利要求11所述的装置,其特征在于,The device according to claim 11, wherein:
    所述相同类型包括:pid、time、dev、ino或ofs。The same types include: pid, time, dev, ino or ofs.
  13. 一种终端,其特征在于,包括处理器、存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-6任一项所述的方法中的步骤的指令。A terminal, characterized by comprising a processor, a memory, a communication interface, and one or more programs. The one or more programs are stored in the memory and configured to be executed by the processor. The program includes instructions for executing the steps in the method according to any one of claims 1-6.
  14. 一种计算机可读存储介质,其特征在于,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行如权利要求1-6任一项所述的方法。A computer-readable storage medium, characterized by storing a computer program for electronic data exchange, wherein the computer program causes a computer to execute the method according to any one of claims 1-6.
  15. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如权利要求1-6任一项所述的方法。A computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute any one of claims 1 to 6 The method described.
  16. 一种网络设备,其特征在于,所述网络设备用于执行所述终端执行如权利要求1-6任一项所述的方法。A network device, characterized in that the network device is used to execute the terminal to execute the method according to any one of claims 1-6.
PCT/CN2021/098652 2020-06-16 2021-06-07 Page thrashing protection method and apparatus for memory reclaim of operating system WO2021254200A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010551527.9A CN111666227B (en) 2020-06-16 2020-06-16 Page bump protection method and device for memory recovery of operating system
CN202010551527.9 2020-06-16

Publications (1)

Publication Number Publication Date
WO2021254200A1 true WO2021254200A1 (en) 2021-12-23

Family

ID=72387740

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/098652 WO2021254200A1 (en) 2020-06-16 2021-06-07 Page thrashing protection method and apparatus for memory reclaim of operating system

Country Status (2)

Country Link
CN (1) CN111666227B (en)
WO (1) WO2021254200A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666227B (en) * 2020-06-16 2021-09-07 北京紫光展锐通信技术有限公司 Page bump protection method and device for memory recovery of operating system
CN113051186B (en) * 2021-03-08 2022-06-24 北京紫光展锐通信技术有限公司 Method and device for processing page bump in memory recovery and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120054466A1 (en) * 2010-08-27 2012-03-01 International Business Machines Corporation Application run-time memory optimizer
CN108228341A (en) * 2017-08-07 2018-06-29 珠海市魅族科技有限公司 Method for recovering internal storage and device, terminal device and computer readable storage medium
CN109086141A (en) * 2018-09-19 2018-12-25 北京京东尚科信息技术有限公司 EMS memory management process and device and computer readable storage medium
CN109697119A (en) * 2017-10-20 2019-04-30 中兴通讯股份有限公司 Terminal Memory recycle processing method and processing device
US20190205250A1 (en) * 2017-12-29 2019-07-04 Guangdong Oppo Mobile Telecommunications Corp., Lt D. Method and device for processing a memory and storage medium
CN110908923A (en) * 2018-09-14 2020-03-24 阿里巴巴集团控股有限公司 Memory recovery method and device
CN111666227A (en) * 2020-06-16 2020-09-15 北京紫光展锐通信技术有限公司 Page bump protection method and device for memory recovery of operating system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104111896B (en) * 2014-07-30 2017-07-14 云南大学 Virtual memory management method and its device in big data processing
CN105095099B (en) * 2015-07-21 2017-12-29 浙江大学 A kind of big page integration method based on the change of page bitmap
CN106569745B (en) * 2016-10-25 2019-07-19 暨南大学 Memory optimizing system towards data de-duplication under a kind of memory overload
CN107729091A (en) * 2017-11-30 2018-02-23 天津光电通信技术有限公司 Embedded system platform and linux kernel associated documents generation method based on Zynq
US10691481B2 (en) * 2018-03-16 2020-06-23 Nutanix, Inc. System and method for detection of underprovisioning of memory in virtual machines

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120054466A1 (en) * 2010-08-27 2012-03-01 International Business Machines Corporation Application run-time memory optimizer
CN108228341A (en) * 2017-08-07 2018-06-29 珠海市魅族科技有限公司 Method for recovering internal storage and device, terminal device and computer readable storage medium
CN109697119A (en) * 2017-10-20 2019-04-30 中兴通讯股份有限公司 Terminal Memory recycle processing method and processing device
US20190205250A1 (en) * 2017-12-29 2019-07-04 Guangdong Oppo Mobile Telecommunications Corp., Lt D. Method and device for processing a memory and storage medium
CN110908923A (en) * 2018-09-14 2020-03-24 阿里巴巴集团控股有限公司 Memory recovery method and device
CN109086141A (en) * 2018-09-19 2018-12-25 北京京东尚科信息技术有限公司 EMS memory management process and device and computer readable storage medium
CN111666227A (en) * 2020-06-16 2020-09-15 北京紫光展锐通信技术有限公司 Page bump protection method and device for memory recovery of operating system

Also Published As

Publication number Publication date
CN111666227B (en) 2021-09-07
CN111666227A (en) 2020-09-15

Similar Documents

Publication Publication Date Title
US11099900B2 (en) Memory reclamation method and apparatus
US11133563B2 (en) Method of detecting swelling of battery using pressure sensor and electronic device using the method
CN111736980B (en) Memory management method and device
EP3404538B1 (en) Data processing method, and data processing apparatus
JP6870158B2 (en) Methods and devices for processing memory and storage media
WO2021254200A1 (en) Page thrashing protection method and apparatus for memory reclaim of operating system
CN108463792A (en) A kind of false-touch prevention method and terminal
US10901947B2 (en) Method for recognizing infrequently-used data and terminal
US11704240B2 (en) Garbage data scrubbing method, and device
CN110837343B (en) Snapshot processing method and device and terminal
US10540415B2 (en) Apparatus and method for managing history information in an electronic device
WO2024179104A1 (en) Method for preloading memory page, electronic device, and chip system
CN109408465A (en) The recording method of file attaching information, device, storage medium and terminal
CN111104180B (en) Application program optimization method and device, storage medium and electronic equipment
CN107908492B (en) Black screen detection method, mobile terminal and computer readable storage medium
CN107145386A (en) Data migration method, terminal device and computer-readable recording medium
CN103944922B (en) Data processing method, terminal, server and system
CN109348062B (en) Emergency call implementation method, electronic device and computer-readable storage medium
CN107872367B (en) Black screen detection method, mobile terminal and computer readable storage medium
CN107832191B (en) Black screen detection method, mobile terminal and computer readable storage medium
WO2024139279A1 (en) Access control list rule configuration method and apparatus, electronic device, and storage medium
CN111666226B (en) Page bump protection method for operating system memory recovery and user equipment
CN107766210B (en) Black screen detection method, mobile terminal and computer readable storage medium
CN108833495A (en) Data cache method, equipment and the computer readable storage medium of user's request
CN111443938B (en) System updating method and device, storage medium and mobile terminal

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21827077

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21827077

Country of ref document: EP

Kind code of ref document: A1