WO2016000470A1 - Memory control method and device - Google Patents

Memory control method and device Download PDF

Info

Publication number
WO2016000470A1
WO2016000470A1 PCT/CN2015/075704 CN2015075704W WO2016000470A1 WO 2016000470 A1 WO2016000470 A1 WO 2016000470A1 CN 2015075704 W CN2015075704 W CN 2015075704W WO 2016000470 A1 WO2016000470 A1 WO 2016000470A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
physical memory
physical
page
control device
Prior art date
Application number
PCT/CN2015/075704
Other languages
French (fr)
Chinese (zh)
Inventor
陈荔城
刘垚
陈明宇
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016000470A1 publication Critical patent/WO2016000470A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/16Handling requests for interconnection or transfer for access to memory bus

Abstract

A memory control method and device, the method comprising: a memory control device (600) receives a control policy for a physical memory and a corresponding triggering condition (S101), the triggering condition comprising a change in state information of the physical memory and/or an access process received by the memory control device (600); the memory control device (600) monitors the state information of the physical memory and the access process (S102); when the triggering condition is satisfied, the memory control device (600) invokes the corresponding control policy to control the physical memory (S103). Therefore, the memory control device (600) serving as hardware acquires from a system the necessary control policy, physical memory control semantic information required for carrying out the control policy, and the triggering condition of the corresponding control measurement, such that when the triggering condition is satisfied, the memory control device (600) can invoke the control policy corresponding to the triggering condition to control the physical memory without a system raising a page fault in the control process, thus improving control efficiency.

Description

一种内存控制方法和装置Memory control method and device 技术领域Technical field
本发明涉及计算机领域,特别是涉及一种内存控制方法和装置。The present invention relates to the field of computers, and in particular, to a memory control method and apparatus.
背景技术Background technique
在系统运行中,处理器会通过访问进程向物理内存进行访问,目前主要是通过软件,如操作系统(Operating System,OS)、虚拟机监视器(Virtual Machine Monitor,VMM)等来直接负责处理这些访问进程并相应的对物理内存进行控制。In the system running, the processor accesses the physical memory through the access process. Currently, it is directly responsible for processing these through software, such as an operating system (OS), a virtual machine monitor (VMM), and the like. Access the process and control the physical memory accordingly.
系统在对物理内存进行进程控制时会与物理内存之间产生大量的信令交互,其中很大一部分的信令交互基本上都需要系统通过中断处理(如page fault)来实现,而且系统在每次进行中断处理时都需要保存中断处理时物理内存中的相关上下文信息,这样控制流程会耗费大量的系统资源。可见,通过软件系统直接对物理内存进行进程控制的开销很大,在有些系统中,中断处理甚至会导致超过2600CPU时钟周期的平均延迟,大大影响了系统的整体工作效率。When the system performs process control on physical memory, it generates a large number of signaling interactions with physical memory. A large part of the signaling interaction basically needs to be implemented by the system through interrupt processing (such as page fault), and the system is in each When interrupt processing is performed, the relevant context information in the physical memory at the time of interrupt processing needs to be saved, so that the control process consumes a large amount of system resources. It can be seen that the overhead of directly controlling the physical memory through the software system is very large. In some systems, the interrupt processing may even cause an average delay of more than 2600 CPU clock cycles, which greatly affects the overall working efficiency of the system.
由此可见,系统直接对作为硬件的物理内存进行进程控制的效率很低。It can be seen that the efficiency of the system directly controlling the physical memory as hardware is very low.
发明内容Summary of the invention
为了解决上述技术问题,本发明提供了一种内存控制方法和装置,使得系统通过硬件控制设备控制物理内存,提高了效率。In order to solve the above technical problem, the present invention provides a memory control method and apparatus, which enable a system to control physical memory through a hardware control device, thereby improving efficiency.
本发明实施例公开了如下技术方案:The embodiment of the invention discloses the following technical solutions:
第一方面,本发明提供了一种内存控制方法,所述方法包括:In a first aspect, the present invention provides a memory control method, the method comprising:
内存控制设备接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程;The memory control device receives a control policy for the physical memory and a corresponding trigger condition, where the control policy carries upper layer semantic information for implementing the control policy, where the trigger condition includes a change in state information of the physical memory and/or The access process received by the memory control device;
所述内存控制设备监听物理内存的状态信息以及所述访问进程;The memory control device monitors status information of the physical memory and the access process;
当满足所述触发条件时,所述内存控制设备调用相应的控制策略对所述物理内存进行控制。 When the trigger condition is met, the memory control device invokes a corresponding control policy to control the physical memory.
在第一方面的第一种可能的实现方式中,In a first possible implementation of the first aspect,
所述物理内存的地址信息包括物理地址和虚拟地址;The address information of the physical memory includes a physical address and a virtual address;
所述内存控制设备通过自身包括的翻译后备缓冲器TLB对所述物理内存的物理地址和虚拟地址之间进行虚实地址转换操作,使得:The memory control device performs a virtual real address translation operation between the physical address and the virtual address of the physical memory by using a translation look-aside buffer TLB included in the memory control device, so that:
所述访问进程使用所述物理内存的虚拟地址通过所述内存控制设备访问所述物理内存;所述内存控制设备通过所述虚实地址转换操作,使用所述物理内存的物理地址对所述物理内存进行控制。The access process accesses the physical memory by using the virtual address of the physical memory through the memory control device; the memory control device uses the physical address of the physical memory to the physical memory by using the virtual real address translation operation Take control.
结合第一方面或者第一方面的第一种可能的实现方式,在第二种可能的实现方式中,当所述触发条件包括所述访问进程具体为请求锁定页面时,包括:With reference to the first aspect, or the first possible implementation manner of the first aspect, in the second possible implementation manner, when the triggering condition includes that the access process is specifically a request to lock a page, the method includes:
当所述内存控制设备监听到所述访问进程具体为锁定指定页面在所述物理内存中时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process is specifically locking the specified page in the physical memory, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically include:
所述内存控制设备解析所述访问进程中使用的指定页面的物理内存地址信息确定出所述指定页面的物理页面信息;The memory control device parses physical memory address information of the specified page used in the access process to determine physical page information of the specified page;
若所述指定页面处于所述物理内存中,所述内存控制设备将所述指定页面锁定在所述物理内存中;And if the specified page is in the physical memory, the memory control device locks the specified page in the physical memory;
若所述指定页面不在所述物理内存中,所述内存控制设备将所述指定页面换入并锁定在所述物理内存中。If the specified page is not in the physical memory, the memory control device swaps in and locks the specified page in the physical memory.
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,当所述访问进程具体包括请求为直接内存存取缓冲区DMA Buffer分配物理页面时,包括:In conjunction with the second possible implementation of the first aspect, in a third possible implementation, when the access process specifically includes requesting to allocate a physical page for the direct memory access buffer DMA Buffer, the method includes:
当所述内存控制设备监听到所述访问进程具体为DMA Buffer分配物理页面时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device monitors that the access process specifically allocates a physical page for the DMA buffer, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically:
所述内存控制设备从所述物理内存中为所述DMA Buffer分配物理页面;The memory control device allocates a physical page for the DMA Buffer from the physical memory;
所述内存控制设备将分配的所述物理页面锁定在所述物理内存中,并将所述物理页面对应的页表项锁定在所述TLB中。The memory control device locks the allocated physical page in the physical memory, and locks a page table entry corresponding to the physical page in the TLB.
结合第一方面或者第一方面的第一种可能的实现方式,在第四种可能的实现方式中,当所述触发条件包括所述访问进程具体导致缺页中断发生时,包括: With reference to the first aspect, or the first possible implementation manner of the first aspect, in a fourth possible implementation manner, when the triggering condition includes that the accessing process specifically causes a page fault interrupt to occur, the method includes:
当所述内存控制设备监听到所述访问进程具体导致缺页中断发生时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process specifically causes a page fault interrupt to occur, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically:
所述内存控制设备确定出导致缺页中断的页面的替换页面并反馈至发送所述访问进程的发送方。The memory control device determines a replacement page of the page that caused the page fault interrupt and feeds back to the sender that sent the access process.
结合第一方面或者第一方面的第一种可能的实现方式,在第五种可能的实现方式中,当所述触发条件包括所述物理内存的状态信息的变化具体为内存容量发生变化时,包括:With reference to the first aspect, or the first possible implementation manner of the first aspect, in a fifth possible implementation manner, when the trigger condition includes a change in state information of the physical memory, specifically, a change in memory capacity, include:
当所述内存控制设备监听到所述物理内存的状态信息的变化具体为内存容量发生变化时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device monitors that the change of the state information of the physical memory is specifically changed by the memory capacity, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically include:
当所述物理内存容量发生变化具体为所述物理内存容量增加时,所述内存控制设备确定增加的物理内存的容量以及类型,并更新所述物理内存变化后的状态信息;When the physical memory capacity changes, specifically, the physical memory capacity increases, the memory control device determines the capacity and type of the increased physical memory, and updates the state information after the physical memory change;
当所述物理内存容量发生变化具体为所述物理内存容量减少时,所述内存控制设备将减少的物理内存中存储的页面内容复制到所述物理内存中剩余内存的空闲空间中,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity decreases, the memory control device copies the reduced page content stored in the physical memory to the free space of the remaining memory in the physical memory, and updates the State information after a change in physical memory.
结合第一方面或者第一方面的第一种或第二种或第三种或第四种或第五种可能的实现方式,在第六种可能的实现方式中,还包括:With reference to the first aspect or the first or second or the third or the fourth or the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner, the method further includes:
当所述物理内存的状态信息发生变化时,所述内存控制设备将所述物理内存变化后的状态信息反馈至发送所述针对物理内存的控制策略以及相应的触发条件的发送方,所述变化包括内存容量变化、内存类型变化或内存使用率满足预定阈值;When the state information of the physical memory changes, the memory control device feeds back the state information after the physical memory change to the sender that sends the control policy for the physical memory and the corresponding trigger condition, the change Including memory capacity changes, memory type changes, or memory usage rates that meet predetermined thresholds;
所述内存控制设备接收所述发送方所发送的对应所述物理内存变化后的状态信息的控制策略以及相应的触发条件。The memory control device receives a control policy sent by the sender corresponding to the changed state information of the physical memory and a corresponding trigger condition.
第二方面,本发明提供了一种内存控制装置,包括:In a second aspect, the present invention provides a memory control device, including:
接收单元,用于接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程;a receiving unit, configured to receive a control policy for the physical memory and a corresponding triggering condition, where the control policy carries upper layer semantic information for implementing the control policy, where the triggering condition includes a change of state information of the physical memory / or the access process received by the memory control device;
监听单元,用于监听物理内存的状态信息以及所述访问进程;a monitoring unit, configured to monitor status information of the physical memory and the access process;
控制单元,用于当所述监听单元的结果满足所述触发条件时,调用相应 的控制策略对所述物理内存进行控制。a control unit, configured to invoke a corresponding when the result of the monitoring unit satisfies the trigger condition The control strategy controls the physical memory.
在第二方面的第一种可能的实现方式中,其特征在于,当所述物理内存的地址信息包括物理地址和虚拟地址时,还包括:In a first possible implementation manner of the second aspect, when the address information of the physical memory includes a physical address and a virtual address, the method further includes:
转换单元,用于通过自身包括的翻译后备缓冲器TLB对所述物理内存的物理地址和虚拟地址之间进行虚实地址转换操作,使得:And a converting unit, configured to perform a virtual real address translation operation between the physical address and the virtual address of the physical memory by using a translation look-aside buffer TLB included by the translation buffer TLB:
所述访问进程使用所述物理内存的虚拟地址通过所述转换单元访问所述物理内存;所述转换单元通过所述虚实地址转换操作,使用所述物理内存的物理地址对所述物理内存进行控制。The access process uses the virtual address of the physical memory to access the physical memory through the conversion unit; the conversion unit controls the physical memory by using the physical address of the physical memory by the virtual real address translation operation .
结合第二方面或者第二方面的第一种可能的实现方式,在第二种可能的实现方式中,包括:With reference to the second aspect or the first possible implementation manner of the second aspect, in a second possible implementation manner, the method includes:
所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体为请求锁定页面时,具体用于:When the result of the monitoring unit meets the triggering condition, the control unit specifically uses the request to lock the page, and is specifically used to:
解析所述访问进程中使用的指定页面的物理内存地址信息确定出所述指定页面的物理页面信息;Parsing physical memory address information of the specified page used in the access process to determine physical page information of the specified page;
若所述指定页面处于所述物理内存中,将所述指定页面锁定在所述物理内存中;If the specified page is in the physical memory, the specified page is locked in the physical memory;
若所述指定页面不在所述物理内存中,将所述指定页面换入并锁定在所述物理内存中。If the specified page is not in the physical memory, the specified page is swapped in and locked in the physical memory.
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,包括:In conjunction with the second possible implementation of the second aspect, in a third possible implementation manner, the method includes:
所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体包括请求为直接内存存取缓冲区DMA Buffer分配物理页面时,具体用于:The control unit is specifically configured to: when the result of the listening unit meets the trigger condition, that the access process specifically includes requesting to allocate a physical page for the direct memory access buffer DMA Buffer,
从所述物理内存中为所述DMA Buffer分配物理页面;Allocating a physical page for the DMA Buffer from the physical memory;
将分配的所述物理页面锁定在所述物理内存中,并将所述物理页面对应的页表项锁定在所述TLB中。The allocated physical page is locked in the physical memory, and the page table entry corresponding to the physical page is locked in the TLB.
结合第二方面或者第二方面的第一种可能的实现方式,在第四种可能的实现方式中,包括:With reference to the second aspect or the first possible implementation manner of the second aspect, in a fourth possible implementation manner, the method includes:
所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体导致缺页中断发生时,具体用于:The control unit is specifically configured to: when the result of the listening unit meets the trigger condition, that the access process specifically causes a page fault interrupt to occur, specifically:
确定出导致缺页中断的页面的替换页面并反馈至发送所述访问进程的发送方。 A replacement page of the page that caused the page fault interrupt is determined and fed back to the sender that sent the access process.
结合第二方面或者第二方面的第一种可能的实现方式,在第五种可能的实现方式中,包括:With reference to the second aspect or the first possible implementation manner of the second aspect, in a fifth possible implementation manner, the method includes:
所述控制单元当所述监听单元的结果满足触发条件包括所述触发条件包括所述物理内存的状态信息的变化具体为内存容量发生变化时,具体用于:The control unit is specifically configured to: when the result of the monitoring unit meets the triggering condition, the triggering condition includes that the change of the state information of the physical memory is specifically changed by the memory capacity, specifically:
当所述物理内存容量发生变化具体为所述物理内存容量减少时,将减少的物理内存中存储的页面内容复制到所述物理内存中剩余内存的空闲空间中,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity is reduced, copying the page content stored in the reduced physical memory into the free space of the remaining memory in the physical memory, and updating the physical memory after the change Status information.
结合第二方面或者第二方面的第一种或第二种或第三种或第四种或第五种可能的实现方式,在第六种可能的实现方式中,还包括:With reference to the second aspect or the first or second or the third or the fourth or the fifth possible implementation manner of the second aspect, in a sixth possible implementation manner, the method further includes:
反馈单元,用于当所述物理内存的状态信息发生变化时,将所述物理内存变化后的状态信息反馈至发送所述针对物理内存的控制策略以及相应的触发条件的发送方,所述变化包括内存容量变化、内存类型变化或内存使用率满足预定阈值;a feedback unit, configured to: when the state information of the physical memory changes, feed back the state information after the physical memory is changed to a sender that sends the control policy for the physical memory and a corresponding trigger condition, where the change Including memory capacity changes, memory type changes, or memory usage rates that meet predetermined thresholds;
所述接收单元,还用于接收所述发送方所发送的对应所述物理内存变化后的状态信息的控制策略以及相应的触发条件。The receiving unit is further configured to receive a control policy that is sent by the sender and corresponding to the state information after the change of the physical memory, and a corresponding trigger condition.
由上述技术方案可以看出,作为硬件的内存控制设备从系统获取必要控制策略、完成这些控制策略所需的物理内存控制语义信息,以及相应控制测量的触发条件,使得当满足一个触发条件时,所述内存控制设备可以调用对应该触发条件的控制策略对所述物理内存进行控制,控制的过程中不再需要系统进行中断处理,提高了控制效率。It can be seen from the above technical solution that the memory control device as a hardware acquires necessary control strategies from the system, physical memory control semantic information required to complete the control policies, and corresponding trigger conditions for controlling the measurement, so that when a trigger condition is met, The memory control device can control the physical memory by calling a control policy corresponding to the trigger condition, and the system does not need to perform interrupt processing in the control process, thereby improving control efficiency.
附图说明DRAWINGS
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present invention, and other drawings can be obtained from those skilled in the art without any inventive labor.
图1为本发明实施例提供的一种内存控制的方法流程图;FIG. 1 is a flowchart of a method for memory control according to an embodiment of the present invention;
图2为本发明实施例提供的对物理内存进行物理页面锁定的方法示意图;2 is a schematic diagram of a method for performing physical page locking on physical memory according to an embodiment of the present invention;
图3为本发明实施例提供的一种内存控制的装置结构图;3 is a structural diagram of a device for memory control according to an embodiment of the present invention;
图4为本发明实施例提供的一种内存控制的装置结构图; 4 is a structural diagram of a device for memory control according to an embodiment of the present invention;
图5为本发明实施例提供的一种内存控制的装置结构图;FIG. 5 is a structural diagram of a device for memory control according to an embodiment of the present invention;
图6为本发明实施例提供的一种内存控制设备的硬件结构示意图。FIG. 6 is a schematic structural diagram of hardware of a memory control device according to an embodiment of the present invention.
具体实施方式detailed description
从现有技术中可以看出,使用作为软件的系统(OS)来控制作为硬件的物理内存需要频繁的软硬件交互,导致其会对系统本身的开销很大,而且会造成大量的处理延迟。但是实际上,对物理内存的控制特点是,大部分对物理内存的控制操作相对来说都比较简单,并不是必须使用复杂的软件才能完成,完全可以使用其他硬件(比如说内存控制器,Memory Control ler)来执行这些控制操作,比如对非法地址访问的判断、页面的第一次访问的处以及页面替换等。针对这一特点,本发明实施例提供了一种内存控制方法和装置,使用作为硬件的内存控制设备从系统获取必要控制策略、完成这些控制策略所需的物理内存控制语义信息,以及相应控制测量的触发条件,使得当满足一个触发条件时,所述内存控制设备可以调用对应该触发条件的控制策略对所述物理内存进行控制,控制的过程中不再需要系统进行中断处理,大大提高了控制效率。It can be seen from the prior art that using a system (OS) as software to control physical memory as hardware requires frequent hardware and software interactions, which causes a great overhead to the system itself and causes a large amount of processing delay. But in fact, the control of physical memory is that most of the control operations on physical memory are relatively simple, not necessarily using complex software to complete, you can use other hardware (such as memory controller, Memory) Control ler) to perform these control operations, such as the judgment of illegal address access, the first visit of the page, and page replacement. In response to this feature, an embodiment of the present invention provides a memory control method and apparatus, using a memory control device as a hardware to acquire necessary control policies from a system, physical memory control semantic information required to complete these control strategies, and corresponding control measurements. The triggering condition is such that when a trigger condition is met, the memory control device can call the control strategy corresponding to the trigger condition to control the physical memory, and the system does not need to perform interrupt processing in the process of control, thereby greatly improving the control. effectiveness.
本发明实施例还针对物理内存具有物理地址和虚拟地址的特点,将可以进行虚拟地址和物理地址之间地址转换的硬件(比如说较为典型的翻译后备缓冲器(Translation Lookaside Buffer,TLB))整合作为所述内存控制设备的一部分,使得所述内存控制设备也可以处理使用虚拟地址访问物理内存的访问进程,进一步的提高了本发明实施例的适用范围。The embodiment of the present invention further integrates hardware (for example, a typical translation lookaside buffer (TLB)) that can perform address translation between a virtual address and a physical address according to the physical address and the virtual address of the physical memory. As part of the memory control device, the memory control device can also process an access process using a virtual address to access physical memory, which further improves the scope of application of the embodiments of the present invention.
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly described in conjunction with the drawings in the embodiments of the present invention. Some embodiments, rather than all of the embodiments, are invented. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
实施例一Embodiment 1
本实施例将对内存控制设备如何对物理内存进行控制进行描述,请参阅图1,其为本发明实施例提供的一种内存控制的方法流程图,该方法包括: This embodiment will describe how the memory control device controls the physical memory. Referring to FIG. 1 , it is a flowchart of a memory control method according to an embodiment of the present invention, where the method includes:
S101:内存控制设备接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程。S101: The memory control device receives a control policy for the physical memory and a corresponding trigger condition, where the control policy carries upper layer semantic information for implementing the control policy, where the trigger condition includes a change of state information of the physical memory. / or the access process received by the memory control device.
这里需要说明的是,这里所述的控制策略主要是用于指导所述内存控制设备控制物理内存的,比如说限定访问进程的可用物理内存配额,制定页面优先级,锁定页面等,然而执行这些控制策略需要使用到对应的上层语义信息如操作命令等,可以包括:进程的创建或结束,虚地址分配或释放等,发送操作命令,比如如何锁定(Pin)一个物理页面在物理内存中,Pin一段虚拟地址空间对应的页表项在TLB内等等。所述上层语义信息还指原本硬件中不包含的,主要由软件执行的语义信息。It should be noted that the control strategy described herein is mainly used to guide the memory control device to control physical memory, such as limiting the available physical memory quota of the access process, setting page priority, locking the page, etc., but performing these The control policy needs to use the corresponding upper layer semantic information, such as operation commands, and may include: process creation or termination, virtual address allocation or release, etc., and send operation commands, such as how to lock (Pin) a physical page in physical memory, Pin A page entry corresponding to a virtual address space is in the TLB, and so on. The upper layer semantic information also refers to semantic information that is not included in the original hardware and is mainly executed by software.
这个所述的触发条件可以有一个或多个,每个所述触发条件可以对应一个或多个控制策略,相关内容将在实施例二中针对不同的具体情况进行展开说明,这里不再赘述。The triggering condition may be one or more, and each of the triggering conditions may be corresponding to one or more control policies. The related content will be described in different embodiments in the second embodiment, and details are not described herein again.
所述内存控制设备可以有多种方式获取这些控制策略以及相应的触发条件,比如说从系统(OS)处获取,或者通过预先设置等,本发明对所述内存控制设备如何获取所述制策略以及相应的触发条件不进行限定。The memory control device can acquire the control policies and the corresponding triggering conditions in multiple manners, such as obtaining from the system (OS), or by setting in advance, etc., how the present invention acquires the policy for the memory control device. And the corresponding trigger conditions are not limited.
S102:所述内存控制设备监听物理内存的状态信息以及所述访问进程。S102: The memory control device monitors status information of the physical memory and the access process.
S103:当满足所述触发条件时,所述内存控制设备调用相应的控制策略对所述物理内存进行控制。S103: When the trigger condition is met, the memory control device invokes a corresponding control policy to control the physical memory.
这两步骤需要说明的是,由于在S101中获取的所述控制策略和触发条件是具有对应关系的,故一旦满足了一个触发条件,由于所述内存控制设备6已经具备了必要的上层语义信息,故所述内存控制设备调用对应的控制策略即可以根据控制策略使用上层语义信息进行相应的处理,比如说锁定一个指定页面在物理内存中,处理缺页中断等原本需要系统才能处理的与物理内存相关的情况。判断所述访问进程的类别可以通过访问进程标识(pid)完成。The two steps need to be explained that since the control policy and the trigger condition acquired in S101 have a corresponding relationship, once the trigger condition is met, the memory control device 6 already has the necessary upper layer semantic information. Therefore, the memory control device invokes the corresponding control strategy, that is, the upper layer semantic information can be used for corresponding processing according to the control strategy, for example, locking a specified page in physical memory, processing a page fault interrupt, and the like that the system needs to be processed and physical. Memory related situation. Determining the category of the access process can be done by accessing the process identifier (pid).
可见,作为硬件的内存控制设备从系统获取必要控制策略、完成这些控制策略所需的物理内存控制语义信息,以及相应控制测量的触发条件,使得当满足一个触发条件时,所述内存控制设备可以调用对应该触发条件 的控制策略对所述物理内存进行控制,控制的过程中不再需要系统进行中断处理,大大提高了控制效率。It can be seen that the memory control device as a hardware acquires necessary control policies from the system, physical memory control semantic information required to complete the control policies, and trigger conditions for corresponding control measurements, so that when a trigger condition is met, the memory control device can Call the corresponding trigger condition The control strategy controls the physical memory, and the system does not need to perform interrupt processing in the process of control, which greatly improves the control efficiency.
实施例二Embodiment 2
本实施例将在实施例一的基础上,对所述触发条件进行展开说明,并根据不同的触发条件为例描述所述内存控制设备如何对所述物理内存进行处理和控制。This embodiment will expand the trigger condition on the basis of the first embodiment, and describe how the memory control device processes and controls the physical memory according to different trigger conditions.
在对所述触发条件展开说明之前,需要先针对物理内存包括物理地址和虚拟地址的特点进行描述,所述物理地址和所述虚拟地址之间一般具有映射关系,在现有技术中,作为软件的系统控制或者访问物理内存时,需要关注物理内存的物理地址,比如对所述物理内存执行存储器直接访问(Direct Memory Access,DMA)操作命令时,需要有多种限制,比如说物理地址必须连续,必须从低地址开始等,操作流程是比较繁琐的。在本发明实施例中,所述内存控制设备将TLB整合作为自身的一个组成部分,将虚实地址的转换功能灵活的应用在对物理内存的控制中。可选的,本发明实施例还包括:Before the description of the triggering condition is described, the physical memory includes a physical address and a virtual address. The physical address and the virtual address generally have a mapping relationship. In the prior art, as a software. When the system controls or accesses the physical memory, you need to pay attention to the physical address of the physical memory. For example, when you perform the Direct Memory Access (DMA) operation command on the physical memory, you need to have various restrictions. For example, the physical address must be continuous. , must start from a low address, etc., the operation process is rather cumbersome. In the embodiment of the present invention, the memory control device integrates the TLB as an integral part of itself, and flexibly applies the conversion function of the virtual real address to the control of the physical memory. Optionally, the embodiment of the present invention further includes:
所述物理内存的地址信息包括物理地址和虚拟地址。The address information of the physical memory includes a physical address and a virtual address.
所述内存控制设备通过自身包括的TLB对所述物理内存的物理地址和虚拟地址之间进行虚实地址转换操作,使得:The memory control device performs a virtual real address translation operation between the physical address and the virtual address of the physical memory by using a TLB included in the memory control device, so that:
所述访问进程使用所述物理内存的虚拟地址通过所述内存控制设备访问所述物理内存;所述内存控制设备通过所述虚实地址转换操作,使用所述物理内存的物理地址对所述物理内存进行控制。The access process accesses the physical memory by using the virtual address of the physical memory through the memory control device; the memory control device uses the physical address of the physical memory to the physical memory by using the virtual real address translation operation Take control.
也就是说,针对所述物理内存的访问进程可以直接使用所述物理内存的虚拟地址进行访问,从而在一些情况下,不再需要考虑到所访问的物理内存的物理地址是否连续和从低地址开始,只需要直接使用连续的虚拟地址进行相关操作即可,详细的内容将在所述内存控制设备如何支持DMA操作的部分进行描述。That is to say, the access process for the physical memory can directly access the virtual address of the physical memory, so that in some cases, it is no longer necessary to consider whether the physical address of the accessed physical memory is continuous and from the low address. Initially, only the continuous virtual address needs to be used directly for related operations, and the detailed content will be described in the section on how the memory control device supports DMA operations.
接下来对所述触发条件进行展开说明,并根据不同的触发条件为例描述所述内存控制设备如何对所述物理内存进行处理和控制,本发明实施例 提供了至少五种不同的触发条件情况,这些触发条件可以是在实施例一的基础上实现,也可以是在本实施例中增加了虚实地址转换的基础上实现,本发明对此不进行限定。The following describes the deployment of the triggering conditions, and describes how the memory control device processes and controls the physical memory according to different triggering conditions. At least five different trigger condition conditions are provided, which may be implemented on the basis of the first embodiment, or may be implemented on the basis of adding a virtual real address translation in the embodiment, which is not limited by the present invention. .
第一种情况:The first case:
可选的,当所述触发条件包括所述访问进程具体为请求锁定页面时,包括:Optionally, when the triggering condition includes that the accessing process is specifically a request to lock a page, the method includes:
当所述内存控制设备监听到所述访问进程具体为请求锁定指定页面在所述物理内存中时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process is specifically requesting to lock the specified page in the physical memory, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory. Specifically include:
所述内存控制设备解析所述访问进程中使用的指定页面的物理内存地址信息确定出所述指定页面的物理页面信息。The memory control device parses the physical memory address information of the specified page used in the access process to determine physical page information of the specified page.
若所述指定页面处于所述物理内存中,所述内存控制设备将所述指定页面锁定在所述物理内存中。And if the specified page is in the physical memory, the memory control device locks the specified page in the physical memory.
若所述指定页面不在所述物理内存中,所述内存控制设备将所述指定页面换入并锁定在所述物理内存中。If the specified page is not in the physical memory, the memory control device swaps in and locks the specified page in the physical memory.
由于内存控制设备本身并无法了解物理内存中保存的页面对于当前应用场景的优先级高低或者重要程度,在对所述物理内存进行控制时,很有可能会将重要页面换出到物理内存外,导致系统处理效率降低,故系统在考虑到页面的优先级或者重要程度后,为了防止某些重要页面被换出物理内存,系统会向所述内存控制设备发送锁定指定页面的访问进程。当所述内存控制设备接收到要求锁定指定页面的访问进程时,相当于触发了相应的触发条件,所述内存控制设备将调用对应的控制策略,包括查询页面、锁定页面等。Because the memory control device itself cannot know the priority or importance of the page saved in the physical memory for the current application scenario, when the physical memory is controlled, it is very likely that the important page is swapped out of the physical memory. As a result, the efficiency of the system is reduced. Therefore, after the system considers the priority or importance of the page, in order to prevent some important pages from being swapped out of physical memory, the system sends an access process to the memory control device to lock the specified page. When the memory control device receives the access process that requires the specified page to be locked, the corresponding trigger condition is triggered, and the memory control device invokes the corresponding control policy, including the query page, the lock page, and the like.
进一步通过举例进行说明,Further illustrated by way of example,
比如在本实施例增加了虚实地址转换的基础上,锁定页面的应用场景可以参见图2,图2为本发明实施例提供的对物理内存进行物理页面锁定的方法示意图,如图2所示:For example, in the embodiment, the application scenario of the locked page is as shown in FIG. 2 . FIG. 2 is a schematic diagram of a method for physically locking a physical memory according to an embodiment of the present invention.
S201:系统向所述内存控制设备发送Pin一段地址空间(可以是指一个指定页面)在内存中的访问进程,所述访问进程(或者叫Pin命令)的 格式可以为:Pin start_addr len(或Pin pid)。所述Pin命令被加入到所述内存控制设备的命令队列中。所述Pin命令可通过系统标准的调用mlock或mlock_al l函数来封装和实现,从而保持系统接口兼容,不需要对应用系统进行任何修改,而且不需要系统中断切换到内核态,也不要系统来处理。S201: The system sends, to the memory control device, a access process in which an address space (which may refer to a specified page) is in memory, and the access process (or a Pin command) The format can be: Pin start_addr len (or Pin pid). The Pin command is added to the command queue of the memory control device. The Pin command can be encapsulated and implemented by calling the mlock or mlock_al l function of the system standard, thereby keeping the system interface compatible, without any modification to the application system, and without requiring the system interrupt to switch to the kernel state, and the system does not need to process .
S202:当所述内存控制设备从命令队列中调度执行到所述Pin命令时,获取所述Pin命令的操作类型(Pin)和操作参数(一段地址空间)。S202: When the memory control device schedules execution from the command queue to the Pin command, acquires an operation type (Pin) and an operation parameter (an address space) of the Pin command.
S203:所述内存控制设备根据解析得到的所述指定页面的虚拟地址,以页面为单位查询所述内存控制设备内的TLB,获取对应的所述指定页面的物理地址。S203: The memory control device queries the TLB in the memory control device by using a virtual address of the specified page, and obtains a physical address of the specified page.
S204:如果所述指定页面尚未分配,所述内存控制设备通过设定所述指定页面的属性为锁定(PG_mlocked),实现将所述指定页面锁定在所述物理内存中。在以后在对所述物理内存进行操作的过程中,被锁定的所述指定页面将不会被从所述物理内存中换出。S204: If the specified page has not been allocated, the memory control device locks the specified page in the physical memory by setting an attribute of the specified page to be locked (PG_mlocked). In the subsequent operation of the physical memory, the specified page that is locked will not be swapped out of the physical memory.
如果物理页面被换出(present=0),则所述内存控制设备启动换入(Swap),将所述指定页面换入到所述物理内存中,再进一步的对所述指定页面执行锁定页面的操作。If the physical page is swapped out (present=0), the memory control device initiates Swap, swaps the specified page into the physical memory, and further performs a lock page on the specified page. Operation.
S205:在所述Pin命令执行完成后,所述内存控制设备还可以进一步的通知系统,比如可发送响应(Response)信息。S205: After the execution of the Pin command is completed, the memory control device may further notify the system, for example, may send response information.
第二种情况:The second case:
可选的,当所述访问进程具体包括请求为直接内存存取缓冲区(Direct Memory Access Buffer,DMA Buffer)分配物理页面时,包括:Optionally, when the access process specifically includes requesting to allocate a physical page for a direct memory access buffer (DMA Buffer), the method includes:
当所述内存控制设备监听到所述访问进程具体为DMA Buffer分配物理页面时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device monitors that the access process specifically allocates a physical page for the DMA buffer, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically:
所述内存控制设备从所述物理内存中为所述DMA Buffer分配物理页面;The memory control device allocates a physical page for the DMA Buffer from the physical memory;
所述内存控制设备将分配的所述物理页面锁定在所述物理内存中,并 将所述物理页面对应的页表项锁定在所述TLB中。The memory control device locks the allocated physical page in the physical memory, and The page table entry corresponding to the physical page is locked in the TLB.
对于DMA需要说明的是,DMA目前应用的范围很广,如现在从磁盘中的文件读写数据到内存时需要使用到DMA;从网卡收发网络包到内存时需要使用到DMA;从PCIE设备上的存储空间读写数据到内存时需要使用到DMA。What needs to be explained for DMA is that DMA has a wide range of applications. For example, DMA is required to read and write data from a file on disk to memory; DMA is required to send and receive network packets from the network card to the memory; from the PCIE device The storage space needs to use DMA when reading and writing data to memory.
也就是说,所述访问进程通过操作系统分配一段在虚拟地址空间连续的DMA Buffer(缓冲区)空间,并向所述内存控制器发送请求一段DMA Buffer(缓冲区)物理空间的命令;That is, the access process allocates a DMA Buffer space in the virtual address space through the operating system, and sends a command requesting a DMA Buffer physical space to the memory controller;
所述内存控制器执行分配DMA Buffer物理空间的命令,硬件分配对应物理页面,并将这些页面锁定在内存中,并将其对应的页表项锁定在所述内存控制器中的TLB内;这时候为DMA Buffer分配的物理页面可以任意分配,而不再需要占用一段连续的物理地址空间;由此打破了DMA对DMA Buffer要求连续物理页面的限制。The memory controller executes a command for allocating a physical space of the DMA Buffer, the hardware allocates corresponding physical pages, and locks the pages in the memory, and locks the corresponding page table entries in the TLB in the memory controller; The physical pages allocated for the DMA Buffer can be arbitrarily allocated without having to occupy a contiguous physical address space; thus breaking the limitation of the DMA on the DMA Buffer requiring continuous physical pages.
操作系统使用DMA Buffer对应的虚拟地址空间和需要访问的磁盘空间信息向DMA控制器发送DMA请求。The operating system sends a DMA request to the DMA controller using the virtual address space corresponding to the DMA Buffer and the disk space information to be accessed.
DMA控制器使用虚拟地址向所述内存控制器发送数据读写请求;The DMA controller sends a data read/write request to the memory controller using a virtual address;
所述内存控制器直接使用虚拟地址查询其上的TLB获取对应物理地址,从而实现将数据从外设(如磁盘)读入到DMA Buffer所在的物理页面或将数据从DMA Buffer写回到外设。The memory controller directly queries the TLB on the virtual address to obtain the corresponding physical address, thereby reading data from a peripheral device (such as a disk) into a physical page where the DMA Buffer is located or writing data from the DMA Buffer to the peripheral device. .
第三种情况:The third case:
可选的,当所述触发条件包括所述访问进程具体导致缺页中断发生时,包括:Optionally, when the triggering condition includes that the accessing process specifically causes a page fault interrupt to occur, the method includes:
当所述内存控制设备监听到所述访问进程具体导致缺页中断发生时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process specifically causes a page fault interrupt to occur, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically:
所述内存控制设备确定出导致缺页中断的页面的替换页面并反馈至发送所述访问进程的发送方。The memory control device determines a replacement page of the page that caused the page fault interrupt and feeds back to the sender that sent the access process.
这里需要说明的是,所述缺页中断的情况主要是指所述访问进程所访 问的目标页面没有存储在所述物理内存中的情况。当由于访问进程导致缺页中断的情况发生时,所述内存控制设备需要为这次缺页中断确定出代替页面。相对于现有技术来说,原本在现有技术中需要系统进行的确定代替页面的流程,在本发明实施例中可以由所述内存控制设备来完成,也就是说,确定代替页面的流程中查找空白页面、是否可以作为替换页面以及页面是否干净等均可以由所述内存控制设备完成。这样大大简化了在出现缺页中断时系统的操作负担,提高了系统处理速度。It should be noted here that the situation of the page fault interruption mainly refers to the visit of the access process. The target page of the question is not stored in the physical memory. When a page fault interrupt occurs due to an access process, the memory control device needs to determine an alternate page for this page fault interrupt. Compared with the prior art, the process of determining the replacement page in the prior art is required to be completed by the memory control device in the embodiment of the present invention, that is, in the process of determining the replacement page. Finding a blank page, whether it can be a replacement page, and whether the page is clean can be done by the memory control device. This greatly simplifies the operating load of the system in the event of page faults and increases the processing speed of the system.
第四种情况:The fourth situation:
可选的,当所述触发条件包括所述物理内存的状态信息的变化具体为内存容量发生变化时,包括:Optionally, when the triggering condition includes the change of the state information of the physical memory, specifically, the memory capacity changes, including:
当所述内存控制设备监听到所述物理内存的状态信息的变化具体为内存容量发生变化时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device monitors that the change of the state information of the physical memory is specifically changed by the memory capacity, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically include:
当所述物理内存容量发生变化具体为所述物理内存容量增加时,所述内存控制设备确定增加的物理内存的容量以及类型,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity increases, the memory control device determines the capacity and type of the increased physical memory, and updates the state information after the physical memory change.
当所述物理内存容量发生变化具体为所述物理内存容量减少时,所述内存控制设备将减少的物理内存中存储的页面内容复制到所述物理内存中剩余内存的空闲空间中,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity decreases, the memory control device copies the reduced page content stored in the physical memory to the free space of the remaining memory in the physical memory, and updates the State information after a change in physical memory.
这里需要说明的是,目前对于物理内存来说是可以支持热插拔的,物理内存的类型也越发多样,故所述内存控制设备控制的所述物理内存的容量和类型随时都可能发生变化,在本发明实施例中,所述内存控制设备可以监听所述物理内存的状态信息的变化,并可以自行对所述物理内存的容量的变化进行对应的处理和操作。It should be noted that the physical memory is currently hot swappable, and the type of physical memory is more diverse. Therefore, the capacity and type of the physical memory controlled by the memory control device may change at any time. In the embodiment of the present invention, the memory control device can monitor the change of the state information of the physical memory, and can perform corresponding processing and operations on the change of the capacity of the physical memory.
进一步通过实际应用场景进行举例说明:Further examples are given through actual application scenarios:
当对所述物理内存进行热插拔动作时,底层硬件(如BIOS)将对应的内存热插拔事件(Hot plug)通过相应的接口发送给所述内存控制设备,所述相应的接口可以是高级配置和电源管理接口(Advanced  Configuration and Power Management Interface,ACPI)。When the physical memory is hot swapped, the underlying hardware (such as the BIOS) sends a corresponding hot plug of the memory to the memory control device through a corresponding interface, where the corresponding interface may be Advanced configuration and power management interface (Advanced Configuration and Power Management Interface, ACPI).
所述内存控制设备当接收到所述内存热插拔事件时,对应调整所述物理内存中的存储结构,当所述物理内存的容量增加了,例如新插上的物理内存的情况,所述内存控制设备将新加入的物理内存加入到内存管理的Free List中(如果系统是Linux中为伙伴系统(Buddy System)的空闲页面链表);当所述物理内存的容量减少了,例如所述物理内存的一部分被拔除了的情况,需要先将被拔除的物理内存中包含的有效数据到剩余物理内存中的空闲页面中,并重新设置对应数据与物理内存中存储地址之间的对应关系。所以所述内存控制设备对内存热插拔事件的处理不再需要系统的参与,可以实现对系统的完全透明。When the memory control device receives the memory hot plug event, the memory structure in the physical memory is correspondingly adjusted, and when the capacity of the physical memory is increased, for example, the newly inserted physical memory, the The memory control device adds the newly added physical memory to the Free List of the memory management (if the system is a free page linked list of the Buddy System in Linux); when the capacity of the physical memory is reduced, for example, the physical When a part of the memory is removed, the valid data contained in the extracted physical memory needs to be first added to the free page in the remaining physical memory, and the correspondence between the corresponding data and the storage address in the physical memory is reset. Therefore, the processing of the memory hot swap event by the memory control device does not require the participation of the system, and the system can be completely transparent.
进一步的,所述内存控制设备还可以识别物理内存的类型,例如新增加的物理内存的情况,所述内存控制设备确定新增加的物理内存的存储类型,比如说PCM或者DRAM等。例如减少物理内存的情况,所述内存控制设备确定剩余的物理内存的存储类型。当所述内存控制设备需要向所述物理内存中存储数据时,可以根据数据的类型将不同类型的数据存储到对应的类型的物理内存中,例如,根据PCM非易失的特点,系统指示所述内存控制设备将重要的数据结构放在PCM空间,提高系统的可靠性和稳定性。根据PCM读快写慢的特点,系统可以指示所述内存控制设备将程序的代码段和只读数据段放在PCM空间。其他写访问较密集的数据可被分配到DRAM空间中。Further, the memory control device may also identify a type of physical memory, such as a newly added physical memory, and the memory control device determines a storage type of the newly added physical memory, such as PCM or DRAM. For example, in the case of reducing physical memory, the memory control device determines the storage type of the remaining physical memory. When the memory control device needs to store data in the physical memory, different types of data may be stored into a corresponding type of physical memory according to the type of the data, for example, according to the characteristics of the PCM non-volatile, the system indicates The memory control device places important data structures in the PCM space to improve system reliability and stability. According to the PCM read slow write feature, the system can instruct the memory control device to place the program code segment and the read-only data segment in the PCM space. Other data with more write access can be allocated to the DRAM space.
第五种情况:The fifth situation:
可选的,还包括:Optionally, it also includes:
当所述物理内存的状态信息发生变化时,所述内存控制设备将所述物理内存变化后的状态信息反馈至发送所述针对物理内存的控制策略以及相应的触发条件的发送方,所述变化包括内存容量变化、内存类型变化或内存使用率满足预定阈值;When the state information of the physical memory changes, the memory control device feeds back the state information after the physical memory change to the sender that sends the control policy for the physical memory and the corresponding trigger condition, the change Including memory capacity changes, memory type changes, or memory usage rates that meet predetermined thresholds;
所述内存控制设备接收所述发送方所发送的对应所述物理内存变化后的状态信息的控制策略以及相应的触发条件。The memory control device receives a control policy sent by the sender corresponding to the changed state information of the physical memory and a corresponding trigger condition.
这里需要说明的是,本情况主要是指所述内存控制设备还具备向系统 反馈所述物理内存的状态信息,以便于系统根据当前所述物理内存的状态信息来确定对应的控制策略,并将新确定出的控制策略发送给所述内存控制设备。通过直接控制所述物理内存的所述内存控制设备的反馈,系统可以有效掌握所述物理内存的状态信息的变化,以此向所述内存控制设备发送更加实用的控制策略,让所述内存控制设备能够更有针对性的控制所述物理内存。It should be noted here that the present situation mainly means that the memory control device also has a system to the system. The state information of the physical memory is fed back, so that the system determines a corresponding control policy according to the current state information of the physical memory, and sends the newly determined control policy to the memory control device. By directly controlling the feedback of the memory control device of the physical memory, the system can effectively grasp the change of the state information of the physical memory, thereby sending a more practical control strategy to the memory control device, and allowing the memory to be controlled. The device is able to control the physical memory more specifically.
所述第五种情况除了可以在实施例一的基础上或者在本实施例中增加了虚实地址转换的基础上实现,也可以至少和其他四种情况(第一种情况到第四种情况)结合进行实施。例如所述第五种情况可以和第四种情况结合实施,在出现所述第四种情况(也就是出现热插拔事件)时,所述物理内存的容量或者类型基本上会出现变化,由此就会触发所述第五种情况,这样系统将会更加所述内存控制设备反馈的当前所述物理内存的状态信息向所述内存控制设备下发更有针对性的控制策略和相应的触发条件。还有多种触发的可能组合,这里不再一一穷举。The fifth case may be implemented on the basis of the first embodiment or the virtual real address translation is added in the embodiment, and may be at least the other four cases (the first case to the fourth case). Combined implementation. For example, the fifth case may be implemented in combination with the fourth case. When the fourth case occurs (that is, a hot plug event occurs), the capacity or type of the physical memory basically changes. In this case, the fifth situation is triggered, so that the system will further release the state information of the current physical memory fed back by the memory control device to the memory control device to issue a more targeted control strategy and corresponding trigger. condition. There are also many possible combinations of triggers, which are no longer exhaustive.
综上可见,作为硬件的内存控制设备从系统获取必要控制策略、完成这些控制策略所需的物理内存控制语义信息,以及相应控制测量的触发条件,使得当满足一个触发条件时,所述内存控制设备可以调用对应该触发条件的控制策略对所述物理内存进行控制,控制的过程中不再需要系统进行中断处理,大大提高了控制效率。In summary, the memory control device as a hardware acquires the necessary control strategies from the system, the physical memory control semantic information required to complete the control strategies, and the trigger conditions for corresponding control measurements, such that when a trigger condition is met, the memory control The device can control the physical memory by calling a control policy corresponding to the trigger condition, and the system does not need to perform interrupt processing in the control process, thereby greatly improving the control efficiency.
实施例三Embodiment 3
参阅图3,图3为本发明实施例提供的一种内存控制的装置结构图,包括:Referring to FIG. 3, FIG. 3 is a structural diagram of a device for memory control according to an embodiment of the present invention, including:
接收单元301,用于接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程。The receiving unit 301 is configured to receive a control policy for the physical memory and a corresponding triggering condition, where the control policy carries upper layer semantic information for implementing the control policy, where the triggering condition includes a change of status information of the physical memory. And/or the access process received by the memory control device.
有关所述接收单元301所执行内容的描述请参考实施例一S101中的相关描述,这里不再赘述。For a description of the content of the receiving unit 301, refer to the related description in Embodiment 1 S101, and details are not described herein again.
监听单元302,用于监听物理内存的状态信息以及所述访问进程。 The monitoring unit 302 is configured to monitor status information of the physical memory and the access process.
有关所述监听单元302所执行内容的描述请参考实施例一S102中的相关描述,这里不再赘述。For a description of the content performed by the monitoring unit 302, refer to the related description in Embodiment 1 S102, and details are not described herein again.
控制单元303,用于当所述监听单元的结果满足所述触发条件时,调用相应的控制策略对所述物理内存进行控制。The control unit 303 is configured to invoke the corresponding control policy to control the physical memory when the result of the monitoring unit satisfies the trigger condition.
有关所述控制单元303所执行内容的描述请参考实施例一S103中的相关描述,这里不再赘述。For a description of the content of the control unit 303, refer to the related description in Embodiment 1 S103, and details are not described herein again.
可选的,在图3所示实施例的基础上,当所述物理内存的地址信息包括物理地址和虚拟地址时,所述内存控制装置还可以进一步包括转换单元401,图4为本发明实施例提供的一种内存控制的装置结构图,如图4所示,还包括:Optionally, on the basis of the embodiment shown in FIG. 3, when the address information of the physical memory includes a physical address and a virtual address, the memory control apparatus may further include a converting unit 401, where FIG. 4 is implemented according to the present invention. The device structure diagram of a memory control provided by the example, as shown in FIG. 4, further includes:
转换单元401,用于通过自身包括的翻译后备缓冲器TLB对所述物理内存的物理地址和虚拟地址之间进行虚实地址转换操作,使得:The converting unit 401 is configured to perform a virtual real address translation operation between the physical address and the virtual address of the physical memory by using a translation look-aside buffer TLB included by the translation buffer TLB.
所述访问进程使用所述物理内存的虚拟地址通过所述转换单元访问所述物理内存;所述转换单元通过所述虚实地址转换操作,使用所述物理内存的物理地址对所述物理内存进行控制。The access process uses the virtual address of the physical memory to access the physical memory through the conversion unit; the conversion unit controls the physical memory by using the physical address of the physical memory by the virtual real address translation operation .
有关所述转换单元401所执行内容的描述请参考实施例二中有关物理地址和虚拟地址之间进行虚实地址转换操作的相关描述,这里不再赘述。For a description of the content of the conversion unit 401, refer to the related description of the virtual real address translation operation between the physical address and the virtual address in the second embodiment, and details are not described herein again.
接下来对所述触发条件进行展开说明,并根据不同的触发条件为例描述所述内存控制设备如何对所述物理内存进行处理和控制,本发明实施例提供了至少五种不同的触发条件情况,这些触发条件可以是在实施例一的基础上实现,也可以是在本实施例中增加了虚实地址转换的基础上实现,本发明对此不进行限定。The following describes the deployment of the triggering conditions, and describes how the memory control device processes and controls the physical memory according to different triggering conditions. The embodiment of the present invention provides at least five different triggering conditions. The triggering condition may be implemented on the basis of the first embodiment, or may be implemented based on the addition of the virtual real address translation in the embodiment, which is not limited by the present invention.
第一种情况:The first case:
可选的,包括:Optional, including:
所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体为锁定页面时,具体用于:The control unit is specifically configured to: when the result of the monitoring unit meets the triggering condition, that the access process is specifically a locked page, specifically:
解析所述访问进程中使用的指定页面的物理内存地址信息确定出所述指定页面的物理页面信息; Parsing physical memory address information of the specified page used in the access process to determine physical page information of the specified page;
若所述指定页面处于所述物理内存中,将所述指定页面锁定在所述物理内存中;If the specified page is in the physical memory, the specified page is locked in the physical memory;
若所述指定页面不在所述物理内存中,将所述指定页面换入并锁定在所述物理内存中。If the specified page is not in the physical memory, the specified page is swapped in and locked in the physical memory.
第二种情况:The second case:
可选的,包括:Optional, including:
所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体包括请求为直接内存存取缓冲区DMA Buffer分配物理页面时,具体用于:The control unit is specifically configured to: when the result of the listening unit meets the trigger condition, that the access process specifically includes requesting to allocate a physical page for the direct memory access buffer DMA Buffer,
从所述物理内存中为所述DMA Buffer分配物理页面;Allocating a physical page for the DMA Buffer from the physical memory;
将分配的所述物理页面锁定在所述物理内存中,并将所述物理页面对应的页表项锁定在所述TLB中。The allocated physical page is locked in the physical memory, and the page table entry corresponding to the physical page is locked in the TLB.
第三种情况:The third case:
可选的,包括:Optional, including:
所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体导致缺页中断发生时,具体用于:The control unit is specifically configured to: when the result of the listening unit meets the trigger condition, that the access process specifically causes a page fault interrupt to occur, specifically:
确定出导致缺页中断的页面的替换页面并反馈至发送所述访问进程的发送方。A replacement page of the page that caused the page fault interrupt is determined and fed back to the sender that sent the access process.
第四种情况:The fourth situation:
可选的,包括:Optional, including:
所述控制单元当所述监听单元的结果满足触发条件包括所述触发条件包括所述物理内存的状态信息的变化具体为内存容量发生变化时,具体用于:The control unit is specifically configured to: when the result of the monitoring unit meets the triggering condition, the triggering condition includes that the change of the state information of the physical memory is specifically changed by the memory capacity, specifically:
当所述物理内存容量发生变化具体为所述物理内存容量减少时,将减少的物理内存中存储的页面内容复制到所述物理内存中剩余内存的空闲空间中,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity is reduced, copying the page content stored in the reduced physical memory into the free space of the remaining memory in the physical memory, and updating the physical memory after the change Status information.
第五种情况:The fifth situation:
可选的,在图3所示实施例的基础上,所示内存控制装置还可以进一步包括反馈单元501,图5为本发明实施例提供的一种内存控制的装置结 构图,如图5所示,还包括:Optionally, on the basis of the embodiment shown in FIG. 3, the memory control device may further include a feedback unit 501, where FIG. 5 is a device for memory control according to an embodiment of the present invention. The composition, as shown in Figure 5, also includes:
反馈单元501,用于当所述物理内存的状态信息发生变化时,将所述物理内存变化后的状态信息反馈至发送所述针对物理内存的控制策略以及相应的触发条件的发送方,所述变化包括内存容量变化、内存类型变化或内存使用率满足预定阈值;The feedback unit 501 is configured to: when the state information of the physical memory changes, feed back the state information after the physical memory is changed to a sender that sends the control policy for the physical memory and a corresponding trigger condition, where Changes include changes in memory capacity, memory type changes, or memory usage that meet predetermined thresholds;
所述接收单元301,还用于接收所述发送方所发送的对应所述物理内存变化后的状态信息的控制策略以及相应的触发条件。The receiving unit 301 is further configured to receive a control policy that is sent by the sender and that corresponds to the state information after the physical memory is changed, and a corresponding trigger condition.
可见,作为硬件的内存控制设备从系统获取必要控制策略、完成这些控制策略所需的物理内存控制语义信息,以及相应控制测量的触发条件,使得当满足一个触发条件时,所述内存控制设备可以调用对应该触发条件的控制策略对所述物理内存进行控制,控制的过程中不再需要系统进行中断处理,大大提高了控制效率。It can be seen that the memory control device as a hardware acquires necessary control policies from the system, physical memory control semantic information required to complete the control policies, and trigger conditions for corresponding control measurements, so that when a trigger condition is met, the memory control device can The control system corresponding to the trigger condition is called to control the physical memory, and the system does not need to perform interrupt processing in the process of control, thereby greatly improving the control efficiency.
实施例四Embodiment 4
请参阅图6,图6为本发明实施例提供的一种内存控制设备的硬件结构示意图,所述内存控制设备600包括存储器601和接收器602,以及分别与所述存储器601和所述接收器602连接的处理器603,所述存储器601用于存储一组程序指令,所述处理器603用于调用所述存储器601存储的程序指令执行如下操作:Referring to FIG. 6, FIG. 6 is a schematic diagram of a hardware structure of a memory control device according to an embodiment of the present invention. The memory control device 600 includes a memory 601 and a receiver 602, and the memory 601 and the receiver respectively. The processor 603 is configured to store a set of program instructions, and the processor 603 is configured to invoke the program instructions stored by the memory 601 to perform the following operations:
触发所述接收器602接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程;Triggering the receiver 602 to receive a control policy for physical memory and a corresponding trigger condition, the control policy carrying upper layer semantic information for implementing the control policy, the trigger condition including a change of status information of the physical memory And/or an access process received by the memory control device;
监听物理内存的状态信息以及所述访问进程;Monitoring status information of physical memory and the access process;
当满足所述触发条件时,调用相应的控制策略对所述物理内存进行控制。When the trigger condition is met, the corresponding control strategy is invoked to control the physical memory.
可选地,所述处理器603可以为中央处理器(Central Processing Unit,CPU),所述存储器601可以为随机存取存储器(Random Access Memory,RAM)类型的内部存储器,所述接收器602可以包含普通物理接口, 所述物理接口可以为以太(Ethernet)接口或异步传输模式(Asynchronous Transfer Mode,ATM)接口。所述处理器603、接收器602和存储器601可以集成为一个或多个独立的电路或硬件,如:专用集成电路(Application Specific Integrated Circuit,ASIC)。Optionally, the processor 603 may be a central processing unit (CPU), and the memory 601 may be an internal memory of a random access memory (RAM) type, and the receiver 602 may be Contains a common physical interface, The physical interface may be an Ethernet interface or an Asynchronous Transfer Mode (ATM) interface. The processor 603, the receiver 602, and the memory 601 may be integrated into one or more independent circuits or hardware, such as an Application Specific Integrated Circuit (ASIC).
需要说明的是,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。It should be noted that those skilled in the art can understand that all or part of the process of implementing the foregoing embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage. In the medium, the program, when executed, may include the flow of an embodiment of the methods as described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上对本发明所提供的一种内存控制方法和装置进行了详细介绍,本文中应用了具体实施例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。 The foregoing is a detailed description of a memory control method and apparatus provided by the present invention. The principles and embodiments of the present invention are described herein with reference to specific embodiments. The description of the above embodiments is only for helping to understand the method of the present invention. And the core idea of the present invention; at the same time, those skilled in the art, according to the idea of the present invention, there will be changes in the specific embodiments and application scope. In summary, the content of the present specification should not be construed as the present invention. limits.

Claims (14)

  1. 一种内存控制方法,其特征在于,所述方法包括:A memory control method, the method comprising:
    内存控制设备接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程;The memory control device receives a control policy for the physical memory and a corresponding trigger condition, where the control policy carries upper layer semantic information for implementing the control policy, where the trigger condition includes a change in state information of the physical memory and/or The access process received by the memory control device;
    所述内存控制设备监听物理内存的状态信息以及所述访问进程;The memory control device monitors status information of the physical memory and the access process;
    当满足所述触发条件时,所述内存控制设备调用相应的控制策略对所述物理内存进行控制。When the trigger condition is met, the memory control device invokes a corresponding control policy to control the physical memory.
  2. 根据权利要求1所述的方法,其特征在于,The method of claim 1 wherein
    所述物理内存的地址信息包括物理地址和虚拟地址;The address information of the physical memory includes a physical address and a virtual address;
    所述内存控制设备通过自身包括的翻译后备缓冲器TLB对所述物理内存的物理地址和虚拟地址之间进行虚实地址转换操作,使得:The memory control device performs a virtual real address translation operation between the physical address and the virtual address of the physical memory by using a translation look-aside buffer TLB included in the memory control device, so that:
    所述访问进程使用所述物理内存的虚拟地址通过所述内存控制设备访问所述物理内存;所述内存控制设备通过所述虚实地址转换操作,使用所述物理内存的物理地址对所述物理内存进行控制。The access process accesses the physical memory by using the virtual address of the physical memory through the memory control device; the memory control device uses the physical address of the physical memory to the physical memory by using the virtual real address translation operation Take control.
  3. 根据权利要求1或2所述的方法,其特征在于,当所述触发条件包括所述访问进程具体为请求锁定页面时,包括:The method according to claim 1 or 2, wherein when the triggering condition includes that the accessing process is specifically a request to lock a page, the method includes:
    当所述内存控制设备监听到所述访问进程具体为锁定指定页面在所述物理内存中时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process is specifically locking the specified page in the physical memory, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically include:
    所述内存控制设备解析所述访问进程中使用的指定页面的物理内存地址信息确定出所述指定页面的物理页面信息;The memory control device parses physical memory address information of the specified page used in the access process to determine physical page information of the specified page;
    若所述指定页面处于所述物理内存中,所述内存控制设备将所述指定页面锁定在所述物理内存中;And if the specified page is in the physical memory, the memory control device locks the specified page in the physical memory;
    若所述指定页面不在所述物理内存中,所述内存控制设备将所述指定页面换入并锁定在所述物理内存中。If the specified page is not in the physical memory, the memory control device swaps in and locks the specified page in the physical memory.
  4. 根据权利要求3所述的方法,其特征在于,当所述访问进程具体包括请求为直接内存存取缓冲区DMA Buffer分配物理页面时,包括:The method according to claim 3, wherein when the accessing process specifically comprises requesting to allocate a physical page for the direct memory access buffer DMA Buffer, the method comprises:
    当所述内存控制设备监听到所述访问进程具体为DMA Buffer分配物 理页面时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process is specifically a DMA Buffer distributor When the page is processed, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, including:
    所述内存控制设备从所述物理内存中为所述DMA Buffer分配物理页面;The memory control device allocates a physical page for the DMA Buffer from the physical memory;
    所述内存控制设备将分配的所述物理页面锁定在所述物理内存中,并将所述物理页面对应的页表项锁定在所述TLB中。The memory control device locks the allocated physical page in the physical memory, and locks a page table entry corresponding to the physical page in the TLB.
  5. 根据权利要求1或2所述的方法,其特征在于,当所述触发条件包括所述访问进程具体导致缺页中断发生时,包括:The method according to claim 1 or 2, wherein when the triggering condition includes that the accessing process specifically causes a page fault interrupt to occur, the method includes:
    当所述内存控制设备监听到所述访问进程具体导致缺页中断发生时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device detects that the access process specifically causes a page fault interrupt to occur, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically:
    所述内存控制设备确定出导致缺页中断的页面的替换页面并反馈至发送所述访问进程的发送方。The memory control device determines a replacement page of the page that caused the page fault interrupt and feeds back to the sender that sent the access process.
  6. 根据权利要求1或2所述的方法,其特征在于,当所述触发条件包括所述物理内存的状态信息的变化具体为内存容量发生变化时,包括:The method according to claim 1 or 2, wherein when the triggering condition includes a change in state information of the physical memory, specifically, a change in memory capacity, the method includes:
    当所述内存控制设备监听到所述物理内存的状态信息的变化具体为内存容量发生变化时,满足所述触发条件,所述内存控制设备调用相应的控制策略对所述物理内存进行控制,具体包括:When the memory control device monitors that the change of the state information of the physical memory is specifically changed by the memory capacity, the triggering condition is met, and the memory control device invokes a corresponding control policy to control the physical memory, specifically include:
    当所述物理内存容量发生变化具体为所述物理内存容量增加时,所述内存控制设备确定增加的物理内存的容量以及类型,并更新所述物理内存变化后的状态信息;When the physical memory capacity changes, specifically, the physical memory capacity increases, the memory control device determines the capacity and type of the increased physical memory, and updates the state information after the physical memory change;
    当所述物理内存容量发生变化具体为所述物理内存容量减少时,所述内存控制设备将减少的物理内存中存储的页面内容复制到所述物理内存中剩余内存的空闲空间中,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity decreases, the memory control device copies the reduced page content stored in the physical memory to the free space of the remaining memory in the physical memory, and updates the State information after a change in physical memory.
  7. 根据权利要求1至6任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 6, further comprising:
    当所述物理内存的状态信息发生变化时,所述内存控制设备将所述物理内存变化后的状态信息反馈至发送所述针对物理内存的控制策略以及相应的触发条件的发送方,所述变化包括内存容量变化、内存类型变化或内存使用率满足预定阈值;When the state information of the physical memory changes, the memory control device feeds back the state information after the physical memory change to the sender that sends the control policy for the physical memory and the corresponding trigger condition, the change Including memory capacity changes, memory type changes, or memory usage rates that meet predetermined thresholds;
    所述内存控制设备接收所述发送方所发送的对应所述物理内存变化后的状态信息的控制策略以及相应的触发条件。 The memory control device receives a control policy sent by the sender corresponding to the changed state information of the physical memory and a corresponding trigger condition.
  8. 一种内存控制装置,其特征在于,包括:A memory control device, comprising:
    接收单元,用于接收针对物理内存的控制策略以及相应的触发条件,所述控制策略携带用于实现所述控制策略的上层语义信息,所述触发条件包括所述物理内存的状态信息的变化和/或所述内存控制设备接收到的访问进程;a receiving unit, configured to receive a control policy for the physical memory and a corresponding triggering condition, where the control policy carries upper layer semantic information for implementing the control policy, where the triggering condition includes a change of state information of the physical memory / or the access process received by the memory control device;
    监听单元,用于监听物理内存的状态信息以及所述访问进程;a monitoring unit, configured to monitor status information of the physical memory and the access process;
    控制单元,用于当所述监听单元的结果满足所述触发条件时,调用相应的控制策略对所述物理内存进行控制。And a control unit, configured to: when the result of the listening unit meets the trigger condition, invoke a corresponding control policy to control the physical memory.
  9. 根据权利要求8所述的装置,其特征在于,当所述物理内存的地址信息包括物理地址和虚拟地址时,还包括:The device according to claim 8, wherein when the address information of the physical memory includes a physical address and a virtual address, the method further includes:
    转换单元,用于通过自身包括的翻译后备缓冲器TLB对所述物理内存的物理地址和虚拟地址之间进行虚实地址转换操作,使得:And a converting unit, configured to perform a virtual real address translation operation between the physical address and the virtual address of the physical memory by using a translation look-aside buffer TLB included by the translation buffer TLB:
    所述访问进程使用所述物理内存的虚拟地址通过所述转换单元访问所述物理内存;所述转换单元通过所述虚实地址转换操作,使用所述物理内存的物理地址对所述物理内存进行控制。The access process uses the virtual address of the physical memory to access the physical memory through the conversion unit; the conversion unit controls the physical memory by using the physical address of the physical memory by the virtual real address translation operation .
  10. 根据权利要求8或9所述的装置,其特征在于,包括:The device according to claim 8 or 9, comprising:
    所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体为请求锁定页面时,具体用于:When the result of the monitoring unit meets the triggering condition, the control unit specifically uses the request to lock the page, and is specifically used to:
    解析所述访问进程中使用的指定页面的物理内存地址信息确定出所述指定页面的物理页面信息;Parsing physical memory address information of the specified page used in the access process to determine physical page information of the specified page;
    若所述指定页面处于所述物理内存中,将所述指定页面锁定在所述物理内存中;If the specified page is in the physical memory, the specified page is locked in the physical memory;
    若所述指定页面不在所述物理内存中,将所述指定页面换入并锁定在所述物理内存中。If the specified page is not in the physical memory, the specified page is swapped in and locked in the physical memory.
  11. 根据权利要求10所述的装置,其特征在于,包括:The device according to claim 10, comprising:
    所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体包括请求为直接内存存取缓冲区DMA Buffer分配物理页面时,具体用于:The control unit is specifically configured to: when the result of the listening unit meets the trigger condition, that the access process specifically includes requesting to allocate a physical page for the direct memory access buffer DMA Buffer,
    从所述物理内存中为所述DMA Buffer分配物理页面;Allocating a physical page for the DMA Buffer from the physical memory;
    将分配的所述物理页面锁定在所述物理内存中,并将所述物理页面对应的页表项锁定在所述TLB中。 The allocated physical page is locked in the physical memory, and the page table entry corresponding to the physical page is locked in the TLB.
  12. 根据权利要求8或9所述的装置,其特征在于,包括:The device according to claim 8 or 9, comprising:
    所述控制单元当所述监听单元的结果满足触发条件包括所述访问进程具体导致缺页中断发生时,具体用于:The control unit is specifically configured to: when the result of the listening unit meets the trigger condition, that the access process specifically causes a page fault interrupt to occur, specifically:
    确定出导致缺页中断的页面的替换页面并反馈至发送所述访问进程的发送方。A replacement page of the page that caused the page fault interrupt is determined and fed back to the sender that sent the access process.
  13. 根据权利要求8或9所述的装置,其特征在于,包括:The device according to claim 8 or 9, comprising:
    所述控制单元当所述监听单元的结果满足触发条件包括所述触发条件包括所述物理内存的状态信息的变化具体为内存容量发生变化时,具体用于:The control unit is specifically configured to: when the result of the monitoring unit meets the triggering condition, the triggering condition includes that the change of the state information of the physical memory is specifically changed by the memory capacity, specifically:
    当所述物理内存容量发生变化具体为所述物理内存容量减少时,将减少的物理内存中存储的页面内容复制到所述物理内存中剩余内存的空闲空间中,并更新所述物理内存变化后的状态信息。When the physical memory capacity changes, specifically, the physical memory capacity is reduced, copying the page content stored in the reduced physical memory into the free space of the remaining memory in the physical memory, and updating the physical memory after the change Status information.
  14. 根据权利要求8至13任一项所述的装置,其特征在于,还包括:The device according to any one of claims 8 to 13, further comprising:
    反馈单元,用于当所述物理内存的状态信息发生变化时,将所述物理内存变化后的状态信息反馈至发送所述针对物理内存的控制策略以及相应的触发条件的发送方,所述变化包括内存容量变化、内存类型变化或内存使用率满足预定阈值;a feedback unit, configured to: when the state information of the physical memory changes, feed back the state information after the physical memory is changed to a sender that sends the control policy for the physical memory and a corresponding trigger condition, where the change Including memory capacity changes, memory type changes, or memory usage rates that meet predetermined thresholds;
    所述接收单元,还用于接收所述发送方所发送的对应所述物理内存变化后的状态信息的控制策略以及相应的触发条件。 The receiving unit is further configured to receive a control policy that is sent by the sender and corresponding to the state information after the change of the physical memory, and a corresponding trigger condition.
PCT/CN2015/075704 2014-06-30 2015-04-01 Memory control method and device WO2016000470A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410307864.8A CN105335306B (en) 2014-06-30 2014-06-30 A kind of internal memory control method and device
CN201410307864.8 2014-06-30

Publications (1)

Publication Number Publication Date
WO2016000470A1 true WO2016000470A1 (en) 2016-01-07

Family

ID=55018411

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/075704 WO2016000470A1 (en) 2014-06-30 2015-04-01 Memory control method and device

Country Status (2)

Country Link
CN (1) CN105335306B (en)
WO (1) WO2016000470A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144714A (en) * 2017-06-19 2019-01-04 中兴通讯股份有限公司 EMS memory management process and device

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109002706B (en) * 2018-06-08 2021-04-06 中国科学院计算技术研究所 In-process data isolation protection method and system based on user-level page table
CN112236755A (en) * 2018-09-30 2021-01-15 华为技术有限公司 Memory access method and device
CN110008156B (en) * 2019-03-27 2020-12-15 无锡海斯凯尔医学技术有限公司 Data transmission device, method and readable storage medium
CN113125764B (en) * 2019-12-30 2023-08-25 深圳迈瑞生物医疗电子股份有限公司 Sample analyzer, automatic maintenance method thereof and readable storage medium
CN113590500A (en) * 2020-04-30 2021-11-02 华为技术有限公司 Memory management method and terminal equipment
CN111666226B (en) * 2020-06-16 2022-09-13 北京紫光展锐通信技术有限公司 Page bump protection method for operating system memory recovery and user equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103515A (en) * 2009-12-22 2011-06-22 联想(北京)有限公司 Memory management method, virtual machine monitor and computer
CN102609466A (en) * 2012-01-13 2012-07-25 广州从兴电子开发有限公司 Method and system for controlling shared memory

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198028B (en) * 2013-03-18 2015-12-23 华为技术有限公司 A kind of internal storage data moving method, Apparatus and system
CN103488588A (en) * 2013-10-09 2014-01-01 中国科学院计算技术研究所 Memory protection method and system and network interface controller

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102103515A (en) * 2009-12-22 2011-06-22 联想(北京)有限公司 Memory management method, virtual machine monitor and computer
CN102609466A (en) * 2012-01-13 2012-07-25 广州从兴电子开发有限公司 Method and system for controlling shared memory

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHEN, MINGYU ET AL.: "Studies of Key Technology on Message-based Memory System", NETWORK NEW MEDIA, vol. 2, no. 1, 31 January 2013 (2013-01-31), pages 31 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109144714A (en) * 2017-06-19 2019-01-04 中兴通讯股份有限公司 EMS memory management process and device

Also Published As

Publication number Publication date
CN105335306A (en) 2016-02-17
CN105335306B (en) 2018-02-13

Similar Documents

Publication Publication Date Title
WO2016000470A1 (en) Memory control method and device
EP3121731B1 (en) Memory management method and device
US10503405B2 (en) Zero copy memory reclaim using copy-on-write
US11487675B1 (en) Collecting statistics for persistent memory
JP5510556B2 (en) Method and system for managing virtual machine storage space and physical hosts
WO2017054610A1 (en) Computer, and method and apparatus for controlling quality of service
CN112115090A (en) Multi-protocol support for transactions
US10248175B2 (en) Off-line affinity-aware parallel zeroing of memory in non-uniform memory access (NUMA) servers
CN115039077A (en) Maintaining storage namespace identifiers for real-time virtualized execution environment migration
US20210216453A1 (en) Systems and methods for input/output computing resource control
EP3173931B1 (en) File access method, device and storage system
US9769081B2 (en) Buffer manager and methods for managing memory
KR20150132432A (en) Memory sharing over a network
EP3608790B1 (en) Modifying nvme physical region page list pointers and data pointers to facilitate routing of pcie memory requests
CA2987807C (en) Computer device and method for reading/writing data by computer device
WO2015180598A1 (en) Method, apparatus and system for processing access information of storage device
EP3598310B1 (en) Network interface device and host processing device
WO2014206078A1 (en) Memory access method, device and system
WO2016019566A1 (en) Memory management method, device and system and network-on-chip
US20190042454A1 (en) Techniques to manage cache resource allocations for a processor cache
US9921875B2 (en) Zero copy memory reclaim for applications using memory offlining
US11429413B2 (en) Method and apparatus to manage counter sets in a network interface controller
US20130297881A1 (en) Performing zero-copy sends in a networked file system with cryptographic signing
US20230342458A1 (en) Techniques to mitigate cache-based side-channel attacks
WO2017020194A1 (en) File system protection method, device and storage apparatus

Legal Events

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

Ref document number: 15815086

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15815086

Country of ref document: EP

Kind code of ref document: A1