CN114116191A - Memory cold page processing method and electronic equipment - Google Patents

Memory cold page processing method and electronic equipment Download PDF

Info

Publication number
CN114116191A
CN114116191A CN202110706480.3A CN202110706480A CN114116191A CN 114116191 A CN114116191 A CN 114116191A CN 202110706480 A CN202110706480 A CN 202110706480A CN 114116191 A CN114116191 A CN 114116191A
Authority
CN
China
Prior art keywords
page
memory
cold
pages
cold page
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202110706480.3A
Other languages
Chinese (zh)
Other versions
CN114116191B (en
Inventor
袁晓峰
伊鹏翔
田孝斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
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 Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202110706480.3A priority Critical patent/CN114116191B/en
Publication of CN114116191A publication Critical patent/CN114116191A/en
Priority to PCT/CN2022/088346 priority patent/WO2022267664A1/en
Application granted granted Critical
Publication of CN114116191B publication Critical patent/CN114116191B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • 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/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • 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/5022Mechanisms to release resources
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention discloses a method for processing a memory cold page and electronic equipment, wherein the electronic equipment marks the cold page of a memory page in a physical memory when starting up is completed; in the cooling process, when the memory page is accessed, modifying the cold page mark of the accessed memory page; and after cooling, determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks, and releasing the physical memory occupied by the cold pages. Therefore, on one hand, the cold pages are identified and released, and the computing speed of the electronic equipment is improved; on the other hand, only the cold pages in the memory are recycled, recycling of non-cold pages is avoided, and the problem of low computing efficiency caused by the fact that the kernel frequently reads data of the non-cold pages from the disk is further avoided.

Description

Memory cold page processing method and electronic equipment
Technical Field
The invention relates to the technical field of terminals, in particular to a method for processing a memory cold page and electronic equipment.
Background
In an android (android) system, a memory applied by a process mainly comprises a file page and an anonymous page, wherein the file page is a file which can be mapped to a disk, and when the memory is low, the file page can be cleaned so as to release the memory; the anonymous page is not mapped with a disk file, so that the memory cannot be directly recycled and released, usually, the anonymous page is compressed by a memory compression technology when the memory is low, and the compressed data is still stored in the memory and still occupies the memory space.
In the process of starting up the mobile phone, a large amount of memory is applied by the started system processes such as system _ server, wherein part of the memory is rarely used after the system is started up, and the part of the memory can be called as a cold page. As shown in FIG. 1, the 450MB of memory requested by the electronic device during the boot phase lasts about 200M of cold pages in the memory after 1665 seconds(s) of booting. Since the system process is not killed, the part of the cold page is kept in the memory, and even if the anonymous page is compressed, the memory is continuously occupied.
Similarly, in the running process after the mobile phone is started, the processes of starting and running the application program also apply for a large amount of memory, and there are also cold pages which are rarely used in part of the memory, and the cold pages also occupy the memory.
How to identify the cold pages in the memory to recycle the cold pages to release the memory is a problem to be solved currently.
Disclosure of Invention
The embodiment of the invention provides a processing method of a memory cold page and electronic equipment, which can identify the cold page in a memory to recycle the cold page to release the memory and improve the performance of the electronic equipment.
In a first aspect, the present application provides a method for processing a memory cold page, including: when the electronic equipment is started up, marking cold pages on memory pages in a physical memory; during the cooling process, when the memory page is accessed, modifying a cold page flag of the accessed memory page, wherein the memory page comprises at least one of a file page, an uncompressed anonymous page and a compressed anonymous page; and after cooling, determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks, and releasing the physical memory occupied by the cold pages.
The target time period may be a time period of the cooling process, that is, a time period from the marking of the cold page to the completion of cooling, or a time period from any time after the marking of the cold page to the completion of cooling.
On one hand, the method realizes the identification and release of the cold pages and improves the calculation speed of the electronic equipment; on the other hand, only the cold pages in the memory are recycled, recycling of non-cold pages is avoided, and the problem of low computing efficiency caused by the fact that the kernel frequently reads data of the non-cold pages from the disk is further avoided.
When the memory pages comprise anonymous pages (uncompressed anonymous pages and/or compressed anonymous pages), cold pages in the anonymous pages can be identified, and the part of cold pages generated by starting an operating system is released, so that the available space of the physical memory is increased.
In conjunction with the first aspect, in some embodiments, an electronic device includes a cold page manager and a cold page kernel module;
when the electronic device is started up, one implementation of marking the memory pages in the physical memory with the cold page marks is as follows: the cold page manager sends a marking command when the startup is completed; the cold page kernel module responds to the marking command and marks cold pages of the memory pages in the physical memory;
wherein, during the cooling process, when the memory page is accessed, one implementation of the cold page flag for modifying the accessed memory page is as follows: in the cooling process, if an access request aiming at a memory page is monitored, a cold page mark of the accessed memory page is modified by a cold page kernel module;
after the electronic device is cooled, determining that the memory page which is not accessed in the target time period is a cold page based on the cold page mark is realized as follows: the cold page manager sends a processing command after cooling; the cold page kernel module responds to the processing command and determines that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks;
wherein one implementation of the electronic device releasing the physical memory occupied by the cold page is as follows: the cold page kernel module releases the physical memory occupied by the cold page in response to the processing command.
According to the method, the state of the electronic equipment is identified through the cold page manager of the application layer, when the electronic equipment is started, the marking command, the monitoring of the cooling completion and the issuing processing command are carried out, and the marking, the modification and the release of the memory page are realized through the cold page kernel module of the kernel layer.
With reference to the first aspect, in some embodiments, the target time period is a time period in which a cooling process is performed, and at this time, the memory page that is not accessed in the target time period is a memory page that has a cold page mark after cooling, that is, a cold page;
one implementation of modifying the cold page flag of an accessed memory page is: the cold page flag of the accessed memory page is deleted.
According to the method, if the memory page is accessed, the cold page mark of the accessed memory page is deleted, and the memory page still having the cold page mark after cooling is identified as the cold page, so that an effective cold page identification method is provided.
In conjunction with the first aspect, in some embodiments, the cold page is marked as time; one implementation of modifying the cold page flag of an accessed memory page may be: modifying the cold page of the accessed memory page marks the access time of the accessed memory page.
According to the method, the time is used as the cold page mark, if the memory page is accessed, the cold page mark of the accessed memory page is modified to be the access time of the memory page, and further, the memory page which is not accessed in the target time period is determined to be the cold page, so that an effective cold page identification method is provided.
In combination with the first aspect, in some embodiments, the method further comprises:
and when the cold page kernel module monitors that the memory page is released by the low memory, deleting the cold page mark of the released memory page.
With reference to the first aspect, in some embodiments, the memory pages include uncompressed anonymous pages, and before the releasing the physical memory occupied by the cold pages, the method further includes:
dumping the cold page to a swap space of an external memory if the cold page is an uncompressed anonymous page; or the like, or, alternatively,
and if the cold page is an uncompressed anonymous page, compressing the cold page and storing the compressed cold page.
With reference to the first aspect, in some embodiments, the memory pages include file pages, and before the releasing the physical memory occupied by the cold pages, the method further includes:
and in the case that the cold page is a file page and is a dirty page, dumping the cold page to an external memory.
With reference to the first aspect, in some embodiments, the memory pages include compressed anonymous pages, and before the releasing the physical memory occupied by the cold pages, the method further includes:
decompressing the compressed anonymous page, and dumping the decompressed anonymous page to a swap space of an external memory.
With reference to the first aspect, in some embodiments, the time of the cooling process is a time period from the completion of the electronic device being turned on to the reaching of the cumulative screen-on time of the screen.
In a second aspect, the present application provides an electronic device comprising functional units for performing the method provided in any one of the embodiments of the first aspect or the first aspect.
In a third aspect, the present application provides an electronic device, configured to perform the method provided in the first aspect or any one of the embodiments of the first aspect. The electronic device may include: one or more processors and a physical memory, the physical memory being configured to store memory pages, the processors being configured to: when the startup is completed, marking a cold page on a memory page in the physical memory; in the cooling process, when the memory page is accessed, modifying the cold page mark of the accessed memory page; after cooling, determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks; and releasing the physical memory occupied by the cold page.
In combination with the third aspect, in some embodiments, the processor includes a cold page manager and a cold page kernel module;
the processor is configured to perform the cold page marking on the memory page in the physical memory when the boot is completed, and specifically includes: the cold page manager is used for issuing a marking command when the startup is completed; the cold page kernel module is used for responding to the marking command and marking a cold page on a memory page in the physical memory;
the processor is configured to modify a cold page flag of the accessed memory page when the memory page is accessed in the cooling process, and specifically includes: the cold page kernel module is used for modifying a cold page mark of an accessed memory page if an access request aiming at the memory page is monitored in the cooling process;
the processor is configured to determine, after the cooling, based on the cold page flag, that the memory page that is not accessed in the target time period is a cold page, and specifically includes: the cold page manager is used for issuing a processing command after cooling; the cold page kernel module is used for responding to the processing command and determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks;
the processor is configured to execute the releasing of the physical memory occupied by the cold page, and specifically includes: and the cold page kernel module is used for responding to the processing command and releasing the physical memory occupied by the cold page.
With reference to the third aspect, in some embodiments, the processor further includes a memory management module, where the memory pages include uncompressed anonymous pages, and the memory management module is configured to:
before the cold page kernel module executes the physical memory occupied by the released cold page, dumping the cold page to a swap space of an external memory under the condition that the cold page is an uncompressed anonymous page; or, in the case that the cold page is an uncompressed anonymous page, compressing the cold page and storing the compressed cold page.
With reference to the third aspect, in some embodiments, the processor further includes a memory management module, where the memory page includes a file page, and the memory management module is configured to:
before the cold page kernel module executes the physical memory occupied by the released cold page, in the case that the cold page is a file page and is a dirty page, dumping the cold page to an external memory.
With reference to the third aspect, in some embodiments, the processor further includes a memory management module, where the memory pages include compressed anonymous pages, and the memory management module is configured to:
before the cold page kernel module executes the physical memory occupied by the released cold page, decompressing the compressed anonymous page, and dumping the decompressed anonymous page to a swap space of an external memory.
In a fourth aspect, the present application provides a computer-readable storage medium, which has instructions stored thereon, and when the computer-readable storage medium is executed on an electronic device, the electronic device is caused to perform the method for processing the memory cold page described in the first aspect or any one of the embodiments of the first aspect.
In a fifth aspect, the present application provides a computer program product containing instructions, which when run on an electronic device, causes the electronic device to perform the method for processing a memory cold page described in the first aspect or any one of the embodiments of the first aspect.
Drawings
The drawings that are required to be used in the description of the embodiments will be briefly described below.
Fig. 1 is an exemplary diagram of memory usage of an electronic device in a period of time after booting according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of another electronic device provided in an embodiment of the present application;
fig. 4 is a schematic diagram of a software architecture of an electronic device according to an embodiment of the present application;
fig. 5 is a flowchart illustrating a method for processing a memory cold page according to an embodiment of the present application;
fig. 6 is a flowchart illustrating another method for processing a memory cold page according to an embodiment of the present disclosure;
FIG. 7 is a flowchart illustrating a method for processing a cold page of a memory according to an embodiment of the present application;
fig. 8A is a schematic diagram illustrating a correspondence relationship between a structure of a memory page and the memory page according to an embodiment of the present application;
fig. 8B is a schematic structural diagram of a memory page structure according to an embodiment of the present disclosure;
fig. 8C is a schematic diagram illustrating a correspondence relationship between a compressed object and a structure table according to an embodiment of the present application.
Detailed Description
The following is a description of key terms to which this application relates.
(1) Pages (pages), page frames (page frames), and page tables (page tables)
The space of memory includes a logical memory space (also referred to as a virtual memory space) and a physical memory space, both of which are divided into fixed-size blocks, e.g., 4KB, each of which is referred to as a page in the logical memory space and a page frame in the physical memory space. The mapping of pages to page frames is stored in a page table. The page table includes a plurality of pieces of information, and one piece of information stores a flag indicating whether the piece of information is usable or not, a flag indicating whether a page frame is dirty or not, and the like, in addition to a page number and a page frame number mapped to the page number.
(2) File-backed page and anonymous page
The memory page in the following embodiments of the present application refers to a page frame. Memory pages can be divided into file pages and anonymous pages. The anonymous pages may include compressed anonymous pages and uncompressed anonymous pages.
In the android system, the memory applied for the process mainly comprises a file page and an anonymous page. The file pages (also called file pages) can be mapped into the disk, when the memory is low, the memory can be cleared and released, and when necessary, the memory can be read from the disk again; the anonymous page cannot be directly recycled and released to the memory because the anonymous page is not mapped with the disk file.
Heap memory dynamically allocated by an application program, namely Anonymous pages (Anonymous pages) spoken in memory management, is likely to be accessed again, cannot be directly recycled, and the memory cannot be directly released naturally. However, it also appears to be a waste of resources if these memories are rarely accessed after allocation.
The zRAM is a function of a CPU kernel and can provide virtual memory compression, and the zRAM pages on a compression block device of a memory, and before being written into the compression block device, an anonymous page is compressed through a compression algorithm, and then the compressed anonymous page is stored in a physical memory temporarily applied by the zRAM, so that more available memory can be released when the memory is in shortage, and transmission overhead caused by exchanging the anonymous page to an external memory is avoided, and performance is improved.
(3) Cold page
In this embodiment, a cold page refers to a memory page that is not accessed in a memory for a period of time. In some scenarios, a cold page refers to an anonymous page and/or a file page that is not accessed in the physical memory occupied by the operating system for a period of time after the operating system is started. In other scenarios, not limited to operating systems, a cold page may refer to a page of memory that has not been accessed for a period of time in physical memory.
(4) External memory
External storage generally refers to external storage, which refers to storage other than memory of the electronic device and cache memory of the processor, which is generally non-volatile storage. Common external memories include a hard disk, a floppy disk, an optical disk, a usb disk, an embedded multimedia card (emmc), a Universal Flash Storage (UFS), a multimedia card, and the like.
The following embodiments of the present application provide a method for processing a cold page of a memory and an electronic device using the method, where the electronic device marks a cold page mark on a memory page first, and if the memory page is accessed, modifies the cold page mark of the accessed memory page, and then determines, based on the cold page mark, that the memory page that is not accessed in a target time period is a cold page, and then dumps the cold page to an external memory, so as to release a physical memory occupied by the cold page. The target time period may be from the time when the cold page is marked to the current time, or from any time after the cold page is marked to the current time.
According to the method, whether the memory page is the cold page or not is identified through the cold page mark, and the cold page is recovered, so that on one hand, the memory can be released, and the calculation speed of the electronic equipment is improved; on the other hand, only the cold pages in the memory are recycled, recycling of non-cold pages is avoided, and the problem of low computing efficiency caused by the fact that the kernel frequently reads data of the non-cold pages from the disk is further avoided.
As shown in fig. 2, an electronic device 100 provided in the present application may include: a processor 110, an external memory 120, an internal memory (also referred to as "internal memory") 121, a Universal Serial Bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, a Subscriber Identity Module (SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
Processor 110 may include one or more processing units, such as: the processor 110 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors.
The controller may be, among other things, a neural center and a command center of the electronic device 100. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution.
A memory may also be provided in processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 110, thereby increasing the efficiency of the system.
In some embodiments, processor 110 may include one or more interfaces. The interface may include an integrated circuit (I2C) interface, an integrated circuit built-in audio (I2S) interface, a Pulse Code Modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI), a general-purpose input/output (GPIO) interface, a Subscriber Identity Module (SIM) interface, and/or a Universal Serial Bus (USB) interface, etc.
The I2C interface is a bi-directional synchronous serial bus that includes a serial data line (SDA) and a Serial Clock Line (SCL). In some embodiments, processor 110 may include multiple sets of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces, respectively. For example: the processor 110 may be coupled to the touch sensor 180K via an I2C interface, such that the processor 110 and the touch sensor 180K communicate via an I2C bus interface to implement the touch functionality of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, processor 110 may include multiple sets of I2S buses. The processor 110 may be coupled to the audio module 170 via an I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may communicate audio signals to the wireless communication module 160 via the I2S interface, enabling answering of calls via a bluetooth headset.
The PCM interface may also be used for audio communication, sampling, quantizing and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled by a PCM bus interface. In some embodiments, the audio module 170 may also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to implement a function of answering a call through a bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus used for asynchronous communications. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is generally used to connect the processor 110 with the wireless communication module 160. For example: the processor 110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface to implement a bluetooth function. In some embodiments, the audio module 170 may transmit the audio signal to the wireless communication module 160 through a UART interface, so as to realize the function of playing music through a bluetooth headset.
MIPI interfaces may be used to connect processor 110 with peripheral devices such as display screen 194, camera 193, and the like. The MIPI interface includes a Camera Serial Interface (CSI), a Display Serial Interface (DSI), and the like. In some embodiments, processor 110 and camera 193 communicate through a CSI interface to implement the capture functionality of electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal and may also be configured as a data signal. In some embodiments, a GPIO interface may be used to connect the processor 110 with the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, and the like.
The USB interface 130 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be used to connect a charger to charge the electronic device 100, and may also be used to transmit data between the electronic device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone. The interface may also be used to connect other electronic devices, such as AR devices and the like.
It should be understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only an illustration, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection manners or a combination of multiple interface connection manners in the above embodiments.
The charging management module 140 is used to detect a charging input from the charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may detect a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may detect the wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 140 may also supply power to the electronic device through the power management module 141 while charging the battery 142.
The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 detects the input of the battery 142 and/or the charge management module 140, and supplies power to the processor 110, the internal memory 121, the external memory 120, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be disposed in the same device.
The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, a modem processor, a baseband processor, and the like.
The antennas 1 and 2 are used for transmitting and detecting electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas can also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed as a diversity antenna of a wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
The mobile communication module 150 may provide a solution including 2G/3G/4G/5G wireless communication applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a Low Noise Amplifier (LNA), and the like. The mobile communication module 150 can detect the electromagnetic wave from the antenna 1, filter, amplify, etc. the detected electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modem processor, and convert the signal into electromagnetic wave through the antenna 1 to radiate the electromagnetic wave. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be disposed in the same device as at least some of the modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the detected electromagnetic wave signal into a low-frequency baseband signal. The demodulator then passes the demodulated low frequency baseband signal to a baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and then transferred to the application processor. The application processor outputs a sound signal through an audio output device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be a stand-alone device. In other embodiments, the modem processor may be provided in the same device as the mobile communication module 150 or other functional modules, independent of the processor 110.
The wireless communication module 160 may provide a solution for wireless communication applied to the electronic device 100, including Wireless Local Area Networks (WLANs) (e.g., wireless fidelity (Wi-Fi) networks), bluetooth (bluetooth, BT), Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 detects an electromagnetic wave via the antenna 2, performs frequency modulation and filtering processing on an electromagnetic wave signal, and transmits the processed signal to the processor 110. The wireless communication module 160 can also detect a signal to be transmitted from the processor 110, frequency-modulate it, amplify it, and convert it into electromagnetic waves via the antenna 2 to radiate it. Illustratively, the wireless communication module 160 may include a Bluetooth module, a Wi-Fi module, and the like.
In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150 and antenna 2 is coupled to wireless communication module 160 so that electronic device 100 can communicate with networks and other devices through wireless communication techniques. The wireless communication technology may include global system for mobile communications (GSM), General Packet Radio Service (GPRS), code division multiple access (code division multiple access, CDMA), Wideband Code Division Multiple Access (WCDMA), time-division code division multiple access (time-division code division multiple access, TD-SCDMA), Long Term Evolution (LTE), LTE, BT, GNSS, WLAN, NFC, FM, and/or IR technologies, etc. The GNSS may include a Global Positioning System (GPS), a global navigation satellite system (GLONASS), a beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS), and/or a Satellite Based Augmentation System (SBAS).
The electronic device 100 implements display functions via the GPU, the display screen 194, and the application processor. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and an application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
The display screen 194 is used to display images, video, and the like. The display screen 194 includes a display panel. The display panel may adopt a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), and the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, with N being a positive integer greater than 1.
The electronic device 100 may implement a shooting function through the ISP, the camera 193, the video codec, the GPU, the display 194, the application processor, and the like.
The ISP is used to process the data fed back by the camera 193. For example, when a photo is taken, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converting into an image visible to naked eyes. The ISP can also carry out algorithm optimization on the noise, brightness and skin color of the image. The ISP can also optimize parameters such as exposure, color temperature and the like of a shooting scene. In some embodiments, the ISP may be provided in camera 193.
The camera 193 is used to capture still images or video. The object generates an optical image through the lens and projects the optical image to the photosensitive element. The photosensitive element may be a Charge Coupled Device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The light sensing element converts the optical signal into an electrical signal, which is then passed to the ISP where it is converted into a digital image signal. And the ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into image signal in standard RGB, YUV and other formats. In some embodiments, the electronic device 100 may include 1 or N cameras 193, N being a positive integer greater than 1.
The digital signal processor is used for processing digital signals, and can process digital image signals and other digital signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to perform fourier transform or the like on the frequency bin energy.
Video codecs are used to compress or decompress digital video. The electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record video in a variety of encoding formats, such as: moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, and the like.
The NPU is a neural-network (NN) computing processor that processes input information quickly by using a biological neural network structure, for example, by using a transfer mode between neurons of a human brain, and can also learn by itself continuously. Applications such as intelligent recognition of the electronic device 100 can be realized through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, and the like.
The external storage 120 is generally referred to as an external storage, and in the embodiment of the present application, the external storage is a storage other than a memory of the electronic device and a cache of the processor, and the storage is generally a nonvolatile storage. Common external memories include a hard disk, a floppy disk, an optical disk, a usb disk, a Micro SD card, etc. for expanding the storage capacity of the electronic device 100. The external memory may communicate with the processor 110 via an external memory interface or bus to implement data storage functions. For example, files such as music, video, etc. are saved in the external memory.
Internal memory 121, which may also be referred to as "memory," may be used to store computer-executable program code, including instructions. The internal memory 121 may include a program storage area and a data storage area. The storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required by at least one function, and the like. The storage data area may store data (such as audio data, phone book, etc.) created during use of the electronic device 100, and the like. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (UFS), and the like. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
The electronic device 100 may implement audio functions via the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. Such as music playing, recording, etc.
The audio module 170 is used to convert digital audio information into an analog audio signal output and also to convert an analog audio input into a digital audio signal. The audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 may be disposed in the processor 110.
The speaker 170A, also called a "horn", is used to convert the audio electrical signal into an acoustic signal. The electronic apparatus 100 can listen to music through the speaker 170A or listen to a handsfree call.
The receiver 170B, also called "earpiece", is used to convert the electrical audio signal into an acoustic signal. When the electronic apparatus 100 receives a call or voice information, it can receive voice by placing the receiver 170B close to the ear of the person.
The microphone 170C, also referred to as a "microphone," is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can input a voice signal to the microphone 170C by speaking the user's mouth near the microphone 170C. The electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C to achieve a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further include three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, perform directional recording, and so on.
The headphone interface 170D is used to connect a wired headphone. The headset interface 170D may be the USB interface 130, or may be a 3.5mm open mobile electronic device platform (OMTP) standard interface, a cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The pressure sensor 180A is used for sensing a pressure signal, and converting the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. The pressure sensor 180A can be of a wide variety, such as a resistive pressure sensor, an inductive pressure sensor, a capacitive pressure sensor, and the like. The capacitive pressure sensor may be a sensor comprising at least two parallel plates having an electrically conductive material. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the strength of the pressure from the change in capacitance. When a touch operation is applied to the display screen 194, the electronic apparatus 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic apparatus 100 may also calculate the touched position from the detection signal of the pressure sensor 180A. In some embodiments, the touch operations that are applied to the same touch position but different touch operation intensities may correspond to different operation instructions. For example: and when the touch operation with the touch operation intensity smaller than the first pressure threshold value acts on the short message application icon, executing an instruction for viewing the short message. And when the touch operation with the touch operation intensity larger than or equal to the first pressure threshold value acts on the short message application icon, executing an instruction of newly building the short message.
The gyro sensor 180B may be used to determine the motion attitude of the electronic device 100. In some embodiments, the angular velocity of electronic device 100 about three axes (i.e., the x, y, and z axes) may be determined by gyroscope sensor 180B. The gyro sensor 180B may be used for photographing anti-shake. For example, when the shutter is pressed, the gyro sensor 180B detects a shake angle of the electronic device 100, calculates a distance to be compensated for by the lens module according to the shake angle, and allows the lens to counteract the shake of the electronic device 100 through a reverse movement, thereby achieving anti-shake. The gyroscope sensor 180B may also be used for navigation, somatosensory gaming scenes.
The air pressure sensor 180C is used to measure air pressure. In some embodiments, electronic device 100 calculates altitude, aiding in positioning and navigation, from barometric pressure values measured by barometric pressure sensor 180C.
The magnetic sensor 180D includes a hall sensor. The electronic device 100 may detect the opening and closing of the flip holster using the magnetic sensor 180D. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 may detect the opening and closing of the flip according to the magnetic sensor 180D. And then according to the opening and closing state of the leather sheath or the opening and closing state of the flip cover, the automatic unlocking of the flip cover is set.
The acceleration sensor 180E may detect the magnitude of acceleration of the electronic device 100 in various directions (typically three axes). The magnitude and direction of gravity can be detected when the electronic device 100 is stationary. The method can also be used for recognizing the posture of the electronic equipment, and is applied to horizontal and vertical screen switching, pedometers and other applications.
A distance sensor 180F for measuring a distance. The electronic device 100 may measure the distance by infrared or laser. In some embodiments, taking a picture of a scene, electronic device 100 may utilize range sensor 180F to range for fast focus.
The proximity light sensor 180G may include, for example, a Light Emitting Diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light to the outside through the light emitting diode. The electronic device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 may determine that there are no objects near the electronic device 100. The electronic device 100 can utilize the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear for talking, so as to automatically turn off the screen to achieve the purpose of saving power. The proximity light sensor 180G may also be used in a holster mode, a pocket mode automatically unlocks and locks the screen.
The ambient light sensor 180L is used to sense the ambient light level. Electronic device 100 may adaptively adjust the brightness of display screen 194 based on the perceived ambient light level. The ambient light sensor 180L may also be used to automatically adjust the white balance when taking a picture. The ambient light sensor 180L may also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
The fingerprint sensor 180H is used to collect a fingerprint. The electronic device 100 can utilize the collected fingerprint characteristics to unlock the fingerprint, access the application lock, photograph the fingerprint, answer an incoming call with the fingerprint, and so on.
The temperature sensor 180J is used to detect temperature. In some embodiments, electronic device 100 implements a temperature processing strategy using the temperature detected by temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 performs a reduction in performance of a processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, the electronic device 100 heats the battery 142 when the temperature is below another threshold to avoid the low temperature causing the electronic device 100 to shut down abnormally. In other embodiments, when the temperature is lower than a further threshold, the electronic device 100 performs boosting on the output voltage of the battery 142 to avoid abnormal shutdown due to low temperature.
The touch sensor 180K is also referred to as a "touch panel". The touch sensor 180K may be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, which is also called a "touch screen". The touch sensor 180K is used to detect a touch operation applied thereto or nearby. The touch sensor can communicate the detected touch operation to the application processor to determine the touch event type. Visual output associated with the touch operation may be provided through the display screen 194. In other embodiments, the touch sensor 180K may be disposed on a surface of the electronic device 100, different from the position of the display screen 194.
The bone conduction sensor 180M may acquire a vibration signal. In some embodiments, the bone conduction sensor 180M may acquire a vibration signal of the human vocal part vibrating the bone mass. The bone conduction sensor 180M may also contact the human body pulse to detect a blood pressure pulsation signal. In some embodiments, the bone conduction sensor 180M may also be disposed in a headset, integrated into a bone conduction headset. The audio module 170 may analyze a voice signal based on the vibration signal of the bone mass vibrated by the sound part acquired by the bone conduction sensor 180M, so as to implement a voice function. The application processor can analyze heart rate information based on the blood pressure beating signal acquired by the bone conduction sensor 180M, so as to realize the heart rate detection function.
The keys 190 include a power-on key, a volume key, and the like. The keys 190 may be mechanical keys. Or may be touch keys. The electronic apparatus 100 may detect a key input, and generate a key signal input related to user setting and function control of the electronic apparatus 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration cues, as well as for touch vibration feedback. For example, touch operations applied to different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also respond to different vibration feedback effects for touch operations applied to different areas of the display screen 194. Different application scenarios (e.g., time reminding, detected information, alarm clock, game, etc.) may also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
Indicator 192 may be an indicator light that may be used to indicate a state of charge, a change in charge, or a message, missed call, notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card can be brought into and out of contact with the electronic apparatus 100 by being inserted into the SIM card interface 195 or being pulled out of the SIM card interface 195. The electronic device 100 may support 1 or N SIM card interfaces, N being a positive integer greater than 1. The SIM card interface 195 may support a Nano SIM card, a Micro SIM card, a SIM card, etc. The same SIM card interface 195 can be inserted with multiple cards at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 may also be compatible with different types of SIM cards. The SIM card interface 195 may also be compatible with a portion of external memory, such as a Micro SD card. The electronic device 100 interacts with the network through the SIM card to implement functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, namely: an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
The above is a detailed description of the embodiments of the present application taking the electronic device 100 as an example. It should be understood that the illustrated structure of the embodiment of the present application does not specifically limit the electronic device 100. Electronic device 100 may have more or fewer components than shown, may combine two or more components, or may have a different configuration of components. The various components shown in the figures may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and/or application specific integrated circuits.
The electronic device provided in the embodiment of the present application may be a User Equipment (UE), for example, a user mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a netbook, a Personal Digital Assistant (PDA), and other devices; the electronic device can also be a wearable electronic device, such as a smart watch, smart glasses, a smart bracelet and the like; but also VR devices or AR devices etc.
The relationship between the processor 110, the memory 121, and the external storage 120 is described below with reference to fig. 3. The processor 110 may include one or more CPU cores 111, a cache 112 corresponding to each CPU core 111, and a memory management module (memory controller)113, a cold page manager 114, and a cold page kernel module 115 running in the processor 110. The memory 121 is a physical memory, which is divided into page frames, and the memory 121 is further configured to store a page table, where the page table is used to translate a virtual address into a physical address, and identify whether a page of a page frame is dirty or not.
The processor 110 is an integrated circuit, and an operating system and software programs may be run in the processor 110, so that the processor 110 can access a cache, a memory, an external storage, and perform data processing.
The CPU core 111 divides the virtual memory and the physical memory into pages of the same size, and the page is used as a unit of memory division, which is typically 4 kB. The virtual address (also called logical address) used by the processor 110 is mapped to a physical address of the memory 121, and the mapping is stored in a page table.
The memory management module 113 is used for controlling the memory 121 inside the electronic device 100, and implementing data exchange between the memory 121 and the CPU core 111. The memory management module 113 receives a read/write request sent by the CPU core, translates a virtual address carried in the request into a physical address based on a page table, and sends the physical address to the memory 121, and the memory 121 performs corresponding read/write operations according to the physical address.
The cold page manager 114 is used to determine whether a trigger condition for releasing the memory is satisfied, for example, a power-on completion broadcast is monitored or a flag command is issued if the trigger condition is satisfied.
The cold page kernel module 115 is configured to mark a cold page to a memory page in the memory 121 after receiving the marking command.
The cold page kernel module 115 modifies the cold page flag of the accessed memory page in response to the modification instruction, for example, deletes the cold page flag thereof; alternatively, when the cold page flag is time, the cold page flag is updated to the latest time.
The cold page manager 114 issues a processing instruction after cooling is completed.
In response to the processing instruction, the cold page kernel module 115 determines, based on the cold page flag, that the memory page that is not accessed in the target time period is a cold page, and releases the memory 121 occupied by the cold page.
It should be understood that the cold page manager 114 and the cold page kernel module 115 may also be disposed in the memory management module 113, and the memory management module 113 may also be a separate chip, and is connected to the CPU core through a system bus, and the embodiments of the present application do not limit the locations of the memory management module 113 and the cold page manager.
The software system of the electronic device 100 shown in fig. 2 and fig. 3 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the invention takes an Android system with a layered architecture as an example, and exemplarily illustrates a software system architecture of the electronic device 100.
As shown in fig. 4, the layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the operating system is divided into four layers, an application layer, an application framework layer, an Android runtime (Android runtime) and system library (Android runtime), a Hardware Abstraction Layer (HAL), and a kernel layer from top to bottom. Wherein:
the application layer may include a series of application packages. As shown in fig. 4, the application packages may include camera, gallery, calendar, call, map, navigation, WLAN, bluetooth, music, video, short message, and other applications, and may include other application packages not shown.
The application framework layer provides an Application Programming Interface (API) and a programming framework for the application program of the application layer. The application framework layer includes a number of predefined functions. As shown in FIG. 4, the application framework layers may include a window manager, content provider, view system, phone manager, resource manager, notification manager, and the like.
A window manager may be used to manage the window program. The window manager can obtain the size of the display screen, judge whether a status bar exists, lock the screen, intercept the screen and the like.
The content provider may be used to store and retrieve data and make the data accessible to applications. The data may include video, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
The view system may include visual controls such as controls to display text, controls to display pictures, and the like. The view system may be used to build applications.
The resource manager provides various resources for the application, such as localized strings, icons, pictures, layout files, video files, and the like.
The notification manager enables the application to display notification information in the status bar, can be used to convey notification-type messages, can disappear automatically after a short dwell, and does not require user interaction. Such as a notification manager used to inform download completion, message alerts, etc. The notification manager may also be a notification that appears in the form of a chart or scroll bar text at the top status bar of the system, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialog window. For example, prompting text information in the status bar, sounding a prompt tone, vibrating the electronic device, flashing an indicator light, etc.
The android runtime includes a core library and a virtual machine. The android runtime is responsible for scheduling and managing the android system. The core library comprises two parts: one part is a function which needs to be called by java language, and the other part is a core library of android. As shown in fig. 4, the core library may include a cold page manager for implementing identification of system status, identification and management of cold pages, including: the specific implementation of the identification of the system startup completion state, the judgment of the cooling time, the issuing of the marking command, the issuing of the processing command, and the like can be referred to the related description in the processing method of the memory cold page described in the following method embodiment, and details are not repeated here.
The application layer and the application framework layer run in a virtual machine. And executing java files of the application program layer and the application program framework layer into a binary file by the virtual machine. The virtual machine is used for performing the functions of object life cycle management, stack management, thread management, safety and exception management, garbage collection and the like.
The HAL may be an encapsulation to Linux kernel driver, providing an interface upward, shielding the low level implementation details. That is, the support for hardware is divided into two layers, one in User Space (User Space) and one in Kernel Space (Kernel Space), where the hardware abstraction layer runs in User Space and the Linux Kernel driver runs in Kernel Space. As shown in fig. 2, the HAL may include a sensor HAL, which may be a package driven to a sensor in the kernel.
The kernel layer is a layer between hardware and software. The kernel layer may include a cold page kernel module and a memory management module.
The cold page kernel module is a kernel module of the cold page manager and is used for marking the memory pages in the memory after receiving a marking command issued by the cold page manager; after receiving a processing command, identifying cold pages in the memory pages, and processing and releasing the cold pages; for specific implementation of clearing or modifying the mark of the accessed memory page and the like when the marked memory page is accessed, reference may be made to related descriptions in the method for processing a memory cold page described in the following method embodiments, and details are not described here again.
The core layer may also include a display driver, a camera driver, an audio driver, a sensor driver, etc., without being limited to the drivers and hardware listed in fig. 4; the hardware layer may also include a display screen, fingerprint sensor, camera, etc., none of which are shown in fig. 4.
The method for processing the memory cold page provided by the embodiment of the present application is described in four stages with reference to fig. 5, fig. 6, and fig. 7, and the method can be implemented by the electronic device 100 shown in fig. 2 and fig. 3. The following describes each stage related to the embodiments of the present application.
(one) completion of boot-up
The electronic device receives the input startup operation, loads the system file stored in the external memory to the memory in response to the startup operation, and displays the desktop (also called a main interface) after the startup is completed.
S10: the cold page manager judges whether the startup is completed. S11 may be executed after the completion of the power-on.
The cold page manager may determine whether booting is completed by, but not limited to, the following 3: monitoring a startup completion broadcast, and determining that startup is completed when the startup completion broadcast is monitored; reading the relevant configuration items of the startup to judge whether the startup is finished, for example, the boot _ completed setting is carried out; and thirdly, after a period of time (such as 5 minutes) from the detection of the startup operation, determining that the startup is finished.
(II) memory page tag
The electronic device can determine whether to start the function according to the current memory usage or the user usage, and execute the technical scheme, that is, whether to execute the memory page marking, the cooling process and the cold page processing process. For example, the present solution may be executed when the current usage amount of the memory is greater than a threshold, such as 50%, 70%, and the like. For another example, after the power is turned on, the user may not execute the technical scheme when the use duration is less than the threshold, for example, one hour; when the current time is greater than the threshold value, the technical scheme is executed, the using time of the user can be the accumulated screen lightening time of the screen after the startup is finished, and further, when the user does not use the screen for a long time, the technical scheme can not be executed.
S11: the cold page manager issues a marking command when a trigger condition is satisfied.
In some embodiments, the cold page manager satisfies the trigger condition upon detecting completion of power-up.
In still other embodiments, the cold page manager satisfies the trigger condition when the current time is a preset time. For example, the cold page manager may release the cold pages in the memory periodically or periodically, and when the set period is reached by the time of the timer or the time from the last memory mark, the trigger condition is satisfied.
S12: and the cold page kernel module responds to the marking command and marks the cold page of the memory page in the physical memory.
In some embodiments, the cold page flag may be an identification or time to indicate that the memory page is a cold page. It may be located on a structure (struct page) that describes a single memory page. It should be understood that, in the kernel, the physical memory is managed according to the page size, each page (memory page) corresponds to one structure as the management data structure of the page, and the structure and the memory page of the memory page are stored separately, as shown in the schematic diagram of the correspondence relationship between the structure and the memory page of the memory page shown in fig. 8A. As shown in fig. 8B, a structural diagram of a memory page structure provided in an embodiment of the present application is shown, where the memory page structure includes nodes (nodes), zones (zones), flags (flags), and so on. The node part stores a node number and indicates a node to which the memory page belongs; a region partial memory storage domain indicating a memory domain to which a memory page belongs; the flag portion stores information indicating the status of the memory page and may include a cold page field, a locked (locked) field, a dirty (dirty) field, etc., for example only. Wherein the cold page field is used for storing a cold page flag of the memory page; the lock field is used for indicating whether the memory page is locked or not; the dirty field is used to indicate whether a memory page is modified.
The flag portion includes a cold page field, which may be a newly added field or an original free field of the structure.
It should be further noted that the memory page described in fig. 8B above may be a file page or an uncompressed anonymous page. For the compressed anonymous page, one anonymous page compressed by zram is a compressed object, or referred to as a zram object, and is stored in one memory block, a structure body describing the compressed object is referred to as a structure table (structzram _ table _ entry table), and each structure table corresponds to one compressed anonymous page, as shown in fig. 8C. The structure table may include a plurality of portions including a flag (flag). The flag portion may include a cold page field to store a cold page flag of the compressed anonymous page. The cold page field can be a newly added field or an original idle field of the structure table; it may also be a free flag (zmam _ idle) originally in the structure table, which is used to indicate whether its corresponding memory block is free.
The meaning of the memory pages may be different in different implementations. Using the identification of cold pages as a marker to indicate cold pages as an example, the following is described in three implementations.
Achievement (1): memory pages refer to all pages in memory, including file pages, uncompressed anonymous pages, and compressed anonymous pages. The cold page kernel module can traverse the file page LRU linked list and mark a cold page mark for each file page; traversing the anonymous page LRU linked list, marking each uncompressed anonymous page with a cold page marker, and marking compressed anonymous pages with cold page markers. The marking of memory pages may include, but is not limited to, the following two implementations:
in implementation 1, the marking process may not distinguish between the file page and the anonymous page, and both may use the same cold page mark. Such as the structure of a memory page shown in fig. 8B. The flag is obtained by adding a cold page field to a flag portion of the structure, and writing a cold page flag in the cold page field corresponding to each memory page, for example, the cold page flag is "1", that is, the cold page fields corresponding to all the memory pages are all written in "1".
For compressed anonymous pages, the process of marking may be: the cold page kernel module writes the cold page fields in the structure table corresponding to the compressed anonymous pages into the cold page marks, for example, the cold page marks are represented by "1", that is, the cold page fields corresponding to all the compressed anonymous pages are written into "1".
It should be understood that the file pages and uncompressed anonymous pages are not distinguished during the marking process, not to say, they are distinguishable by information in the flag (flag).
In implementation 2, the marking process can distinguish between file pages and uncompressed anonymous pages. For example, for a file page and an uncompressed anonymous page, a cold page flag may be written in the cold page field to which the corresponding file page is distributed, for example, all the cold page fields corresponding to the file page are written to "11" and all the cold page fields corresponding to the uncompressed anonymous page are written to "10".
For the compressed anonymous pages, a cold page flag, for example, a "10" flag, may be written in the corresponding cold page field, i.e., all the cold page fields corresponding to the compressed anonymous pages are written in "10".
The above description is given by taking "1", "11", "10" as an example, and other forms are possible, and the present invention is not limited to the above.
Achievement (2): since the compressed anonymous pages in memory may be released using other mechanisms, such as a write back (writeback) mechanism for zram, the release of compressed anonymous pages may not be considered, and in this case, the memory pages refer to uncompressed anonymous pages and file pages in memory. Specific implementations of the labeling can be found in implementation 1 and implementation 2 described above.
Achievement (3): since the file pages in the memory can also be released by using other mechanisms, the release of the file pages may not be considered here, and at this time, the memory pages refer to uncompressed anonymous pages in the memory. Specific implementations of the labeling can be found in implementation 1 and implementation 2 described above.
When the cold page mark adopts a time mode, the cold page kernel module writes the current time into a structural body or a structural table corresponding to the memory page in the physical memory.
(III) Cooling Process
S13: the cold page manager detects whether cooling is complete. If so, S15 is executed, otherwise, the detection is continued.
S14: in the cooling process, if an access request for a memory page is monitored, the cold page kernel module modifies a cold page tag corresponding to the accessed memory page.
The cooling process, i.e. the time period from the time when the mark command is issued to the time when the cooling is completed, aims to screen out the cold pages. And the cold page manager enters cooling after the marking is finished, the cooling time duration can be a fixed value, such as half an hour or 2 hours, the accumulated screen-on time duration of the screen after the marking command is issued by the electronic equipment can also be recorded or acquired, and the cooling is determined to be finished when the accumulated screen-on time duration is the target time duration.
The cooling duration may be dynamically varied based on time, scene, or running application, among other things. The following are described separately:
(1) the length of cooling is set according to time. For example, in a time period when the user uses the liquid medicine frequently, such as 11 pm, the cooling time period may be set to be shorter, such as half an hour or 1 hour, to ensure the memory as much as possible; and when the user is in infrequent use periods, such as 1 to 6 am, the cooling period may be set longer, such as 5 hours.
(2) The length of cooling is set according to the scene. For example, the electronic device obtains the current position, if the user is in an office, the user is not frequently used, the memory pressure is not high, and at this time, the cooling duration may be set to be a little longer, for example, 3 hours; and when the user is at home, the cooling time period can be set a little shorter, for example, 1 hour, because the user uses it frequently.
(3) The length of cooling is set according to the application. The cooling time period may be set longer, such as 2 hours, for applications that are currently in use when the user's usage frequency is high, and shorter, such as half an hour, for applications that are currently in use when the user's usage frequency is low, to release cold pages of less-frequently used applications as soon as possible.
Not limited to the above arrangement of the cooling time period, the cooling time period may also be dynamically changed based on other conditions.
In some embodiments, when the electronic device is turned off or a video is currently being played, cooling may not be performed, where "cooling is not performed" means that the cold page kernel module does not perform an access request for monitoring a memory page during cooling, that is, does not modify a cold page flag corresponding to the accessed memory page when accessing the memory page. The electronic equipment enters a dormant state when the screen is turned off, and power consumption can be reduced by not performing cooling; when a video is being played, most accessed memory pages are cache of the video, and after the video is played or accessed once, the memory pages are usually not accessed again for a long time, and if a cold page mark is deleted, the cold page mark cannot be identified as a cold page in a subsequent cold page processing process, so that the part of the memory may not be released. If the accessed memory page does not modify the cold page mark when the video is currently played, the memory page generated by video playing can be released in the subsequent cold page processing process, so that the available space of the memory is increased.
During the cooling process, if a memory page is accessed or recycled by low memory, the electronic device needs to modify the cold page tag of the accessed memory page in addition to performing a normal access or recycling process. Specific implementations of modifying cold page identifications of file pages, uncompressed anonymous pages, and compressed anonymous pages are described below, respectively, using page markers as an example to indicate cold page identifications:
document page:
as shown in fig. 7, if the cold page kernel module listens for an access request for a memory page, the cold page flag of the file page may be cleared. The memory management module responds to the access request and performs operations such as data reading or writing.
As shown in fig. 7, when it is monitored that a file page needs to be recovered by a low memory, that is, when a physical memory occupied by the file page needs to be released, the cold page kernel module clears a cold page flag corresponding to the file page before recovery, and for a clean page, the memory management module directly releases the physical memory occupied by the file page; for a dirty page, the memory management module writes the dirty page back to the external memory first, and then releases the physical memory occupied by the dirty page.
The specific implementation of clearing the cold page mark corresponding to the file page is shown as an example: for example, the cold page flag scheme adopted in embodiment 1 may be modified to "0" in the cold page field. For another example, the cold page flag method adopted in embodiment 2 may be modified to "00" in the cold page field. For another example, the structure corresponding to the memory page further includes a cold page indication field, and the indication information indicating that the data in the cold page field is invalid is written in the cold page indication field.
Uncompressed anonymous page:
the cold page kernel module may clear the cold page tag of the uncompressed anonymous page when it is monitored that the uncompressed anonymous page is accessed.
Optionally, as shown in fig. 7, when the uncompressed anonymous page needs to be recycled by the low memory, the memory management module compresses data of the uncompressed anonymous page in response to the low memory recycling instruction, and releases the uncompressed anonymous page, where the compressed anonymous page exists in the compression block device of the physical memory. When the cold page kernel module monitors that the uncompressed anonymous page needs to be recovered by the low memory, the cold page kernel module can write a cold night mark into a cold night field corresponding to the compressed anonymous page, so that the cold page mark is transferred to the compressed anonymous page.
Compressed anonymous page:
and when the cold page kernel module monitors that the compressed anonymous page is accessed, the cold page kernel module can clear the cold page mark corresponding to the compressed anonymous page. And the memory management module responds to the access request and decompresses the compressed anonymous page to obtain a decompressed anonymous page, so as to realize the access process.
In some embodiments, the cold page flag is time, and the cold page flag of the cold page to be accessed is modified to be the current access time of the accessed memory page or to be the current access time.
(IV) Cold Page treatment
S15: the cold page manager issues a process command when cooling is complete.
S16: and the cold page kernel module responds to the processing command, identifies the cold page in the physical memory and releases the physical memory occupied by the cold page.
When the cold page is marked with an identifier for indicating a cold page, one implementation of identifying a cold page may be: the cold page kernel module may determine a memory page for which a cold page identifier still exists after cooling as a cold page.
The cold page is marked as time, and one implementation of identifying the cold page may be: and the cold page kernel module calculates the time difference between the cold page identification time corresponding to each memory page and the current time, and then determines the memory pages with the time difference larger than the target duration as the cold pages. For example, if a memory page that is not accessed for 2 hours is defined as a cold page, the target duration may be 2 hours, and then whether the memory page is a cold page is determined by traversing the memory page and comparing a time difference between a time marked by the cold page of the memory page and a current system time, where the time is greater than or equal to 2 hours, and the memory page is a cold page; less than 2 hours, the cold page is not.
In another implementation of identifying the cold page, the cold page kernel module may also subtract a target duration from the current time to obtain a target time, and further compare whether the time of the cold page identifier corresponding to each memory page is before the target time, if so, the memory page is the cold page, otherwise, the memory page is not the cold page.
The release procedure for the file page, the uncompressed anonymous page and the compressed anonymous page is as follows:
document page:
the cold page kernel module can directly release the cold page when the cold page is a file page and is a clean page. When a cold page is a file page and is a dirty page, the cold page may be flushed to external memory and the physical memory occupied by the cold page is reclaimed.
Uncompressed anonymous page:
when the cold page is an uncompressed anonymous page, the cold page kernel module can dump the uncompressed anonymous page to an external memory and release the physical memory occupied by the cold page. It should be appreciated that although a process does not access an anonymous page that is a cold page for a while, the anonymous page may still be accessed again and thus cannot be recycled directly.
In one implementation, when the cold page is an uncompressed anonymous page, the cold page kernel module may dump the cold page to a swap space (swap space) through a swap mechanism and release the physical memory occupied by the cold page. The swap space is an area on the external memory, and the virtual memory is composed of an accessible physical memory and the swap space. swap space may be used to store memory pages that are temporarily inactive.
In another implementation, when the cold page is an uncompressed anonymous page, the cold page kernel module may compress the uncompressed anonymous page and store the compressed cold page in the physical memory. And compared with the uncompressed anonymous page, the compressed memory page occupies less physical memory space. Optionally, the cold page kernel module may also dump the compressed anonymous page to an external memory or swap space by a zram support write back (writeback) function.
Compressed anonymous page:
the cold page kernel module may flush the cold page to external memory when it is a compressed anonymous page.
In some embodiments, the zram supports write back (writeback) functionality, which may provide for marking and dumping of anonymous pages after zram compression. Therefore, when the cold page is a compressed anonymous page, the cold page kernel module can write the cold page back to the external memory swap space through a write-back mechanism of the zram to release the physical memory occupied by the cold page.
Optionally, before releasing the memory occupied by the cold page, the cold page kernel module may clear the cold page flag corresponding to the cold page, or may not clear the cold page flag thereon, which is not limited herein.
In some embodiments, the processing mechanism of the memory cold page of the present invention can be used in other scene phases. For example, after the (first) boot is completed, (second) memory page marking, (third) cooling process, and (fourth) cold page processing, the identification and processing of the cold page for the memory page in the electronic device may be polled, i.e., the (second) to (fourth) processes are performed. Wherein, the time of polling wait can be set as a fixed value, such as 1 hour or 2 hours; and the dynamic adjustment can also be carried out based on the time, the use condition of the memory and the like.
For example, in a time period when the user uses the electronic device frequently, such as 20 o 'clock to 23 o' clock, the polling waiting time may be shorter, such as 20 minutes or half an hour, so as to release the memory as soon as possible and provide sufficient memory space for the operation of the electronic device; in a time period when the user uses the electronic device infrequently, such as 1 to 6 am, the polling waiting time may be longer, such as 4 or 5 hours, so as to avoid the electronic device from running the CPU burden and generating unnecessary power consumption caused by performing the above processes (two) to (four).
For another example, when the usage amount of the memory of the electronic device is continuously higher than the threshold, such as 60% or 70%, the polling wait time may be shorter, such as 0 minute, 10 minutes, and the like, so as to release the memory as soon as possible and provide sufficient memory space for the operation of the electronic device; when the usage amount of the memory of the electronic device is continuously lower than the threshold, the amount of the memory is sufficient, and the polling waiting time may be longer, such as 4 hours or 5 hours, to reduce unnecessary energy consumption.
In the above embodiments, all or part of the implementation may be realized by software, hardware, firmware or any combination thereof. When implemented using a software program, may take the form of a computer program product, either entirely or partially. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part.
The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
Through the above description of the embodiments, it is clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device may be divided into different functional modules to complete all or part of the above described functions.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical functional division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, that is, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (19)

1. A method for processing a memory cold page, comprising:
when the electronic equipment is started up, marking cold pages on memory pages in a physical memory;
modifying, by the electronic device, a cold page flag of a memory page being accessed when the memory page is accessed during a cooling process, the memory page including at least one of a file page, an uncompressed anonymous page, and a compressed anonymous page;
after the electronic equipment is cooled, determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks;
the electronic device releases the physical memory occupied by the cold page.
2. The method of claim 1, wherein the electronic device comprises a cold page manager and a cold page kernel module;
when the electronic device is started up, the method marks cold pages on memory pages in the physical memory, and specifically includes: the cold page manager sends a marking command when the startup is completed; the cold page kernel module responds to the marking command and marks cold pages of the memory pages in the physical memory;
in the cooling process of the electronic device, when the memory page is accessed, modifying the cold page flag of the accessed memory page, which specifically includes: in the cooling process, if an access request aiming at a memory page is monitored, the cold page kernel module modifies a cold page mark of the accessed memory page;
after the electronic device is cooled, determining, based on the cold page flag, that a memory page that is not accessed in a target time period is a cold page, where the determining specifically includes: the cold page manager issues a processing command after cooling; the cold page kernel module responds to the processing command and determines that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks;
the electronic device releasing the physical memory occupied by the cold page specifically includes: and the cold page kernel module responds to the processing command and releases the physical memory occupied by the cold page.
3. The method according to claim 1 or 2, wherein the target time period is a time period in which the cooling process is performed, and the memory pages that are not accessed in the target time period are memory pages that have cold page marks after cooling;
the modifying the cold page tag of the accessed memory page includes: the cold page flag of the accessed memory page is deleted.
4. The method of claim 1 or 2, wherein the cold page is marked as time; the modifying the cold page tag of the accessed memory page includes: modifying the cold page of the accessed memory page marks the access time of the accessed memory page.
5. The method according to any one of claims 2-4, further comprising:
and when the cold page kernel module monitors that the memory page is released by the low memory, deleting the cold page mark of the released memory page.
6. The method according to any of claims 1-5, wherein the memory pages comprise uncompressed anonymous pages, and wherein before releasing physical memory occupied by the cold pages, the method further comprises:
dumping the cold page to a swap space of an external memory if the cold page is an uncompressed anonymous page; or the like, or, alternatively,
and if the cold page is an uncompressed anonymous page, compressing the cold page and storing the compressed cold page.
7. The method according to any of claims 1-6, wherein the memory pages comprise file pages, and before releasing the physical memory occupied by the cold pages, the method further comprises:
and in the case that the cold page is a file page and is a dirty page, dumping the cold page to an external memory.
8. The method according to any of claims 1-6, wherein the memory pages comprise compressed anonymous pages, and wherein before releasing physical memory occupied by the cold pages, the method further comprises:
decompressing the compressed anonymous page, and dumping the decompressed anonymous page to a swap space of an external memory.
9. The method according to any one of claims 1-8, wherein the time of the cooling process is a cumulative screen-on time from completion of the power-on of the electronic device to the screen reaching a target duration.
10. An electronic device comprising one or more processors and physical memory, the physical memory configured to store memory pages, the processors configured to perform:
when the startup is completed, marking a cold page on a memory page in the physical memory;
in the cooling process, when the memory page is accessed, modifying the cold page mark of the accessed memory page;
after cooling, determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks;
and releasing the physical memory occupied by the cold page.
11. The electronic device of claim 10, wherein the processor comprises a cold page manager and a cold page kernel module;
the processor is configured to perform the cold page marking on the memory page in the physical memory when the boot is completed, and specifically includes: the cold page manager is used for issuing a marking command when the startup is completed; the cold page kernel module is used for responding to the marking command and marking a cold page on a memory page in the physical memory;
the processor is configured to modify a cold page flag of the accessed memory page when the memory page is accessed in the cooling process, and specifically includes: the cold page kernel module is used for modifying a cold page mark of an accessed memory page if an access request aiming at the memory page is monitored in the cooling process;
the processor is configured to determine, after the cooling, based on the cold page flag, that the memory page that is not accessed in the target time period is a cold page, and specifically includes: the cold page manager is used for issuing a processing command after cooling; the cold page kernel module is used for responding to the processing command and determining that the memory pages which are not accessed in the target time period are cold pages based on the cold page marks;
the processor is configured to execute the releasing of the physical memory occupied by the cold page, and specifically includes: and the cold page kernel module is used for responding to the processing command and releasing the physical memory occupied by the cold page.
12. The electronic device according to claim 10 or 11, wherein the target time period is a time period in which the cooling process is performed, and the memory pages that are not accessed in the target time period are memory pages that have cold page marks after cooling;
the modifying the cold page tag of the accessed memory page includes: the cold page flag of the accessed memory page is deleted.
13. The electronic device of claim 10 or 11, wherein the cold page flag is time; the modifying the cold page tag of the accessed memory page includes: modifying the cold page of the accessed memory page marks the access time of the accessed memory page.
14. The electronic device of any of claims 11-13, wherein the cold page kernel module is further configured to: and when the memory page is monitored to be released by the low memory, deleting the cold page mark of the released memory page.
15. The electronic device of any of claims 11-14, wherein the processor further comprises a memory management module, wherein the memory pages comprise uncompressed anonymous pages, and wherein the memory management module is configured to:
before the cold page kernel module executes the physical memory occupied by the released cold page, dumping the cold page to a swap space of an external memory under the condition that the cold page is an uncompressed anonymous page; or, in the case that the cold page is an uncompressed anonymous page, compressing the cold page and storing the compressed cold page.
16. The electronic device according to any of claims 11-14, wherein the processor further comprises a memory management module, the memory page comprises a file page, and the memory management module is configured to:
before the cold page kernel module executes the physical memory occupied by the released cold page, in the case that the cold page is a file page and is a dirty page, dumping the cold page to an external memory.
17. The electronic device of any of claims 11-15, wherein the processor further comprises a memory management module, wherein the memory pages comprise compressed anonymous pages, and wherein the memory management module is configured to:
before the cold page kernel module executes the physical memory occupied by the released cold page, decompressing the compressed anonymous page, and dumping the decompressed anonymous page to a swap space of an external memory.
18. The electronic device according to any one of claims 10-17, wherein the time of the cooling process is a cumulative screen-on time from completion of power-on of the electronic device to a screen reaching a target time.
19. A computer-readable storage medium comprising instructions that, when executed on an electronic device, cause the electronic device to perform the method of any of claims 1-9.
CN202110706480.3A 2021-06-24 2021-06-24 Memory cold page processing method and electronic equipment Active CN114116191B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202110706480.3A CN114116191B (en) 2021-06-24 2021-06-24 Memory cold page processing method and electronic equipment
PCT/CN2022/088346 WO2022267664A1 (en) 2021-06-24 2022-04-22 Memory cold page processing method and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110706480.3A CN114116191B (en) 2021-06-24 2021-06-24 Memory cold page processing method and electronic equipment

Publications (2)

Publication Number Publication Date
CN114116191A true CN114116191A (en) 2022-03-01
CN114116191B CN114116191B (en) 2023-09-01

Family

ID=80359317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110706480.3A Active CN114116191B (en) 2021-06-24 2021-06-24 Memory cold page processing method and electronic equipment

Country Status (2)

Country Link
CN (1) CN114116191B (en)
WO (1) WO2022267664A1 (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114461405A (en) * 2022-04-01 2022-05-10 荣耀终端有限公司 Storage method and related device for locking page in memory
CN114741205A (en) * 2022-06-02 2022-07-12 荣耀终端有限公司 Anonymous page recovery method and electronic device
CN115481444A (en) * 2022-11-10 2022-12-16 荣耀终端有限公司 File protection method and electronic equipment
WO2022267664A1 (en) * 2021-06-24 2022-12-29 荣耀终端有限公司 Memory cold page processing method and electronic device
CN115858046A (en) * 2023-02-28 2023-03-28 荣耀终端有限公司 Memory page preloading method, electronic equipment and chip system
WO2024044986A1 (en) * 2022-08-30 2024-03-07 晶晨半导体(上海)股份有限公司 Memory management method and module, chip, electronic device, and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070038808A1 (en) * 2005-07-13 2007-02-15 Samsung Electronics Co., Ltd. Data storage system with complex memory and method of operating the same
TW201015315A (en) * 2008-10-08 2010-04-16 Sunplus Technology Co Ltd Method of flash translation layer using free pages of obsolete block
CN103412800A (en) * 2013-08-05 2013-11-27 华为技术有限公司 Virtual machine warm backup method and equipment
CN103729305A (en) * 2012-10-11 2014-04-16 财团法人工业技术研究院 Method and computer system for memory management on virtual machine system
CN106970881A (en) * 2017-03-10 2017-07-21 浙江大学 The one cold and hot page based on big page is followed the trail of and pressure recovery method
CN110888821A (en) * 2019-09-30 2020-03-17 华为技术有限公司 Memory management method and device
CN111782397A (en) * 2020-07-01 2020-10-16 浪潮云信息技术股份公司 Shielding method of Linux page replacement mechanism

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9286101B2 (en) * 2011-07-28 2016-03-15 Red Hat, Inc. Free page hinting
CN105159777B (en) * 2015-08-03 2018-07-27 中科创达软件股份有限公司 The method for recovering internal storage and device of process
CN115757193B (en) * 2019-11-15 2023-11-03 荣耀终端有限公司 Memory management method and electronic equipment
CN111352861B (en) * 2020-02-19 2023-09-29 Oppo广东移动通信有限公司 Memory compression method and device and electronic equipment
CN114116191B (en) * 2021-06-24 2023-09-01 荣耀终端有限公司 Memory cold page processing method and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070038808A1 (en) * 2005-07-13 2007-02-15 Samsung Electronics Co., Ltd. Data storage system with complex memory and method of operating the same
TW201015315A (en) * 2008-10-08 2010-04-16 Sunplus Technology Co Ltd Method of flash translation layer using free pages of obsolete block
CN103729305A (en) * 2012-10-11 2014-04-16 财团法人工业技术研究院 Method and computer system for memory management on virtual machine system
CN103412800A (en) * 2013-08-05 2013-11-27 华为技术有限公司 Virtual machine warm backup method and equipment
CN106970881A (en) * 2017-03-10 2017-07-21 浙江大学 The one cold and hot page based on big page is followed the trail of and pressure recovery method
CN110888821A (en) * 2019-09-30 2020-03-17 华为技术有限公司 Memory management method and device
CN111782397A (en) * 2020-07-01 2020-10-16 浪潮云信息技术股份公司 Shielding method of Linux page replacement mechanism

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
ILHOON SHIN 等: "Hot/cold clustering for page mapping in NAND flash memory", 《IEEE TRANSACTIONS ON CONSUMER ELECTRONICS》, pages 1728 - 1731 *
钟宝荣 等: "内存数据库中空闲页面管理的方法研究", 《计算机工程与设计》, pages 1523 - 1524 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022267664A1 (en) * 2021-06-24 2022-12-29 荣耀终端有限公司 Memory cold page processing method and electronic device
CN114461405A (en) * 2022-04-01 2022-05-10 荣耀终端有限公司 Storage method and related device for locking page in memory
CN114461405B (en) * 2022-04-01 2022-09-13 荣耀终端有限公司 Storage method and related device for locking page in memory
CN114741205A (en) * 2022-06-02 2022-07-12 荣耀终端有限公司 Anonymous page recovery method and electronic device
WO2024044986A1 (en) * 2022-08-30 2024-03-07 晶晨半导体(上海)股份有限公司 Memory management method and module, chip, electronic device, and storage medium
CN115481444A (en) * 2022-11-10 2022-12-16 荣耀终端有限公司 File protection method and electronic equipment
CN115481444B (en) * 2022-11-10 2023-03-31 荣耀终端有限公司 File protection method and electronic equipment
CN115858046A (en) * 2023-02-28 2023-03-28 荣耀终端有限公司 Memory page preloading method, electronic equipment and chip system

Also Published As

Publication number Publication date
CN114116191B (en) 2023-09-01
WO2022267664A1 (en) 2022-12-29

Similar Documents

Publication Publication Date Title
WO2021083378A1 (en) Method for accelerating starting of application, and electronic device
CN114116191B (en) Memory cold page processing method and electronic equipment
CN114443277A (en) Memory management method and device, electronic equipment and computer readable storage medium
WO2021093626A1 (en) Memory management method and electronic device
CN114461588B (en) Method for adjusting pre-reading window and electronic equipment
CN113704205B (en) Log storage method, chip, electronic device and readable storage medium
CN114356537A (en) Memory management method, electronic device and computer-readable storage medium
CN113495744A (en) Version upgrading method and related device
CN114968543A (en) Method for processing document page and related device
WO2023051094A1 (en) Memory recovery method and apparatus, electronic device, and readable storage medium
CN114461589B (en) Method for reading compressed file, file system and electronic equipment
CN113901485B (en) Application program loading method, electronic device and storage medium
CN114489469B (en) Data reading method, electronic equipment and storage medium
CN112783418B (en) Method for storing application program data and mobile terminal
CN116828100A (en) Bluetooth audio playing method, electronic equipment and storage medium
CN114077519A (en) System service recovery method and device and electronic equipment
CN116048772B (en) Method and device for adjusting frequency of central processing unit and terminal equipment
CN116684520B (en) Shutdown method, electronic equipment, storage medium and chip
CN115941836B (en) Interface display method, electronic equipment and storage medium
CN116723384B (en) Process control method, electronic device and readable storage medium
WO2023109569A1 (en) File storage method, file access method, electronic device, and storage medium
WO2021147838A1 (en) Flash memory swap partition control method and mobile device
CN116860429A (en) Memory management method and electronic equipment
CN116841455A (en) Data storage method, system, host equipment and storage equipment
CN116709609A (en) Message delivery method, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40068154

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant