CN105335306B - A kind of internal memory control method and device - Google Patents

A kind of internal memory control method and device Download PDF

Info

Publication number
CN105335306B
CN105335306B CN201410307864.8A CN201410307864A CN105335306B CN 105335306 B CN105335306 B CN 105335306B CN 201410307864 A CN201410307864 A CN 201410307864A CN 105335306 B CN105335306 B CN 105335306B
Authority
CN
China
Prior art keywords
memory
physical memory
physical
page
control equipment
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.)
Active
Application number
CN201410307864.8A
Other languages
Chinese (zh)
Other versions
CN105335306A (en
Inventor
陈荔城
刘垚
陈明宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
Original Assignee
Huawei Technologies Co Ltd
Institute of Computing Technology of CAS
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 Technologies Co Ltd, Institute of Computing Technology of CAS filed Critical Huawei Technologies Co Ltd
Priority to CN201410307864.8A priority Critical patent/CN105335306B/en
Priority to PCT/CN2015/075704 priority patent/WO2016000470A1/en
Publication of CN105335306A publication Critical patent/CN105335306A/en
Application granted granted Critical
Publication of CN105335306B publication Critical patent/CN105335306B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The embodiment of the invention discloses a kind of internal memory control method and device, including:Memory control equipment receives the control strategy and corresponding trigger condition for physical memory, the access process that the trigger condition includes the change of the status information of the physical memory and/or the Memory control equipment receives;The Memory control equipment monitors the status information of physical memory and the access process;When meeting the trigger condition, the corresponding control strategy of Memory control equipment calls is controlled to the physical memory, it can be seen that, Memory control equipment as hardware obtains necessary control strategy from system, complete the physical memory control semantic information needed for these control strategies, and the trigger condition of corresponding control measurement, so that when meeting a trigger condition, the Memory control equipment can call to should the control strategy of trigger condition the physical memory is controlled, system is no longer needed to carry out interrupt processing during control, improve control efficiency.

Description

A kind of internal memory control method and device
Technical field
The present invention relates to computer realm, more particularly to a kind of internal memory control method and device.
Background technology
In system operation, processor can be conducted interviews by access process to physical memory, presently mainly by soft Part, such as operating system (Operating System, OS), virtual machine monitor (Virtual Machine Monitor, VMM) Etc. being directly responsible for handling these access processes and physical memory be controlled accordingly.
System produces substantial amounts of Signalling exchange when carrying out Process flowchart to physical memory between meeting and physical memory, wherein Substantial portion of Signalling exchange, which is substantially all, needs system to pass through interrupt processing (such as page fault) to realize, and system Related context information when carrying out being required for preserving interrupt processing during interrupt processing every time in physical memory, such controlling stream Journey can expend substantial amounts of system resource.It can be seen that the expense for directly carrying out Process flowchart to physical memory by software systems is very big, In some systems, interrupt processing results even in the average retardation more than the 2600CPU clock cycle, leverages system Whole work efficiency.
As can be seen here, system is directly very low to carrying out the efficiency of Process flowchart as the physical memory of hardware.
The content of the invention
In order to solve the above-mentioned technical problem, the invention provides a kind of internal memory control method and device so that system passes through Hardware control device controls physical memory, improves efficiency.
The embodiment of the invention discloses following technical scheme:
In a first aspect, the invention provides a kind of internal memory control method, methods described includes:
Memory control equipment receives the control strategy and corresponding trigger condition for physical memory, the control strategy The upper strata semantic information for realizing the control strategy is carried, the trigger condition includes the status information of the physical memory Change and/or the access process that receives of the Memory control equipment;
The Memory control equipment monitors the status information of physical memory and the access process;
When meeting the trigger condition, the corresponding control strategy of Memory control equipment calls is to the physical memory It is controlled.
In the first possible implementation of first aspect,
The address information of the physical memory includes physical address and virtual address;
The translation look-aside buffer TLB that the Memory control equipment is included by itself to the physical memory physically Actual situation address translation operation is carried out between location and virtual address so that:
The access process accesses the thing using the virtual address of the physical memory by the Memory control equipment Manage internal memory;The Memory control equipment uses the physical address pair of the physical memory by the actual situation address translation operation The physical memory is controlled.
With reference to the possible implementation of the first of first aspect or first aspect, in second of possible implementation In, when it is specially to ask page locking that the trigger condition, which includes the access process, including:
It is specially to lock specified page in the physical memory when the Memory control equipment listens to the access process When middle, meet the trigger condition, the corresponding control strategy of Memory control equipment calls is controlled to the physical memory System, is specifically included:
The physical memory addresses information that the Memory control equipment parses the specified page used in the access process is true Make the physical page information of the specified page;
If the specified page is in the physical memory, the specified page is locked in by the Memory control equipment In the physical memory;
If the specified page, not in the physical memory, the Memory control equipment changes to the specified page simultaneously It is locked in the physical memory.
With reference to second of possible implementation of first aspect, in the third possible implementation, when the visit The process of asking specifically include request for direct memory access buffering area DMA Buffer distribute physical page when, including:
It is full when it is specially DMA Buffer distribution physical pages that the Memory control equipment, which listens to the access process, The foot trigger condition, the corresponding control strategy of Memory control equipment calls are controlled to the physical memory, specifically Including:
The Memory control equipment is the DMA Buffer distribution physical page from the physical memory;
The physical page of distribution is locked in the physical memory by the Memory control equipment, and by the physics Page table entry corresponding to the page is locked in the TLB.
With reference to the possible implementation of the first of first aspect or first aspect, in the 4th kind of possible implementation In, when the trigger condition, which includes the access process, specifically causes page faults to occur, including:
When the Memory control equipment, which listens to the access process, specifically causes page faults to occur, meet described touch Clockwork spring part, the corresponding control strategy of Memory control equipment calls are controlled to the physical memory, specifically included:
The replacement page for the page that the Memory control equipment is determined to cause page faults simultaneously feeds back to the transmission visit Ask the sender of process.
With reference to the possible implementation of the first of first aspect or first aspect, in the 5th kind of possible implementation In, when the change that the trigger condition includes the status information of the physical memory is specially that memory size changes, bag Include:
When the change for the status information that the Memory control equipment listens to the physical memory is specially memory size hair During changing, meet the trigger condition, the corresponding control strategy of Memory control equipment calls enters to the physical memory Row control, is specifically included:
When the physical memory capacity changes the specially physical memory capacity increase, the Memory control is set It is standby to determine the capacity and type of increased physical memory, and update the status information after the physical memory change;
When the physical memory capacity changes the specially physical memory capacity reduction, the Memory control is set It is standby to copy to the content of pages stored in the physical memory of reduction in the physical memory in the free space of free memory, and Update the status information after the physical memory change.
With reference to the first or second or the third or the 4th kind or the 5th kind of possibility of first aspect or first aspect Implementation, in the 6th kind of possible implementation, in addition to:
When the status information of the physical memory changes, the Memory control equipment changes the physical memory For the control strategy of physical memory and the sender of corresponding trigger condition, institute described in status information feedback afterwards to transmission State change include memory size change, type of memory change or memory usage meet predetermined threshold;
The Memory control equipment receives the state letter after the correspondence physical memory change transmitted by described sender The control strategy of breath and corresponding trigger condition.
Second aspect, the invention provides a kind of Memory control device, including:
Receiving unit, for receiving control strategy and corresponding trigger condition for physical memory, the control plan The upper strata semantic information for realizing the control strategy is slightly carried, the state that the trigger condition includes the physical memory is believed The access process that the change of breath and/or the Memory control equipment receive;
Monitoring unit, for the status information for monitoring physical memory and the access process;
Control unit, for when the result of the monitoring unit meets the trigger condition, calling corresponding control plan Slightly the physical memory is controlled.
In the first possible implementation of second aspect, it is characterised in that when the address of the physical memory is believed When breath includes physical address and virtual address, in addition to:
Converting unit, the physical address for the translation look-aside buffer TLB that is included by itself to the physical memory Actual situation address translation operation is carried out between virtual address so that:
The access process is accessed in the physics using the virtual address of the physical memory by the converting unit Deposit;The converting unit is by the actual situation address translation operation, using the physical address of the physical memory to the physics Internal memory is controlled.
With reference to the possible implementation of the first of second aspect or second aspect, in second of possible implementation In, including:
Described control unit is specially to ask when the result of the monitoring unit meets that trigger condition includes the access process When seeking page locking, it is specifically used for:
The physical memory addresses information for parsing the specified page used in the access process determines the specified page Physical page information;
If the specified page is in the physical memory, the specified page is locked in the physical memory;
If the specified page is changed to and is locked in the physics not in the physical memory, by the specified page In depositing.
With reference to second of possible implementation of second aspect, in the third possible implementation, including:
Described control unit meets that trigger condition specifically includes including the access process when the result of the monitoring unit When asking to distribute physical page for direct memory access buffering area DMA Buffer, it is specifically used for:
It is the DMA Buffer distribution physical page from the physical memory;
The physical page of distribution is locked in the physical memory, and by page table entry corresponding to the physical page It is locked in the TLB.
With reference to the possible implementation of the first of second aspect or second aspect, in the 4th kind of possible implementation In, including:
Described control unit meets that trigger condition includes the access process and specifically caused when the result of the monitoring unit When page faults occur, it is specifically used for:
The replacement page for the page for determining to cause page faults simultaneously feeds back to the sender for sending the access process.
With reference to the possible implementation of the first of second aspect or second aspect, in the 5th kind of possible implementation In, including:
Described control unit meets that trigger condition includes the trigger condition including described when the result of the monitoring unit When the change of the status information of physical memory is specially that memory size changes, it is specifically used for:
When the physical memory capacity changes the specially physical memory capacity reduction, by the physics of reduction The content of pages of storage is copied in the physical memory in the free space of free memory, and updates the physical memory Status information after change.
With reference to the first or second or the third or the 4th kind or the 5th kind of possibility of second aspect or second aspect Implementation, in the 6th kind of possible implementation, in addition to:
Feedback unit, for when the status information of the physical memory changes, after the physical memory is changed Status information feedback to the sender for sending the control strategy for physical memory and corresponding trigger condition, it is described Change includes memory size change, type of memory change or memory usage and meets predetermined threshold;
The receiving unit, it is additionally operable to receive the state after the correspondence physical memory change transmitted by described sender The control strategy of information and corresponding trigger condition.
It can be seen from above-mentioned technical proposal as hardware Memory control equipment from system obtain necessary control strategy, Complete the physical memory control semantic information needed for these control strategies, and the trigger condition of corresponding control measurement so that when Meet a trigger condition when, the Memory control equipment can call to should trigger condition control strategy to the physics Internal memory is controlled, and is no longer needed system to carry out interrupt processing during control, is improved control efficiency.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is the required accompanying drawing used in technology description to be briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, without having to pay creative labor, may be used also To obtain other accompanying drawings according to these accompanying drawings.
Fig. 1 is a kind of method flow diagram of Memory control provided in an embodiment of the present invention;
Fig. 2 is the method schematic diagram provided in an embodiment of the present invention that physical page locking is carried out to physical memory;
Fig. 3 is a kind of structure drawing of device of Memory control provided in an embodiment of the present invention;
Fig. 4 is a kind of structure drawing of device of Memory control provided in an embodiment of the present invention;
Fig. 5 is a kind of structure drawing of device of Memory control provided in an embodiment of the present invention;
Fig. 6 is a kind of hardware architecture diagram of Memory control equipment provided in an embodiment of the present invention.
Embodiment
From the prior art as can be seen that using the system (OS) as software to control the physical memory as hardware to need Frequently software and hardware to interact, cause it very big to the expense of system in itself, and substantial amounts of processing delay can be caused.But In fact, the control feature to physical memory is, most of control operation to physical memory is comparatively all fairly simple, and It is not required to complete using complicated software, other hardware (such as Memory Controller Hub, Memory can be used completely Controller these control operations are performed), such as sentencing of accessing of the judgement that accesses illegal address, the first time of the page And page replacement etc..For this feature, the embodiments of the invention provide a kind of internal memory control method and device, using as hard The Memory control equipment of part controls semantic from the necessary control strategy of system acquisition, the physical memory completed needed for these control strategies Information, and the trigger condition of corresponding control measurement so that when meeting a trigger condition, the Memory control equipment can be with Call to should the control strategy of trigger condition the physical memory is controlled, no longer need system to enter during control Row interrupt processing, substantially increases control efficiency.
The characteristics of embodiment of the present invention has physical address and virtual address also directed to physical memory, it can carry out virtual Hardware (such as the more typical translation look-aside buffer (Translation of address conversion between address and physical address Lookaside Buffer, TLB)) part of the integration as the Memory control equipment so that the Memory control equipment The access process that physical memory is accessed using virtual address can be handled, further improves the applicable model of the embodiment of the present invention Enclose.
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is explicitly described, it is clear that described embodiment be the present invention Part of the embodiment, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art are not having The every other embodiment obtained under the premise of creative work is made, belongs to the scope of protection of the invention.
Embodiment one
The present embodiment will be described to how internal memory control device is controlled to physical memory, referring to Fig. 1, it is A kind of method flow diagram of Memory control provided in an embodiment of the present invention, this method include:
S101:Memory control equipment receives the control strategy and corresponding trigger condition for physical memory, the control System strategy carries the upper strata semantic information for realizing the control strategy, and the trigger condition includes the shape of the physical memory The access process that the change of state information and/or the Memory control equipment receive.
Explanation is needed exist for, control strategy described here is mainly used for instructing the Memory control equipment to control Physical memory, such as the free physical memory quota of access process is limited, page priorities, page locking etc. are formulated, so And perform these control strategies and need to use corresponding upper strata semantic information such as operational order etc., it can include:The wound of process Build or terminate, virtual address distribution or release etc., send operational order, for example how to lock (Pin) physical page in physics In internal memory, page table entry corresponding to mono- section of virtual address space of Pin is in TLB etc..The upper strata semantic information also refers to originally hard Do not include in part, the semantic information mainly performed by software.
Trigger condition described in this can have one or more, and each trigger condition can correspond to one or more Control strategy, related content will carry out expansion explanation for different concrete conditions in embodiment two, repeat no more here.
The Memory control equipment can have various ways to obtain these control strategies and corresponding trigger condition, such as Say and obtained from system (OS), or by pre-setting, how the present invention obtains the system to the Memory control equipment Strategy and corresponding trigger condition are without limiting.
S102:The Memory control equipment monitors the status information of physical memory and the access process.
S103:When meeting the trigger condition, the corresponding control strategy of Memory control equipment calls is to the thing Reason internal memory is controlled.
This two step it should be noted that due to the control strategy and trigger condition that are obtained in S101 be have pair It should be related to, therefore once meet a trigger condition, because the Memory control equipment 6 has had been provided with necessary upper strata language Adopted information, therefore control strategy corresponding to the Memory control equipment calls can use upper strata semantic information according to control strategy Handled accordingly, such as lock a specified page in physical memory, processing page faults etc. need system originally The just treatable situation related to physical memory.Judge that the classification of the access process can be by accessing process identification (PID) (pid) complete.
It can be seen that the Memory control equipment as hardware obtains necessary control strategy from system, completes these control strategy institutes The physical memory control semantic information needed, and the trigger condition of corresponding control measurement so that when meeting a trigger condition, The Memory control equipment can call to should the control strategy of trigger condition the physical memory is controlled, control During no longer need system carry out interrupt processing, substantially increase control efficiency.
Embodiment two
The present embodiment will carry out expansion explanation on the basis of embodiment one to the trigger condition, and according to different Describe how the Memory control equipment is handled and be controlled to the physical memory exemplified by trigger condition.
, it is necessary to first include physical address and virtual address for physical memory before to trigger condition expansion explanation The characteristics of be described, typically there are mapping relations between the physical address and the virtual address, in the prior art, make , it is necessary to pay close attention to the physical address of physical memory when system for software controls or accesses physical memory, such as to the physics , it is necessary to there is a variety of limitations when internal memory performs direct memory access (DMA) (Direct Memory Access, DMA) operational order, than Such as say that physical address must be continuous, it is necessary to since low address etc., operating process is comparatively laborious.In the embodiment of the present invention In, the Memory control equipment integrates TLB as the part of itself, and the translation function of actual situation address is flexible Apply in the control to physical memory.Optionally, the embodiment of the present invention also includes:
The address information of the physical memory includes physical address and virtual address.
The TLB that the Memory control equipment is included by itself to the physical address and virtual address of the physical memory it Between carry out actual situation address translation operation so that:
The access process accesses the thing using the virtual address of the physical memory by the Memory control equipment Manage internal memory;The Memory control equipment uses the physical address pair of the physical memory by the actual situation address translation operation The physical memory is controlled.
That is, it can directly use the virtual address of the physical memory for the access process of the physical memory Conduct interviews, so as in some cases, it is no longer necessary to the physical address of the physical memory in view of being accessed it is whether continuous and Since low address, it is only necessary to directly carry out associative operation using continuous virtual address, detailed content will be described How Memory control equipment supports the part of dma operation to be described.
Next expansion explanation is carried out to the trigger condition, and according to describing the internal memory exemplified by different trigger conditions How control device is handled and be controlled to the physical memory, and the embodiments of the invention provide at least five kinds of different triggerings Condition, these trigger conditions can be realized or add in the present embodiment on the basis of embodiment one Realized on the basis of actual situation address conversion, the present invention is to this without limiting.
The first situation:
Optionally, when it is specially to ask page locking that the trigger condition, which includes the access process, including:
It is specially to ask locking specified page in the physics when the Memory control equipment listens to the access process When in internal memory, meet the trigger condition, the corresponding control strategy of Memory control equipment calls enters to the physical memory Row control, is specifically included:
The physical memory addresses information that the Memory control equipment parses the specified page used in the access process is true Make the physical page information of the specified page.
If the specified page is in the physical memory, the specified page is locked in by the Memory control equipment In the physical memory.
If the specified page, not in the physical memory, the Memory control equipment changes to the specified page simultaneously It is locked in the physical memory.
The page preserved in physical memory in itself and can not be understood for current application scene due to Memory control equipment Priority height or significance level, when being controlled to the physical memory, it is more likely that important Page swap-out can be arrived Outside physical memory, cause the reduction of system treatment effeciency, therefore system is after the priority or significance level in view of the page, in order to Some important pages are prevented to be paged out physical memory, system can send the access of locking specified page to the Memory control equipment Process.It is corresponding equivalent to triggering when the Memory control equipment receives the access process for requiring locking specified page Trigger condition, the Memory control equipment will call corresponding to control strategy, including query page, page locking etc..
Further illustrate by way of example,
For example on the basis of embodiment adds actual situation address conversion, the application scenarios of page locking may refer to figure 2, Fig. 2 be the method schematic diagram provided in an embodiment of the present invention that physical page locking is carried out to physical memory, as shown in Figure 2:
S201:System sends the sector address spaces of Pin mono- (can refer to a specified page) to the Memory control equipment Access process in internal memory, the form of the access process (or crying Pin orders) can be:Pin start_addr len (or Pin pid).The Pin orders are added into the command queue of the Memory control equipment.The Pin orders can pass through Calling mlock or the mlock_all function of system standard are encapsulated and realized, so as to keep system interface compatibility, it is not necessary to right Application system carries out any modification, and do not need system break to be switched to kernel state, also should not system handle.
S202:When the Memory control equipment is dispatched from command queue goes to the Pin orders, described in acquisition The action type (Pin) and operating parameter (a sector address space) of Pin orders.
S203:The virtual address for the specified page that the Memory control equipment obtains according to parsing, using the page to be single The TLB that position is inquired about in the Memory control equipment, the physical address of the specified page corresponding to acquisition.
S204:If the specified page is not yet distributed, the Memory control equipment is by setting the specified page Attribute is locking (PG_mlocked), realizes and the specified page is locked in the physical memory.Afterwards to described During physical memory is operated, the locked specified page will not be swapped out from the physical memory.
If physical page is paged out (present=0), the Memory control equipment starts change (Swap), by institute Specified page change is stated into the physical memory, the operation of page locking is further performed to the specified page.
S205:After the completion of Pin orders execution, the Memory control equipment can also further notify system, Such as transmittable response (Response) information.
Second of situation:
Optionally, it is direct memory access buffering area (Direct Memory when the access process specifically includes request Access Buffer, DMA Buffer) distribution physical page when, including:
It is full when it is specially DMA Buffer distribution physical pages that the Memory control equipment, which listens to the access process, The foot trigger condition, the corresponding control strategy of Memory control equipment calls are controlled to the physical memory, specifically Including:
The Memory control equipment is the DMA Buffer distribution physical page from the physical memory;
The physical page of distribution is locked in the physical memory by the Memory control equipment, and by the physics Page table entry corresponding to the page is locked in the TLB.
For DMA it should be noted that the scopes applied at present of DMA are very wide, such as now from the file read-write number in disk DMA is needed to use during according to internal memory;Needed to use during from network interface card transceiver network bag to internal memory to DMA;From PCIE device Memory space is read to need to use DMA when writing data to internal memory.
That is, the access process distributes one section in the continuous DMA of virtual address space by operating system Buffer (buffering area) space, and send one section of DMA Buffer (buffering area) physical space of request to the Memory Controller Hub Order;
The Memory Controller Hub performs the order of distribution DMA Buffer physical spaces, and hardware distribution corresponds to physical page, And by these page lockings in internal memory, and its corresponding page table entry is locked in the TLB in the Memory Controller Hub;At this moment The physical page waited as DMA Buffer distribution can be distributed arbitrarily, and no longer need to take one section of continuous physical address sky Between;Thus the limitation that DMA requires DMA Buffer the continuous physical page has been broken.
Operating system is using virtual address space corresponding to DMA Buffer and needs the disk space information that accesses to DMA Controller sends DMA request.
Dma controller sends reading and writing data to the Memory Controller Hub using virtual address and asked;
The Memory Controller Hub directly obtains corresponding physical address using the TLB of virtual address inquiry thereon, so as to realize By data from peripheral hardware be read into DMA Buffer (such as disk) where physical page or data are write back to from DMA Buffer Peripheral hardware.
The third situation:
Optionally, when the trigger condition, which includes the access process, specifically causes page faults to occur, including:
When the Memory control equipment, which listens to the access process, specifically causes page faults to occur, meet described touch Clockwork spring part, the corresponding control strategy of Memory control equipment calls are controlled to the physical memory, specifically included:
The replacement page for the page that the Memory control equipment is determined to cause page faults simultaneously feeds back to the transmission visit Ask the sender of process.
Explanation is needed exist for, the situation of the page faults is primarily referred to as the page object that the access process is accessed Face is not stored in the situation in the physical memory.It is described when causing the situation of page faults to occur due to access process Memory control equipment needs to determine to replace the page for current page faults.For prior art, originally in existing skill Needed in art system carry out determination replace the page flow, in embodiments of the present invention can by the Memory control equipment Lai Complete, that is to say, that it is determined that replacing the page and the page instead of searching blank page in the flow of the page, whether can be used as and be No clean wait can be completed by the Memory control equipment.This greatly simplifies the operation of the system when there are page faults Burden, improves system processing speed.
4th kind of situation:
Optionally, when the change that the trigger condition includes the status information of the physical memory is specially memory size hair During changing, including:
When the change for the status information that the Memory control equipment listens to the physical memory is specially memory size hair During changing, meet the trigger condition, the corresponding control strategy of Memory control equipment calls enters to the physical memory Row control, is specifically included:
When the physical memory capacity changes the specially physical memory capacity increase, the Memory control is set It is standby to determine the capacity and type of increased physical memory, and update the status information after the physical memory change.
When the physical memory capacity changes the specially physical memory capacity reduction, the Memory control is set It is standby to copy to the content of pages stored in the physical memory of reduction in the physical memory in the free space of free memory, and Update the status information after the physical memory change.
Explanation is needed exist for, hot plug, the class of physical memory can be supported for physical memory at present Type is also various all the more, therefore the appearance amount and type of the physical memory of Memory control equipment control may all become at any time Change, in embodiments of the present invention, the Memory control equipment can monitor the change of the status information of the physical memory, and can Corresponding processing and operation are carried out with the change voluntarily to the capacity of the physical memory.
Further it is illustrated by practical application scene:
When carrying out hot plug action to the physical memory, bottom hardware (such as BIOS) is by corresponding memory hot plug thing Part (Hot plug) is sent to the Memory control equipment by corresponding interface, and corresponding interface can be advanced configuration With power-management interface (Advanced Configuration and Power Management Interface, ACPI).
The Memory control equipment is corresponding to adjust in the physical memory when receiving the memory hot plug event Storage organization, when the capacity of the physical memory adds, such as the situation for the physical memory newly plugged, the Memory control are set It is standby that the physical memory newly added is added in the Free List of memory management (if system is to be buddy system in Linux The free page chained list of (Buddy System));When the capacity of the physical memory reduces, such as the one of the physical memory The situation that part has been pulled out is, it is necessary to first by the valid data included in the physical memory pulled out into remaining physical memory In free page, and reset the corresponding relation in corresponding data and physical memory between storage address.So internal memory Processing of the control device to internal memory hot plug events no longer needs the participation of system, it is possible to achieve to the fully transparent of system.
Further, the Memory control equipment can also identify the type of physical memory, such as in the physics newly increased Situation about depositing, the storage class for the physical memory that the Memory control equipment determination newly increases, such as PCM or DRAM etc.. Such as the situation of physical memory is reduced, the Memory control equipment determines the storage class of remaining physical memory.When described interior When depositing control device needs the data storage into the physical memory, different types of data can be deposited according to the type of data In the physical memory for storing up corresponding type, for example, according to PCM it is non-volatile the characteristics of, system indicates the Memory control equipment Important data structure is placed on PCM spaces, improves the reliability and stability of system.Read to write the characteristics of slow soon according to PCM, be System can indicate that the code segment of program and read-only data section are placed on PCM spaces by the Memory control equipment.Other write access compared with Intensive data can be assigned to that in dram space.
5th kind of situation:
Optionally, in addition to:
When the status information of the physical memory changes, the Memory control equipment changes the physical memory For the control strategy of physical memory and the sender of corresponding trigger condition, institute described in status information feedback afterwards to transmission State change include memory size change, type of memory change or memory usage meet predetermined threshold;
The Memory control equipment receives the state letter after the correspondence physical memory change transmitted by described sender The control strategy of breath and corresponding trigger condition.
Explanation is needed exist for, this situation is primarily referred to as the Memory control equipment and is also equipped with to thing described in system feedback Manage the status information of internal memory, in order to system determined according to the status information of presently described physical memory corresponding to control plan Slightly, and the control strategy newly determined is sent to the Memory control equipment.By the institute for directly controlling the physical memory The feedback of Memory control equipment is stated, system can effectively grasp the change of the status information of the physical memory, with this to described Memory control equipment sends more practical control strategy, allows the Memory control equipment can be described in more targeted control Physical memory.
The 5th kind of situation is except can be on the basis of embodiment one or in the present embodiment with adding actual situation Realized on the basis of the conversion of location, can also at least combine and be carried out in fact with other four kinds of situations (the first situation to the 4th kind of situation) Apply.Such as the 5th kind of situation can be combined with the 4th kind of situation and implemented, and (namely be occurred there is the 4th kind of situation Hot plug events) when, change substantially occurs in the capacity or type of the physical memory, thus will trigger the described 5th Kind of situation, such system will the Memory control equipment feedback presently described physical memory status information to described Memory control equipment issues more targeted control strategy and corresponding trigger condition.The possibility combination of also a variety of triggerings, Here it is no longer exhaustive one by one.
As fully visible, the Memory control equipment as hardware obtains necessary control strategy from system, completes these control plans Slightly required physical memory control semantic information, and the trigger condition of corresponding control measurement so that when one triggering bar of satisfaction During part, the Memory control equipment can call to should the control strategy of trigger condition the physical memory is controlled, No longer need system to carry out interrupt processing during control, substantially increase control efficiency.
Embodiment three
Refering to Fig. 3, Fig. 3 is a kind of structure drawing of device of Memory control provided in an embodiment of the present invention, including:
Receiving unit 301, for receiving control strategy and corresponding trigger condition for physical memory, the control Strategy carries the upper strata semantic information for realizing the control strategy, and the trigger condition includes the state of the physical memory The access process that the change of information and/or the Memory control equipment receive.
Description about content performed by the receiving unit 301 refer to the associated description in the S101 of embodiment one, this In repeat no more.
Monitoring unit 302, for the status information for monitoring physical memory and the access process.
Description about content performed by the monitoring unit 302 refer to the associated description in the S102 of embodiment one, this In repeat no more.
Control unit 303, for when the result of the monitoring unit meets the trigger condition, calling corresponding control Strategy is controlled to the physical memory.
Description about content performed by described control unit 303 refer to the associated description in the S103 of embodiment one, this In repeat no more.
Optionally, on the basis of embodiment illustrated in fig. 3, when the physical memory address information include physical address and During virtual address, the Memory control device can further include converting unit 401, and Fig. 4 provides for the embodiment of the present invention A kind of Memory control structure drawing of device, as shown in figure 4, also including:
Converting unit 401, for the translation look-aside buffer TLB that is included by itself to the physical memory physically Actual situation address translation operation is carried out between location and virtual address so that:
The access process is accessed in the physics using the virtual address of the physical memory by the converting unit Deposit;The converting unit is by the actual situation address translation operation, using the physical address of the physical memory to the physics Internal memory is controlled.
Description about content performed by the converting unit 401 refer in embodiment two about physical address and virtual The associated description of actual situation address translation operation is carried out between address, is repeated no more here.
Next expansion explanation is carried out to the trigger condition, and according to describing the internal memory exemplified by different trigger conditions How control device is handled and be controlled to the physical memory, and the embodiments of the invention provide at least five kinds of different triggerings Condition, these trigger conditions can be realized or add in the present embodiment on the basis of embodiment one Realized on the basis of actual situation address conversion, the present invention is to this without limiting.
The first situation:
Optionally, including:
Described control unit is specially to lock when the result of the monitoring unit meets that trigger condition includes the access process When determining the page, it is specifically used for:
The physical memory addresses information for parsing the specified page used in the access process determines the specified page Physical page information;
If the specified page is in the physical memory, the specified page is locked in the physical memory;
If the specified page is changed to and is locked in the physics not in the physical memory, by the specified page In depositing.
Second of situation:
Optionally, including:
Described control unit meets that trigger condition specifically includes including the access process when the result of the monitoring unit When asking to distribute physical page for direct memory access buffering area DMA Buffer, it is specifically used for:
It is the DMA Buffer distribution physical page from the physical memory;
The physical page of distribution is locked in the physical memory, and by page table entry corresponding to the physical page It is locked in the TLB.
The third situation:
Optionally, including:
Described control unit meets that trigger condition includes the access process and specifically caused when the result of the monitoring unit When page faults occur, it is specifically used for:
The replacement page for the page for determining to cause page faults simultaneously feeds back to the sender for sending the access process.
4th kind of situation:
Optionally, including:
Described control unit meets that trigger condition includes the trigger condition including described when the result of the monitoring unit When the change of the status information of physical memory is specially that memory size changes, it is specifically used for:
When the physical memory capacity changes the specially physical memory capacity reduction, by the physics of reduction The content of pages of storage is copied in the physical memory in the free space of free memory, and updates the physical memory Status information after change.
5th kind of situation:
Optionally, on the basis of embodiment illustrated in fig. 3, shown Memory control device can further include feedback 501, Fig. 5 of member is a kind of structure drawing of device of Memory control provided in an embodiment of the present invention, as shown in figure 5, also including:
Feedback unit 501, for when the status information of the physical memory changes, the physical memory to be changed For the control strategy of physical memory and the sender of corresponding trigger condition, institute described in status information feedback afterwards to transmission State change include memory size change, type of memory change or memory usage meet predetermined threshold;
The receiving unit 301, after being additionally operable to receive the correspondence physical memory change transmitted by described sender The control strategy of status information and corresponding trigger condition.
It can be seen that the Memory control equipment as hardware obtains necessary control strategy from system, completes these control strategy institutes The physical memory control semantic information needed, and the trigger condition of corresponding control measurement so that when meeting a trigger condition, The Memory control equipment can call to should the control strategy of trigger condition the physical memory is controlled, control During no longer need system carry out interrupt processing, substantially increase control efficiency.
Example IV
Referring to Fig. 6, Fig. 6 is a kind of hardware architecture diagram of Memory control equipment provided in an embodiment of the present invention, institute Stating Memory control equipment 600 includes memory 601 and receiver 602, and respectively with the memory 601 and the receiver The processor 603 of 602 connections, the memory 601 are used to store batch processing instruction, and the processor 603 is used to call institute The programmed instruction for stating the storage of memory 601 performs following operation:
Trigger the receiver 602 and receive the control strategy for being directed to physical memory and corresponding trigger condition, the control System strategy carries the upper strata semantic information for realizing the control strategy, and the trigger condition includes the shape of the physical memory The access process that the change of state information and/or the Memory control equipment receive;
Monitor the status information of physical memory and the access process;
When meeting the trigger condition, corresponding control strategy is called to be controlled the physical memory.
Alternatively, the processor 603 can be central processing unit (Central Processing Unit, CPU), institute State the internal storage that memory 601 can be random access memory (Random Access Memory, RAM) type, institute General Physics interface can be included by stating receiver 602, and the physical interface can be ether (Ethernet) interface or asynchronous biography Defeated pattern (Asynchronous Transfer Mode, ATM) interface.The processor 603, receiver 602 and memory 601 One or more independent circuits or hardware can be integrated into, such as:Application specific integrated circuit (Application Specific Integrated Circuit, ASIC).
It should be noted that one of ordinary skill in the art will appreciate that realize the whole in above-described embodiment method or portion Split flow, it is that by computer program the hardware of correlation can be instructed to complete, described program can be stored in a computer In read/write memory medium, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, it is described Storage medium can be magnetic disc, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
A kind of internal memory control method provided by the present invention and device are described in detail above, it is used herein Specific embodiment is set forth to the principle and embodiment of the present invention, and the explanation of above example is only intended to help and understood The method and its core concept of the present invention;Meanwhile for those of ordinary skill in the art, according to the thought of the present invention, having There will be changes in body embodiment and application, in summary, this specification content should not be construed as to the present invention Limitation.

Claims (12)

1. a kind of internal memory control method, it is characterised in that methods described includes:
Memory control equipment receives the control strategy and corresponding trigger condition for physical memory, and the control strategy carries For realizing the upper strata semantic information of the control strategy, the trigger condition includes the change of the status information of the physical memory The access process that change and/or the Memory control equipment receive;
The Memory control equipment monitors the status information of physical memory and the access process;
When meeting the trigger condition, the corresponding control strategy of Memory control equipment calls is carried out to the physical memory Control;
The address information of the physical memory includes physical address and virtual address;
The translation look-aside buffer TLB that the Memory control equipment is included by itself to the physical address of the physical memory and Actual situation address translation operation is carried out between virtual address so that:
The access process is accessed in the physics using the virtual address of the physical memory by the Memory control equipment Deposit;The Memory control equipment is by the actual situation address translation operation, using the physical address of the physical memory to described Physical memory is controlled.
2. according to the method for claim 1, it is characterised in that when the trigger condition is specially including the access process When asking page locking, including:
When it is specially to lock specified page in the physical memory that the Memory control equipment, which listens to the access process, Meet the trigger condition, the corresponding control strategy of Memory control equipment calls is controlled to the physical memory, tool Body includes:
The physical memory addresses information that the Memory control equipment parses the specified page used in the access process is determined The physical page information of the specified page;
If the specified page is in the physical memory, the specified page is locked in described by the Memory control equipment In physical memory;
If the specified page, not in the physical memory, the specified page is changed to and locked by the Memory control equipment In the physical memory.
3. according to the method for claim 2, it is characterised in that ask to be direct internal memory when the access process specifically includes When access buffer DMABuffer distributes physical page, including:
When it is specially DMABuffer distribution physical pages that the Memory control equipment, which listens to the access process, meet institute Trigger condition is stated, the corresponding control strategy of Memory control equipment calls is controlled to the physical memory, specifically included:
The Memory control equipment is the DMABuffer distribution physical page from the physical memory;
The physical page of distribution is locked in the physical memory by the Memory control equipment, and by the physical page Corresponding page table entry is locked in the TLB.
4. according to the method for claim 1, it is characterised in that when the trigger condition is specifically led including the access process When causing page faults generation, including:
When the Memory control equipment, which listens to the access process, specifically causes page faults to occur, meet the triggering bar Part, the corresponding control strategy of Memory control equipment calls are controlled to the physical memory, specifically included:
The replacement page for the page that the Memory control equipment is determined to cause page faults and feed back to send it is described access into The sender of journey.
5. according to the method for claim 1, it is characterised in that when the trigger condition includes the state of the physical memory When the change of information is specially that memory size changes, including:
When the change for the status information that the Memory control equipment listens to the physical memory is specially that memory size becomes During change, meet the trigger condition, the corresponding control strategy of Memory control equipment calls is controlled to the physical memory System, is specifically included:
When the physical memory capacity changes the specially physical memory capacity increase, the Memory control equipment is true The capacity and type of fixed increased physical memory, and update the status information after the physical memory change;
When the physical memory capacity changes the specially physical memory capacity reduction, the Memory control equipment will The content of pages stored in the physical memory of reduction is copied in the physical memory in the free space of free memory, and is updated Status information after the physical memory change.
6. according to the method described in any one of claim 1 to 5, it is characterised in that also include:
When the status information of the physical memory changes, after the Memory control equipment changes the physical memory For the control strategy of physical memory and the sender of corresponding trigger condition, the change described in status information feedback to transmission Change includes memory size change, type of memory change or memory usage and meets predetermined threshold;
The Memory control equipment receives the status information after the correspondence physical memory change transmitted by described sender Control strategy and corresponding trigger condition.
A kind of 7. Memory control device, it is characterised in that including:
Receiving unit, control strategy and corresponding trigger condition, the control strategy for receiving for physical memory are taken Band is used for the upper strata semantic information for realizing the control strategy, and the trigger condition includes the status information of the physical memory The access process that change and/or the Memory control equipment receive;
Monitoring unit, for the status information for monitoring physical memory and the access process;
Control unit, for when the result of the monitoring unit meets the trigger condition, calling corresponding control strategy pair The physical memory is controlled;
When the address information of the physical memory includes physical address and virtual address, in addition to:
Converting unit, physical address and void for the translation look-aside buffer TLB that is included by itself to the physical memory Intend carrying out actual situation address translation operation between address so that:
The access process accesses the physical memory using the virtual address of the physical memory by the converting unit;Institute Converting unit is stated by the actual situation address translation operation, the physical memory is entered using the physical address of the physical memory Row control.
8. device according to claim 7, it is characterised in that including:
Described control unit is specially to ask lock when the result of the monitoring unit meets that trigger condition includes the access process When determining the page, it is specifically used for:
The physical memory addresses information for parsing the specified page used in the access process determines the thing of the specified page Manage page info;
If the specified page is in the physical memory, the specified page is locked in the physical memory;
If the specified page not in the physical memory, the specified page is changed to and is locked in the physical memory In.
9. device according to claim 8, it is characterised in that including:
Described control unit meets that trigger condition specifically includes request including the access process when the result of the monitoring unit When distributing physical page for direct memory access buffering area DMABuffer, it is specifically used for:
It is the DMABuffer distribution physical page from the physical memory;
The physical page of distribution is locked in the physical memory, and page table entry corresponding to the physical page is locked In the TLB.
10. device according to claim 7, it is characterised in that including:
Described control unit meets that trigger condition includes the access process and specifically causes to skip leaf when the result of the monitoring unit When interrupting generation, it is specifically used for:
The replacement page for the page for determining to cause page faults simultaneously feeds back to the sender for sending the access process.
11. device according to claim 7, it is characterised in that including:
Described control unit meets that trigger condition includes the trigger condition and includes the physics when the result of the monitoring unit When the change of the status information of internal memory is specially that memory size changes, it is specifically used for:
When the physical memory capacity changes the specially physical memory capacity reduction, by the physical memory of reduction The content of pages of storage is copied in the physical memory in the free space of free memory, and updates the physical memory change Status information afterwards.
12. according to the device described in any one of claim 7 to 11, it is characterised in that also include:
Feedback unit, for when the status information of the physical memory changes, the shape after the physical memory is changed For the control strategy of physical memory and the sender of corresponding trigger condition, the change described in state feedback of the information to transmission Meet predetermined threshold including memory size change, type of memory change or memory usage;
The receiving unit, it is additionally operable to receive the status information after the correspondence physical memory change transmitted by described sender Control strategy and corresponding trigger condition.
CN201410307864.8A 2014-06-30 2014-06-30 A kind of internal memory control method and device Active CN105335306B (en)

Priority Applications (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
PCT/CN2015/075704 WO2016000470A1 (en) 2014-06-30 2015-04-01 Memory control method and device

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN105335306A CN105335306A (en) 2016-02-17
CN105335306B true CN105335306B (en) 2018-02-13

Family

ID=55018411

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (7)

* 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
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 (4)

* 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
CN103198028A (en) * 2013-03-18 2013-07-10 华为技术有限公司 Method, device and system for migrating stored data
CN103488588A (en) * 2013-10-09 2014-01-01 中国科学院计算技术研究所 Memory protection method and system and network interface controller

Patent Citations (4)

* 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
CN103198028A (en) * 2013-03-18 2013-07-10 华为技术有限公司 Method, device and system for migrating stored data
CN103488588A (en) * 2013-10-09 2014-01-01 中国科学院计算技术研究所 Memory protection method and system and network interface controller

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于消息的内存系统关键技术研究;陈明宇;《网络新媒体技术》;20130131;第2卷(第1期);论文第2节 *

Also Published As

Publication number Publication date
CN105335306A (en) 2016-02-17
WO2016000470A1 (en) 2016-01-07

Similar Documents

Publication Publication Date Title
CN105335306B (en) A kind of internal memory control method and device
CN105095094B (en) EMS memory management process and equipment
CN102460400B (en) Hypervisor-based management of local and remote virtual memory pages
US5574944A (en) System for accessing distributed memory by breaking each accepted access request into series of instructions by using sets of parameters defined as logical channel context
CN107526546B (en) Spark distributed computing data processing method and system
CN105938459A (en) Handling address translation requests
CN104598303B (en) Online moving method and device between virtual machine based on KVM
CN104915151A (en) Active sharing memory excessive allocation method in multi-virtual machine system
CN105339910B (en) Virtual NAND capacity extensions in hybrid drive
CN104424122B (en) A kind of electronic equipment and memory division methods
CN103412822B (en) Operation Nonvolatile memory and the method and relevant apparatus of data manipulation
CN105095116A (en) Cache replacing method, cache controller and processor
KR20100132244A (en) Memory system and method of managing memory system
CN108710583A (en) Management method, device, computer equipment and the medium in SSD write buffers area
KR101635395B1 (en) Multi port data cache device and Method for controlling multi port data cache device
CN104346293A (en) Data access method, module, processor and terminal device for hybrid memory
TW200417857A (en) Allocating cache lines
CN107710175A (en) Memory module and operating system and method
CN109901909A (en) Method and virtualization system for virtualization system
CN105718242A (en) Processing method and system for supporting software and hardware data consistency in multi-core DSP (Digital Signal Processing)
CN115269450A (en) Memory cooperative management system and method
US20080225858A1 (en) Data transferring apparatus and information processing system
CN115629882A (en) Method for managing memory in multiple processes
US20180032442A1 (en) Real time memory address translation device
CN105612505B (en) The method and apparatus of CPU scheduling

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant