Information processing method, apparatus, and electronic device
By sharing page table information during memory reclamation, the number of reverse mapping operations during memory reclamation is reduced, solving the problem of high resource consumption during memory reclamation and improving the efficiency of memory management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-30
- Publication Date
- 2026-03-24
AI Technical Summary
Existing technologies require significant processing resources for memory reclamation, especially when multiple processes share memory pages, leading to excessive reverse mapping operations and increased resource consumption.
During memory reclamation, if the page table information of the target memory user object has not been reverse-mapped, a reverse mapping operation is performed on it, and the page table information of memory users sharing the same page table information is configured to have been reverse-mapped, thereby reducing the repeated reverse mapping operations among multiple memory users.
This reduces the number of reverse mapping operations performed on page table information during memory reclamation, thereby reducing resource consumption and improving memory management efficiency.
Smart Images

Figure CN115422097B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, more particularly, to an information processing method and device and electronic equipment. BACKGROUND
[0002] Memory, also known as main memory, is a storage space that can be directly addressed by CPU and is made of semiconductor devices. The space of memory in electronic equipment is limited. In order to ensure that the system has enough memory to use, the system of electronic equipment usually performs memory recycling under certain conditions. However, the processing resources required in the related memory recycling process still need to be reduced. SUMMARY
[0003] In view of the above problems, the present application provides an information processing method, device and electronic equipment to improve the above problems.
[0004] In a first aspect, the present application provides an information processing method, comprising: in a process of performing memory recycling, obtaining a target memory page, the target memory page corresponding to a plurality of memory usage objects; if it is detected that the page table information of a target memory usage object has not been subjected to reverse mapping operation, performing reverse mapping operation on the page table information of the target memory usage object, wherein the target memory usage object is a memory usage object currently subjected to detection among the plurality of memory usage objects; after completing the reverse mapping operation on the page table information of the target memory usage object, configuring the page table information of a memory usage object sharing the same page table information with the target memory usage object as having performed the reverse mapping operation.
[0005] In a second aspect, the present application provides an information processing device, comprising: a page obtaining unit configured to, in a process of performing memory recycling, obtain a target memory page, the target memory page corresponding to a plurality of memory usage objects; an information operation unit configured to, if it is detected that the page table information of a target memory usage object has not been subjected to reverse mapping operation, perform reverse mapping operation on the page table information of the target memory usage object, wherein the target memory usage object is a memory usage object currently subjected to detection among the plurality of memory usage objects; an information configuration unit configured to, after completing the reverse mapping operation on the page table information of the target memory usage object, configure the page table information of a memory usage object sharing the same page table information with the target memory usage object as having performed the reverse mapping operation.
[0006] In a third aspect, the present application provides an electronic equipment comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors to implement the above method.
[0007] In a fourth aspect, the present application provides a computer readable storage medium, which stores program codes, wherein the program codes, when executed by a processor, perform the method described above.
[0008] The information processing method, device and electronic equipment provided in the present application can, in the process of memory recycling, after obtaining a target memory page, detect the page table information of the target memory using object if it is detected that the page table information of the target memory using object has not been subjected to reverse mapping operation. Furthermore, after completing the reverse mapping operation on the page table information of the target memory using object, the page table information of the memory using object sharing the same page table information with the target memory using object is configured as having been subjected to the reverse mapping operation. In this way, in the target memory page corresponding memory using object, if there are multiple memory using objects sharing the same page table information, after the common page table information is subjected to the reverse mapping operation in the process of detecting the target memory using object, the detection process of the other memory using objects sharing the page table information except the target memory using object does not need to perform the reverse mapping operation on the page table information corresponding to the other memory using objects, thereby reducing the number of times of performing the reverse mapping operation on the page table information in the memory recycling process, and in the case that the reverse mapping operation on the page table information needs to consume processing resources, the processing resources consumed in the memory recycling process are also reduced. BRIEF DESCRIPTION OF DRAWINGS
[0009] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative effort.
[0010] Figure 1 A flow chart of an information processing method according to another embodiment of the present application is shown;
[0011] Figure 2 A schematic diagram of multiple memory using objects sharing the same memory page in an embodiment of the present application is shown;
[0012] Figure 3 A schematic diagram of obtaining the page intermediate layer of a memory using object in an embodiment of the present application is shown;
[0013] Figure 4 A flow chart of an information processing method according to another embodiment of the present application is shown;
[0014] Figure 5 A schematic diagram of sharing page table information in an embodiment of the present application is shown;
[0015] Figure 6 A structural block diagram of an information processing device according to an embodiment of the present application is shown;
[0016] Figure 7 A structural block diagram of an electronic device for executing an information processing method according to an embodiment of the present application is shown;
[0017] Figure 8 A storage unit for storing or carrying program codes for implementing an information processing method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the scope of the present application.
[0019] With the rapid development of mobile terminal technology, the demand of consumers for electronic devices is no longer limited to simple functions, but is expected to be able to use a variety of functions smoothly. Therefore, smoothness has become a necessary factor for users to decide whether to purchase an electronic device. Among them, the performance of the memory has a great influence on the running of the electronic device. And the demand for memory of the current electronic device is increasing, for example, a large mobile game may occupy 2G bytes of memory space, and how to better manage the performance of the memory mainly depends on the memory recycling technology.
[0020] For electronic devices, because the size of the included memory is limited, memory recycling is a relatively common mechanism. The main reasons for memory recycling are two: the operating system of the electronic device needs to provide enough memory for any time memory application to come, so that the use of cache and other related memory does not cause the remaining memory of the system to be in a very small state for a long time. Among them, cache is a high-speed memory between the processor and the memory. Also, when there is an application greater than the free memory, memory recycling will be triggered. The core idea of memory recycling is that if some data can be saved to the disk, when the memory is insufficient, these data will be written from the memory to the disk, so that the memory pages occupied by these data can be given to the system as free memory pages.
[0021] The inventors have found that the processing resources required by the related memory recycling process can be further reduced. For example, in the related memory recycling process, it is necessary to detect whether a memory page can be recycled before recycling the memory page. For example, the memory page can be recycled when it is determined that the memory page has not been used recently. In this case, the memory page can be used by multiple processes, and each process using the memory page corresponds to a page table. In this case, it can be determined whether each process has used the memory page recently by detecting whether a specified flag in the page table corresponding to each process is set. Therefore, in the case where the memory page is used by multiple processes, the page table of each process object needs to be obtained to determine whether the memory page has been used recently, which causes the memory recycling process to perform the operation of obtaining the page table (i.e., the reverse mapping operation) multiple times, resulting in a high consumption of processing resources by the memory recycling process.
[0022] Therefore, the inventors propose the information processing method, device, and electronic device in the present application. In the process of recycling memory, after obtaining a target memory page, the page table information of a target memory usage object is detected if it is detected that the page table information of the target memory usage object has not been subjected to a reverse mapping operation. Furthermore, after completing the reverse mapping operation on the page table information of the target memory usage object, the page table information of a memory usage object sharing the same page table information with the target memory usage object is configured to have been subjected to the reverse mapping operation.
[0023] Thus, in the above manner, in the case where multiple memory usage objects share the same page table information in the memory usage objects corresponding to the target memory page, after the common page table information is subjected to a reverse mapping operation in the process of detecting the target usage object, the reverse mapping operation does not need to be performed on the page table information corresponding to the other memory usage objects in the process of detecting the other memory usage objects sharing the page table information, in addition to the target usage object. Thus, the number of times of performing the reverse mapping operation on the page table information in the memory recycling process is reduced, and in the case where the reverse mapping operation on the page table information consumes processing resources, the processing resources consumed in the memory recycling process are also reduced.
[0024] It should be noted that there are various ways for the electronic device to recycle memory.
[0025] As a manner, the electronic device can perform memory recycling by killing the background application. In this manner, after the application is killed, the memory used by the application is recycled in the process of destroying the process of the application, so as to achieve the purpose of memory recycling. Another manner is to perform memory recycling by operating the memory page. For example, the file page used by the application to read a file (for example, some pictures loaded), which can be recycled first after reading the file for a long time, and then read from the disk when the application is used again, so as to relieve the memory tension in a certain period of time. For another example, the anonymous page used by the application, which cannot be discarded at will because it will cause data disorder in the user process after being discarded. At this time, we can choose to compress the anonymous page, for example, the user uses 12kbytes of anonymous page to store user data, we can compress the anonymous page to 4kbytes through compression algorithm, so as to save 8kbytes of memory, and then we can decompress the page to the user when the user uses it again. The information processing method provided by the embodiment of the application can be applied to the process of recycling the memory by operating the memory page.
[0026] The embodiments of the application will be described in detail below with reference to the accompanying drawings.
[0027] Please refer to Figure 1 The information processing method provided by the embodiment of the application comprises:
[0028] S110: In the process of memory recycling, a target memory page is acquired, and the target memory page corresponds to a plurality of memory usage objects.
[0029] It should be noted that the memory page is used by the memory usage object. If the memory page is recently (for example, within a specified period of time) used by the memory usage object, it indicates that the probability of the memory page being recently used is relatively large, and if the recycling is directly performed, it will affect the operation of the electronic device. The memory usage object can include a process or a thread.
[0030] In addition, the same memory page can correspond to a plurality of memory usage objects, and in this case, the plurality of memory usage objects corresponding to the same memory page can recently use the memory page. Therefore, in the process of detecting whether the memory page can be recycled, the plurality of memory usage objects corresponding to the memory page need to be detected.
[0031] In the embodiment of the application, the target memory page can be understood as the memory page which is currently detected to confirm whether it can be recycled.
[0032] S120: If it is detected that the page table information of the target memory usage object is not subjected to the reverse mapping operation, performing the reverse mapping operation on the page table information of the target memory usage object, wherein the target memory usage object is a memory usage object currently subjected to the detection among the plurality of memory usage objects.
[0033] For each memory usage object, corresponding page table information can be configured for the memory usage object in the process that the memory usage object uses the memory page. The page table information can be used to map the corresponding physical page, and can also record the usage of the memory page by the memory usage object. For example, it can be recorded whether the memory usage object has used the memory page recently (e.g., within a specified period). For example, in the case that the memory usage object has used the memory page recently, the corresponding page information is set.
[0034] In this case, in the process of determining whether the target memory page can be recycled, if the memory page corresponds to a plurality of memory usage objects, the usage of the memory page by each memory usage object needs to be detected respectively. The memory usage object currently subjected to the detection is understood as the target memory usage object in the embodiments of the present application. For example, as shown in FIG. 1, memory usage object A, memory usage object B, memory usage object C and memory usage object D share memory page P1. Therefore, in the process of determining whether memory page P1 can be recycled, the usage of memory page P1 by memory usage object A needs to be detected, the usage of memory page P1 by memory usage object B needs to be detected, the usage of memory page P1 by memory usage object C needs to be detected, and the usage of memory page P1 by memory usage object D needs to be detected. Figure 2
[0035] The usage of the memory page by the corresponding memory usage object can be detected through the page table information corresponding to the memory usage object. In the embodiments of the present application, the reverse mapping operation can be understood as an operation process of obtaining the corresponding page table information based on the memory page.
[0036] As a manner, the preset flag can be configured to identify whether the page table information corresponding to the memory usage object has performed the reverse mapping operation. In this manner, the preset flag corresponding to the target memory usage object can be acquired. If the value of the preset flag is a first value, it is determined that the page table information of the target memory usage object has not performed the reverse mapping operation. If the value of the preset flag is a second value, it is determined that the page table information of the target memory usage object has performed the reverse mapping operation. Optionally, the preset flag corresponding to the memory usage object can be configured in the intermediate layer of the page corresponding to the memory usage object. In this case, acquiring the preset flag corresponding to the target memory usage object can include: acquiring the corresponding preset flag from the intermediate layer of the page corresponding to the target memory usage object. The intermediate layer of the page can be a PMD (Page Middle Directory) table.
[0037] As shown in FIG. 10, the address 10 is a memory address corresponding to the memory page P1. In addition, the memory usage object A, the memory usage object B, the memory usage object C and the memory usage object D share the memory page P1. In this case, the VMA corresponding to the memory usage object A, the VMA corresponding to the memory usage object B, the VMA corresponding to the memory usage object C and the VMA corresponding to the memory usage object D can be found through the address 10. Figure 3
[0038] Optionally, taking the process as an example of the memory usage object, each process can be abstracted as a task_struct structure, referred to as a process descriptor. The process descriptor stores information of various aspects of the process, such as open files, signals and memory, etc. A property mm_struct of the task_struct manages all virtual memory areas of the process. In this case, the virtual memory area of the process can be acquired by acquiring the mm_struct property of the task_struct structure of the process.
[0039] In the case where the VMA points to the corresponding intermediate layer of the page, the intermediate layer of the page of the memory usage object A can be found through the VMA corresponding to the memory usage object A, the intermediate layer of the page of the memory usage object B can be found through the VMA corresponding to the memory usage object B, the intermediate layer of the page of the memory usage object C can be found through the VMA corresponding to the memory usage object C, and the intermediate layer of the page of the memory usage object D can be found through the VMA corresponding to the memory usage object D.
[0040] In the case where the VMA points to the corresponding intermediate layer of the page, the intermediate layer of the page of the memory usage object A can be found through the VMA corresponding to the memory usage object A, the intermediate layer of the page of the memory usage object B can be found through the VMA corresponding to the memory usage object B, the intermediate layer of the page of the memory usage object C can be found through the VMA corresponding to the memory usage object C, and the intermediate layer of the page of the memory usage object D can be found through the VMA corresponding to the memory usage object D. Figure 3 In the case shown, if the target memory usage object is memory usage object A, a preset flag can be obtained from the page intermediate layer corresponding to memory usage object A, and the preset flag is used to determine whether the reverse mapping operation has been performed on the page table information of memory usage object A.
[0041] S130: After completing the reverse mapping operation on the page table information of the target memory usage object, the page table information of the memory usage object sharing the same page table information with the target memory usage object is configured as having performed the reverse mapping operation.
[0042] The usage mode of the target memory usage object to the target memory page is the same as the usage mode of the memory usage object sharing the same page table information with the target memory usage object to the target memory page, and the usage mode can include read-write permission and executable permission of the memory page.
[0043] For example, memory usage object A, memory usage object B, memory usage object C, and memory usage object D share memory page P1. Memory usage object A detects memory usage object B, memory usage object C, and memory usage object D before memory usage object A. After performing the reverse mapping operation on the page table information of memory usage object A, in addition to configuring the page table information of memory usage object A as having performed the reverse mapping operation, the page table information of memory usage object B, memory usage object C, and memory usage object D is also configured as having performed the reverse mapping operation. Further, when memory usage object B, memory usage object C, and memory usage object D are detected, their page table information has performed the reverse mapping operation, so that the reverse mapping operation does not need to be performed again.
[0044] The information processing method provided by the embodiment can reduce the number of times of performing the reverse mapping operation on the page table information in the memory recycling process, and also reduce the processing resources consumed in the memory recycling process when the reverse mapping operation on the page table information consumes processing resources.
[0045] Please refer to Figure 4 The information processing method provided by the embodiment includes:
[0046] S210: In the process of memory recycling, a target memory page is obtained, and the target memory page corresponds to a plurality of memory usage objects.
[0047] S220: If it is detected that the page table information of the target memory usage object is not subjected to a reverse mapping operation, a corresponding page intermediate layer is obtained according to the target memory usage object, and the target memory usage object is a memory usage object currently subjected to detection in the plurality of memory usage objects.
[0048] S230: The page table information corresponding to the target memory usage object is obtained from the page intermediate layer, and the page table information in the page intermediate layer is obtained from a reference usage object corresponding page table, and the reference usage object is a usage object corresponding to a page table in the usage objects sharing the page table information with the target memory usage object.
[0049] It should be noted that in the embodiments of the present application, the page table information can be understood as the information included in the PTE (Page Table Entry) page table. However, in the case where a plurality of memory usage objects share the same page table information, not every memory usage object has a corresponding PTE page table, so as to reduce the number of PTE page tables and also facilitate reducing the storage space occupied by the PTE page tables. Therefore, in the case where the memory usage object corresponds to the PTE page table, the page table information corresponding to the memory usage object is recorded in the corresponding PTE page table, and in the case where the memory usage object does not correspond to the page table, the corresponding page table information can be recorded in the corresponding page intermediate layer.
[0050] When the memory usage object accesses the memory page, if the PTE page table corresponding to the memory usage object accessing the memory page is not established, a page fault error will occur, and in this case, the sharing of the page table information included in the PTE page table can be performed.
[0051] As a sharing manner, in response to a page fault error of a target usage object using a target memory page corresponding file, an address space (address_space) corresponding to the target memory page is obtained, a memory usage object mapped in the same region as the target usage object is obtained from the memory usage objects corresponding to the address space as a first memory usage object, the page table information is obtained from the page table (PTE page table) corresponding to the first memory usage object, and the obtained page table information is written into the page intermediate layer of the target usage object, so as to share the page table information corresponding to the page table of the first memory usage object to the target usage object, so that the memory usage object triggering the page fault error does not need to newly establish the corresponding page table (PTE page table) again. Wherein, all VMAs corresponding to the same address space are configured on the red-black tree of this address space.
[0052] For example,Figure 5 As shown, taking processes as the memory users is an example. An electronic device includes processes A and B. When process A accesses a target file (e.g., a library file), the code segment of the target file is already mapped in process A, and a corresponding PTE page table is allocated for process A. In this case, if process B also accesses the target file but encounters a page fault, it can search for the region mapped by the Virtual Machine Function (VMF) of the electronic device, retrieve the process (i.e., the first memory user) with the corresponding PTE page table from that mapped region, and thus obtain process A. Then, it can obtain the virtual memory region of process A, obtain the corresponding intermediate page layer of process A from that virtual memory region, and then obtain the PTE page table of process A based on the intermediate page layer of process A. The page table information of process A's PTE page table is then copied to the intermediate page layer of process B, so that process B, although it has not requested and created its own PTE page table, can still possess the corresponding page table information in the PTE page table.
[0053] As described above, in this embodiment, there are two ways to perform reverse mapping (reverse mapping) on page table information. In this case, one approach is to detect whether the target memory user object corresponds to a page table. If no page table exists, the corresponding page intermediate layer is obtained based on the target memory user object. If a page table exists, the corresponding page table information is obtained from the page table corresponding to the target memory user object.
[0054] It should be noted that in the process of obtaining page table information from the page table, it is still necessary to first obtain the virtual memory region of the memory usage object, then obtain the page intermediate layer pointed to by the virtual memory region, and then obtain the page table pointed to by the page intermediate layer.
[0055] S240: After completing the reverse mapping operation on the page table information of the target memory user object, configure the page table information of the memory user object that shares the same page table information with the target memory user object as having undergone the reverse mapping operation.
[0056] This embodiment provides an information processing method that, when multiple memory users sharing the same page table information exist among the memory users corresponding to a target memory page, after a reverse mapping operation has been performed on the shared page table information during the detection of the target user, it is not necessary to perform a reverse mapping operation on the page table information corresponding to other memory users sharing the same page table information during the detection of other memory users besides the target user. This reduces the number of reverse mapping operations on page table information during memory reclamation, and also reduces the processing resources required during memory reclamation, even when performing reverse mapping operations on page table information consumes processing resources. Furthermore, in this embodiment, when a page fault occurs when the target memory user accesses a file, the memory user corresponding to the memory address of the accessed file can be used to obtain the memory user that is mapped to the same region as the target memory user from the memory user in the address space. Then, the page table information in the page table of the first memory user is written into the page intermediate layer of the target memory user. This achieves the goal of using the page table information in the page table of the first memory user as the page table information of the target memory user, so that it is not necessary to create a separate page table for the target memory user to store the page table information, thus reducing the storage space occupied by the page table.
[0057] Please see Figure 6 This application provides an information processing device 300, which includes:
[0058] Page acquisition unit 310 is used to acquire target memory pages during memory reclamation. The target memory page corresponds to multiple memory usage objects.
[0059] The information operation unit 320 is used to perform a reverse mapping operation on the page table information of the target memory user object if it is detected that the page table information of the target memory user object has not been reverse mapped. The target memory user object is the memory user object currently being detected among multiple memory user objects.
[0060] The information operation unit 320 is further configured to obtain a preset flag corresponding to the target memory user object; if the value of the preset flag is a first value, it is determined that the page table information of the target memory user object has not undergone reverse mapping. Optionally, the information operation unit 320 is further configured to obtain the corresponding preset flag from the page intermediate layer corresponding to the target memory user object.
[0061] The information configuration unit 330 is used to configure the page table information of memory users that share the same page table information as the target memory user as having undergone reverse mapping, after performing a reverse mapping operation on the page table information of the target memory user. The way the target memory user uses the target memory page is the same as the way the memory user that shares the same page table information uses the target memory page.
[0062] In one manner, the information operation unit 320 is specifically used to obtain the corresponding page intermediate layer based on the target memory user object; and to obtain the page table information corresponding to the target memory user object from the page intermediate layer. The page table information in the page intermediate layer is obtained from the page table corresponding to the reference user object, wherein the reference user object is an object with a corresponding page table among the user objects that share page table information with the target memory user object.
[0063] Optionally, the information operation unit 320 is specifically used to detect whether the target memory user object corresponds to a page table; if there is no corresponding page table, it performs the operation of obtaining the corresponding page intermediate layer based on the target memory user object; if there is a corresponding page table, it obtains the corresponding page table information from the page table corresponding to the target memory user object.
[0064] The information operation unit 320 is further specifically configured to, in response to a page fault in the file corresponding to the target memory page used by the target user object, obtain the address space corresponding to the target memory page; from the memory users corresponding to the address space, obtain the memory user object mapped to the same region as the target user object as the first memory user object; obtain page table information from the page table corresponding to the first memory user object, and write the obtained page table information to the page intermediate layer of the target user object, so as to share the page table information corresponding to the page table of the first memory user object with the target user object.
[0065] This embodiment provides an information processing device that, during memory reclamation, after acquiring a target memory page, can detect if the page table information of the target memory user object has not undergone reverse mapping. Furthermore, after performing a reverse mapping operation on the page table information of the target memory user object, the page table information of memory users sharing the same page table information as the target memory user object is configured as having undergone a reverse mapping operation. Thus, in cases where multiple memory users sharing the same page table information exist within the target memory page, after performing a reverse mapping operation on the shared page table information during the detection of the target user object, it is unnecessary to perform a reverse mapping operation on the page table information of other memory users sharing the same page table information during the detection of other memory users besides the target user object. This reduces the number of reverse mapping operations performed on page table information during memory reclamation and also reduces the processing resources consumed during memory reclamation, even when performing reverse mapping on page table information requires processing resources.
[0066] It should be noted that the device embodiments in this application correspond to the aforementioned method embodiments. The specific principles in the device embodiments can be found in the content of the aforementioned method embodiments, and will not be repeated here.
[0067] The following will combine Figure 7 This application describes an electronic device.
[0068] Please see Figure 7 Based on the aforementioned information processing methods and apparatus, this application also provides an electronic device 1000 capable of executing the aforementioned information processing methods. The electronic device 1000 includes one or more (only one shown in the figure) processors 102, a memory 104, a network module 106, a sensor module 108, and an audio acquisition device 110, all coupled to each other. The memory 104 stores programs capable of executing the contents of the aforementioned embodiments, and the processor 102 can execute the programs stored in the memory 104.
[0069] The processor 102 may include one or more processing cores. The processor 102 connects to various parts within the electronic device 1000 using various interfaces and lines, and performs various functions and processes data of the electronic device 1000 by running or executing instructions, programs, code sets, or instruction sets stored in the memory 104, and by calling data stored in the memory 104. Optionally, the processor 102 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 102 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 102 and may be implemented separately using a communication chip.
[0070] The memory 104 may include random access memory (RAM) or read-only memory (ROM). The memory 104 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below.
[0071] The network module 106 is used to enable information interaction between the electronic device 1000 and other devices, such as transmitting device control commands, manipulation request commands, and status information acquisition commands. However, the network module 106 may differ depending on the specific device being played by the audio playback device 200.
[0072] Sensor module 108 may include at least one sensor. Specifically, sensor module 108 may include, but is not limited to, a light sensor, a motion sensor, a pressure sensor, an infrared thermal sensor, a distance sensor, an acceleration sensor, and other sensors.
[0073] The pressure sensor is a sensor that detects pressure generated by pressing on the electronic device 1000. Specifically, the pressure sensor detects pressure generated by contact or pressing between the user and the audio playback device, such as pressure generated by contact or pressing between the user's ear and the mobile terminal. Therefore, the pressure sensor can be used to determine whether contact or pressing has occurred between the user and the electronic device 1000, and the magnitude of the pressure.
[0074] The accelerometer can detect the magnitude of acceleration in various directions (generally three axes), and when stationary, it can detect the magnitude and direction of gravity. It can be used for applications such as identifying the posture of the electronic device 1000 (e.g., screen orientation switching, related games, magnetometer posture calibration), and vibration recognition functions (e.g., pedometer, tapping). Additionally, the electronic device 1000 can also be equipped with other sensors such as a gyroscope, barometer, hygrometer, and thermometer, which will not be elaborated upon here.
[0075] An audio acquisition device 110 is used to acquire audio signals. Optionally, the audio acquisition device 110 includes multiple audio acquisition components. These audio acquisition components can be microphones.
[0076] In one approach, the network module of the electronic device 1000 is a radio frequency (RF) module. This RF module is used to receive and transmit electromagnetic waves, converting electromagnetic waves into electrical signals, thereby enabling communication with a communication network or other devices. The RF module may include various existing circuit elements used to perform these functions, such as antennas, RF transceivers, digital signal processors, encryption / decryption chips, user identity modules (SIM cards), memory, etc. For example, the RF module can interact with external devices by transmitting or receiving electromagnetic waves, thereby receiving audio signals transmitted by external devices.
[0077] Furthermore, the electronic device 1000 may also include an image acquisition device for image acquisition. For example, the image acquisition device can be used to capture video, still images, or moving images.
[0078] Please refer to Figure 8 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 800 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0079] The computer-readable storage medium 800 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 800 has storage space for program code 810 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
[0080] In summary, the information processing method, apparatus, and electronic device provided in this application, during memory reclamation, after obtaining the target memory page, can detect the page table information of the target memory user if it is detected that the page table information of the target memory user has not undergone reverse mapping. Furthermore, after performing the reverse mapping operation on the page table information of the target memory user, the page table information of memory users sharing the same page table information with the target memory user is configured as having undergone the reverse mapping operation. Thus, in the case where multiple memory users share the same page table information corresponding to the target memory page, after performing a reverse mapping operation on the shared page table information during the detection of the target user, it is not necessary to perform a reverse mapping operation on the page table information corresponding to other memory users sharing the same page table information during the detection of other memory users besides the target user. This reduces the number of reverse mapping operations performed on page table information during memory reclamation and also reduces the processing resources consumed during memory reclamation, even when performing reverse mapping on page table information requires processing resources.
[0081] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. An information processing method, characterized in that, The method includes: During the memory reclamation process, a target memory page is obtained, and the target memory page corresponds to multiple memory usage objects; If it is detected that the page table information of the target memory usage object has not been reverse mapped, a reverse mapping operation is performed on the page table information of the target memory usage object, wherein the target memory usage object is the memory usage object currently being detected among the plurality of memory usage objects; After completing the reverse mapping operation on the page table information of the target memory user object, the page table information of the target memory user object and the page table information of memory users that share the same page table information with the target memory user object are configured as having performed the reverse mapping operation.
2. The method according to claim 1, characterized in that, The reverse mapping operation on the page table information of the target memory-using object includes: The corresponding page intermediate layer is obtained based on the virtual memory region of the target memory object; The page table information corresponding to the target memory user object is obtained from the page intermediate layer. The page table information in the page intermediate layer is obtained from the page table corresponding to the reference user object. The reference user object is an object that has a corresponding page table among the user objects that share page table information with the target memory user object.
3. The method according to claim 2, characterized in that, Before obtaining the corresponding page intermediate layer based on the virtual memory region of the target memory usage object, the process also includes: Detect whether the target memory usage object corresponds to a page table; If no corresponding page table exists, proceed to obtain the corresponding page intermediate layer based on the virtual memory region of the target memory object; If a page table exists, obtain the corresponding page table information from the page table corresponding to the target memory usage object.
4. The method according to claim 2, characterized in that, The method further includes: In response to a page fault occurring in the file corresponding to the target memory page used by the target user, the address space corresponding to the target memory page is obtained; From the memory usage objects corresponding to the address space, obtain the memory usage object that is mapped to the same region as the target usage object as the first memory usage object; Page table information is obtained from the page table corresponding to the first memory user object, and the obtained page table information is written to the page middleware layer of the target user object, so as to share the page table information corresponding to the page table of the first memory user object with the target user object.
5. The method according to claim 1, characterized in that, The step of detecting that the page table information of the target memory-using object has not been reverse-mapped before the following is also included: Retrieve the preset flags corresponding to the target memory usage object; If the value of the preset flag is the first value, it is determined that the page table information of the target memory object has not been reverse-mapped.
6. The method according to claim 5, characterized in that, The step of obtaining the preset flag corresponding to the target memory usage object includes: Obtain the corresponding preset flag from the intermediate layer of the page corresponding to the target memory usage object.
7. The method according to any one of claims 1-6, characterized in that, The way the target memory user uses the target memory page is the same as the way the memory user that shares the same page table information with the target memory user uses the target memory page.
8. An information processing device, characterized in that, The device includes: The page acquisition unit is used to acquire the target memory page during the memory reclamation process, wherein the target memory page corresponds to multiple memory usage objects; An information operation unit is configured to perform a reverse mapping operation on the page table information of the target memory user object if it is detected that the page table information of the target memory user object has not been reverse mapped, wherein the target memory user object is the memory user object currently being detected among the plurality of memory user objects; The information configuration unit is configured, after performing a reverse mapping operation on the page table information of the target memory user object, to configure the page table information of the target memory user object and the page table information of memory users that share the same page table information with the target memory user object as having performed the reverse mapping operation.
9. An electronic device, characterized in that, It includes one or more processors and memory; one or more programs are stored in the memory and configured to be executed by the one or more processors according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores program code, wherein the program code, when executed by a processor, performs the method according to any one of claims 1-7.
Citation Information
Patent Citations
Controlling access to pages in memory in computing device
CN109564522A
Page exchange method and device and electronic equipment
CN114840332A