CN117667369A - Memory management method, electronic device, chip system and readable storage medium - Google Patents

Memory management method, electronic device, chip system and readable storage medium Download PDF

Info

Publication number
CN117667369A
CN117667369A CN202211033616.XA CN202211033616A CN117667369A CN 117667369 A CN117667369 A CN 117667369A CN 202211033616 A CN202211033616 A CN 202211033616A CN 117667369 A CN117667369 A CN 117667369A
Authority
CN
China
Prior art keywords
physical address
memory space
target application
data
space
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.)
Pending
Application number
CN202211033616.XA
Other languages
Chinese (zh)
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.)
Huawei Cloud Computing Technologies Co Ltd
Original Assignee
Huawei Cloud Computing Technologies 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 Huawei Cloud Computing Technologies Co Ltd filed Critical Huawei Cloud Computing Technologies Co Ltd
Priority to CN202211033616.XA priority Critical patent/CN117667369A/en
Priority to PCT/CN2023/105048 priority patent/WO2024041219A1/en
Publication of CN117667369A publication Critical patent/CN117667369A/en
Pending legal-status Critical Current

Links

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]
    • 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/54Interprogram communication

Abstract

The application provides a memory management method, electronic equipment, a chip system and a readable storage medium, relates to the technical field of communication, and solves the problem of unreasonable memory resource allocation in the conventional RDMA technology to a certain extent. The method is applied to the first electronic equipment and comprises the following steps: determining the data quantity to be stored by a target application and an effective memory space in a physical address space associated with the target application, wherein the effective memory space comprises N memory spaces indicated by first physical address units, each first physical address unit comprises at least one physical address with data read-write permission, and N is an integer greater than or equal to 0; if the data volume is larger than the effective memory space, expanding the effective memory space according to a first difference value between the data volume and the effective memory space; if the data volume is smaller than the effective memory space, the effective memory space is reduced according to a second difference between the effective memory space and the data volume.

Description

Memory management method, electronic device, chip system and readable storage medium
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a memory management method, an electronic device, a chip system, and a readable storage medium.
Background
Remote direct data access (Remote Direct Memory Access, RDMA) technology is a network transmission technology for directly accessing a remote computer storage area, and compared with the traditional network technology, the RDMA technology can bypass an operating system protocol stack, reduce the number of times of copying data, avoid the kernel mode switching overhead of a user mode, occupy smaller system resources and reduce time delay.
In the process of data transmission by the application in the electronic equipment based on the RDMA technology, a certain amount of physical address space needs to be registered in advance with an RDMA system for caching data in the process of sending and receiving the data by the RDMA network card. When a plurality of applications run simultaneously on the electronic device, a corresponding physical address space needs to be pre-allocated for each application, however, memory resources of a memory in the electronic device are limited, and the pre-allocated physical address space with a fixed size may not meet memory requirements of some applications, or may be larger than the memory requirements of some applications, so that resource waste is caused.
Disclosure of Invention
The application provides a memory management method, electronic equipment, a chip system and a readable storage medium, which solve the problem of unreasonable memory resource allocation in the conventional RDMA technology to a certain extent.
In order to achieve the above purpose, the present application adopts the following technical scheme:
in a first aspect, the present application provides a memory management method, applied to a first electronic device, where the method includes: determining the data quantity to be stored by a target application and an effective memory space in a physical address space associated with the target application, wherein the effective memory space comprises N memory spaces indicated by first physical address units, each first physical address unit comprises at least one physical address with data read-write permission, and N is an integer greater than or equal to 0; if the data volume is larger than the effective memory space, expanding the effective memory space according to a first difference value between the data volume and the effective memory space; if the data volume is smaller than the effective memory space, the effective memory space is reduced according to a second difference between the effective memory space and the data volume.
Based on the memory management method provided by the application, whether the effective memory space meets the memory space required by the current data amount to be stored of the application is determined according to the difference value between the data amount to be stored of the target application and the effective memory space with the data read-write permission in the physical address space corresponding to the target application, so that the effective memory space of the target application is dynamically adjusted. If the effective memory space does not meet the memory space required by the data amount to be stored, the effective memory space can be expanded according to a first difference value between the data amount and the effective memory space, so that the expanded effective memory space meets the memory space required by the application, and if the effective memory space meets the memory space required by the data amount to be stored, the effective memory space can be reduced according to a second difference value between the effective memory space and the data amount, thereby releasing partial unoccupied effective memory space and avoiding wasting memory resources.
In a possible implementation manner of the first aspect, the physical address space further includes a second physical address unit, where the second physical address unit includes at least one physical address that does not have data writing authority.
In a possible implementation manner of the first aspect, the method further includes:
when a memory allocation request sent by a target application is received, a second physical address unit is allocated to the target application; and when receiving a registration request sent by the target application and based on remote direct data access communication, registering an initial mapping table between the second physical address unit and the virtual address space of the target application.
In a possible implementation manner of the first aspect, the virtual address space of the target application includes M virtual address units, each virtual address unit includes at least one virtual address, and M is an integer greater than or equal to 1;
expanding the effective memory space according to a first difference between the data volume and the effective memory space, comprising:
according to the first difference value, M first physical address units are distributed for the target application, and the memory space of the M first physical address units is larger than or equal to the first difference value, wherein m+N < M is more than or equal to 1; and remapping M virtual address units corresponding to the second physical address units in the M virtual address units to M first physical address units.
In one possible implementation manner of the first aspect, the virtual address space of the target application includes M virtual address units, each virtual address unit includes at least one virtual address, M is an integer greater than or equal to 1, and the effective memory space includes N first physical address units corresponding to N virtual address units in the M virtual address units, where N is greater than or equal to 1 and less than or equal to M;
reducing the effective memory space according to a second difference between the effective memory space and the data volume, comprising:
and when the second difference value is larger than or equal to a preset threshold value, remapping N virtual address units corresponding to N first physical address units in the N virtual address units to a second physical address unit, wherein the memory space of the N first physical address units is smaller than or equal to the second difference value, and the preset threshold value is larger than 0, and N is smaller than or equal to 1.
In one possible implementation manner of the first aspect, the target application is an application installed in the first electronic device.
In a possible implementation manner of the first aspect, the amount of data to be stored is an amount of data of the target application or an amount of data of an application installed in the second electronic device received by the first electronic device.
In a second aspect, the present application provides an electronic device, comprising: a processor for running a computer program stored in a memory to implement the method in any one of the possible implementations of the first aspect.
In a third aspect, the present application provides another electronic device, including: a processor and a remote direct data access network card;
the remote direct data access network card is used for determining the data quantity to be stored by the target application and the effective memory space in the physical address space associated with the target application, wherein the effective memory space comprises N memory spaces indicated by first physical address units, each first physical address unit comprises at least one physical address with data read-write permission, and N is an integer greater than or equal to 0; if the data volume is larger than the effective memory space, the remote direct data access network card is further used for sending first interrupt information to the processor, the first interrupt information comprises a first difference value between the data volume and the effective memory space, and the processor is used for expanding the effective memory space according to the first difference value; if the data volume is smaller than the effective memory space, the remote direct data access network card is further configured to send second interrupt information to the processor, where the second interrupt information includes a second difference between the effective memory space and the data volume, and the processor is configured to reduce the effective memory space according to the second difference.
In a possible implementation manner of the third aspect, the physical address space further includes a second physical address unit, where the second physical address unit includes at least one physical address that does not have data writing authority.
In a possible implementation manner of the third aspect, the processor is further configured to:
when a memory allocation request sent by a target application is received, a second physical address unit is allocated to the target application;
the remote direct data access network card is also for:
and when receiving a registration request sent by the target application and based on remote direct data access communication, registering an initial mapping table between the second physical address unit and the virtual address space of the target application.
In a possible implementation manner of the third aspect, the virtual address space of the target application includes M virtual address units, each virtual address unit includes at least one virtual address, and M is an integer greater than or equal to 1;
the processor is further configured to:
according to the first difference value, M first physical address units are distributed for the target application, and the memory space of the M first physical address units is larger than or equal to the first difference value, wherein m+N < M is more than or equal to 1; and remapping M virtual address units corresponding to the second physical address units in the M virtual address units to M first physical address units.
In one possible implementation manner of the third aspect, the virtual address space of the target application includes M virtual address units, each virtual address unit includes at least one virtual address, M is an integer greater than or equal to 1, and the effective memory space includes N first physical address units corresponding to N virtual address units in the M virtual address units, where N is greater than or equal to 1 and less than or equal to M;
The processor is further configured to: and when the second difference value is larger than or equal to a preset threshold value, remapping N virtual address units corresponding to N first physical address units in the N virtual address units to a second physical address unit, wherein the memory space of the N first physical address units is smaller than or equal to the second difference value, and the preset threshold value is larger than 0, and N is smaller than or equal to 1.
In one possible implementation manner of the third aspect, the target application is an application installed in the electronic device.
In a possible implementation manner of the third aspect, the amount of data to be stored is an amount of data sent by a second remote direct data access network card received by the first remote direct data access network card.
In a fourth aspect, the present application provides a chip system comprising a processor executing a computer program stored in a memory to implement the method of any one of the possible implementations of the first aspect.
In a fifth aspect, the present application provides a computer readable storage medium storing a computer program which when executed by a processor implements the method of any one of the possible implementations of the first aspect.
In a sixth aspect, the present application provides a computer program product for, when run on an electronic device, causing the electronic device to perform the method of any one of the possible implementations of the first aspect.
Technical effects of the second aspect to the sixth aspect provided in the present application may be referred to technical effects of each possible implementation manner of the first aspect, which are not described herein.
Drawings
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Fig. 2 is a schematic software structure of an electronic device according to an embodiment of the present application.
Fig. 3 is a schematic diagram of data transmission based on a conventional network communication technology according to an embodiment of the present application.
Fig. 4 is a schematic diagram of data transmission based on the existing RDMA communication technology according to an embodiment of the present application.
Fig. 5 is a schematic diagram of mapping relationships among a virtual address space, a page table, and a physical address space according to an embodiment of the present application.
Fig. 6 is a flowchart of a memory management method according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a mapping relationship between a virtual address space of a target application and a second physical address unit according to an embodiment of the present application.
Fig. 8 is a schematic diagram of a mapping relationship between a virtual address space and a physical address space of a target application according to an embodiment of the present application.
Fig. 9 is a schematic diagram of a mapping relationship between a virtual address space and a physical address space of another target application according to an embodiment of the present application.
Fig. 10 is a schematic diagram of interaction among a target application, a processor and an RDMA network card in an electronic device according to an embodiment of the present application.
Fig. 11 is a schematic diagram of interaction between a first electronic device and a second electronic device according to an embodiment of the present application.
Fig. 12 is another interaction schematic diagram between a target application, a processor and an RDMA network card in an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application are described below with reference to the drawings in the embodiments of the present application and related embodiments. In the description of the embodiments of the present application, the terminology used in the embodiments below is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of this application and the appended claims, the singular forms "a," "an," "the," and "the" are intended to include, for example, "one or more" such forms of expression, unless the context clearly indicates to the contrary. It should also be understood that in the various embodiments herein below, "at least one", "one or more" means one or more than two (including two). The term "and/or" is used to describe an association relationship of associated objects, meaning that there may be three relationships; for example, a and/or B may represent: a alone, a and B together, and B alone, wherein A, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise. The term "coupled" includes both direct and indirect connections, unless stated otherwise. The terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
In the embodiments of the present application, words such as "exemplary" or "such as" are used to mean serving as examples, illustrations, or descriptions. Any embodiment or design described herein as "exemplary" or "for example" should not be construed as preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "such as" is intended to present related concepts in a concrete fashion.
The memory management method provided by the embodiment of the application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, augmented reality (augmented reality, AR)/Virtual Reality (VR) devices, notebook computers, ultra-mobile personal computer (UMPC), netbooks, personal digital assistants (personal digital assistant, PDA), servers and the like, and the embodiment of the application does not limit the specific types of the electronic devices.
Referring to fig. 1, a schematic structural diagram of an electronic device 100 according to an embodiment of the present application is provided, where the electronic device 100 may include a processor (central processing unit, CPU) 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge 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, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, and a subscriber identity module (subscriber identification module, SIM) card interface 195, an rdma network card 196, and the like. The sensor module 180 may include, among others, a pressure sensor, a gyroscope sensor, a barometric sensor, a magnetic sensor, an acceleration sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a temperature sensor, a touch sensor, an ambient light sensor L, a bone conduction sensor, etc.
It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, electronic device 100 may include more or fewer components than shown, or certain components may be combined, or certain components may be split, or different arrangements of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
CPU110 may include one or more processing units such as, for example: CPU110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc. Wherein the different processing units may be separate devices or may be integrated in one or more processors.
The controller may be a neural hub and a command center of the electronic device 100, among others. The controller can generate operation control signals according to the instruction operation codes and the time sequence signals to finish the control of instruction fetching and instruction execution.
In some embodiments, the CPU110 may include one or more interfaces. The interfaces may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, and/or a universal serial bus (universal serial bus, USB) interface, among others.
The I2C interface is a bi-directional synchronous serial bus comprising a serial data line (SDA) and a serial clock line (derail clock line, SCL). In some embodiments, CPU110 may contain multiple sets of I2C buses. The CPU110 may be coupled to a touch sensor, a charger, a flash, a camera 193, etc., respectively, through different I2C bus interfaces. For example: the CPU110 may be coupled to the touch sensor through an I2C interface, so that the CPU110 and the touch sensor communicate through an I2C bus interface to implement a touch function of the electronic device 100.
The I2S interface may be used for audio communication. In some embodiments, CPU110 may contain multiple sets of I2S buses. The CPU110 may be coupled to the audio module 170 via an I2S bus to enable communication between the CPU110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call through the bluetooth headset.
PCM interfaces may also be used for audio communication to sample, quantize and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 may be coupled through 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 to implement a function of answering a call through the 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 for asynchronous communications. The bus may be a bi-directional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, a UART interface is typically used to connect CPU110 with wireless communication module 160. For example: the CPU110 communicates with a bluetooth module in the wireless communication module 160 through a UART interface, implementing a bluetooth function. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through a UART interface, to implement a function of playing music through a bluetooth headset.
The MIPI interface may be used to connect CPU110 with peripheral devices such as display 194, camera 193, etc. The MIPI interfaces include camera serial interfaces (camera serial interface, CSI), display serial interfaces (display serial interface, DSI), and the like. In some embodiments, CPU110 and camera 193 communicate through a CSI interface to implement the photographing function of electronic device 100. The CPU110 and the display screen 194 communicate through a 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 or as a data signal. In some embodiments, a GPIO interface may be used to connect CPU110 with camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, and the like. The GPIO interface may also be configured as an I2C interface, an I2S interface, a UART interface, an MIPI interface, etc.
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 transfer data between the electronic device 100 and a peripheral device. And can also be used for connecting with a headset, and playing audio through the headset. The interface may also be used to connect other electronic devices 100, such as AR devices, etc.
It should be understood that the interfacing relationship between the modules illustrated in the embodiments of the present application is only illustrative, and does not limit the structure of the electronic device 100. In other embodiments of the present application, the electronic device 100 may also use different interfacing manners, or a combination of multiple interfacing manners in the foregoing embodiments.
The charge management module 140 is configured to receive a charge input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charge management module 140 may receive a charging input of a wired charger through the USB interface 130. In some wireless charging embodiments, the charge management module 140 may receive 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 100 through the power management module 141 while charging the battery 142.
The power management module 141 is used for connecting the battery 142, and the charge management module 140 and the CPU110. The power management module 141 receives input from the battery 142 and/or the charge management module 140 and provides power to the CPU110, the internal memory 121, the external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may also be configured to monitor battery capacity, battery cycle number, battery health (leakage, impedance) and other parameters. In other embodiments, the power management module 141 may also be disposed in the CPU110. In other embodiments, the power management module 141 and the charge 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 receiving electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication bands. Different antennas may also be multiplexed to improve the utilization of the antennas. For example: the antenna 1 may be multiplexed into 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 for wireless communication including 2G/3G/4G/5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (low noise amplifier, LNA), etc. The mobile communication module 150 may receive electromagnetic waves from the antenna 1, perform processes such as filtering, amplifying, and the like on the received electromagnetic waves, and transmit the processed electromagnetic waves to the modem processor for demodulation. The mobile communication module 150 can amplify the signal modulated by the modem processor, and convert the signal into electromagnetic waves through the antenna 1 to radiate. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the CPU 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 may be provided in the same device as at least some of the modules of the CPU 110.
The modem processor may include a modulator and a demodulator. The modulator is used for modulating the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used for demodulating the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low frequency baseband signal to the 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 sound signals through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays images 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 CPU110.
The wireless communication module 160 may provide solutions for wireless communication including wireless local area network (wireless local area networks, WLAN) (e.g., wireless fidelity (wireless fidelity, wi-Fi) network), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field wireless communication technology (near field communication, NFC), infrared technology (IR), etc., as applied to the electronic device 100. The wireless communication module 160 may be one or more devices integrating at least one communication MMU, for example the wireless communication module 160 may be an RDMA network card. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signals, filters the electromagnetic wave signals, and transmits the processed signals to the CPU110. The wireless communication module 160 may also receive a signal to be transmitted from the CPU110, frequency-modulate the signal, amplify the signal, and convert the signal into electromagnetic waves to radiate the electromagnetic waves through the antenna 2.
In some embodiments, antenna 1 and mobile communication module 150 of electronic device 100 are coupled, and antenna 2 and wireless communication module 160 are coupled, such that electronic device 100 may communicate with a network and other devices through wireless communication techniques. The wireless communication techniques may include the Global System for Mobile communications (global system for mobile communications, GSM), general packet radio service (general packet radio service, GPRS), code division multiple access (code division multiple access, CDMA), wideband code division multiple access (wideband code division multiple access, WCDMA), time division code division multiple access (time-division code division multiple access, TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR techniques, among others. The GNSS may include a global satellite positioning system (global positioning system, GPS), a global navigation satellite system (global navigation satellite system, GLONASS), a beidou satellite navigation system (beidou navigation satellite system, BDS), a quasi zenith satellite system (quasi-zenith satellite system, QZSS) and/or a satellite based augmentation system (satellite based augmentation systems, SBAS).
The electronic device 100 implements display functions through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. CPU110 may include one or more GPUs that execute program instructions to generate or change display information.
The display screen 194 is used to display images, videos, and the like. The display 194 includes a display panel. The display panel may employ a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED) or an active-matrix organic light-emitting diode (matrix organic light emitting diode), a flexible light-emitting diode (flex), a mini, a Micro led, a Micro-OLED, a quantum dot light-emitting diode (quantum dot light emitting diodes, QLED), or the like. In some embodiments, the electronic device 100 may include 1 or N display screens 194, N being a positive integer greater than 1.
The electronic device 100 may implement photographing functions through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
The ISP is used to process data fed back by the camera 193. For example, when photographing, the shutter is opened, light is transmitted to the camera photosensitive element through the lens, the optical signal is converted into an electric signal, and the camera photosensitive element transmits the electric signal to the ISP for processing and is converted into an image visible to naked eyes. ISP can also optimize 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 the 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 onto the photosensitive element. The photosensitive element may be a charge coupled device (charge coupled device, CCD) or a Complementary Metal Oxide Semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, which is then transferred to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or the like format. In some embodiments, 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 other digital signals besides digital image signals. For example, when the electronic device 100 selects a frequency bin, the digital signal processor is used to fourier transform the frequency bin energy, or the like.
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: dynamic picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
The NPU is a neural-network (NN) computing processor, and can rapidly process input information by referencing a biological neural network structure, for example, referencing a transmission mode between human brain neurons, and can also continuously perform self-learning. Applications such as intelligent awareness of the electronic device 100 may be implemented through the NPU, for example: image recognition, face recognition, speech recognition, text understanding, etc.
The electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. 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 CPU110, or some functional modules of the audio module 170 may be disposed in the CPU 110.
The speaker 170A, also referred to as a "horn," is used to convert audio electrical signals into sound signals. The electronic device 100 may listen to music, or to hands-free conversations, through the speaker 170A.
A receiver 170B, also referred to as a "earpiece", is used to convert the audio electrical signal into a sound signal. When electronic device 100 is answering a telephone call or voice message, voice may be received by placing receiver 170B in close proximity to the human ear.
Microphone 170C, also referred to as a "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or transmitting voice information, the user can sound near the microphone 170C through the mouth, inputting a sound signal to 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, and may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may also be provided with three, four, or more microphones 170C to enable collection of sound signals, noise reduction, identification of sound sources, directional recording functions, etc.
The earphone interface 170D is used to connect a wired earphone. The earphone interface 170D may be a USB interface 130 or a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, a american cellular telecommunications industry association (cellular telecommunications industry association of the USA, CTIA) standard interface.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback. For example, touch operations acting on different applications (e.g., photographing, audio playing, etc.) may correspond to different vibration feedback effects. The motor 191 may also correspond to different vibration feedback effects by touching different areas of the display screen 194. Different application scenarios (such as time reminding, receiving information, alarm clock, game, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect may also support customization.
The indicator 192 may be an indicator light, may be used to indicate a state of charge, a change in charge, a message indicating a missed call, a notification, etc.
The SIM card interface 195 is used to connect a SIM card. The SIM card may be inserted into the SIM card interface 195, or removed from the SIM card interface 195 to enable contact and separation with the electronic device 100. 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 Nano SIM cards, micro SIM cards, and the like. The same SIM card interface 195 may be used to insert multiple cards simultaneously. 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 external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as communication and data communication. In some embodiments, the electronic device 100 employs esims, i.e.: 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 external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the CPU110 through the external memory interface 120 to realize a data storage function. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer executable program code including instructions. The CPU110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an application program (such as a sound playing function, an image playing function, etc.) required for at least one function of the operating system, etc. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on. 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 (universal flash storage, UFS), and the like.
Referring to fig. 2, a software structure diagram of an electronic device according to an embodiment of the present application is shown. The operating system in the electronic device may be an Android system, a microsoft Windows system (Windows), an apple mobile operating system (iOS) or a hong system (Harmony OS), etc. Here, an operation system of an electronic device will be described as an example of a hong system.
In some embodiments, the hong-and-Monte-Care system may be divided into four layers, including a kernel layer, a system services layer, a framework layer, and an application layer, with the layers communicating via software interfaces.
As shown in fig. 2, the kernel layer includes a kernel abstraction layer (Kernel Abstract Layer, KAL) and a driver subsystem. The KAL comprises a plurality of kernels, such as a Kernel Linux Kernel of a Linux system, a Kernel Liteos of a lightweight Internet of things system and the like. The drive subsystem may then include a hardware drive framework (Hardware Driver Foundation, HDF). The hardware driver framework can provide unified peripheral access capability and driver development and management framework. The kernel layer of the multi-kernel can select corresponding kernels for processing according to the requirements of the system.
The system service layer is a core capability set of the hong Monte system, and provides service for application programs through the framework layer. The layer may include a set of system basic capability subsystems, a set of base software service subsystems, a set of enhanced software service subsystems, and a set of hardware service subsystems.
The system basic capability subsystem set provides basic capabilities for running, scheduling, migrating, etc. operations of distributed applications on devices of the hong system. Subsystems such as distributed soft buses, distributed data management, distributed task scheduling, ark multi-lingual runtime, public base library, multi-modal input, graphics, security, artificial intelligence (Artificial Intelligence, AI), user program frameworks, etc. may be included. The system class library of the multi-language running time and the foundation of the multi-language running time of the C or C++ or JavaScript (JS) is provided, and the running time can also be provided for Java programs (namely application programs or parts developed in the framework layer using Java language) which are statically built by using a ark compiler.
The basic set of software services subsystems provides common, generic software services for the hong system. Subsystems such as event notification, telephony, multimedia, design For X (DFX), MSDP & DV, etc. may be included.
The enhanced software services subsystem set provides differentiated capability enhanced software services for different devices for the hong Monte System. May include smart screen proprietary services, wearable proprietary services, internet of things (Internet of Things, ioT) proprietary services subsystem components.
The hardware service subsystem set provides hardware services for the hong system. Subsystems such as location services, biometric identification, wearable proprietary hardware services, ioT proprietary hardware services, and the like may be included.
The framework layer provides Java, C, C++, JS and other multi-language User program frameworks and capability (Abilitys) frameworks for the HongMong system application development, two kinds of User Interface (UI) frameworks (comprising Java UI frameworks applicable to Java languages and JS UI frameworks applicable to JS languages) and multi-language framework application program interfaces (Application Programming Interface, APIs) with various software and hardware services open to the outside. The APIs supported by the hong system devices will also vary depending on the degree of componentization clipping of the system.
The application layer includes system applications and third party applications (or referred to as extension applications). The system applications may include applications installed by default for electronic devices such as desktops, control boxes, settings, telephones, and the like. The extended application may be an application designed by the manufacturer of the electronic device, such as an application program for an electronic device manager, a switch migration, a note, weather, etc. While third party non-system applications may be developed by other vendors, applications may be run in hong-and-Monte systems, such as gaming, navigation, social or shopping applications.
Providing the ability to run tasks in the background and unified data access abstraction. The PA primarily provides support for the FA, for example, as a background service providing computing power, or as a data repository providing data access capability. The application developed based on the FA or the PA can realize specific service functions, support cross-device scheduling and distribution, and provide consistent and efficient application experience for users.
Hardware interaction and resource sharing can be realized among a plurality of electronic devices running the buddha system through a distributed soft bus, distributed device virtualization, distributed data management and distributed task scheduling.
Operating systems generally fall into two states: the operating system is provided with an operating system application executed in the kernel mode and a common application executed in the user mode, and the user mode application has lower execution authority than the kernel mode application. In general, a kernel mode application can access all hardware resources in an electronic device, such as an internal memory, an external memory card, a network card and the like, and the user mode application has limited accessible hardware resources, so that when the user mode application performs operations such as data transmission, data storage or data reading, the user mode application needs to be trapped into a kernel mode (i.e. call a computer program in the kernel) by a system calling mode and an interrupt signal generating mode, thereby realizing corresponding operations.
An MMU (memory management unit ) 111 (shown in fig. 1) is provided between the CPU110 and the internal memory 121 of the general electronic device and the bus of the external memory interface 120. When the CPU110 needs to access the internal memory 121 (i.e., the memory described above), a virtual address may be provided, and the MMU may map the virtual address to a physical address, thereby enabling the CPU110 to read data from the internal memory 121 or write data to the internal memory 121 based on the physical address.
A virtual address is an address in a virtual address space that an operating system in an electronic device can recognize or generate, the size range of which can be determined by the number of bits of the operating system running in CPU 110. For example, if the operating system running in CPU110 is 32 bits, the virtual address is also 32 bits, and its address range may be 0-0xFFFFFFFF (4 GB); if the operating system running in CPU110 is 64 bits, the virtual address is also 64 bits, and its address space may be 0-0xFFFFFFFFFFFFFFFF (16 EB).
The virtual address may be divided into a plurality of virtual address spaces according to actual needs, such as a user-state virtual address space and a kernel-state virtual address space. The user-state virtual address space may be accessed by user-state applications (such as read, write, open, close, or draw) and kernel-state applications (such as process management, storage management, file management, or device management), and the kernel-state virtual address space may be accessed only by the kernel-state applications at runtime. For example, the address range of the virtual address space is [0x00000000,0xFFFFFFFF ], the address range of the user state virtual address space may be [ 0x000000000000, 0x80000000 ] (i.e., 0 GB-2 GB), and the address range of the kernel state virtual address space may be [0x80000000-0xFFFFFFFF ] (i.e., 2 GB-4 GB).
The physical address may be an address in an address space actually possessed by a hardware storage device such as the internal memory 121. The address space of the physical address may be smaller than the address space of the virtual address, such as 256MB when the size of the address space of the virtual address may be 4 GB.
As shown in fig. 3, in the process of data transmission by the application of the transmitting end and the application of the receiving end based on the traditional network communication technology, the CPU of the transmitting end needs to copy the data to be transmitted of the application into the buffer space of the TCP/IP protocol stack of the kernel mode, and then copy the data to be transmitted into the buffer space of the driving layer and the buffer space of the traditional network card in sequence, and finally the traditional network card of the transmitting end can transmit the data to the traditional network card of the receiving end based on the pre-established communication link, in the process, a large amount of CPU resources are required to be occupied to copy the data, and conversion between the user mode and the kernel mode is required, so that the time delay in the data transmission process is long.
Compared with the traditional network communication technology, the RDMA (Remote Direct Memory Access) technology can bypass a protocol stack of an operating system and reduce the copying times of data, thereby occupying less CPU resources and reducing time delay. The receiving end and the sending end can be electronic equipment such as a server, a client, a mobile phone terminal and the like, and the electronic equipment at least comprises an Ethernet network card (namely an RDMA network card) with a remote direct memory access function and a CPU, wherein the RDMA network card is mainly used for executing data reading operation and/or data writing operation in the data transmission process.
MMUs typically manage virtual and physical address spaces by dividing them into a plurality of virtual pages having a fixed space size and a plurality of physical pages having a fixed space size based on a page management mechanism, and the number of virtual addresses in the virtual pages is the same as the number of physical addresses in the physical pages, and the fixed space size may be 4kb, 16kb, 64kb, or the like, for example. Each virtual page is provided with a corresponding virtual page number, each virtual page comprises at least one virtual address, each virtual address corresponds to the virtual page number of the corresponding virtual page and an intra-page offset in the corresponding virtual page, the intra-page offset being the displacement of the virtual address relative to the virtual base address in the corresponding virtual page. Each physical page is provided with a corresponding physical page number, each physical page comprises at least one physical address, and each physical address corresponds to the physical page number of the physical page to which the physical address belongs.
As shown in fig. 4, before an application in an electronic device performs data transfer based on RDMA communication, it needs to apply a physical address space that can be used to store data. Specifically, after receiving the memory allocation request of the application, the processor determines a virtual address space corresponding to the application, and the MMU may map the virtual address space of the application to a physical address space, and create and fill in a local memory a page table of a mapping relationship between a virtual address in the virtual address space of the application and a physical address in the corresponding physical address space. After the application is successful, the application may send a registration request to the RDMA network card, so that the RDMA network card stores a page table for indicating a mapping relationship between a virtual address space and a physical address space of the application into a network card memory of the RDMA network card.
Referring to fig. 5, a mapping relationship among a virtual address space, a page table and a physical address space is shown. Wherein the page table includes a plurality of page table entries, the number of page table entries being the same as the number of virtual pages in the virtual address space, each page table entry being for indicating a mapping relationship between a virtual page number of a virtual page in the virtual address space and a physical page number of a physical page in the physical address space. As shown in fig. 5, it is assumed that 6 virtual pages in the virtual address space are mapped to page numbers of 6 physical pages in the physical address space, virtual page numbers of the 6 virtual pages are 0 to 5, and physical page numbers of physical pages corresponding to the virtual page numbers of each virtual page are recorded in the page table. After receiving the virtual address sent by the application sending end, the RDMA network card can determine the physical page number of the physical page corresponding to the virtual page number of the virtual page to which the virtual address belongs through the page table, and can determine the physical address corresponding to the virtual address according to the physical base address in the physical page and the intra-page offset of the virtual address in the virtual page to which the virtual address belongs.
Existing RDMA communication technologies generally include two communication modes, the first being a messaging mode of operation, such as send and receive operations, and the second being a memory mode of operation, such as RDMA Read and RDMA Write operations. Based on a message type operation mode, the second electronic device triggers a receive operation instruction to determine a physical address used for receiving data, an application of the first electronic device can buffer data to be sent to a pre-allocated physical address space and send the send operation instruction to a first RDMA network card in the first electronic device, the first RDMA network card buffers the data to be sent to an RDMA memory and encapsulates the data to be sent to generate a data packet, so that the data packet is transmitted to a second RDMA network card in the second electronic device through a communication link pre-created by the first electronic device and the second electronic device, and the second RDMA network card can store the data in the data packet to the physical address used for receiving the data after unpacking the data packet.
Based on the memory type operation mode, the second electronic device can provide the virtual address space accessible in the second electronic device and the access authority thereof for the first electronic device through the pre-created communication link. The application in the first electronic device may send an RDMA Read operation instruction to a first RDMA network card in the first electronic device, where the RDMA Read operation instruction includes a virtual address in the second electronic device where data to be Read is stored and a virtual address in the first electronic device where the data is received, the first RDMA network card may transmit a Read request packet corresponding to the RDMA Read operation instruction to a second RDMA network card in the second electronic device through a communication link, the second RDMA network card may determine a physical address corresponding to the virtual address where the data to be Read is stored according to a page table stored in advance, encapsulate the data to be Read into a data packet, and then transmit the data to the first RDMA network card through a communication link, where the first RDMA network card may write the data to be Read into the physical address in the first electronic device corresponding to the virtual address where the data is received by querying the page table stored in advance.
The application in the first electronic device may send an RDMA Write operation instruction to a first RDMA network card in the first electronic device, where the Write operation instruction includes a virtual address for receiving data and a data size in the second electronic device, the first RDMA network card obtains data to be sent from a physical address space corresponding to the application, caches the data to be sent and the virtual address for receiving data in the second electronic device into an RDMA memory of the first RDMA network card, encapsulates the RDMA memory into a data packet, and transmits the data packet to the second RDMA network card through a communication link created in advance, and the second RDMA network card may decapsulate the data packet and store the data in the data packet into the physical address corresponding to the virtual address for receiving data in the second electronic device by querying a page table stored in advance.
It should be noted that, before the data transmission, the first electronic device and the second electronic device may establish a communication link through a Socket connection or a connection manager (Connection Manager, CM) connection, and exchange information required for some RDMA communication through the communication link, for example: the first electronic device may obtain a virtual address of a virtual address space in the second electronic device, and the second electronic device may obtain a virtual address of the virtual address space in the first electronic device.
In the process of data transmission based on the conventional RDMA communication technology, the physical address in the physical address space corresponding to the application and the mapping relation between the virtual address space and the physical address space of the application are fixed. When a plurality of applications run simultaneously on the electronic device, a corresponding physical address space needs to be allocated for each application, but storage resources of a memory are limited, during a data transmission process, each application can only access the corresponding pre-allocated physical address space, and the size of the physical address space corresponding to each application cannot be changed according to an actually required memory space, so that the physical address space of some applications may not meet the actual memory requirement of the application, and the physical address space of some applications may be larger than the actual memory requirement of the application, so that part of the physical address space is not utilized.
In the prior art, there is a method for expanding a physical address space corresponding to an application, and one method is: when the application detects that the current communication memory can not meet the memory space required by the communication data in the current service scene, the mapping relation between the current physical address space and the disconnected mapping relation can be selected, the new physical address space is re-registered to be matched with the memory space required by the communication data in the current service scene, and although the method can dynamically adjust the memory space corresponding to the application according to the actual service requirement, the mode of disconnecting the mapping relation between the current physical address space and re-registering is complex and time-consuming. The other method is as follows: the application can register a plurality of physical address spaces with different fixed space sizes to the RDMA system according to the memory spaces required by communication data in different service scenes, but only one physical address space is used in each data transmission process, and other unused physical address spaces are in an idle state, so that more memory resources are wasted.
Therefore, in order to solve the problem of unreasonable memory resource allocation in the existing RDMA technology, the application provides a memory management method, an electronic device, a chip system and a readable storage medium, which dynamically adjusts an effective memory space with data read-write permission in a corresponding physical address space according to the data volume to be stored by a target application, releases a first physical address unit which is not utilized in the effective memory space when the effective memory space is larger than the data volume to be stored, and expands the effective memory space when the effective memory space is smaller than the data volume to be stored, so that the effective memory space meets memory requirements applied to different service scenes, and corresponding memory resources are reasonably allocated for the application.
The technical scheme of the present application is described in detail below with specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 6 is a flowchart of a memory management method provided in the embodiment of the present application, which mainly relates to a process of dynamically adjusting an effective memory space in a physical address space associated with a target application in a process of data transmission based on RDMA technology by the target application in the electronic device. The memory management method can be applied to electronic equipment with RDMA communication function, wherein the electronic equipment comprises an internal memory, a processor and an RDMA network card. An exemplary memory management method provided in the present application is described below with reference to fig. 6.
S601, determining the data quantity to be stored by a target application and an effective memory space in a physical address space associated with the target application, wherein the effective memory space comprises N memory spaces indicated by first physical address units, each first physical address unit comprises at least one physical address with data read-write permission, and N is an integer greater than or equal to 0.
It should be noted that, after the target application installed in the electronic device registers the corresponding physical address space, the target application generates data to be stored in a process of performing subsequent data transmission with applications installed on other electronic devices based on the RDMA communication operation. In the first data transmission process after the target application registers the physical address space, the electronic device can determine whether to adjust the effective memory space pre-registered by the target application based on the relative size between the effective memory space in the pre-registered physical address space and the data to be stored, so as to cache the data to be stored by the target application in the effective memory space associated with the effective memory space.
The effective memory space is a memory space indicated by all first physical address units in the physical address space, one physical page which is provided with data writing authority and data reading authority simultaneously is arranged in the memory space of the corresponding internal memory of one first physical address unit, and one first physical address unit comprises one or more physical addresses with data writing authority and data reading authority.
In one example, if there is no effective memory space in the physical address space pre-registered by the target application, when performing the first data transmission based on the physical address space, the effective memory space needs to be allocated to the target application, that is, the effective memory space in the physical address space pre-registered with the target application is extended, so that the effective memory space meets the memory space required by the first data transmission. For example, the physical address space pre-registered by the target application may include one or more physical address units having a fixed size, where the physical address unit is a physical page provided with data writing authority but data reading authority, and the physical address unit includes at least one physical address not provided with data writing authority but data reading authority. For example, as shown in fig. 7, the number of second physical address units in the pre-registered physical address space is 1, and the space size of the second physical address units may be 4kb, all virtual address units in the virtual address space of the target application may be mapped to the second physical address units.
In another example, the target application pre-registered physical address space has an effective memory space with a fixed space size, for example, the target application pre-registered physical address space includes a first physical address unit, and the first physical address unit corresponds to a virtual address unit in the virtual address space of the target application; or the physical address unit pre-registered by the target application comprises a first physical address unit and a second physical address unit, wherein the first physical address unit corresponds to one of the virtual address units in the virtual address space of the target application, and the rest of the virtual address units correspond to the second physical address unit. When the first data transmission is performed based on the physical address space, whether the pre-registered effective memory space needs to be adjusted or not is determined according to the relative size between the memory space required by the first data transmission and the pre-registered effective memory space, namely, if the pre-registered effective memory space is larger than the memory space required by the first data transmission, the first physical address unit utilized in the pre-registered effective memory space is recycled and expanded, and if the pre-registered effective memory space is smaller than the memory space required by the first data transmission, the pre-registered effective memory space is expanded.
It should be further noted that, in a subsequent data transmission process after the first data transmission, the physical address space associated with the target application may be an effective memory space after the effective memory space in the physical address space is adjusted in the previous data transmission process. For example, if the electronic device performs the first adjustment on the pre-registered effective memory space in the first data transmission process, in the second data transmission after the first data transmission, the effective memory space in the physical address space associated with the target application is the first adjusted effective memory space, and the electronic device needs to determine whether the first adjusted effective memory space meets the memory space required by the second data transmission, so as to determine whether to adjust the effective memory space again.
In this embodiment of the present application, if the target application is an application installed on the first electronic device, the data to be stored by the target application may be data of the target application sent by the first electronic device to an application on the second electronic device based on an RDMA communication operation, and the RDMA communication operation may be a send operation or an RDMA Write operation, for example. The data to be stored may also be data of an application on the second electronic device received by the first electronic device based on an RDMA communication operation, which may be a receive operation or an RDMA Read operation, for example.
S602, if the data volume is larger than the effective memory space, expanding the effective memory space according to a first difference value between the data volume and the effective memory space.
If the data amount to be stored by the target application is larger than the effective memory space of the target application, the effective memory space can be expanded according to a first difference value between the data amount and the effective memory space. Specifically, M first physical address units may be allocated to the target application from memory spaces that are not registered by other applications in the internal memory according to the first difference value, where M is an integer greater than or equal to 1, and memory spaces of the M first physical address units are greater than or equal to the first difference value, where 1 is less than or equal to m+n < M, that is, the extended effective memory space satisfies a memory space required by the data volume to be stored by the target application. In addition, after the number of the extended first physical address units is determined according to the first difference value, a mapping table between a virtual address space and a physical address space of the target application is updated, and M virtual address units corresponding to the second physical address unit in the M virtual address units are remapped to M first physical address units.
Exemplary, reference is made to the schematic mapping relationship between virtual address space and physical address space of the target application shown in fig. 8. Assuming that the data size to be stored by the target application is 15kb, the physical address space of the target application includes 3 first physical address units, each first physical address unit corresponds to one virtual address unit of the target application, other M-3 virtual address units in the virtual address space of the target application correspond to the second physical address unit, and the sizes of the first physical address unit, the virtual address unit and the second physical address unit are all 4kb, that is, the effective memory space of the target application is 12kb, it is determined that the data size stored by the target application is greater than the effective memory space and the first difference between the two is 3kb, and correspondingly, as shown in fig. 8, the effective memory space of the target application can be expanded by 1 first physical address unit, that is, a physical page (that is, page in fig. 8) is allocated for the target application from the memory space which is not registered by other applications, and the physical page is set as the first physical address unit with data writing authority and data reading authority, so that the size of the effective memory space after the target application expansion is 16kb is satisfied, thereby the memory space of the target application needs to store the data size. Accordingly, the mapping table needs to be updated to remap one of the other M-3 virtual address units corresponding to the second physical address unit in the virtual address space of the target application to the extended first physical address unit.
And S603, if the data volume is smaller than the effective memory space, reducing the effective memory space according to a second difference value between the effective memory space and the data volume.
If the amount of data to be stored by the target application is smaller than the effective memory space of the target application, the effective memory space can be reduced according to a second difference between the effective memory space and the amount of data. Specifically, assuming that the effective memory space includes N first physical address units corresponding to N virtual address units in M virtual address units of the target application, when the second difference value is greater than or equal to a preset threshold value, the preset threshold value is greater than 0, the effective memory space is reduced by N first physical address units, where N is greater than or equal to 1, and the memory space of N first physical address units is less than or equal to the second difference value. In addition, after the number of the first physical address units to be reduced is determined according to the second difference value, a mapping table between the virtual address space and the physical address space of the target application is updated, and N virtual address units in the N virtual address units are remapped to the second physical address unit.
For example, the preset threshold may be a size of the memory space indicated by the first physical address unit.
Exemplary, reference is made to the schematic mapping between virtual address space and physical address space of the application shown in FIG. 9. Assuming that the sizes of the first physical address unit, the virtual address unit and the second physical address unit are all 4kb, the preset threshold is 4kb, the data size to be stored by the target application is 8kb, the physical address space of the target application comprises 3 first physical address units, namely, the effective memory space of the target application is 12kb, each first physical address unit corresponds to one virtual address unit of the target application, other M-3 virtual address units in the virtual address space of the target application correspond to the second physical address unit, the effective memory space is larger than the data size stored by the target application, and the second difference value between the two is 4kb and is equal to the preset threshold. As shown in fig. 9, the effective memory space of the target application may be reduced by 1 first physical address unit, and the first physical address unit is released, that is, the mapping relationship between the first physical address unit and the virtual address unit in the target application is released, where the released first physical address unit is a physical page not provided with the read-write permission, and in addition, the mapping table needs to be updated to remap the virtual address unit corresponding to the first physical address unit to the second physical memory unit of the target application.
It can be appreciated that if the amount of data to be stored by the target application is smaller than the effective memory space of the target application, and the second difference between the effective memory space and the amount of data is greater than 0 and smaller than the preset threshold, the size of the effective memory space of the target application does not need to be changed.
In this embodiment of the present application, based on different types of RDMA communication operations, the electronic device may enable, by using two different trigger modes, that is, an active trigger mode and a passive trigger mode, a processor in the electronic device to expand or reduce an effective memory space in a physical address space associated with a target application according to a data amount to be stored by the installed target application and a difference value between the effective memory spaces of the target application.
In one example, assume that a first electronic device includes a first processor and a first RDMA network card, a first target application is installed in the first electronic device, a second electronic device includes a second processor and a second RDMA network card, a second target application is installed in the second electronic device, and the first electronic device and the second electronic device may perform data transmission based on RDMA technology. These two different triggering modes are exemplarily described below with reference to the interaction diagrams shown in fig. 10 and 11.
Mode one, the active trigger mode.
In the first mode, when the first target application in the first electronic device writes the data to be stored into the physical address space associated with the first target application, the first processor can be enabled to expand or reduce the effective memory space in the first physical address space in an active triggering mode. Correspondingly, the data to be stored by the first target application is: based on the first type of RDMA communication operation, the first electronic device sends data of the first target application to the second RDMA network card of the second electronic device through the first RDMA network card, and the first type of RDMA communication operation can be a send operation or an RDMA Write operation.
By way of example and not limitation, reference is made to the interaction diagram between the target application, the processor, and the RDMA network card shown in fig. 10, where the first processor includes a virtual memory management unit and a physical memory management unit, where the virtual memory management unit operates in a user mode and is configured to determine a virtual address space corresponding to the application when a memory allocation request of the application is received. The physical memory management unit operates in a kernel state, is used for distributing a corresponding physical address space for the application, and dynamically expands and reduces the effective memory space in the physical address space of the application in an active triggering mode. The virtual memory management unit can be trapped into a kernel mode in a system call mode, so that the physical memory management module allocates a corresponding physical address space for the application.
As shown in fig. 10, the active triggering mode includes the following steps:
s1001, the first target application sends a query request to the physical memory management unit through the virtual memory management unit.
The first target application may send a query request to the physical memory management unit through the virtual memory management unit before storing the data to be stored in the corresponding physical address space. The first target application may send a query request to the virtual memory management unit by calling a query API (ApplicationProgramming Interface, application program interface) interface, and the virtual memory management unit may enable the first target application to sink into a physical memory management unit in a kernel mode by using an ioctl (input/output control) system call function, so that the physical memory management unit receives the query request sent by the first target application.
S1002, the physical memory management unit determines an effective memory space in a physical address space associated with the first target application.
After receiving the query request, the physical memory management unit may determine an effective memory space in the physical address space of the first target application according to the mapping table, and transmit the space size of the effective memory space to the first target application through the virtual memory management unit.
When the first target application performs first data transmission, the mapping table is an initial mapping table pre-registered by the first target application. In the subsequent data transmission process, the mapping table may be an updated mapping table corresponding to the adjusted physical address space in the last data transmission.
S1003, the first target application determines whether the amount of data to be stored is greater than the effective memory space.
The first target application may determine, according to the obtained size of the effective memory space, whether the amount of data to be stored is greater than the effective memory space. Specifically, if the amount of data to be stored is smaller than the effective memory space, a reduction request may be sent to the physical memory management unit through the virtual memory management unit based on the memory reduction API interface, where the reduction request may include a second difference between the effective memory space and the amount of data to be stored; if the amount of data to be stored is greater than the effective memory space, an expansion request can be sent to the physical memory management unit through the virtual memory management unit based on the memory expansion API interface, and the expansion request can include a first difference value between the amount of data to be stored and the effective memory space, so as to actively trigger the physical memory management unit to expand or reduce the effective memory space.
S1004, the physical memory management unit expands the effective memory space according to a first difference value between the data volume to be stored and the effective memory space, or reduces the effective memory space according to a second difference value between the effective memory space and the data volume to be stored.
Upon receiving the expansion request and the contraction request, the physical memory management unit may expand and contract the effective memory space of the first target application according to the method provided in steps S602 and S603 in the above embodiment.
Optionally, after the physical memory management unit expands and reduces the effective memory space of the first target application, the active triggering manner further includes the following steps:
in S1005, the physical memory management unit may send a signal of successful expansion or successful contraction to the first target application through the virtual memory management unit, so that the first target application may store the data to be stored into the updated physical address space.
S1006, the physical memory management unit may further send an instruction for updating the mapping table to the first RDMA network card, so that the first RDMA network card stores the updated mapping table corresponding to the first target application in the network card memory.
And a mode II, namely a passive triggering mode.
In the second mode, when the first RDMA network card of the first electronic device receives the data of the second target application sent by the second RDMA network card of the second electronic device, the first processor may expand or reduce the effective memory space in the first physical address space by a passive triggering mode after receiving the interrupt information of the first RDMA network card, and then the corresponding data to be stored by the first target application is: based on the second RDMA communication operation, the first electronic device receives data of a second target application sent by a second RDMA network card of the second electronic device through the first RDMA network card. The second type of RDMA communication operation may be, for example, a receive operation or an RDMA Read operation.
In the second mode, when the first electronic device executes the second type of RDMA communication operation, the first target application may send an RDMA communication operation instruction to the first RDMA network card on the first electronic device, where the RDMA communication operation instruction includes a virtual base address corresponding to a physical base address in a physical address space of the obtained data, the first RDMA network card obtains the data sent by the second target application on the second electronic device and then caches the data in the first RDMA network card, and the first RDMA network card may determine the physical base address corresponding to the virtual base address according to a mapping table between a virtual address space and the physical address space of the pre-stored first target application, and store the obtained data in an effective memory space in the physical address space of the first target application with the physical base address as a starting address. Therefore, after the first RDMA network card acquires the data of the second target application sent by the second RDMA network card, it needs to confirm whether the memory address space of the first target application meets the data amount to be stored, and when the memory address space is not met or remains, the memory address space of the first target application is adjusted in a passive triggering mode.
By way of example and not limitation, referring to the interaction diagram between the first electronic device and the second electronic device shown in fig. 11, the passive triggering method comprises the steps of:
s1101, the first RDMA network card determines the data size to be stored by the first target application.
The method comprises the steps that a first RDMA network card of a first electronic device receives data of a second target application sent by a second RDMA network card of a second electronic device, wherein the data quantity to be stored by the first target application is the data quantity of the second target application.
S1102, the first RDMA network card determines whether an amount of data to be stored by the first target application is greater than an effective memory space associated with the first target application.
Specifically, the first RDMA network card may determine, according to a mapping table stored in advance and corresponding to the first target application, an effective memory space in a physical address space associated with the first target application, and further determine whether the amount of data to be stored is greater than the effective memory space. If the amount of data to be stored is greater than the effective memory space, the first RDMA network card may send first interrupt information to a virtual memory management unit in the first processor, where the first interrupt information may include a first difference between the amount of data to be stored and the effective memory space; if the amount of data to be stored by the first target application is smaller than the effective memory space, the RDMA network card may send second interrupt information to the processor, where the second interrupt information may include a second difference between the effective memory space and the amount of data to be stored, so that the physical memory management unit is triggered by a passive trigger manner to adjust the effective memory space of the first target application according to the first difference or the second difference.
S1103, the physical memory management unit expands the effective memory space according to a first difference between the amount of data to be stored and the effective memory space, or reduces the effective memory space according to a second difference between the effective memory space and the amount of data to be stored.
The physical memory management unit may expand the effective memory space according to the first difference after receiving the first interrupt signal sent by the first RDMA network card, or may reduce the effective memory space according to the second difference after receiving the second interrupt signal sent by the first RDMA network card.
The method for expanding and shrinking the effective memory space of the first target application may refer to the specific description of steps S602 and S603 in the above method embodiment, which is not repeated here.
Optionally, after the physical memory management unit expands and reduces the effective memory space of the first target application, the passive triggering manner further includes the following steps:
s1104, the physical memory management unit may send an instruction to update the mapping table to the first RDMA network card, so that the first RDMA network card stores the updated mapping table corresponding to the first target application in the network card memory.
Based on the above embodiment, the present application further provides a method for registering a physical address space. The specific process of registering a physical address space before data transmission based on RDMA communication technology by a target application installed in an electronic device is described in the following by way of example with reference to an interaction diagram of the target application, a processor and an RDMA network card in the electronic device shown in fig. 12.
As shown in fig. 12, the registration method of the physical address space of the target application includes the steps of:
s1201, the target application sends a memory allocation request to the virtual memory management unit. For example, the target application may invoke the memory application API interface to send a memory allocation request to the virtual memory management unit.
S1202, after receiving a memory allocation request sent by a target application, the virtual memory management unit allocates a corresponding virtual address space for the target application.
It should be noted that, in one example, when the virtual memory management unit receives a memory allocation request sent by each target application in the electronic device, a virtual address space with the same space size may be allocated to each target application, and the virtual addresses in the virtual address space of each target application are the same. In another example, the target application may determine the size of the virtual address space required by the runtime, and after the target application may send a memory allocation request including the required virtual address space size information to the virtual memory management unit, the virtual memory unit may allocate, for each application, a virtual address space having the same space size as the required virtual address space size from the user-state virtual address space of the first electronic device according to the required virtual address space size of each target application.
In this embodiment of the present application, the virtual address space of the target application includes at least one virtual address unit, where the virtual address unit is a virtual page having a preset space size and into which the virtual address space is divided based on the paging management mechanism, and each virtual address unit includes at least one virtual address.
S1203, the virtual memory management unit may be trapped in a kernel mode by a system call manner, so that the physical memory management unit allocates a physical address space for the target application.
In one example, the physical address space allocated by the memory management unit for the target application may include a second physical address unit, where the second physical address unit is a physical page configured to have data read permission and not have data write permission, and each second physical address unit includes one or more physical addresses having data write permission, and the number of physical addresses in the second physical address unit is the same as the number of virtual addresses in the virtual address unit.
For example, if the size of the physical address space in the internal memory of the electronic device is 2GB, and the size of the virtual address space of the target application is 4GB, the physical address space can be equally divided into 524288 physical pages with a size of 4kb based on the paging management mechanism, and correspondingly, the virtual address space can be equally divided into 1049576 virtual pages with a size of 4 kb. Referring to the schematic diagram of the mapping relationship between the virtual address space of the target application and the second physical address unit shown in fig. 7, all the virtual address units in the virtual address space of the target application may be mapped to one second physical address unit.
In another example, the physical address space allocated by the memory management unit for the target application may include the second physical address unit and the smaller available memory space. The virtual address space of the target application comprises M virtual address units, the effective memory space comprises N first physical address units, N is an integer larger than or equal to 0, the N first physical address units are in one-to-one correspondence with the N virtual address units in the M virtual address units, wherein the first physical address units are physical pages set to have data reading permission and data writing permission, each first physical address unit comprises at least one physical address with data reading permission, namely, an RDMA network card can write data into the physical addresses in the first physical address units and can read pre-cached data in the physical addresses. For example, the number of the first physical address unit and the second physical address unit in the allocated physical address space may be 1, and the first physical address unit may be mapped to one of the virtual address units in the virtual address space of the target application, and the other virtual address units in the virtual address space of the target application may be mapped to the second physical address unit. Optionally, the number of physical addresses in the first physical address unit is the same as the number of physical addresses in the second physical address unit.
It may be understood that when the physical address space of the target application includes a second physical address unit that does not have the data writing authority, the processor and the RDMA network card may determine, according to whether the physical address in the physical address space corresponding to the target application has the data reading and writing authority in the mapping table, the size of the effective memory space in the physical address space of the target application, so as to expand and recover the memory space according to the data amount to be stored by the target application and the difference value between the sizes of the effective memory spaces in the subsequent data transmission process.
Further, after the physical memory management unit allocates the corresponding physical address space for the target application, an initial mapping table between the virtual address space and the physical address space needs to be created for the target application, and the initial mapping table is stored in the internal memory. The initial mapping table is used for indicating the mapping relation between the page number of each virtual address unit in the virtual address space and the page number of the physical address unit in the physical address space, and the read-write authority of the physical address unit.
And S1204, after the physical memory management unit allocates the corresponding physical address space for the target application, the physical memory management unit can send a successfully allocated signal to the target application through the virtual memory management unit.
S1205, the target application sends a registration request to the RDMA network card after receiving the successfully allocated signal.
Wherein the registration request contains the identification of the target application.
S1206, after receiving the registration request, the RDMA network card registers an initial mapping table between the physical address space and the virtual address space of the target application.
Specifically, the RDMA network card may initially map the memory space to be stored in the network card memory according to the identifier of the target application, so that the RDMA network card has the authority to read and write the data of the physical address in the physical address space of the target application.
Based on the memory management method provided by the application, the electronic device can allocate the second physical address unit without the data writing permission for the target application in advance, so that the subsequent data transmission process based on the RDMA communication technology can determine whether the effective memory space meets the memory space required by the data volume to be stored of the application according to the difference between the data volume to be stored of the target application and the effective memory space with the data reading and writing permission in the physical address space corresponding to the target application, and accordingly dynamically adjust the effective memory space of the target application, if the effective memory space does not meet the memory space required by the data volume to be stored, the effective memory space can be expanded according to the first difference between the data volume and the effective memory space, so that the expanded effective memory space meets the memory space required by the application, and if the effective memory space meets the memory space required by the data volume to be stored, the effective memory space can be reduced according to the second difference between the effective memory space and the data volume, thereby avoiding the partial unoccupied effective memory space to be released, and further improving the memory resource utilization rate of the memory for the target application.
Based on the memory management method provided in the above embodiment, the embodiment of the present application further provides the following:
embodiments of the present application provide a computer program product including a program that, when executed by an electronic device, causes the electronic device to implement the memory management method described in the foregoing embodiments.
The present embodiment provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the memory management method shown in the above embodiments.
The embodiment of the application provides a chip, which comprises a memory and a processor, wherein the processor executes a computer program stored in the memory to realize controlling the electronic device to execute the memory management method shown in each embodiment.
The integrated units described above, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable storage medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer memory, read-only memory (ROM), random access memory (random access memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/device and method may be implemented in other manners. For example, the apparatus/device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
In addition, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used merely to distinguish between descriptions and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.

Claims (17)

1. A memory management method applied to a first electronic device, the method comprising:
determining the data quantity to be stored by a target application and an effective memory space in a physical address space associated with the target application, wherein the effective memory space comprises N memory spaces indicated by first physical address units, each first physical address unit comprises at least one physical address with data read-write permission, and N is an integer greater than or equal to 0;
if the data volume is larger than the effective memory space, expanding the effective memory space according to a first difference value between the data volume and the effective memory space;
And if the data volume is smaller than the effective memory space, reducing the effective memory space according to a second difference value between the effective memory space and the data volume.
2. The method of claim 1, further comprising a second physical address unit in the physical address space, the second physical address unit comprising at least one physical address that does not have data write permission.
3. The method according to claim 2, wherein the method further comprises:
when a memory allocation request sent by the target application is received, allocating the second physical address unit for the target application;
and when receiving a registration request based on remote direct data access communication sent by the target application, registering an initial mapping table between the second physical address unit and a virtual address space of the target application.
4. A method according to claim 2 or 3, wherein the virtual address space of the target application comprises M virtual address units, each virtual address unit comprising at least one virtual address, M being an integer greater than or equal to 1;
the expanding the effective memory space according to a first difference between the data amount and the effective memory space includes:
Distributing M first physical address units for the target application according to the first difference value, wherein the memory space of the M first physical address units is larger than or equal to the first difference value, and m+N < M is more than or equal to 1;
and remapping M virtual address units corresponding to the second physical address units in the M virtual address units to M first physical address units.
5. The method of any one of claims 2 to 4, wherein the virtual address space of the target application includes M virtual address units, each virtual address unit including at least one virtual address, M being an integer greater than or equal to 1, the effective memory space including N of the first physical address units corresponding to N of the M virtual address units, 1N M;
the reducing the effective memory space according to a second difference between the effective memory space and the data volume includes:
and when the second difference value is greater than or equal to a preset threshold value, remapping N virtual address units corresponding to N first physical address units in the N virtual address units to the second physical address unit, wherein the memory space of the N first physical address units is smaller than or equal to the second difference value, and the preset threshold value is greater than 0, and N is less than or equal to 1.
6. The method according to any one of claims 1 to 5, wherein the target application is an application installed in the first electronic device.
7. The method according to any one of claims 1 to 6, wherein the amount of data to be stored is the amount of data of the target application or the amount of data of an application installed in a second electronic device received by the first electronic device.
8. An electronic device comprising a processor for running a computer program stored in a memory to implement the method of any one of claims 1 to 7.
9. An electronic device comprising a processor and a first remote direct data access network card;
the first remote direct data access network card is used for determining the data quantity to be stored by a target application and an effective memory space in a physical address space associated with the target application, the effective memory space comprises N memory spaces indicated by first physical address units, each first physical address unit comprises at least one physical address with data reading and writing authority, and N is an integer greater than or equal to 0;
If the data size is larger than the effective memory space, the first remote direct data access network card is further configured to send first interrupt information to the processor, where the first interrupt information includes a first difference value between the data size and the effective memory space, and the processor is configured to expand the effective memory space according to the first difference value;
and if the data volume is smaller than the effective memory space, the first remote direct data access network card is further configured to send second interrupt information to the processor, where the second interrupt information includes a second difference value between the effective memory space and the data volume, and the processor is configured to reduce the effective memory space according to the second difference value.
10. The electronic device of claim 9, further comprising a second physical address unit in the physical address space, the second physical address unit comprising at least one physical address that does not have data write permission.
11. The electronic device of claim 10, wherein the processor is further configured to:
when a memory allocation request sent by the target application is received, allocating the second physical address unit for the target application;
The first remote direct data access network card is further configured to:
and when receiving a registration request based on remote direct data access communication sent by the target application, registering an initial mapping table between the second physical address unit and a virtual address space of the target application.
12. The electronic device of claim 10 or 11, wherein the virtual address space of the target application comprises M virtual address units, each virtual address unit comprising at least one virtual address, M being an integer greater than or equal to 1;
the processor is further configured to:
distributing M first physical address units for the target application according to the first difference value, wherein the memory space of the M first physical address units is larger than or equal to the first difference value, and m+N < M is more than or equal to 1;
and remapping M virtual address units corresponding to the second physical address units in the M virtual address units to M first physical address units.
13. The electronic device of any one of claims 10 to 12, wherein the virtual address space of the target application includes M virtual address units, each virtual address unit including at least one virtual address, M being an integer greater than or equal to 1, the effective memory space including N of the first physical address units corresponding to N of the M virtual address units, 1N M;
The processor is further configured to:
when the second difference value is greater than or equal to a preset threshold value, remapping N virtual address units corresponding to N first physical address units in the N virtual address units to the second physical address unit, wherein the memory space of the N first physical address units is smaller than or equal to the second difference value, and the preset threshold value is greater than 0, and N is less than or equal to 1;
and remapping N virtual address units in the N virtual address units to the second physical address unit.
14. The electronic device of any one of claims 9 to 13, wherein the target application is an application installed in the electronic device.
15. The electronic device of any of claims 9-14, wherein the amount of data to be stored is an amount of data sent by a second remote direct data access network card received by the first remote direct data access network card.
16. A chip system comprising a processor executing a computer program stored in a memory to implement the method of any one of claims 1 to 7.
17. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program which, when executed by a processor, implements the method according to any of claims 1 to 7.
CN202211033616.XA 2022-08-26 2022-08-26 Memory management method, electronic device, chip system and readable storage medium Pending CN117667369A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202211033616.XA CN117667369A (en) 2022-08-26 2022-08-26 Memory management method, electronic device, chip system and readable storage medium
PCT/CN2023/105048 WO2024041219A1 (en) 2022-08-26 2023-06-30 Memory management method, electronic device, chip system, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211033616.XA CN117667369A (en) 2022-08-26 2022-08-26 Memory management method, electronic device, chip system and readable storage medium

Publications (1)

Publication Number Publication Date
CN117667369A true CN117667369A (en) 2024-03-08

Family

ID=90012425

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211033616.XA Pending CN117667369A (en) 2022-08-26 2022-08-26 Memory management method, electronic device, chip system and readable storage medium

Country Status (2)

Country Link
CN (1) CN117667369A (en)
WO (1) WO2024041219A1 (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7702826B2 (en) * 2005-12-28 2010-04-20 Intel Corporation Method and apparatus by utilizing platform support for direct memory access remapping by remote DMA (“RDMA”)-capable devices
CN109445945B (en) * 2018-10-29 2023-09-19 努比亚技术有限公司 Memory allocation method of application program, mobile terminal, server and storage medium
CN111414248B (en) * 2019-01-04 2023-03-21 阿里巴巴集团控股有限公司 Memory management method and device and computing equipment
CN110515727A (en) * 2019-08-16 2019-11-29 苏州浪潮智能科技有限公司 A kind of the memory headroom operating method and relevant apparatus of FPGA
CN111221758B (en) * 2019-09-30 2023-06-27 华为技术有限公司 Method and computer device for processing remote direct memory access request

Also Published As

Publication number Publication date
WO2024041219A1 (en) 2024-02-29

Similar Documents

Publication Publication Date Title
CN113722087B (en) Virtual memory management method and electronic equipment
WO2021104259A1 (en) Method and terminal for data sharing between fast application and native application
CN114461375B (en) Memory resource management method and electronic equipment
CN111382087A (en) Memory management method and electronic equipment
CN110413383B (en) Event processing method, device, terminal and storage medium
CN115858046B (en) Method for preloading memory pages, electronic equipment and chip system
WO2023051094A1 (en) Memory recovery method and apparatus, electronic device, and readable storage medium
CN115080505B (en) Data migration method, terminal, storage medium, and program product
CN115729684B (en) Input/output request processing method and electronic equipment
US20230342301A1 (en) Method for Determining Physical Address and Chip System
WO2024041219A1 (en) Memory management method, electronic device, chip system, and readable storage medium
CN112783418B (en) Method for storing application program data and mobile terminal
CN116627855B (en) Memory processing method and related device
WO2024007944A1 (en) Method for extending memory isolation domain, and electronic device
WO2024027544A1 (en) Memory management method and electronic device
CN115543600A (en) Memory space management method and memory space management device
WO2024032430A1 (en) Memory management method and electronic device
CN116244067B (en) Virtual memory management method and electronic equipment
WO2023005783A1 (en) Data processing method and electronic device
WO2023051056A1 (en) Memory management method, electronic device, computer storage medium, and program product
CN116993619B (en) Image processing method and related equipment
WO2023174322A1 (en) Layer processing method and electronic device
CN113704209B (en) Data sharing method, electronic device and storage medium
WO2022111711A1 (en) Inter-process communication method and apparatus
EP4137973A1 (en) Method and apparatus for applying file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication