CN103197957A - Page copying method for user program execution - Google Patents
Page copying method for user program execution Download PDFInfo
- Publication number
- CN103197957A CN103197957A CN2013100912652A CN201310091265A CN103197957A CN 103197957 A CN103197957 A CN 103197957A CN 2013100912652 A CN2013100912652 A CN 2013100912652A CN 201310091265 A CN201310091265 A CN 201310091265A CN 103197957 A CN103197957 A CN 103197957A
- Authority
- CN
- China
- Prior art keywords
- page
- fault
- buffering
- user
- user program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Storage Device Security (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
A page copying method for user program execution comprises the following steps: step 1, intercepting a fault page having a page fault by an inner core to determine the fault reason and the page attribute; step 2, judging whether a page of a page table exists, and if the page of the page table does not exist, turning to the step 3; step 3, judging whether the page attribute is a file page, and if so, turning to the step 4; step 4, judging whether the fault reason of the file page is an execution fault, and if so, turning to the step 5; and step 5, determining whether file page is in page buffering, and if not, then loading to the page buffering; furthermore, judging whether the page buffering is in a progress local memory node, if so, then filling the page table and returning to a user, and otherwise, then executing the page copying action and releasing the page buffering.
Description
Technical field
The present invention relates to field of computer technology, more particularly, page copy method when the present invention relates to a kind of user program and carrying out.
Background technology
NUMA is the abbreviation of Non-Uniform Memory Access, refers to have a plurality of memory nodes on multinuclear or the multiprocessor machine, and is inequality from the access time to different memory nodes that processor sends.
NUMA operating system is single reflection on the whole.But have only during actual motion internal memory and schedulable CPU are tied to the highest performance of competence exertion processor on the same NUMA node, this be because if CPU at a certain node, and there is the another one node in it in employed, will cause the memory access performance to reduce owing to the NUMA characteristic of hardware, thereby make travelling speed reduce.
NUMA operating system generally provides internal memory binding and CPU binding strategy, thereby so that process uses local internal memory to improve performance; But this mode only at the datarams of process, to the not relevant binding measure of executable instruction internal memory of process, thereby causes the process instruction page may stride the situation of memory node memory access.
When server has NUMA characteristic and operation NUMA operating system, because Page Cache(page buffering, file system can at first the content of file leave in file load during to internal memory in the page buffering) share, cause the routine text section on the different nodes may drop on the page buffering of non-node, thereby reduce performance.
Summary of the invention
Technical matters to be solved by this invention is at having above-mentioned defective in the prior art, providing a kind of and can solve page copy method when the required text segment page of process execution uses the problem of local memory node to carry out with the user program that improves program feature on the NUMA operating system.
According to the present invention, page copy method when providing a kind of user program to carry out, it comprises:
First step: utilize kernel to intercept and capture the page fault that has page fault, determine failure cause and page properties;
Second step: judge that whether this page fault has had page table page, if this page fault does not have page table page, then arrives third step;
Third step: whether the page properties of judging this page fault is the file page, if the page properties of this page fault is the file page, then to the 4th step;
The 4th step: whether the failure cause of judging this document page is to carry out fault, if carry out fault, then to the 5th step;
The 5th step: whether determine this document page in page buffering, if not in page buffering, then be loaded on page buffering; And, whether judge the page buffering of this page fault at the local memory node of process, if at the local memory node of process, then fill page table after, return the user; If at the local memory node of process, then do not carry out the page copy action, and discharge this page buffering, fill corresponding page table after, return the user.
The page copy method also comprised when preferably, described user program was carried out:
If it is not to carry out fault that the 4th step is judged the failure cause of this document page, but Read fault or write fault, then to the 6th step;
The 6th step: whether determine this document page in page buffering, if not in page buffering, then be loaded on page buffering; And, judge that the page buffering of this page fault whether at the local memory node of process, if at the local memory node of process, then fill corresponding page table, returns the user; If not at the local memory node of process, and this page has attribute-executable simultaneously, and the page table attribute that this page then is set is " fault during execution ", returns the user after filling page table.
The page copy method also comprised when preferably, described user program was carried out:
After executing, described the 5th step and described the 6th step enter the 7th step; And, if judge in described second step that this page fault has had page table page, then to the 7th step;
The 7th step: determine the failure cause of this page, if because fault when carrying out then enters the 8th step;
The 8th step: this page execution is copied, discharge original page buffer page, rewrite new page table, remove " fault during execution " mark in the page table, return the user.
Preferably, failure cause comprises Read fault, writes fault, carries out fault.
Preferably, page properties comprises the file page and the non-file page.
The action that the page copy method is specifically carried out page copy when carrying out according to user program of the present invention has two places, and one is the 5th step, and a place is the 8th step.The 5th step is the page fault that takes place when carrying out a brand-new page first, directly carries out corresponding page copy according to NUMA internal memory binding strategy for this situation and gets final product; The 8th step is because some page has readable simultaneously and can carry out authority, this class page is not to cause owing to carrying out to skip leaf when reading in internal memory first, we can adopt the mode of " aftertreatment " at this class page, elder generation is with page table page setting " the fault during execution " mark (the 6th step) of the page, can report page or leaf to carry out fault when processor is carried out such page then, at last enter and eight step copy the page after return user according to above-mentioned flow processing this moment.
The page copy method was at the instruction region of memory on the NUMA operating system when user program that the present invention proposes was carried out, when kernel judges that this proceeding internal memory and CPU all are limited on certain memory node, but the text segment internal memory that the acquiescence loading is come in is not on this node, can enable page copy function when carrying out, when carrying out, copy the corresponding text segment page to this node, to improve the text segment value performance of program.
And, the present invention be advantageous in that the Page Localization problem when carrying out at user program, in conjunction with the mode that adopts " pre-service " and " aftertreatment ", pre-service is at the brand-new page page fault that causes owing to execution first, carry out replication actions according to rule in advance, " aftertreatment " because the page that read-write causes loads, just may trigger the page copy action at first when having only real execution to this page." pre-service " and " aftertreatment " combination is carried out, and performance cost is little, and comprehensive income is big.In addition, this technology realizes in operating system nucleus, and is transparent fully to user program.
Description of drawings
By reference to the accompanying drawings, and by with reference to following detailed, will more easily more complete understanding be arranged and more easily understand its attendant advantages and feature the present invention, wherein:
Fig. 1 schematically shows the process flow diagram of page copy method when user program is carried out according to the preferred embodiment of the invention.
Need to prove that accompanying drawing is used for explanation the present invention, and unrestricted the present invention.Notice that the accompanying drawing of expression structure may not be to draw in proportion.And in the accompanying drawing, identical or similar elements indicates identical or similar label.
Embodiment
In order to make content of the present invention clear and understandable more, below in conjunction with specific embodiments and the drawings content of the present invention is described in detail.
As mentioned above, thereby NUMA operating system generally provides internal memory binding and CPU binding strategy so that process uses local internal memory to improve performance, but this method has certain limitation.
Concrete analysis, the employed internal memory of process be from having seen two aspects in logic, the one, and the datarams of process, the 2nd, the instruction internal memory of process.The speed of the distribution influence process visit data of datarams, the value speed of the distribution influence process of instruction internal memory.Datarams can be bound optimization with the internal memory binding strategy that operating system provides usually, but present NUMA operating system is not all for carrying out corresponding strategy setting and optimizing at the instruction internal memory.User program generally is that one group of executable file and some dynamic base of carrying out constitute, and when user program is carried out, these executable files and dynamic base can be loaded in the page buffering of operating system, and page buffering can be fallen on certain memory node.These pages can be in the middle of the long duration be present in page buffering, especially the dynamic base of Gong Xianging.So, executive utility or when reusing same shared dynamic base again, all can point to the page in the same page buffering, and this page may not be the page of local memory node, thereby cause the process value situation of memory node memory access to occur striding.If process is long playing, because the expense that the cross-node memory access of instruction fetch brings will increase.
At above-mentioned situation, the present invention is on NUMA operating system, and under the situation of internal memory and CPU binding, the text segment page that process is carried out also is tied to corresponding memory node in process, thereby guarantee to instruct Page Localization, improve the performance of getting finger when process instruction is carried out.And this method realizes by operating system nucleus, and transparent fully to consumer process.
Fig. 1 schematically shows the process flow diagram of page copy method when user program is carried out according to the preferred embodiment of the invention.
Specifically, as shown in Figure 1, the page copy method comprised when user program was carried out according to the preferred embodiment of the invention:
First step S1: utilize kernel to intercept and capture the page fault that has page fault, determine failure cause and page properties.Specifically, failure cause comprises Read fault, writes fault, carries out fault, and page properties comprises the file page and the non-file page.
The second step S2: judge whether this page fault has had page table page, if this page fault does not have page table page, then arrives third step S3, if this page fault has had page table page, then to the 7th step S7.
Third step S3: whether the page properties of judging this page fault is the file page, if the page properties of this page fault is the file page, then to the 4th step S4, if the page properties of this page fault is not the file page, then this flow process finishes, and is follow-up according to the original treatment scheme processing of operating system.
The 4th step S4: whether the failure cause of judging this document page is to carry out fault, if carry out fault, and then to the 5th step S5, if not carrying out fault, but Read fault or write fault, then to the 6th step S6.
The 5th step S5: whether determine this document page in page buffering, if not in page buffering, then be loaded on page buffering; And, whether judge the page buffering of this page fault at the local memory node of process, if at the local memory node of process, then fill page table after, return the user; If at the local memory node of process, then do not carry out the page copy action, and discharge this page buffering, fill corresponding page table after, return the user.
The 6th step S6: whether determine this document page in page buffering, if not in page buffering, then be loaded on page buffering; And, judge that the page buffering of this page fault whether at the local memory node of process, if at the local memory node of process, then fill corresponding page table, returns the user; If not at the local memory node of process, and this page has attribute-executable simultaneously, and the page table attribute that this page then is set is " fault during execution ", returns the user after filling page table.
The 7th step S7: determine the failure cause of this page, if because fault when carrying out then enters the 8th step S8, if not, then this flow process finishes, and is follow-up according to the original flow processing of operating system.
The 8th step S8: this page execution is copied, discharge original page buffer page, rewrite new page table, remove " fault during execution " mark in the page table, return the user.
Can see that according to top described flow process the action that the page copy method was specifically carried out page copy when user program was carried out according to the preferred embodiment of the invention has two places, one is the 5th step S5, and a place is the 8th step S8.The 5th step S5 is the page fault that takes place when carrying out a brand-new page first, directly carries out corresponding page copy according to NUMA internal memory binding strategy for this situation and gets final product; The 8th step S8 is because some page has readable simultaneously and can carry out authority, this class page is not to cause owing to carrying out to skip leaf when reading in internal memory first, we can adopt the mode of " aftertreatment " at this class page, elder generation is with page table page setting " the fault during execution " mark (the 6th step S6) of the page, can report page or leaf to carry out fault when processor is carried out such page then, at last enter and eight step S8 copy the page after return user according to above-mentioned flow processing this moment.
Certainly, other embodiments of the invention can only realize the action of the page copy of the 5th step.But it is preferred that the action of execution page copy has two places.
The page copy method was at the instruction region of memory on the NUMA operating system when user program that the preferred embodiment of the present invention proposes was carried out, when kernel judges that this proceeding internal memory and CPU all are limited on certain memory node, but the text segment internal memory that the acquiescence loading is come in is not on this node, can enable page copy function when carrying out, when carrying out, copy the corresponding text segment page to this node, to improve the text segment value performance of program.
And, the Page Localization problem when carrying out at user program of being also advantageous in that of the preferred embodiment of the present invention, in conjunction with the mode that adopts " pre-service " and " aftertreatment ", pre-service is at the brand-new page page fault that causes owing to execution first, carry out replication actions according to rule in advance, " aftertreatment " because the page that read-write causes loads, just may trigger the page copy action at first when having only real execution to this page." pre-service " and " aftertreatment " combination is carried out, and performance cost is little, and comprehensive income is big.In addition, this technology realizes in operating system nucleus, and is transparent fully to user program.
In addition, need to prove, unless otherwise indicated, otherwise the term in the instructions " first ", " second ", " the 3rd " etc. describe each assembly of only being used for distinguishing instructions, element, step etc., rather than are used for logical relation between each assembly of expression, element, the step or ordinal relation etc.
Be understandable that though the present invention with the preferred embodiment disclosure as above, yet above-described embodiment is not in order to limit the present invention.For any those of ordinary skill in the art, do not breaking away under the technical solution of the present invention scope situation, all can utilize the technology contents of above-mentioned announcement that technical solution of the present invention is made many possible changes and modification, or be revised as the equivalent embodiment of equivalent variations.Therefore, every content that does not break away from technical solution of the present invention according to any simple modification, equivalent variations and the modification that technical spirit of the present invention is done above embodiment, all still belongs in the scope of technical solution of the present invention protection.
Claims (5)
1. page copy method when a user program is carried out is characterized in that comprising:
First step: utilize kernel to intercept and capture the page fault that has page fault, determine failure cause and page properties;
Second step: judge that whether this page fault has had page table page, if this page fault does not have page table page, then arrives third step;
Third step: whether the page properties of judging this page fault is the file page, if the page properties of this page fault is the file page, then to the 4th step;
The 4th step: whether the failure cause of judging this document page is to carry out fault, if carry out fault, then to the 5th step;
The 5th step: whether determine this document page in page buffering, if not in page buffering, then be loaded on page buffering; And, whether judge the page buffering of this page fault at the local memory node of process, if at the local memory node of process, then fill page table after, return the user; If at the local memory node of process, then do not carry out the page copy action, and discharge this page buffering, fill corresponding page table after, return the user.
2. page copy method when user program according to claim 1 is carried out is characterized in that also comprising: not to carry out fault if the 4th step is judged the failure cause of this document page, but Read fault or write fault, then to the 6th step;
The 6th step: whether determine this document page in page buffering, if not in page buffering, then be loaded on page buffering; And, judge that the page buffering of this page fault whether at the local memory node of process, if at the local memory node of process, then fill corresponding page table, returns the user; If not at the local memory node of process, and this page has attribute-executable simultaneously, and the page table attribute that this page then is set is " fault during execution ", returns the user after filling page table.
3. page copy method when user program according to claim 2 is carried out is characterized in that also comprising:
After executing, described the 5th step and described the 6th step enter the 7th step; And, if judge in described second step that this page fault has had page table page, then to the 7th step;
The 7th step: determine the failure cause of this page, if because fault when carrying out then enters the 8th step;
The 8th step: this page execution is copied, discharge original page buffer page, rewrite new page table, remove " fault during execution " mark in the page table, return the user.
4. the page copy method is characterized in that when carrying out according to the described user program of one of claim 1 to 3, and failure cause comprises Read fault, writes fault, carries out fault.
5. the page copy method is characterized in that page properties comprises the file page and the non-file page when carrying out according to the described user program of one of claim 1 to 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310091265.2A CN103197957B (en) | 2013-03-20 | 2013-03-20 | Page clone method when a kind of user program performs |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310091265.2A CN103197957B (en) | 2013-03-20 | 2013-03-20 | Page clone method when a kind of user program performs |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103197957A true CN103197957A (en) | 2013-07-10 |
CN103197957B CN103197957B (en) | 2016-06-08 |
Family
ID=48720547
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310091265.2A Active CN103197957B (en) | 2013-03-20 | 2013-03-20 | Page clone method when a kind of user program performs |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103197957B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040143833A1 (en) * | 2003-01-16 | 2004-07-22 | International Business Machines Corporation | Dynamic allocation of computer resources based on thread type |
CN1617113A (en) * | 2003-11-13 | 2005-05-18 | 国际商业机器公司 | Method of assigning virtual memory to physical memory, storage controller and computer system |
US20070083715A1 (en) * | 2005-09-13 | 2007-04-12 | International Business Machines Corporation | Early return indication for return data prior to receiving all responses in shared memory architecture |
CN101477496A (en) * | 2008-12-29 | 2009-07-08 | 北京航空航天大学 | NUMA structure implementing method based on distributed internal memory virtualization |
CN101604263A (en) * | 2009-07-13 | 2009-12-16 | 浪潮电子信息产业股份有限公司 | A kind of method that realizes multi-duplicate running of core code segment of operation system |
US20120137079A1 (en) * | 2010-11-26 | 2012-05-31 | International Business Machines Corporation | Cache coherency control method, system, and program |
-
2013
- 2013-03-20 CN CN201310091265.2A patent/CN103197957B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040143833A1 (en) * | 2003-01-16 | 2004-07-22 | International Business Machines Corporation | Dynamic allocation of computer resources based on thread type |
CN1617113A (en) * | 2003-11-13 | 2005-05-18 | 国际商业机器公司 | Method of assigning virtual memory to physical memory, storage controller and computer system |
US20070083715A1 (en) * | 2005-09-13 | 2007-04-12 | International Business Machines Corporation | Early return indication for return data prior to receiving all responses in shared memory architecture |
CN101477496A (en) * | 2008-12-29 | 2009-07-08 | 北京航空航天大学 | NUMA structure implementing method based on distributed internal memory virtualization |
CN101604263A (en) * | 2009-07-13 | 2009-12-16 | 浪潮电子信息产业股份有限公司 | A kind of method that realizes multi-duplicate running of core code segment of operation system |
US20120137079A1 (en) * | 2010-11-26 | 2012-05-31 | International Business Machines Corporation | Cache coherency control method, system, and program |
Also Published As
Publication number | Publication date |
---|---|
CN103197957B (en) | 2016-06-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Leijen et al. | Mimalloc: Free list sharding in action | |
JP5934094B2 (en) | Mapping across multiple processors of processing logic with data parallel threads | |
Needham et al. | The Cambridge CAP computer and its protection system | |
US10372493B2 (en) | Thread and/or virtual machine scheduling for cores with diverse capabilities | |
US8627018B2 (en) | Automatic optimization for programming of many-core architectures | |
US9304920B2 (en) | System and method for providing cache-aware lightweight producer consumer queues | |
CN102693188B (en) | For carrying out the method and apparatus that hardware based dynamic effusion detects in controlled runtime environment | |
CN101630276B (en) | High-efficiency memory access method | |
CN101542441A (en) | Memory consistency protection in a multiprocessor computing system | |
US8650537B2 (en) | Optimizing an object-oriented program by transforming invocations of synthetic accessor methods | |
CN105659208A (en) | Data processing apparatus and method for processing a plurality of threads | |
US9727465B2 (en) | Self-disabling working set cache | |
JP2015530662A5 (en) | ||
US20180046474A1 (en) | Method for executing child kernels invoked on device side utilizing dynamic kernel consolidation and related non-transitory computer readable medium | |
CN114730249A (en) | Reduction of page migration between different types of memory | |
Leite et al. | LRMalloc: A modern and competitive lock-free dynamic memory allocator | |
CN103140834A (en) | Processor support for filling memory regions | |
CN114253713A (en) | Asynchronous batch processing method and system based on reactivor | |
CN110347471B (en) | Hierarchical display component system, display component calling method and device | |
CN107885489A (en) | A kind of method and system of quick detection real name registration data index | |
CN101650688B (en) | Method for accessing VM_IO address space and user mode debugger | |
CN103197957A (en) | Page copying method for user program execution | |
CN112748854B (en) | Optimized access to a fast storage device | |
US20080072009A1 (en) | Apparatus and method for handling interrupt disabled section and page pinning apparatus and method | |
US8732721B2 (en) | Method for reducing trap overhead when executing a guest in a virtual machine |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |