WO2016019566A1 - Memory management method, device and system and network-on-chip - Google Patents

Memory management method, device and system and network-on-chip Download PDF

Info

Publication number
WO2016019566A1
WO2016019566A1 PCT/CN2014/083966 CN2014083966W WO2016019566A1 WO 2016019566 A1 WO2016019566 A1 WO 2016019566A1 CN 2014083966 W CN2014083966 W CN 2014083966W WO 2016019566 A1 WO2016019566 A1 WO 2016019566A1
Authority
WO
WIPO (PCT)
Prior art keywords
physical
physical page
memory
page number
page
Prior art date
Application number
PCT/CN2014/083966
Other languages
French (fr)
Chinese (zh)
Inventor
蔡卫光
程德华
吴祖光
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2014/083966 priority Critical patent/WO2016019566A1/en
Priority to CN201480037710.XA priority patent/CN105518631B/en
Publication of WO2016019566A1 publication Critical patent/WO2016019566A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation
    • G06F12/1027Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1016Performance improvement

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a memory management method, apparatus and system, and an on-chip network. Background technique
  • Page-based virtual memory technology is a core part of memory management in current computing systems.
  • the operating system divides the address space of physical memory into multiple consecutive physical pages, and divides the address space of the virtual memory that the program will use into multiple consecutive virtual pages.
  • the memory management unit converts the virtual address that the program needs to access to a physical address, and then accesses the physical memory according to the physical address.
  • the process of address translation is usually implemented using TLB (Translation Look-aside Buffer). Specifically, after obtaining the virtual address, the CPU determines the virtual page number according to the virtual address, and then searches for the virtual page number in the TLB entry of the process (the mapping relationship between the virtual page number and the physical page number is saved), if the TLB is in the TLB. If the virtual page number is found in the entry, it is called TLB hit (that is, TLB Hit), and the physical page number corresponding to the virtual page number is output, and the physical address is determined according to the physical page number; if the virtual address is not found, The page number indicates that the TLB Missing page (TLB Miss) has occurred.
  • TLB Translation Look-aside Buffer
  • mapping information corresponding to the virtual page number (including the mapping relationship between the virtual page number and the physical page number) from the memory, and find the memory.
  • the mapping information of the virtual page number is reloaded into the TLB for next use.
  • the physical memory of the device configuration is getting larger and larger (for example, one server can integrate tens of GB or even TB of physical memory), while the TLB
  • the resources are limited, and the number of TLB entries that can be saved is limited. Therefore, in large memory applications, the situation of TLB missing pages is very serious, resulting in a large system overhead.
  • large page technology is usually used to reduce the system overhead caused by TLB page faults.
  • large page technology that is, increasing the page size, increasing the page size is equivalent to increasing the address space that each entry in the TLB can map.
  • For the program it is equivalent to reducing the number of pages used by the program.
  • Large page technology can reduce the page fault overhead to a certain extent.
  • experiments have shown that when the page size increases to a certain limit, the page fault overhead will not change, that is, the use of large page technology to reduce page fault overhead. Limited effect. Summary of the invention
  • an embodiment of the present invention provides a memory management method, device and system, and an on-chip network.
  • the technical solution is as follows:
  • an embodiment of the present invention provides a memory management method, where the method includes: when a physical memory needs to be allocated for a process, determining, from an idle physical page, a number allocated to the process a physical page;
  • the adjusting The instruction is configured to instruct the memory manager to perform an exchange process on at least one pair of second physical pages in the physical memory, where each pair of the second physical page includes the first physical page in which the physical page number is discontinuous One and one non-idle physical page such that the first physical page obtained after the exchange is continuous with at least one other of the first physical pages;
  • the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries a first physical page number and a second physical page number.
  • the storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
  • the method may further include: sending a reset instruction to the memory manager, where the reset instruction is used to instruct the memory manager to create the physical page number and A mapping table of internal page numbers.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number.
  • an embodiment of the present invention provides a memory management method, where the method includes: a memory manager receiving an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to At least one pair of second physical pages in the physical memory is exchanged, and each pair of the second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical page, the A physical page is an idle physical page to be assigned to a process;
  • the physical page in the physical memory is exchanged according to the adjustment instruction, so that the first physical page obtained after the exchange is continuous with at least another of the first physical pages.
  • the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries the first physical page number and the second physical page number.
  • the storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
  • the method may further include: receiving a reset instruction, where the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and the internal page number. ;
  • a mapping table of the physical page number and the internal page number is created according to the reset instruction.
  • the method may further include:
  • the physical memory is accessed according to the internal address.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number.
  • an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: a memory allocation module, configured to determine, when an physical memory needs to be allocated for a process, an idle physical page to allocate to the process a physical page;
  • a sending module configured to: when the first physical page determined by the memory allocation module is at least two, and the first physical page that is determined to have a discontinuous physical page number in the first physical page, The memory manager sends an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform an exchange process on at least one pair of second physical pages in the physical memory, where each pair of the second physical page includes the physical page One of the first physical pages that are not consecutive and one non-idle physical page, so that after the exchange The first physical page is continuous with at least one other of the first physical pages;
  • An entry processing module configured to add an entry in the address translation buffer TLB page table of the process, where the entry records that at least two consecutive first physical pages are merged into one large physical page And a mapping relationship with the virtual page of the process, where the large physical page includes the first physical page obtained after the exchange.
  • the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries the first physical page number and the second physical page number.
  • the storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
  • the sending module is further configured to send a reset instruction to the memory manager, where the reset instruction is used to instruct the memory manager to create the physical page A mapping table of numbers and internal page numbers.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number.
  • an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: a receiving module, configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to at least the physical memory A pair of second physical pages are exchanged, each pair of the second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical page, the first physical page being An empty physical page assigned to the process;
  • An execution module configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module, so that the first physical page obtained after the exchange is continuous with at least another of the first physical pages of.
  • the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries a first physical page number and a second physical page number.
  • the storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
  • the receiving module is further configured to receive a complex a bit instruction, the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and an internal page number; the execution module is further configured to: create the physical page number and an internal page number according to the reset instruction Mapping table.
  • the receiving module is further configured to receive a memory access instruction, where the memory access instruction includes a starting physical address and length information;
  • the device further includes:
  • An address conversion module configured to convert a starting physical address in the memory access instruction into an internal address according to a mapping table of the physical page number and an internal page number;
  • a memory access module configured to access the physical memory according to the internal address obtained by the address translation module.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number.
  • an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer to execute an instruction, and the processor and the memory pass The bus connection, when the computer is running, the processor executes the computer-executed instructions stored by the memory to cause the computer to perform the method of the first aspect.
  • an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: the apparatus includes: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, The processor is coupled to the memory via the bus, and when the computer is running, the processor executes the computer-executed instructions stored by the memory to cause the computer to perform the method as described in the second aspect method.
  • an embodiment of the present invention provides a memory management system, where the system includes a central processor and a memory controller;
  • the central processing unit includes the memory management device of the third aspect or the fifth aspect; the memory controller includes the memory management device of the fourth aspect or the sixth aspect.
  • an embodiment of the present invention provides an on-chip network, where the on-chip network includes: multiple processors, multiple routers, and multiple memory controllers, and the processor passes the router and the memory controller connection;
  • the processor includes the memory management device according to the third aspect or the fifth aspect;
  • the router includes the memory management device according to the fourth aspect or the sixth aspect.
  • the technical solution provided by the embodiment of the present invention has the beneficial effects of: first determining the first physical page allocated to the process, and then performing an exchange process on the first physical page whose physical page number is discontinuous, thereby enabling the first physical body obtained after the exchange.
  • the page is contiguous with another physical page, so that at least two consecutive first physical pages can be merged into one large physical page, which is added as an entry to the process's TLB page table, thereby reducing the process at the address.
  • the number of TLB entries used during mapping which in turn reduces TLB page fault overhead.
  • FIG. 1 is a schematic structural diagram of a memory management system in a computer system
  • FIG. 2 is a flowchart of a memory management method according to Embodiment 1 of the present invention.
  • FIG. 3 is a flowchart of a memory management method according to Embodiment 2 of the present invention.
  • FIG. 4 is a flowchart of a memory management method according to Embodiment 3 of the present invention.
  • FIG. 5 is a flowchart of a memory management method according to Embodiment 4 of the present invention.
  • FIG. 6 is a structural block diagram of a memory management apparatus according to Embodiment 5 of the present invention.
  • FIG. 7 is a structural block diagram of a memory management apparatus according to Embodiment 6 of the present invention.
  • FIG. 8 is a structural block diagram of a memory management apparatus according to Embodiment 7 of the present invention.
  • FIG. 9 is a structural block diagram of a memory management apparatus according to Embodiment 8 of the present invention.
  • FIG. 10 is a structural block diagram of a memory management apparatus according to Embodiment 9 of the present invention.
  • FIG. 11 is a structural block diagram of a memory management apparatus according to Embodiment 10 of the present invention.
  • FIG. 12 is a structural block diagram of a memory management system according to Embodiment 11 of the present invention.
  • FIG. 13 is a structural block diagram of an on-chip network according to Embodiment 12 of the present invention. detailed description
  • Embodiments of the present invention provide a memory management method, apparatus, and system, which are applicable to a memory management system in a computer system.
  • the structure of the memory management system will be described below in conjunction with FIG.
  • the memory management system 100 includes a central processing unit 110 (CPU), a memory controller 120, and a physical memory 130 (also referred to as a main memory, such as a dynamic random access memory). Memory, referred to as DRAM)).
  • the CPU 110 is provided with an address generation unit 111 (AGU) and a memory management unit (MMU).
  • AGU address generation unit
  • MMU memory management unit
  • the core part of the MMU 112 is a translation look-aside buffer (Translation Look-aside Buffer). , referred to as TLB).
  • the physical memory 130 stores a page table of each process, and the page table of the process is used to record the physical page number of the physical page that is arranged in the main memory when the virtual page of the process is loaded into the main memory.
  • each process corresponds to a page table
  • the complete page table of the process is stored in a specific area of the main memory
  • the most active part of the page table is stored in the TLB (ie, the TLB page table).
  • the virtual address to be accessed is calculated by the AGU 111, and the virtual address is sent into the TLB to query the corresponding physical address. If the physical address is queried in the TLB, the memory access request is generated according to the physical address. A memory access request is issued to the MMU 112. If the corresponding physical address is not found in the TLB, the CPU 110 needs to find the physical address corresponding to the virtual address in the physical memory 130, and add the found mapping relationship to the TLB page table.
  • the embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG. 1, and the method can be executed by a CPU. As shown in Figure 2, the method includes:
  • Step 101 When physical memory needs to be allocated for the process, the first physical page allocated to the process is determined from the free physical page.
  • the operating system when the process starts, the operating system needs to allocate physical memory for the process; or, after the process starts, the process requests physical memory from the operating system as needed. At this time, the operating system also needs to allocate physical memory for the process.
  • Step 102 When the determined first physical page is at least two, and the first physical page having the physical page number discontinuous exists in the determined first physical page, the adjustment instruction is sent to the memory manager.
  • the adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, each pair of second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle
  • the physical page is such that the first physical page obtained after the exchange is continuous with at least one other first physical page.
  • the memory manager may be the memory controller in FIG. 1 or a router in an on-chip network.
  • Step 103 Add an entry in the TLB page table of the process, where the entry records the mapping relationship between the at least two consecutive first physical pages and the virtual page of the process after being merged into one large physical page.
  • the large physical page includes the first physical page obtained after the exchange.
  • the page table of the process in the physical memory is updated before an entry is added to the TLB page table of the process.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply.
  • Embodiment 2 Embodiment 2
  • the embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG. This method can be performed by a memory controller. As shown in Figure 3, the method includes:
  • Step 201 Receive an adjustment instruction.
  • the adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, each pair of second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical Page, the first physical page is the free physical page to be assigned to the process.
  • Step 202 Exchange physical pages in the physical memory according to the adjustment instruction, so that the first physical page obtained after the exchange is continuous with at least another first physical page.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the process when the address mapping is performed.
  • the number of TLB entries used which in turn reduces the TLB page fault overhead.
  • the embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG.
  • the memory manager is a storage controller
  • the operating system divides the physical address space of the main memory into a plurality of physical pages, and assigns a physical page number to each physical page
  • the storage controller is each physical page.
  • An internal page number is allocated, and the storage controller is used to access the physical memory according to the internal page number, and the physical page number corresponds to the internal page number.
  • the method includes:
  • Step Mount 301 When the system is initialized, the CPU divides the physical page and the virtual page.
  • the operating system divides the physical address space of the entire physical memory into a plurality of consecutive physical pages, assigns a physical page number to each physical page, and divides the entire virtual address space that the program will use into Multiple consecutive virtual pages, each virtual page is assigned a virtual page number.
  • the physical page number is visible to the operating system, and the virtual page number is visible to the program.
  • the physical page numbers of different physical pages vary.
  • the operating system can divide the physical address space of the entire physical memory into a plurality of consecutive physical pages according to the same page size, for example, 4 KB, that is, the size of each physical page is the same, which is convenient for maintenance and management.
  • Virtual pages are divided by the same page size as physical pages.
  • the size of the physical page can also be different.
  • the physical page number of each physical page is fixed.
  • Step 302 The CPU sends a reset instruction to the storage controller, where the reset command is used to instruct the storage controller to establish a mapping relationship between the physical page number and the internal page number.
  • the reset instruction may be a page_reset instruction, and when the memory controller receives the instruction, a mapping relationship between the physical page number and the internal page number is established.
  • An internal page number can be assigned to each physical page by step 302, and the internal page number is visible to the storage controller.
  • the internal page numbers of different physical pages vary. At this point, each physical page has a physical page number and an internal page number.
  • Step 303 When it is necessary to allocate physical memory for the process, the CPU determines the size of the physical memory to be allocated to the process.
  • the operating system determines the size of the physical memory required by the process according to the information in the process's mirror (binary file); or the process requests the virtual memory space from the operating system during the process running.
  • the system will determine the size of the virtual memory space requested by the process. The size of the physical memory that needs to be allocated to the process.
  • Step 304 The CPU scans the free physical page.
  • a free physical page is an unallocated physical page.
  • a physical page table is usually saved to record the allocation of physical pages in physical memory. When implemented, the free physical page can be determined.
  • Step 305 The CPU determines, according to the determined size of the physical memory, the first physical page to be allocated to the process from the free physical page.
  • the first physical page allocated to the process is determined from the free physical page.
  • Step 306 When the first physical page is determined to be at least two, and the first physical page whose physical page number is discontinuous exists in the determined first physical page, the CPU sends an adjustment instruction to the storage controller.
  • the adjustment instruction is used to instruct the storage controller to perform at least one pair of second physical pages in the physical memory, and each pair of second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical
  • the page is such that the first physical page obtained after the exchange is continuous with at least the other first physical page.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the storage instruction is used to instruct the storage controller to exchange the internal page number corresponding to the first physical page number and the second physical page number. Internal page number.
  • the adjustment instruction may be a page_swap ( fnl , pfn2 ) instruction, where pfn1 is used to indicate a first physical page number (for example, may be a physical page number of a first physical page in the second physical page), and pfn2 is used to indicate The second physical page number (eg, may be the physical page number of a non-idle physical page in the second physical page).
  • each adjustment instruction may include one or more pairs of physical page numbers of the second physical page (ie, including a plurality of first physical page numbers and a plurality of second physical page numbers), when an adjustment instruction includes multiple
  • the physical page number of the plurality of pairs of the second physical page may be separated by a semicolon.
  • the first physical page whose physical page number is not continuous may be discontinuous with the physical page number of the first physical page that is smaller than the physical page number of the current first physical page, or may be compared with the current physical page number of the first physical page.
  • the physical page number of the physical page number of the first physical page is not continuous, and may be a physical medium that is larger than the physical page number of the first physical page and smaller than the physical page number of the current first physical page.
  • the page numbers are not continuous. Specifically, which first physical pages are adjusted, the adjustment strategy can be configured according to actual needs. There is no limit to the comparison.
  • Step 307 The storage controller executes an adjustment instruction.
  • the storage controller is provided with a mapping table of physical page numbers and internal page numbers.
  • the storage controller receives the page_swap (pfnl, pfn2) instruction, it is about to be in the mapping table.
  • the internal page number corresponding to the physical page number is modified to the internal page number corresponding to the second physical page number
  • the internal page number corresponding to the second physical page number is modified to the internal page number corresponding to the first physical page number.
  • the physical page corresponding to the first physical page number becomes a non-idle physical page
  • the physical page corresponding to the second physical page number is the first physical page obtained after the exchange.
  • the effect seen by the operating system is to exchange data of two physical pages.
  • the storage controller may further send a response message to the CPU, where the response message is used to indicate whether the adjustment instruction is successfully executed.
  • Step 308 The CPU adds an entry in the TLB page table of the process, and the added entry records the mapping of at least two consecutive first physical pages into a large physical page and the virtual page of the process. relationship.
  • the method further includes updating the page table of the process in the main memory.
  • Each virtual page of the corresponding process in the page table of the process has an entry, and the content of the entry includes the address (physical page number) of the main memory page where the virtual page is located, and the effective indication of whether the virtual page is loaded into the main memory. Bit.
  • the entry may also include the size of the page.
  • the CPU may add it as an entry to the TLB page table, or may divide the consecutive multiple first physical pages into multiple The entry is added to the TLB page table of the process. For example, for 10 consecutive first physical pages, the CPU can splicing 10 first physical pages into one large physical page, and then adding it as an entry to the TLB.
  • the page table it is also possible to splicing 10 first physical pages into two large physical pages (for example, two large physical pages include five physical pages, or two large physical pages, one including four physical pages, One includes 6 physical pages). That is to say, the number of the large physical pages can be set according to actual needs, and the present invention is not limited thereto as long as the condition including at least two consecutive first physical pages is satisfied.
  • the physical page numbers of the three physical pages are Page_A, Page_B, and Page_C, respectively, and their corresponding internal page numbers are Page_0, Page_l, and Page_2, respectively, Page_A, Page_B, and Page_C.
  • Page_A and Page_C After scanning the free physical page, the physical page corresponding to Page_A and Page_C is obtained as a free physical page, and the physical page corresponding to Page_B is occupied by other processes. At this time, it is determined that the physical page corresponding to Page_A and Page_C is assigned to the process. (ie as the first physical page).
  • the physical pages corresponding to Page_A and Page_C need to be mapped separately by using two TLB entries, and in this embodiment, the physical page numbers of the two first physical pages (Page_A and Page_C) Is not continuous, in this case, the CPU sends a page_swap (Page_B, Page_C) instruction to the storage controller.
  • the storage controller modifies the corresponding table of the physical page number and the internal page number stored therein.
  • Page_B is modified to correspond to Page2
  • Page_C ' ⁇ is changed to correspond to pagel. Since the physical page number corresponding to the physical page is fixed, the operation is actually equivalent to two physical pages (the physical corresponding to Page_B and Page_C).
  • the corresponding internal page number of the page has been changed, so that the physical page numbers corresponding to the two first physical pages become continuous.
  • the two physical pages consecutive to the two physical page numbers are merged into one large physical page and added to the TLB entry. That is to say, the situation that the two TLB entries need to be mapped is implemented by using only one TLB entry, and the large physical page includes the physical page corresponding to Page_A and the physical corresponding to Page_B obtained after the exchange.
  • the page, that is, the large physical page corresponds to the two virtual pages of the process.
  • Step 309 The CPU sends a memory access request to the storage controller, where the memory access request includes a process number, a starting physical address, and a length information.
  • the fetch request usually also includes the type of operation, such as read operation, write operation.
  • the CPU when the process needs to access the virtual memory, the CPU generates the virtual address to be accessed, the high address of the virtual address is the logical page number, and the low bit is the offset within the page; then, the CPU converts the virtual address into a physical address, and converts
  • the process is as follows: First, according to the page table, the physical page number corresponding to the logical page number is found, and the physical page number is used as the high field of the physical address, and the offset is integrated with the page of the virtual address to form a complete physical address. After the CPU obtains the complete physical address, it generates a memory access request based on the physical address, and sends the generated memory access request to the storage controller.
  • Step 310 The storage controller converts the starting physical address in the fetch request into an internal address.
  • the upper bits of the physical address are physical page numbers, and the lower bits are offsets within the page; specifically, the step 310 may include:
  • the storage controller determines the physical page number according to the starting physical address
  • the internal page number corresponding to the starting physical page number is determined according to the mapping table of the physical page number and the internal page number;
  • the internal page number is spliced with the offset within the page to obtain the internal address corresponding to the starting physical address.
  • the step 310 can be completed when the memory access request is in the queue of the storage controller, and therefore, the access efficiency of the physical memory is not affected.
  • Step 311 The storage controller accesses the physical memory according to the obtained internal address.
  • the storage controller accesses the physical memory, the data corresponding to the internal address is transferred into the cache (Cache).
  • the mapping table of the physical page number and the internal page number is stored in the storage controller, and the storage controller executes the reset instruction, the adjustment instruction, and the conversion of the physical address and the internal address, in other implementations.
  • the method of the present invention can also be applied to, for example, a network-on-chip (NoC).
  • NoC a mapping table of physical page numbers and internal page numbers can be stored in an on-chip router. The router performs a reset instruction, an adjustment instruction, and a conversion of a physical address and an internal address.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process. Since the page size corresponding to the entry becomes larger, the process can be reduced.
  • the number of TLB entries used in the address mapping reduces the TLB page fault overhead.
  • the page size corresponding to the TLB entry is adjusted in real time according to the actual situation. Compared with the existing large page technology, Reduce page fault overhead more effectively.
  • the embodiment of the present invention by configuring a physical page number and an internal page number for a physical page, and setting a mapping table of a physical page number and a physical page number in the storage controller, the first physical page that is not continuous with the physical page number is performed.
  • the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply.
  • the embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG.
  • the memory manager is a storage controller, and the operating system divides the physical address space of the main memory into a plurality of physical pages, and allocates a physical page number for each physical page, and the storage controller is based on the physical page number. Access physical memory.
  • the method includes:
  • Step Mount 401 When the system is initialized, the CPU divides the physical page and the virtual page.
  • This step 401 is the same as the aforementioned step 301, and a detailed description is omitted here.
  • Step 402 When it is necessary to allocate physical memory for the process, the CPU determines the score from the free physical page. The first physical page of the provisioning process.
  • step 402 The implementation process of the step 402 is the same as the foregoing steps 302-305, and details are not described herein again.
  • Step 403 When the first physical page is determined to be at least two, and the first physical page whose physical page number is discontinuous exists in the determined first physical page, the CPU sends an adjustment instruction to the storage controller.
  • the adjustment instruction is used to instruct the storage controller to perform at least one pair of second physical pages in the physical memory, and each pair of second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle
  • the physical page is such that the first physical page obtained after the exchange is continuous with at least the other first physical page.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the storage instruction is used to instruct the storage controller to exchange data and a second physical page in a physical page corresponding to the first physical page number.
  • the data in the physical page corresponding to the number is used to instruct the storage controller to exchange data and a second physical page in a physical page corresponding to the first physical page number.
  • Step 404 The storage controller executes an adjustment instruction.
  • the physical page corresponding to the first physical page number is the first physical page
  • the physical page of the second physical page number is the non-idle physical page
  • the storage controller can complete the adjustment instruction by transmitting the data of the physical page corresponding to the second physical page number to the physical page corresponding to the first physical page number.
  • the physical page corresponding to the first physical page number becomes a non-idle physical page
  • the physical page corresponding to the second physical page number is an idle physical page, that is, the first physical page obtained after the exchange.
  • the storage controller may further send a response message to the CPU, where the response message is used to indicate whether the adjustment instruction is successfully executed.
  • Step 405 The CPU adds an entry in the TLB page table of the process, where the added entry records the mapping of at least two consecutive first physical pages into a large physical page and the virtual page of the process. relationship.
  • Step 406 The CPU sends a memory access request to the storage controller, where the memory access request includes a process number, a starting physical address, and a length information.
  • This step 406 is the same as the foregoing step 309, and details are not described herein again.
  • Step 407 The storage controller accesses the physical memory according to the starting physical address and length information in the memory access request.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is combined with another object.
  • the page is continuous, so that at least two consecutive first physical pages can be merged into one large physical page, which is added as an entry to the TLB page table of the process, because the page size corresponding to the entry becomes larger, so
  • the number of TLB entries used by the process in the address mapping can be reduced, and the page loss overhead of the TLB entry is reduced.
  • the page size corresponding to the TLB entry is adjusted in real time according to the actual situation, and the existing large page technology. In comparison, it is therefore possible to reduce page fault overhead more effectively.
  • the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Embodiment 5
  • the embodiment of the present invention provides a memory management apparatus, which can be used to implement the method provided in Embodiment 1.
  • the apparatus includes: a memory allocation module 501, a sending module 502, and an entry processing module 503.
  • the memory allocation module 501 is configured to determine, when the physical memory needs to be allocated for the process, the first physical page allocated to the process from the free physical page.
  • the sending module 502 is configured to: when the first physical page determined by the memory allocating module 501 is at least two, and the first physical page that is determined to have a discontinuous physical page number in the first physical page, send to the memory manager And an adjustment instruction, the adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes one and one of the first physical pages whose physical page numbers are discontinuous a non-idle physical page such that the first physical page obtained after the exchange is contiguous with at least one other of the first physical pages;
  • the entry processing module 503 is configured to add an entry in the TLB page table of the process, where the entry records the mapping relationship between the at least two consecutive first physical pages and the virtual page of the process after being merged into one large physical page.
  • the large physical page includes the first physical page obtained after the exchange.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply.
  • the embodiment of the invention provides a memory management device, which can be used to implement the third or fourth embodiment.
  • the device includes:
  • the memory allocation module 601 is configured to determine, when the physical memory needs to be allocated for the process, the first physical page allocated to the process from the free physical page.
  • the sending module 602 is configured to send, when the first physical page determined by the memory allocation module 601 is at least two, and the first physical page in the first physical page that is determined to be discontinuous, to the memory manager And an adjustment instruction, the adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes one and one of the first physical pages whose physical page numbers are discontinuous a non-idle physical page such that the first physical page obtained after the exchange is contiguous with at least one other of the first physical pages;
  • the entry processing module 603 is configured to add an entry in the TLB page table of the process, where the entry records the mapping relationship between the at least two consecutive first physical pages and the virtual page of the process after being merged into one large physical page.
  • the large physical page includes the first physical page obtained after the exchange.
  • the memory manager is provided with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries the first physical page number and the second physical page number, and the storage instruction is used to indicate The memory manager exchanges the internal page number corresponding to the first physical page number and the second physical page number.
  • the memory manager is configured to access the physical memory according to the internal page number.
  • the sending module 602 is further configured to send a reset instruction to the memory manager, the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and the internal page number.
  • the memory manager can be a memory controller or a router for an on-chip network.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange data in the physical page corresponding to the first physical page number and The data in the physical page corresponding to the second physical page number (for the implementation, refer to the third embodiment, and the detailed description is omitted here).
  • the memory manager can be a memory controller.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the process when the address mapping is performed.
  • the number of TLB entries used which in turn reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Example 7
  • the embodiment of the present invention provides a memory management apparatus, which can be used to implement the method provided in Embodiment 2.
  • the apparatus includes: a receiving module 701 and an executing module 702.
  • the receiving module 701 is configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform exchange processing on at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes a physical page number discontinuous One of the first physical pages and one non-idle physical page, the first physical page being the free physical page to be assigned to the process.
  • the executing module 702 is configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module 701, so that the first physical page obtained after the exchange is continuous with at least another first physical page.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Example eight
  • the embodiment of the invention provides a memory management device, which can be used to implement the steps performed by the memory controller in the third or fourth embodiment.
  • the apparatus includes: a receiving module 801 and an executing module 802.
  • the receiving module 801 is configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform exchange processing on at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes a physical page number discontinuous One of the first physical pages and one non-idle physical page, the first physical page being the free physical page to be assigned to the process.
  • the executing module 802 is configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module 801, so that the first physical page obtained after the exchange is continuous with at least another first physical page.
  • a physical page number and an internal part are provided in the memory manager.
  • a mapping table of the page number the adjustment instruction carries a first physical page number and a second physical page number
  • the adjustment instruction is used to instruct the memory manager to exchange the first physical page number and the internal page number corresponding to the second physical page number
  • the memory manager is used to access physical memory based on the internal page number.
  • the receiving module 801 is further configured to receive a reset instruction, where the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and an internal page number; It can also be used to create a mapping table of physical page numbers and internal page numbers according to the reset instruction.
  • the memory manager may be a memory controller or a router of an on-chip network (for the implementation, refer to Embodiment 4, and detailed description is omitted here).
  • the apparatus may further include: an address conversion module 803 and a memory access module 804.
  • the receiving module 801 is further configured to receive a memory access instruction, where the memory access instruction includes a starting physical address and length information.
  • the address conversion module 803 is configured to convert the starting physical address in the fetch instruction into an internal address according to the mapping table of the physical page number and the internal page number.
  • the memory access module 804 is configured to access the physical memory according to the internal address obtained by the address translation module 803.
  • the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange data in the physical page corresponding to the first physical page number and The data in the physical page corresponding to the second physical page number (for the implementation, refer to Embodiment 4, and detailed description is omitted here).
  • the memory manager can be a memory controller.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Example nine
  • An embodiment of the present invention provides a memory management apparatus.
  • the apparatus includes a processor 1001, a memory 1002, a bus 1003, and a communication interface 1004.
  • the memory 1002 is configured to store computer execution instructions
  • the processor 1001 is connected to the memory 1002 via the bus 1003.
  • the processor 1001 executes the computer-executed instructions stored in the memory 1002 to cause the computer to execute the method executed by the CPU in the first embodiment or the third embodiment or the fourth embodiment.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Example ten
  • the embodiment of the present invention provides a memory management apparatus.
  • the apparatus includes a processor 1101, a memory 1102, a bus 1103, and a communication interface 1104.
  • the memory 1102 is used to store computer execution instructions
  • the processor 1101 is connected to the memory 1102 via a bus 1103.
  • the processor 1101 executes the computer execution instructions stored in the memory 1102 to cause the computer to execute the implementation.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Embodiment 11
  • the embodiment of the present invention provides a memory management system.
  • the system includes: a CPU 1201 and a memory controller 1202;
  • the CPU 1201 includes the memory management device provided in Embodiment 5, 6 or 9;
  • the memory controller 1202 includes the memory management device provided in the seventh, eighth or tenth embodiment.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page. As an entry, it is added to the TLB page table of the process, which can reduce the number of TLB entries used by the process in address mapping, and thus reduce the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Example twelve
  • the embodiment of the present invention provides an on-chip network.
  • the on-chip network includes: a plurality of processors 1301, a plurality of routers 1302, and a plurality of memory controllers 1303.
  • the processor 1301 is connected to the memory controller 1303 through the router 1302. ;
  • the processor 1301 includes the memory management device provided in Embodiment 5, 6 or 9.
  • the router 1302 includes the memory management device provided in Embodiment 7, 8, or 10.
  • the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page.
  • the first physical page obtained after the exchange is continuous with another physical page.
  • at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping.
  • the number reduces the TLB page fault overhead.
  • the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. It should be noted that, when the memory management device provided by the foregoing embodiment performs memory management, only the division of each functional module described above is used as an example.
  • the function distribution may be completed by different functional modules as needed.
  • the internal structure of the device is divided into different functional modules to perform all or part of the functions described above.
  • the memory management device and the memory management method embodiment provided in the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • the serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Abstract

Provided are a memory management method, device and system and a network-on-chip. The memory management method comprises: determining first physical pages allocated for a process from idle physical pages; sending an adjustment instruction to a memory manager, wherein the adjustment instruction is used for instructing the memory manager to exchange at least one pair of second physical pages in a physical memory, and each pair of second physical pages comprises one of the first physical pages with physical page numbers being non-consecutive and one non-idle physical page, so that the first physical page obtained after exchange and at least another first physical page are consecutive; and adding a table entry in a TLB page table of the process, wherein a mapping relationship between at least two consecutive first physical pages after being combined into a large physical page and virtual pages of the process is recorded in the table entry, and the large physical page comprises the first physical page obtained after exchange. The present invention can reduce the loss of performance caused by a TLB page fault in the application of a large memory.

Description

内存管理方法、 装置和系统、 以及片上网络  Memory management methods, devices and systems, and on-chip networks
技术领域 Technical field
本发明涉及计算机技术领域, 特别涉及一种内存管理方法、 装置和系统、 以及片上网络。 背景技术  The present invention relates to the field of computer technologies, and in particular, to a memory management method, apparatus and system, and an on-chip network. Background technique
基于页的虚拟内存技术是当前计算系统中内存管理的核心部分。在该技术 中, 操作系统将物理内存的地址空间划分为多个连续的物理页, 并将程序将会 用到的虚拟内存的地址空间划分为多个连续的虚拟页。 在程序运行过程中, 内 存管理单元会将程序需要访问的虚拟地址转换为物理地址, 然后根据物理地址 访问物理内存。  Page-based virtual memory technology is a core part of memory management in current computing systems. In this technique, the operating system divides the address space of physical memory into multiple consecutive physical pages, and divides the address space of the virtual memory that the program will use into multiple consecutive virtual pages. During the running of the program, the memory management unit converts the virtual address that the program needs to access to a physical address, and then accesses the physical memory according to the physical address.
该地址转换的过程通常釆用 TLB ( Translation Look-aside Buffer,翻译后备 緩冲区)实现。具体地, CPU获得虚拟地址后,会根据虚拟地址确定虚拟页号, 然后在该进程的 TLB表项 (保存有虚拟页号和物理页号的映射关系) 中查找 该虚拟页号, 若在 TLB表项中查找到该虚拟页号, 则称为 TLB命中 (即 TLB Hit ), 则输出该虚拟页号对应的物理页号并才艮据该物理页号确定物理地址; 若 查找不到该虚拟页号, 则表明发生了 TLB缺页 (TLB Miss ), 此时, 需要从内 存中寻找该虚拟页号对应的映射信息(包括虚拟页号和物理页号的映射关系), 并将内存中找到的该虚拟页号的映射信息重新装填入 TLB, 以便下次使用。  The process of address translation is usually implemented using TLB (Translation Look-aside Buffer). Specifically, after obtaining the virtual address, the CPU determines the virtual page number according to the virtual address, and then searches for the virtual page number in the TLB entry of the process (the mapping relationship between the virtual page number and the physical page number is saved), if the TLB is in the TLB. If the virtual page number is found in the entry, it is called TLB hit (that is, TLB Hit), and the physical page number corresponding to the virtual page number is output, and the physical address is determined according to the physical page number; if the virtual address is not found, The page number indicates that the TLB Missing page (TLB Miss) has occurred. At this time, it is necessary to find the mapping information corresponding to the virtual page number (including the mapping relationship between the virtual page number and the physical page number) from the memory, and find the memory. The mapping information of the virtual page number is reloaded into the TLB for next use.
在实现本发明的过程中, 发明人发现现有技术至少存在以下问题: 设备配置的物理内存越来越大(例如, 一台服务器能够集成数十 GB甚至 上 TB的物理内存), 而 TLB的资源有限, 其中能够保存的 TLB表项有限, 因 此在大内存应用中, TLB缺页的情况十分严重, 由此带来的系统开销 大。 现 有技术中, 通常釆用大页面技术来减少 TLB缺页带来的系统开销。 所谓大页 面技术, 即增大页面尺寸, 增大页面尺寸相当于增大了 TLB 中每个表项所能 映射的地址空间, 对于程序而言, 相当于减少了其使用的页面数量, 因此, 大 页面技术在一定程度上能减少缺页开销, 但是, 实验证明, 当页面大小增加到 一定限度, 缺页开销将不再变化, 也就是说, 釆用大页面技术对减少缺页开销 作用有限。 发明内容 In the process of implementing the present invention, the inventors have found that the prior art has at least the following problems: The physical memory of the device configuration is getting larger and larger (for example, one server can integrate tens of GB or even TB of physical memory), while the TLB The resources are limited, and the number of TLB entries that can be saved is limited. Therefore, in large memory applications, the situation of TLB missing pages is very serious, resulting in a large system overhead. In the prior art, large page technology is usually used to reduce the system overhead caused by TLB page faults. The so-called large page technology, that is, increasing the page size, increasing the page size is equivalent to increasing the address space that each entry in the TLB can map. For the program, it is equivalent to reducing the number of pages used by the program. Large page technology can reduce the page fault overhead to a certain extent. However, experiments have shown that when the page size increases to a certain limit, the page fault overhead will not change, that is, the use of large page technology to reduce page fault overhead. Limited effect. Summary of the invention
为了解决现有技术中大内存应用中 TLB缺页开销大的问题, 本发明实施 例提供了一种内存管理方法、装置和系统、以及片上网络。所述技术方案如下: 第一方面, 本发明实施例提供了一种内存管理方法, 所述方法包括: 当需要为进程分配物理内存时,从空闲的物理页中确定分配给所述进程的 第一物理页;  In order to solve the problem that the TLB page fault is expensive in the large memory application in the prior art, the embodiment of the present invention provides a memory management method, device and system, and an on-chip network. The technical solution is as follows: In a first aspect, an embodiment of the present invention provides a memory management method, where the method includes: when a physical memory needs to be allocated for a process, determining, from an idle physical page, a number allocated to the process a physical page;
当确定出的所述第一物理页为至少两个, 且确定出的所述第一物理页中存 在物理页号不连续的第一物理页时, 向内存管理器发送调整指令, 所述调整指 令用于指示所述内存管理器对所述物理内存中的至少一对第二物理页进行交 换处理,每对所述第二物理页包括所述物理页号不连续的第一物理页中的一个 和一个非空闲的物理页,使得交换后得到的第一物理页与至少另一个所述第一 物理页是连续的;  When the determined first physical page is at least two, and the determined first physical page has a physical page number discontinuous first physical page, sending an adjustment instruction to the memory manager, the adjusting The instruction is configured to instruct the memory manager to perform an exchange process on at least one pair of second physical pages in the physical memory, where each pair of the second physical page includes the first physical page in which the physical page number is discontinuous One and one non-idle physical page such that the first physical page obtained after the exchange is continuous with at least one other of the first physical pages;
在所述进程的地址转换緩冲区 TLB 页表中添加一条表项, 所述表项中记 录了至少两个连续的所述第一物理页合并为一个大物理页后与所述进程的虚 拟页的映射关系, 所述大物理页包括所述交换后得到的第一物理页。  Adding an entry in the address translation buffer TLB page table of the process, where the entry records that at least two consecutive first physical pages are merged into one large physical page and virtualized with the process A mapping relationship of pages, the large physical page including the first physical page obtained after the exchange.
在第一方面的第一种可能的实施方式中, 所述内存管理器中设有物理页号 和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述 存储指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理页 号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。  In a first possible implementation manner of the first aspect, the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries a first physical page number and a second physical page number. The storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
进一步地, 在该第一种可能的实施方式中, 所述方法还可以包括: 向所述 内存管理器发送复位指令, 所述复位指令用于指示所述内存管理器创建所述物 理页号和内部页号的映射表。  Further, in the first possible implementation manner, the method may further include: sending a reset instruction to the memory manager, where the reset instruction is used to instruct the memory manager to create the physical page number and A mapping table of internal page numbers.
在第一方面的第二种可能的实施方式中, 所述调整指令携带第一物理页号 和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物理页 号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 第二方面, 本发明实施例提供了一种内存管理方法, 所述方法包括: 内存管理器接收调整指令, 所述调整指令用于指示所述内存管理器对所述 物理内存中的至少一对第二物理页进行交换处理,每对所述第二物理页包括所 述物理页号不连续的第一物理页中的一个和一个非空闲的物理页, 所述第一物 理页为待分配给进程的空闲的物理页; In a second possible implementation manner of the first aspect, the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number. In a second aspect, an embodiment of the present invention provides a memory management method, where the method includes: a memory manager receiving an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to At least one pair of second physical pages in the physical memory is exchanged, and each pair of the second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical page, the A physical page is an idle physical page to be assigned to a process;
根据所述调整指令对物理内存中的物理页进行交换处理,使得交换后得到 的第一物理页与至少另一个所述第一物理页是连续的。  The physical page in the physical memory is exchanged according to the adjustment instruction, so that the first physical page obtained after the exchange is continuous with at least another of the first physical pages.
在第二方面的第一种可能的实施方式中, 所述内存管理器中设有物理页号 和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述 存储指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理页 号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。  In a first possible implementation manner of the second aspect, the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries the first physical page number and the second physical page number. The storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
进一步地, 在该第一种可能的实施方式中, 所述方法还可以包括: 接收复位指令, 所述复位指令用于指示所述内存管理器创建所述物理页号 和内部页号的映射表;  Further, in the first possible implementation manner, the method may further include: receiving a reset instruction, where the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and the internal page number. ;
根据复位指令创建所述物理页号和内部页号的映射表。  A mapping table of the physical page number and the internal page number is created according to the reset instruction.
更进一步地, 该方法还可以包括:  Further, the method may further include:
接收访存指令, 所述访存指令包括起始物理地址和长度信息;  Receiving a memory access instruction, where the memory access instruction includes a starting physical address and length information;
根据所述物理页号和内部页号的映射表, 将所述访存指令中的的起始物理 地址转换为内部地址;  Converting a starting physical address in the memory access instruction to an internal address according to a mapping table of the physical page number and an internal page number;
才艮据所述内部地址访问所述物理内存。  The physical memory is accessed according to the internal address.
在第二方面的第二种可能的实施方式中, 所述调整指令携带第一物理页号 和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物理页 号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 第三方面, 本发明实施例提供了一种内存管理装置, 所述装置包括: 内存分配模块, 用于当需要为进程分配物理内存时, 从空闲的物理页中确 定分配给所述进程的第一物理页;  In a second possible implementation manner of the second aspect, the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number. In a third aspect, an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: a memory allocation module, configured to determine, when an physical memory needs to be allocated for a process, an idle physical page to allocate to the process a physical page;
发送模块, 用于当所述内存分配模块确定出的所述第一物理页为至少两 个, 且确定出的所述第一物理页中存在物理页号不连续的第一物理页时, 向内 存管理器发送调整指令, 所述调整指令用于指示所述内存管理器对所述物理内 存中的至少一对第二物理页进行交换处理,每对所述第二物理页包括所述物理 页号不连续的第一物理页中的一个和一个非空闲的物理页,使得交换后得到的 第一物理页与至少另一个所述第一物理页是连续的; a sending module, configured to: when the first physical page determined by the memory allocation module is at least two, and the first physical page that is determined to have a discontinuous physical page number in the first physical page, The memory manager sends an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform an exchange process on at least one pair of second physical pages in the physical memory, where each pair of the second physical page includes the physical page One of the first physical pages that are not consecutive and one non-idle physical page, so that after the exchange The first physical page is continuous with at least one other of the first physical pages;
表项处理模块, 用于在所述进程的地址转换緩冲区 TLB 页表中添加一条 表项, 所述表项中记录了至少两个连续的所述第一物理页合并为一个大物理页 后与所述进程的虚拟页的映射关系, 所述大物理页包括所述交换后得到的第一 物理页。  An entry processing module, configured to add an entry in the address translation buffer TLB page table of the process, where the entry records that at least two consecutive first physical pages are merged into one large physical page And a mapping relationship with the virtual page of the process, where the large physical page includes the first physical page obtained after the exchange.
在第三方面的第一种可能的实施方式中, 所述内存管理器中设有物理页号 和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述 存储指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理页 号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。  In a first possible implementation manner of the third aspect, the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries the first physical page number and the second physical page number. The storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
进一步地, 在该第一种可能的实施方式中, 所述发送模块还可以用于, 向 所述内存管理器发送复位指令, 所述复位指令用于指示所述内存管理器创建所 述物理页号和内部页号的映射表。  Further, in the first possible implementation, the sending module is further configured to send a reset instruction to the memory manager, where the reset instruction is used to instruct the memory manager to create the physical page A mapping table of numbers and internal page numbers.
在第三方面的第二种可能的实施方式中, 所述调整指令携带第一物理页号 和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物理页 号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 第四方面, 本发明实施例提供了一种内存管理装置, 所述装置包括: 接收模块, 用于接收调整指令, 所述调整指令用于指示所述内存管理器对 所述物理内存中的至少一对第二物理页进行交换处理,每对所述第二物理页包 括所述物理页号不连续的第一物理页中的一个和一个非空闲的物理页, 所述第 一物理页为待分配给进程的空闲的物理页;  In a second possible implementation manner of the third aspect, the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number. In a fourth aspect, an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: a receiving module, configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to at least the physical memory A pair of second physical pages are exchanged, each pair of the second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical page, the first physical page being An empty physical page assigned to the process;
执行模块, 用于根据所述接收模块接收到的所述调整指令, 对物理内存中 的物理页进行交换处理,使得交换后得到的第一物理页与至少另一个所述第一 物理页是连续的。  An execution module, configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module, so that the first physical page obtained after the exchange is continuous with at least another of the first physical pages of.
在第四方面的第一种可能的实施方式中, 所述内存管理器中设有物理页号 和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述 存储指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理页 号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。  In a first possible implementation manner of the fourth aspect, the memory manager is configured with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries a first physical page number and a second physical page number. The storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the physical according to the internal page number RAM.
进一步地, 在该第一种可能的实施方式中, 所述接收模块还用于, 接收复 位指令, 所述复位指令用于指示所述内存管理器创建所述物理页号和内部页号 的映射表; 所述执行模块还用于, 根据复位指令创建所述物理页号和内部页号 的映射表。 Further, in the first possible implementation manner, the receiving module is further configured to receive a complex a bit instruction, the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and an internal page number; the execution module is further configured to: create the physical page number and an internal page number according to the reset instruction Mapping table.
更进一步地, 所述接收模块还用于, 接收访存指令, 所述访存指令包括起 始物理地址和长度信息;  Further, the receiving module is further configured to receive a memory access instruction, where the memory access instruction includes a starting physical address and length information;
相应地, 所述装置还包括:  Correspondingly, the device further includes:
地址转换模块, 用于根据所述物理页号和内部页号的映射表, 将所述访存 指令中的的起始物理地址转换为内部地址;  An address conversion module, configured to convert a starting physical address in the memory access instruction into an internal address according to a mapping table of the physical page number and an internal page number;
访存模块, 用于根据所述地址转换模块得到的所述内部地址访问所述物理 内存。  And a memory access module, configured to access the physical memory according to the internal address obtained by the address translation module.
在第四方面的第二种可能的实施方式中, 所述调整指令携带第一物理页号 和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物理页 号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 第五方面, 本发明实施例提供了一种内存管理装置, 所述装置包括: 处理 器、 存储器、 总线和通信接口; 所述存储器用于存储计算机执行指令, 所述处 理器与所述存储器通过所述总线连接, 当所述计算机运行时, 所述处理器执行 所述存储器存储的所述计算机执行指令, 以使所述计算机执行如第一方面所述 的方法。 第六方面, 本发明实施例提供了一种内存管理装置, 其特征在于, 所述装 置包括: 所述装置包括: 处理器、 存储器、 总线和通信接口; 所述存储器用于 存储计算机执行指令, 所述处理器与所述存储器通过所述总线连接, 当所述计 算机运行时, 所述处理器执行所述存储器存储的所述计算机执行指令, 以使所 述计算机执行如第二方面所述的方法。 第七方面, 本发明实施例提供了一种内存管理系统, 所述系统包括中央处 理器和内存控制器;  In a second possible implementation manner of the fourth aspect, the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange the first physical page The data in the physical page corresponding to the number and the data in the physical page corresponding to the second physical page number. In a fifth aspect, an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer to execute an instruction, and the processor and the memory pass The bus connection, when the computer is running, the processor executes the computer-executed instructions stored by the memory to cause the computer to perform the method of the first aspect. According to a sixth aspect, an embodiment of the present invention provides a memory management apparatus, where the apparatus includes: the apparatus includes: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, The processor is coupled to the memory via the bus, and when the computer is running, the processor executes the computer-executed instructions stored by the memory to cause the computer to perform the method as described in the second aspect method. According to a seventh aspect, an embodiment of the present invention provides a memory management system, where the system includes a central processor and a memory controller;
其中, 所述中央处理器包括第三方面或第五方面所述的内存管理装置; 所述内存控制器包括第四方面或第六方面所述的内存管理装置。 第八方面, 本发明实施例提供了一种片上网络, 所述片上网络包括: 多个处理器、 多个路由器和多个内存控制器, 所述处理器通过所述路由器 与所述内存控制器连接; The central processing unit includes the memory management device of the third aspect or the fifth aspect; the memory controller includes the memory management device of the fourth aspect or the sixth aspect. In an eighth aspect, an embodiment of the present invention provides an on-chip network, where the on-chip network includes: multiple processors, multiple routers, and multiple memory controllers, and the processor passes the router and the memory controller connection;
所述处理器包括如第三方面或第五方面所述的内存管理装置;  The processor includes the memory management device according to the third aspect or the fifth aspect;
所述路由器包括如第四方面或第六方面所述的内存管理装置。  The router includes the memory management device according to the fourth aspect or the sixth aspect.
本发明实施例提供的技术方案的有益效果是: 通过先确定分配给进程的第 一物理页, 然后对物理页号不连续的第一物理页进行交换处理, 进而使得交换 后得到的第一物理页与另一个物理页是连续的, 这样, 可以将连续的至少两个 第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB 页表中, 从而可以减少该进程在地址映射时,所使用的 TLB表项的数量,进而减少 TLB 缺页开销。 附图说明  The technical solution provided by the embodiment of the present invention has the beneficial effects of: first determining the first physical page allocated to the process, and then performing an exchange process on the first physical page whose physical page number is discontinuous, thereby enabling the first physical body obtained after the exchange. The page is contiguous with another physical page, so that at least two consecutive first physical pages can be merged into one large physical page, which is added as an entry to the process's TLB page table, thereby reducing the process at the address. The number of TLB entries used during mapping, which in turn reduces TLB page fault overhead. DRAWINGS
为了更清楚地说明本发明实施例中的技术方案, 下面将对实施例描述中所 需要使用的附图作简单地介绍, 显而易见地, 下面描述中的附图仅仅是本发明 的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。  In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described. It is obvious that the drawings in the following description are only some embodiments of the present invention. Other drawings may also be obtained from those of ordinary skill in the art in view of the drawings.
图 1是计算机系统中的内存管理系统的结构示意图;  1 is a schematic structural diagram of a memory management system in a computer system;
图 2是本发明实施例一提供的内存管理方法的流程图;  2 is a flowchart of a memory management method according to Embodiment 1 of the present invention;
图 3是本发明实施例二提供的内存管理方法的流程图;  3 is a flowchart of a memory management method according to Embodiment 2 of the present invention;
图 4是本发明实施例三提供的内存管理方法的流程图;  4 is a flowchart of a memory management method according to Embodiment 3 of the present invention;
图 5是本发明实施例四提供的内存管理方法的流程图;  FIG. 5 is a flowchart of a memory management method according to Embodiment 4 of the present invention; FIG.
图 6是本发明实施例五提供的内存管理装置的结构框图;  6 is a structural block diagram of a memory management apparatus according to Embodiment 5 of the present invention;
图 7是本发明实施例六提供的内存管理装置的结构框图;  7 is a structural block diagram of a memory management apparatus according to Embodiment 6 of the present invention;
图 8是本发明实施例七提供的内存管理装置的结构框图;  8 is a structural block diagram of a memory management apparatus according to Embodiment 7 of the present invention;
图 9是本发明实施例八提供的内存管理装置的结构框图;  9 is a structural block diagram of a memory management apparatus according to Embodiment 8 of the present invention;
图 10是本发明实施例九提供的内存管理装置的结构框图;  FIG. 10 is a structural block diagram of a memory management apparatus according to Embodiment 9 of the present invention; FIG.
图 11是本发明实施例十提供的内存管理装置的结构框图;  11 is a structural block diagram of a memory management apparatus according to Embodiment 10 of the present invention;
图 12是本发明实施例十一提供的内存管理系统的结构框图;  FIG. 12 is a structural block diagram of a memory management system according to Embodiment 11 of the present invention; FIG.
图 13是本发明实施例十二提供的片上网络的结构框图。 具体实施方式 FIG. 13 is a structural block diagram of an on-chip network according to Embodiment 12 of the present invention. detailed description
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图对本发明 实施方式作进一步地详细描述。  The embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
本发明实施例提供了一种内存管理方法、 装置和系统, 适用于计算机系统 中的内存管理系统。 下面先结合图 1介绍内存管理系统的结构。  Embodiments of the present invention provide a memory management method, apparatus, and system, which are applicable to a memory management system in a computer system. The structure of the memory management system will be described below in conjunction with FIG.
参见图 1, 内存管理系统 100包括中央处理器 110 ( Center Prossecing Unit, 简称 CPU )、 存储控制器 120 ( Memory Controller )、 物理内存 130 (又称主存, 例如动态随机存取存储器 ( Dynamic Random Access Memory , 简称 DRAM ) )。 其中, CPU110内设有地址生成单元 111 ( Address Generation Unit, 简称 AGU ) 和内存管理单元 112 ( Memory Management Unit, 简称 MMU ),其中, MMU112 的核心部分为翻译后备緩冲器( Translation Look-aside Buffer, 简称 TLB )。  Referring to FIG. 1 , the memory management system 100 includes a central processing unit 110 (CPU), a memory controller 120, and a physical memory 130 (also referred to as a main memory, such as a dynamic random access memory). Memory, referred to as DRAM)). The CPU 110 is provided with an address generation unit 111 (AGU) and a memory management unit (MMU). The core part of the MMU 112 is a translation look-aside buffer (Translation Look-aside Buffer). , referred to as TLB).
其中, 物理内存 130中保存有各个进程的页表, 进程的页表用于记录进程 的虚拟页调入主存时被安排在主存中的物理页的物理页号。 通常, 每个进程对 应一个页表, 进程的完整的页表存储在主存的特定区域中, 而该页表中最活跃 的部分则会同时存放在 TLB中 (即 TLB页表)。  The physical memory 130 stores a page table of each process, and the page table of the process is used to record the physical page number of the physical page that is arranged in the main memory when the virtual page of the process is loaded into the main memory. Typically, each process corresponds to a page table, the complete page table of the process is stored in a specific area of the main memory, and the most active part of the page table is stored in the TLB (ie, the TLB page table).
当 CPU执行指令时, 由 AGU111计算出待访问的虚拟地址, 并将该虚拟 地址送入 TLB内查询对应的物理地址, 若在 TLB内查询到物理地址, 则根据 该物理地址生成访存请求并向 MMU112发出访存请求。 若在 TLB内未查询到 对应的物理地址, 则 CPU110需要在物理内存 130中查找虚拟地址对应的物理 地址, 并将查找到的映射关系添加到 TLB页表中。 实施例一  When the CPU executes the instruction, the virtual address to be accessed is calculated by the AGU 111, and the virtual address is sent into the TLB to query the corresponding physical address. If the physical address is queried in the TLB, the memory access request is generated according to the physical address. A memory access request is issued to the MMU 112. If the corresponding physical address is not found in the TLB, the CPU 110 needs to find the physical address corresponding to the virtual address in the physical memory 130, and add the found mapping relationship to the TLB page table. Embodiment 1
本发明实施例提供了一种内存管理方法,适用于图 1所示的内存管理系统, 该方法可以由 CPU执行。 如图 2所示, 该方法包括:  The embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG. 1, and the method can be executed by a CPU. As shown in Figure 2, the method includes:
步骤 101 : 当需要为进程分配物理内存时, 从空闲的物理页中确定分配给 进程的第一物理页。  Step 101: When physical memory needs to be allocated for the process, the first physical page allocated to the process is determined from the free physical page.
实现时, 在进程启动时, 操作系统需要为进程分配物理内存; 或者, 在进程启动后, 进程会根据需要向操作系统申请物理内存, 此时, 操作系 统也需要为进程分配物理内存。  In the implementation, when the process starts, the operating system needs to allocate physical memory for the process; or, after the process starts, the process requests physical memory from the operating system as needed. At this time, the operating system also needs to allocate physical memory for the process.
步骤 102: 当确定出的所述第一物理页为至少两个, 且确定出的第一物理 页中存在物理页号不连续的第一物理页时, 向内存管理器发送调整指令。 该调整指令用于指示内存管理器对物理内存中的至少一对第二物理页进 行交换处理,每对第二物理页包括物理页号不连续的第一物理页中的一个和一 个非空闲的物理页,使得交换后得到的第一物理页与至少另一个第一物理页是 连续的。 Step 102: When the determined first physical page is at least two, and the first physical page having the physical page number discontinuous exists in the determined first physical page, the adjustment instruction is sent to the memory manager. The adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, each pair of second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle The physical page is such that the first physical page obtained after the exchange is continuous with at least one other first physical page.
其中, 该内存管理器可以为图 1中的内存控制器, 也可以为片上网络中的 路由器。  The memory manager may be the memory controller in FIG. 1 or a router in an on-chip network.
步骤 103: 在进程的 TLB页表中添加一条表项, 该表项中记录了至少两个 连续的第一物理页合并为一个大物理页后与进程的虚拟页的映射关系。  Step 103: Add an entry in the TLB page table of the process, where the entry records the mapping relationship between the at least two consecutive first physical pages and the virtual page of the process after being merged into one large physical page.
该大物理页包括交换后得到的第一物理页。  The large physical page includes the first physical page obtained after the exchange.
可以理解地, 在进程的 TLB 页表中添加一条表项之前, 会先更新物理内 存中的该进程的页表。  Understandably, the page table of the process in the physical memory is updated before an entry is added to the TLB page table of the process.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例二  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Embodiment 2
本发明实施例提供了一种内存管理方法,适用于图 1所示的内存管理系统。 该方法可以由内存控制器执行。 如图 3所示, 该方法包括:  The embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG. This method can be performed by a memory controller. As shown in Figure 3, the method includes:
步骤 201 : 接收调整指令。  Step 201: Receive an adjustment instruction.
调整指令用于指示内存管理器对物理内存中的至少一对第二物理页进行 交换处理,每对第二物理页包括物理页号不连续的第一物理页中的一个和一个 非空闲的物理页, 第一物理页为待分配给进程的空闲的物理页。  The adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, each pair of second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical Page, the first physical page is the free physical page to be assigned to the process.
步骤 202: 根据调整指令对物理内存中的物理页进行交换处理, 使得交换 后得到的第一物理页与至少另一个第一物理页是连续的。  Step 202: Exchange physical pages in the physical memory according to the adjustment instruction, so that the first physical page obtained after the exchange is continuous with at least another first physical page.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 实施例三 In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the process when the address mapping is performed. The number of TLB entries used, which in turn reduces the TLB page fault overhead. Embodiment 3
本发明实施例提供了一种内存管理方法,适用于图 1所示的内存管理系统。 在本实施例中, 内存管理器为存储控制器, 操作系统将主存的物理地址空间划 分为多个物理页, 并为每个物理页分配一个物理页号, 存储控制器为每个物理 页分配一个内部页号, 存储控制器用于根据该内部页号访问物理内存, 物理页 号与内部页号——对应。 参见图 4, 该方法包括:  The embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG. In this embodiment, the memory manager is a storage controller, and the operating system divides the physical address space of the main memory into a plurality of physical pages, and assigns a physical page number to each physical page, and the storage controller is each physical page. An internal page number is allocated, and the storage controller is used to access the physical memory according to the internal page number, and the physical page number corresponds to the internal page number. Referring to Figure 4, the method includes:
步裝 301 : 系统初始化时, CPU划分物理页和虚拟页。  Step Mount 301: When the system is initialized, the CPU divides the physical page and the virtual page.
具体地, 在系统初始化时, 操作系统将整个物理内存的物理地址空间划分 为连续的多个物理页, 为各个物理页分配物理页号, 并将程序将会用到的整个 虚拟地址空间划分为多个连续的虚拟页, 为各个虚拟页分配虚拟页号。  Specifically, when the system is initialized, the operating system divides the physical address space of the entire physical memory into a plurality of consecutive physical pages, assigns a physical page number to each physical page, and divides the entire virtual address space that the program will use into Multiple consecutive virtual pages, each virtual page is assigned a virtual page number.
其中, 物理页号为操作系统可见, 虚拟页号为程序可见。 不同的物理页的 物理页号各不相同。  The physical page number is visible to the operating system, and the virtual page number is visible to the program. The physical page numbers of different physical pages vary.
具体地, 操作系统可以按照相同的页面大小, 例如 4KB, 将整个物理内存 的物理地址空间划分为连续的多个物理页, 也就是说, 各个物理页的大小是相 同的, 便于维护和管理。 虚拟页按照与物理页相同的页面大小划分。 可以理解 地, 物理页的大小也可以是不同的。  Specifically, the operating system can divide the physical address space of the entire physical memory into a plurality of consecutive physical pages according to the same page size, for example, 4 KB, that is, the size of each physical page is the same, which is convenient for maintenance and management. Virtual pages are divided by the same page size as physical pages. As can be appreciated, the size of the physical page can also be different.
在操作系统的运行过程中, 各个物理页的物理页号是固定不变的。  During the operation of the operating system, the physical page number of each physical page is fixed.
步骤 302: CPU向存储控制器发送复位指令, 该复位指令用于指示存储控 制器建立物理页号和内部页号的映射关系。  Step 302: The CPU sends a reset instruction to the storage controller, where the reset command is used to instruct the storage controller to establish a mapping relationship between the physical page number and the internal page number.
例如, 该复位指令可以为 page_reset指令, 当存储控制器收到该指令时, 即会建立物理页号和内部页号的映射关系。  For example, the reset instruction may be a page_reset instruction, and when the memory controller receives the instruction, a mapping relationship between the physical page number and the internal page number is established.
通过步骤 302即可为各个物理页分配内部页号, 内部页号为存储控制器可 见。 不同的物理页的内部页号各不相同。 至此, 每个物理页都具有一个物理页 号和一个内部页号。  An internal page number can be assigned to each physical page by step 302, and the internal page number is visible to the storage controller. The internal page numbers of different physical pages vary. At this point, each physical page has a physical page number and an internal page number.
步骤 303: 当需要为进程分配物理内存时, CPU确定需分配给进程的物理 内存的大小。  Step 303: When it is necessary to allocate physical memory for the process, the CPU determines the size of the physical memory to be allocated to the process.
通常, 在进程启动时, 操作系统会根据进程的镜像(二进制文件) 中的信 息, 确定进程所需的物理内存的大小; 或者在进程运行过程中, 进程会向操作 系统申请虚拟内存空间, 操作系统会根据进程申请的虚拟内存空间的大小, 确 定需分配给进程的物理内存的大小。 Generally, when the process starts, the operating system determines the size of the physical memory required by the process according to the information in the process's mirror (binary file); or the process requests the virtual memory space from the operating system during the process running. The system will determine the size of the virtual memory space requested by the process. The size of the physical memory that needs to be allocated to the process.
步骤 304: CPU扫描空闲的物理页。  Step 304: The CPU scans the free physical page.
空闲的物理页即未分配的物理页。 在 CPU中, 通常会保存一个物理页表, 用于记录物理内存中物理页的分配情况, 实现时, 可以通过该表确定出空闲的 物理页。  A free physical page is an unallocated physical page. In the CPU, a physical page table is usually saved to record the allocation of physical pages in physical memory. When implemented, the free physical page can be determined.
步骤 305: CPU根据确定出的物理内存的大小, 从空闲的物理页中确定待 分配给该进程的第一物理页。  Step 305: The CPU determines, according to the determined size of the physical memory, the first physical page to be allocated to the process from the free physical page.
通过步骤 302~305即可实现当需要为进程分配物理内存时,从空闲的物理 页中确定分配给进程的第一物理页。  Through steps 302~305, when the physical memory needs to be allocated for the process, the first physical page allocated to the process is determined from the free physical page.
步骤 306: 当确定出的第一物理页为至少两个, 且确定出的第一物理页中 存在物理页号不连续的第一物理页时, CPU向存储控制器发送调整指令。  Step 306: When the first physical page is determined to be at least two, and the first physical page whose physical page number is discontinuous exists in the determined first physical page, the CPU sends an adjustment instruction to the storage controller.
该调整指令用于指示存储控制器对物理内存中的至少一对第二物理页进 行交换处理,每对第二物理页包括物理页号不连续的第一物理页中的一个和一 个非空闲物理页,使得交换后得到的第一物理页与至少与另一个第一物理页连 续。  The adjustment instruction is used to instruct the storage controller to perform at least one pair of second physical pages in the physical memory, and each pair of second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical The page is such that the first physical page obtained after the exchange is continuous with at least the other first physical page.
在本实施例中, 该调整指令携带第一物理页号和第二物理页号, 该存储指 令用于指示存储控制器交换第一物理页号对应的内部页号和第二物理页号对 应的内部页号。  In this embodiment, the adjustment instruction carries a first physical page number and a second physical page number, where the storage instruction is used to instruct the storage controller to exchange the internal page number corresponding to the first physical page number and the second physical page number. Internal page number.
具体地, 该调整指令可以为 page_swap ( fnl , pfn2 )指令, 其中 pfnl用 于指示第一物理页号(例如可以为第二物理页中第一物理页的物理页号), pfn2 用于指示第二物理页号 (例如可以为第二物理页中非空闲的物理页的物理页 号)。  Specifically, the adjustment instruction may be a page_swap ( fnl , pfn2 ) instruction, where pfn1 is used to indicate a first physical page number (for example, may be a physical page number of a first physical page in the second physical page), and pfn2 is used to indicate The second physical page number (eg, may be the physical page number of a non-idle physical page in the second physical page).
实现时, 每个调整指令中可以包括一对或多对第二物理页的物理页号(即 包括多个第一物理页号和多个第二物理页号), 当一个调整指令中包括多对第 二物理页的物理页号时, 例如, 可以釆用分号将多对第二物理页的物理页号隔 开。  When implemented, each adjustment instruction may include one or more pairs of physical page numbers of the second physical page (ie, including a plurality of first physical page numbers and a plurality of second physical page numbers), when an adjustment instruction includes multiple For the physical page number of the second physical page, for example, the physical page number of the plurality of pairs of the second physical page may be separated by a semicolon.
其中, 物理页号不连续的第一物理页, 可以是与第一物理页中比当前第一 物理页的物理页号小的物理页号不连续, 也可以是与第一物理页中比当前第一 物理页的物理页号大的物理页号不连续,还可以是与第一物理页中比当前第一 物理页的物理页号大以及比当前第一物理页的物理页号小的物理页号均不连 续。 具体对哪些第一物理页进行调整, 可以根据实际需要配置调整策略, 本发 明对比不作限制。 The first physical page whose physical page number is not continuous may be discontinuous with the physical page number of the first physical page that is smaller than the physical page number of the current first physical page, or may be compared with the current physical page number of the first physical page. The physical page number of the physical page number of the first physical page is not continuous, and may be a physical medium that is larger than the physical page number of the first physical page and smaller than the physical page number of the current first physical page. The page numbers are not continuous. Specifically, which first physical pages are adjusted, the adjustment strategy can be configured according to actual needs. There is no limit to the comparison.
步骤 307: 存储控制器执行调整指令。  Step 307: The storage controller executes an adjustment instruction.
在本实施例中, 如前所述, 存储控制器中设有物理页号和内部页号的映射 表, 当存储控制器收到该 page_swap ( pfnl , pfn2 )指令时, 即将映射表中, 第一物理页号对应的内部页号修改为第二物理页号对应的内部页号, 同时将第 二物理页号对应的内部页号修改为第一物理页号对应的内部页号, 修改后, 第 一物理页号对应的物理页变为非空闲的物理页, 而第二物理页号对应的物理页 即为交换后得到的第一物理页。  In this embodiment, as described above, the storage controller is provided with a mapping table of physical page numbers and internal page numbers. When the storage controller receives the page_swap (pfnl, pfn2) instruction, it is about to be in the mapping table. The internal page number corresponding to the physical page number is modified to the internal page number corresponding to the second physical page number, and the internal page number corresponding to the second physical page number is modified to the internal page number corresponding to the first physical page number. After modification, The physical page corresponding to the first physical page number becomes a non-idle physical page, and the physical page corresponding to the second physical page number is the first physical page obtained after the exchange.
执行该步骤 307以后,操作系统所看到的效果是对两个物理页的数据进行 了交换。  After performing this step 307, the effect seen by the operating system is to exchange data of two physical pages.
可选地, 在实现时, 存储控制器执行调整指令之后, 还可以向 CPU发送 响应消息, 该响应消息用于指示调整指令是否执行成功。  Optionally, when the storage controller executes the adjustment instruction, the storage controller may further send a response message to the CPU, where the response message is used to indicate whether the adjustment instruction is successfully executed.
步骤 308: CPU在该进程的 TLB页表中添加一条表项, 添加的该条表项 中记录了至少两个连续的第一物理页合并为一个大物理页后与该进程的虚拟 页的映射关系。  Step 308: The CPU adds an entry in the TLB page table of the process, and the added entry records the mapping of at least two consecutive first physical pages into a large physical page and the virtual page of the process. relationship.
容易知道,在该步骤 308之前,该方法还包括更新主存中的该进程的页表。 进程的页表中对应进程的每一个虚拟页有一个表项,表项的内容包含该虚拟页 所在的主存页面的地址(物理页号), 以及指示该虚拟页是否调入主存的有效 位。 在本实施例中, 表项还可以包括页的大小。  It will be readily appreciated that prior to step 308, the method further includes updating the page table of the process in the main memory. Each virtual page of the corresponding process in the page table of the process has an entry, and the content of the entry includes the address (physical page number) of the main memory page where the virtual page is located, and the effective indication of whether the virtual page is loaded into the main memory. Bit. In this embodiment, the entry may also include the size of the page.
需要说明的是, 在实际应用中, 对于连续的多个第一物理页, CPU可以将 其作为一个表项添加到 TLB 页表中, 也可以将连续的多个第一物理页分为多 个表项添加到该进程的 TLB页表中,例如,对于连续的 10个第一物理页, CPU 可以将 10个第一物理页拼接为一个大物理页, 然后将其作为一个表项添加到 TLB页表中, 也可以将 10个第一物理页拼接为两个大物理页 (例如, 两个大 物理页包括 5个物理页, 或者, 两个大物理页中, 一个包括 4个物理页, 一个 包括 6个物理页)。 也就是说, 构成大物理页的个数可以根据实际需要进行设 置, 本发明对此不作限制, 只要满足包括至少两个连续的第一物理页的条件即 可。  It should be noted that, in practical applications, for a plurality of consecutive first physical pages, the CPU may add it as an entry to the TLB page table, or may divide the consecutive multiple first physical pages into multiple The entry is added to the TLB page table of the process. For example, for 10 consecutive first physical pages, the CPU can splicing 10 first physical pages into one large physical page, and then adding it as an entry to the TLB. In the page table, it is also possible to splicing 10 first physical pages into two large physical pages (for example, two large physical pages include five physical pages, or two large physical pages, one including four physical pages, One includes 6 physical pages). That is to say, the number of the large physical pages can be set according to actual needs, and the present invention is not limited thereto as long as the condition including at least two consecutive first physical pages is satisfied.
下面对前述步骤 305-308 进行举例说明。 三个物理页的物理页号分别为 Page_A、 Page_B 和 Page_C, 其对应的内部页号分别为 Page_0、 Page_l 和 Page_2, Page_A、 Page_B和 Page_C连续。 殳设扫描空闲的物理页后,得到 Page_A和 Page_C对应的物理页为空闲的 物理页, 而 Page_B对应的物理页已被其他进程占用, 此时确定将 Page_A和 Page_C对应的物理页分配给该进程 (即作为第一物理页)。 The foregoing steps 305-308 are exemplified below. The physical page numbers of the three physical pages are Page_A, Page_B, and Page_C, respectively, and their corresponding internal page numbers are Page_0, Page_l, and Page_2, respectively, Page_A, Page_B, and Page_C. After scanning the free physical page, the physical page corresponding to Page_A and Page_C is obtained as a free physical page, and the physical page corresponding to Page_B is occupied by other processes. At this time, it is determined that the physical page corresponding to Page_A and Page_C is assigned to the process. (ie as the first physical page).
若按照现有的内存分配方式,需要使用 2个 TLB表项对 Page_A和 Page_C 对应的物理页分别进行映射, 而在本实施例中, 两个第一物理页的物理页号 ( Page_A和 Page_C )是不连续的, 在这种情况下, CPU 向存储控制器发送 page_swap ( Page_B , Page_C )指令, 存储控制器收到该指令后, 修改其中存 储的物理页号和内部页号的对应表, 将 Page_B 修改为与 Page2 对应, 而将 Page_C '爹改为与 pagel对应, 由于物理页对应的物理页号是固定不变的, 所以 该操作实际上相当于两个物理页( Page_B和 Page_C对应的物理页)对应的内 部页号有所改变, 从而使得两个第一物理页对应的物理页号变为连续。 将这两 个物理页号连续的第一物理页合并为一个大物理页, 添加到 TLB表项中。 也 就是说,原本需要釆用两条 TLB表项进行映射的情况变为只需要釆用一条 TLB 表项即可实现,该大物理页包括 Page_A对应的物理页和交换后得到的 Page_B 对应的物理页, 也就是说, 该大物理页与该进程的两个虚拟页对应。  According to the existing memory allocation method, the physical pages corresponding to Page_A and Page_C need to be mapped separately by using two TLB entries, and in this embodiment, the physical page numbers of the two first physical pages (Page_A and Page_C) Is not continuous, in this case, the CPU sends a page_swap (Page_B, Page_C) instruction to the storage controller. After receiving the instruction, the storage controller modifies the corresponding table of the physical page number and the internal page number stored therein. Page_B is modified to correspond to Page2, and Page_C '爹 is changed to correspond to pagel. Since the physical page number corresponding to the physical page is fixed, the operation is actually equivalent to two physical pages (the physical corresponding to Page_B and Page_C). The corresponding internal page number of the page has been changed, so that the physical page numbers corresponding to the two first physical pages become continuous. The two physical pages consecutive to the two physical page numbers are merged into one large physical page and added to the TLB entry. That is to say, the situation that the two TLB entries need to be mapped is implemented by using only one TLB entry, and the large physical page includes the physical page corresponding to Page_A and the physical corresponding to Page_B obtained after the exchange. The page, that is, the large physical page corresponds to the two virtual pages of the process.
步骤 309: CPU向存储控制器发送访存请求, 该访存请求包括进程号、 起 始物理地址和长度信息。  Step 309: The CPU sends a memory access request to the storage controller, where the memory access request includes a process number, a starting physical address, and a length information.
容易知道, 该访存请求通常还包括操作类型, 例如读操作、 写操作。  It is easy to know that the fetch request usually also includes the type of operation, such as read operation, write operation.
实现时, 当进程需要访问虚拟内存时, CPU会产生待访问的虚拟地址, 虚 拟地址的高位为逻辑页号, 低位为页内偏移量; 然后, CPU会将虚拟地址转换 为物理地址, 转换过程如下: 首先根据页表查找到逻辑页号对应的物理页号, 用物理页号作为物理地址的高字段, 在与虚拟地址的页内偏移量拼接, 就构成 了完整的物理地址。 CPU得到完整的物理地址后,根据该物理地址生成访存请 求, 并将生成的访存请求发送给存储控制器。  In the implementation, when the process needs to access the virtual memory, the CPU generates the virtual address to be accessed, the high address of the virtual address is the logical page number, and the low bit is the offset within the page; then, the CPU converts the virtual address into a physical address, and converts The process is as follows: First, according to the page table, the physical page number corresponding to the logical page number is found, and the physical page number is used as the high field of the physical address, and the offset is integrated with the page of the virtual address to form a complete physical address. After the CPU obtains the complete physical address, it generates a memory access request based on the physical address, and sends the generated memory access request to the storage controller.
步骤 310: 存储控制器将访存请求中的起始物理地址转化为内部地址。 如前所述, 物理地址的高位为物理页号, 低位为页内偏移量; 具体地, 该 步骤 310可以包括:  Step 310: The storage controller converts the starting physical address in the fetch request into an internal address. As described above, the upper bits of the physical address are physical page numbers, and the lower bits are offsets within the page; specifically, the step 310 may include:
存储控制器根据起始物理地址确定出物理页号;  The storage controller determines the physical page number according to the starting physical address;
然后根据物理页号和内部页号的映射表确定起始物理页号对应的内部页 号;  Then, the internal page number corresponding to the starting physical page number is determined according to the mapping table of the physical page number and the internal page number;
将内部页号与页内偏移量拼接, 得到起始物理地址对应的内部地址。 在实现时, 该步骤 310可以在访存请求位于存储控制器的队列中时完成, 因此, 不会影响物理内存的访问效率。 The internal page number is spliced with the offset within the page to obtain the internal address corresponding to the starting physical address. In implementation, the step 310 can be completed when the memory access request is in the queue of the storage controller, and therefore, the access efficiency of the physical memory is not affected.
步骤 311 : 存储控制器根据得到的内部地址访问物理内存。  Step 311: The storage controller accesses the physical memory according to the obtained internal address.
存储控制器访问物理内存后, 将该内部地址对应的数据调入緩存 ( Cache ) 中。  After the storage controller accesses the physical memory, the data corresponding to the internal address is transferred into the cache (Cache).
需要说明的是, 在本实施例中, 物理页号和内部页号的映射表保存在存储 控制器中, 由存储控制器执行复位指令、 调整指令以及物理地址和内部地址的 转换, 在其他实施例中, 本发明的方法还可以应用于例如片上网络 ( Network-on-chip, 简称 NoC ), 在 NoC中, 物理页号和内部页号的映射表可 以保存在片内路由器中, 由片内路由器执行复位指令、 调整指令以及物理地址 和内部地址的转换。  It should be noted that, in this embodiment, the mapping table of the physical page number and the internal page number is stored in the storage controller, and the storage controller executes the reset instruction, the adjustment instruction, and the conversion of the physical address and the internal address, in other implementations. In an example, the method of the present invention can also be applied to, for example, a network-on-chip (NoC). In NoC, a mapping table of physical page numbers and internal page numbers can be stored in an on-chip router. The router performs a reset instruction, an adjustment instruction, and a conversion of a physical address and an internal address.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB 页表中, 由于表项对应的页面尺寸变大, 所 以可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减小 TLB 缺页开销, 并且由于 TLB表项对应的页面尺寸是根据实际情况实时调整的, 与现有的大页面技术相比, 因此能够更有效地减少缺页开销。 此外, 本发明实 施例通过为物理页配置物理页号和内部页号, 并在存储控制器内设置物理页号 和物理页号的映射表, 在对物理页号不连续的第一物理页进行调整时, 只需修 改映射表中的映射关系, 不需要在存储控制器内部进行数据传输, 所以系统延 迟小。 另外, 本发明实施例对操作系统的改动少, 易于推广应用。 实施例四  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process. Since the page size corresponding to the entry becomes larger, the process can be reduced. The number of TLB entries used in the address mapping reduces the TLB page fault overhead. The page size corresponding to the TLB entry is adjusted in real time according to the actual situation. Compared with the existing large page technology, Reduce page fault overhead more effectively. In addition, in the embodiment of the present invention, by configuring a physical page number and an internal page number for a physical page, and setting a mapping table of a physical page number and a physical page number in the storage controller, the first physical page that is not continuous with the physical page number is performed. When adjusting, it is only necessary to modify the mapping relationship in the mapping table, and there is no need to perform data transmission inside the storage controller, so the system delay is small. In addition, the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Embodiment 4
本发明实施例提供了一种内存管理方法,适用于图 1所示的内存管理系统。 在本实施例中, 内存管理器为存储控制器, 操作系统将主存的物理地址空间划 分为多个物理页, 并为每个物理页分配一个物理页号, 存储控制器根据该物理 页号访问物理内存。 参见图 5, 该方法包括:  The embodiment of the invention provides a memory management method, which is applicable to the memory management system shown in FIG. In this embodiment, the memory manager is a storage controller, and the operating system divides the physical address space of the main memory into a plurality of physical pages, and allocates a physical page number for each physical page, and the storage controller is based on the physical page number. Access physical memory. Referring to Figure 5, the method includes:
步裝 401 : 系统初始化时, CPU划分物理页和虚拟页。  Step Mount 401: When the system is initialized, the CPU divides the physical page and the virtual page.
该步骤 401与前述步骤 301相同, 在此省略详细描述。  This step 401 is the same as the aforementioned step 301, and a detailed description is omitted here.
步骤 402: 当需要为进程分配物理内存时, CPU从空闲的物理页中确定分 配给进程的第一物理页。 Step 402: When it is necessary to allocate physical memory for the process, the CPU determines the score from the free physical page. The first physical page of the provisioning process.
该步骤 402的实现过程与前述步骤 302~305相同, 在此不再赘述。  The implementation process of the step 402 is the same as the foregoing steps 302-305, and details are not described herein again.
步骤 403: 当确定出的第一物理页为至少两个, 且确定出的第一物理页中 存在物理页号不连续的第一物理页时, CPU向存储控制器发送调整指令。  Step 403: When the first physical page is determined to be at least two, and the first physical page whose physical page number is discontinuous exists in the determined first physical page, the CPU sends an adjustment instruction to the storage controller.
该调整指令用于指示存储控制器对物理内存中的至少一对第二物理页进 行交换处理,每对第二物理页包括物理页号不连续的第一物理页中的一个和一 个非空闲的物理页,使得交换后得到的第一物理页与至少与另一个第一物理页 连续。  The adjustment instruction is used to instruct the storage controller to perform at least one pair of second physical pages in the physical memory, and each pair of second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle The physical page is such that the first physical page obtained after the exchange is continuous with at least the other first physical page.
在本实施例中, 该调整指令携带第一物理页号和第二物理页号, 该存储指 令用于指示存储控制器交换交换第一物理页号对应的物理页内的数据和第二 物理页号对应的物理页内的数据。  In this embodiment, the adjustment instruction carries a first physical page number and a second physical page number, where the storage instruction is used to instruct the storage controller to exchange data and a second physical page in a physical page corresponding to the first physical page number. The data in the physical page corresponding to the number.
步骤 404: 存储控制器执行调整指令。  Step 404: The storage controller executes an adjustment instruction.
具体地, 在实现时, H没第一物理页号对应的物理页为第一物理页, 第二 物理页号的物理页为非空闲的物理页, 由于第一物理页是空闲的物理页, 所以 存储控制器通过将第二物理页号对应的物理页的数据传输到第一物理页号对 应的物理页, 即可完成该调整指令。 交换后, 第一物理页号对应的物理页变为 非空闲的物理页, 而第二物理页号对应的物理页为空闲的物理页, 即交换后得 到的第一物理页。  Specifically, in implementation, the physical page corresponding to the first physical page number is the first physical page, and the physical page of the second physical page number is the non-idle physical page, because the first physical page is a free physical page. Therefore, the storage controller can complete the adjustment instruction by transmitting the data of the physical page corresponding to the second physical page number to the physical page corresponding to the first physical page number. After the exchange, the physical page corresponding to the first physical page number becomes a non-idle physical page, and the physical page corresponding to the second physical page number is an idle physical page, that is, the first physical page obtained after the exchange.
可选地, 在实现时, 存储控制器执行调整指令之后, 还可以向 CPU发送 响应消息, 该响应消息用于指示调整指令是否执行成功。  Optionally, when the storage controller executes the adjustment instruction, the storage controller may further send a response message to the CPU, where the response message is used to indicate whether the adjustment instruction is successfully executed.
步骤 405: CPU在该进程的 TLB页表中添加一条表项, 添加的该条表项 中记录了至少两个连续的第一物理页合并为一个大物理页后与该进程的虚拟 页的映射关系。  Step 405: The CPU adds an entry in the TLB page table of the process, where the added entry records the mapping of at least two consecutive first physical pages into a large physical page and the virtual page of the process. relationship.
容易知道,在该步骤 405之前,该方法还包括更新主存中的该进程的页表。 步骤 406: CPU向存储控制器发送访存请求, 该访存请求包括进程号、 起 始物理地址和长度信息。  It will be readily appreciated that prior to step 405, the method further includes updating the page table of the process in the main memory. Step 406: The CPU sends a memory access request to the storage controller, where the memory access request includes a process number, a starting physical address, and a length information.
该步骤 406与前述步骤 309相同, 在此不再赘述。  This step 406 is the same as the foregoing step 309, and details are not described herein again.
步骤 407: 存储控制器根据访存请求中的起始物理地址和长度信息, 访问 物理内存。  Step 407: The storage controller accesses the physical memory according to the starting physical address and length information in the memory access request.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB 页表中, 由于表项对应的页面尺寸变大, 所 以可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减小 TLB 缺页开销, 并且由于 TLB表项对应的页面尺寸是根据实际情况实时调整的, 与现有的大页面技术相比, 因此能够更有效地减少缺页开销。 另外, 本发明实 施例对操作系统的改动少, 易于推广应用。 实施例五 In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is combined with another object. The page is continuous, so that at least two consecutive first physical pages can be merged into one large physical page, which is added as an entry to the TLB page table of the process, because the page size corresponding to the entry becomes larger, so The number of TLB entries used by the process in the address mapping can be reduced, and the page loss overhead of the TLB entry is reduced. The page size corresponding to the TLB entry is adjusted in real time according to the actual situation, and the existing large page technology. In comparison, it is therefore possible to reduce page fault overhead more effectively. In addition, the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Embodiment 5
本发明实施例提供了一种内存管理装置, 可以用于实现实施例一提供的方 法, 如图 6所示, 该装置包括: 内存分配模块 501、 发送模块 502和表项处理 模块 503。  The embodiment of the present invention provides a memory management apparatus, which can be used to implement the method provided in Embodiment 1. As shown in FIG. 6, the apparatus includes: a memory allocation module 501, a sending module 502, and an entry processing module 503.
其中, 内存分配模块 501, 用于当需要为进程分配物理内存时, 从空闲的 物理页中确定分配给所述进程的第一物理页。  The memory allocation module 501 is configured to determine, when the physical memory needs to be allocated for the process, the first physical page allocated to the process from the free physical page.
发送模块 502,用于当内存分配模块 501确定出的第一物理页为至少两个, 且确定出的第一物理页中存在物理页号不连续的第一物理页时, 向内存管理器 发送调整指令, 该调整指令用于指示内存管理器对物理内存中的至少一对第二 物理页进行交换处理,每对第二物理页包括物理页号不连续的第一物理页中的 一个和一个非空闲的物理页,使得交换后得到的第一物理页与至少另一个所述 第一物理页是连续的;  The sending module 502 is configured to: when the first physical page determined by the memory allocating module 501 is at least two, and the first physical page that is determined to have a discontinuous physical page number in the first physical page, send to the memory manager And an adjustment instruction, the adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes one and one of the first physical pages whose physical page numbers are discontinuous a non-idle physical page such that the first physical page obtained after the exchange is contiguous with at least one other of the first physical pages;
表项处理模块 503, 用于在进程的 TLB页表中添加一条表项, 该表项中记 录了至少两个连续的第一物理页合并为一个大物理页后与进程的虚拟页的映 射关系, 该大物理页包括交换后得到的第一物理页。  The entry processing module 503 is configured to add an entry in the TLB page table of the process, where the entry records the mapping relationship between the at least two consecutive first physical pages and the virtual page of the process after being merged into one large physical page. The large physical page includes the first physical page obtained after the exchange.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例六  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Embodiment 6
本发明实施例提供了一种内存管理装置, 可以用于实现实施例三或四中 CPU执行的步骤。 如图 7所示, 该装置包括: The embodiment of the invention provides a memory management device, which can be used to implement the third or fourth embodiment. The steps performed by the CPU. As shown in Figure 7, the device includes:
内存分配模块 601、 发送模块 602和表项处理模块 603。  The memory allocation module 601, the sending module 602, and the entry processing module 603.
其中, 内存分配模块 601, 用于当需要为进程分配物理内存时, 从空闲的 物理页中确定分配给所述进程的第一物理页。  The memory allocation module 601 is configured to determine, when the physical memory needs to be allocated for the process, the first physical page allocated to the process from the free physical page.
发送模块 602,用于当内存分配模块 601确定出的第一物理页为至少两个, 且确定出的第一物理页中存在物理页号不连续的第一物理页时, 向内存管理器 发送调整指令, 该调整指令用于指示内存管理器对物理内存中的至少一对第二 物理页进行交换处理,每对第二物理页包括物理页号不连续的第一物理页中的 一个和一个非空闲的物理页,使得交换后得到的第一物理页与至少另一个所述 第一物理页是连续的;  The sending module 602 is configured to send, when the first physical page determined by the memory allocation module 601 is at least two, and the first physical page in the first physical page that is determined to be discontinuous, to the memory manager And an adjustment instruction, the adjustment instruction is used to instruct the memory manager to exchange at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes one and one of the first physical pages whose physical page numbers are discontinuous a non-idle physical page such that the first physical page obtained after the exchange is contiguous with at least one other of the first physical pages;
表项处理模块 603, 用于在进程的 TLB页表中添加一条表项, 该表项中记 录了至少两个连续的第一物理页合并为一个大物理页后与进程的虚拟页的映 射关系, 该大物理页包括交换后得到的第一物理页。  The entry processing module 603 is configured to add an entry in the TLB page table of the process, where the entry records the mapping relationship between the at least two consecutive first physical pages and the virtual page of the process after being merged into one large physical page. The large physical page includes the first physical page obtained after the exchange.
在本发明实施例的第一种实现方式中, 内存管理器中设有物理页号和内部 页号的映射表, 调整指令携带第一物理页号和第二物理页号, 存储指令用于指 示内存管理器交换第一物理页号和第二物理页号对应的内部页号, 内存管理器 用于根据内部页号访问物理内存(该实现方式可以参见实施例二, 在此省略详 细描述)。  In a first implementation manner of the embodiment of the present invention, the memory manager is provided with a mapping table of a physical page number and an internal page number, where the adjustment instruction carries the first physical page number and the second physical page number, and the storage instruction is used to indicate The memory manager exchanges the internal page number corresponding to the first physical page number and the second physical page number. The memory manager is configured to access the physical memory according to the internal page number. For the implementation, refer to the second embodiment, and detailed description is omitted here.
在该第一种实现方式中, 发送模块 602还可以用于, 向内存管理器发送复 位指令, 该复位指令用于指示内存管理器创建物理页号和内部页号的映射表。  In the first implementation, the sending module 602 is further configured to send a reset instruction to the memory manager, the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and the internal page number.
在该第一种实现方式中, 内存管理器可以为内存控制器或者片上网络的路 由器。  In this first implementation, the memory manager can be a memory controller or a router for an on-chip network.
在本发明实施例的第二种实现方式中,调整指令携带第一物理页号和第二 物理页号, 调整指令用于指示内存管理器交换第一物理页号对应的物理页内的 数据和第二物理页号对应的物理页内的数据 (该实现方式可以参见实施例三, 在此省略详细描述)。  In a second implementation manner of the embodiment of the present invention, the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange data in the physical page corresponding to the first physical page number and The data in the physical page corresponding to the second physical page number (for the implementation, refer to the third embodiment, and the detailed description is omitted here).
在该第二种实现方式中, 内存管理器可以为内存控制器。  In this second implementation, the memory manager can be a memory controller.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例七 In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the process when the address mapping is performed. The number of TLB entries used, which in turn reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Example 7
本发明实施例提供了一种内存管理装置, 可以用于实现实施例二提供的方 法, 如图 8所示, 该装置包括: 接收模块 701和执行模块 702。  The embodiment of the present invention provides a memory management apparatus, which can be used to implement the method provided in Embodiment 2. As shown in FIG. 8, the apparatus includes: a receiving module 701 and an executing module 702.
其中, 接收模块 701用于接收调整指令, 该调整指令用于指示内存管理器 对所述物理内存中的至少一对第二物理页进行交换处理,每对第二物理页包括 物理页号不连续的第一物理页中的一个和一个非空闲的物理页, 第一物理页为 待分配给进程的空闲的物理页。  The receiving module 701 is configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform exchange processing on at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes a physical page number discontinuous One of the first physical pages and one non-idle physical page, the first physical page being the free physical page to be assigned to the process.
执行模块 702, 用于根据接收模块 701接收到的调整指令, 对物理内存中 的物理页进行交换处理,使得交换后得到的第一物理页与至少另一个第一物理 页是连续的。  The executing module 702 is configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module 701, so that the first physical page obtained after the exchange is continuous with at least another first physical page.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例八  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Example eight
本发明实施例提供了一种内存管理装置, 可以用于实现实施例三或四中内 存控制器执行的步骤。 参见图 9, 该装置包括: 接收模块 801和执行模块 802。  The embodiment of the invention provides a memory management device, which can be used to implement the steps performed by the memory controller in the third or fourth embodiment. Referring to Figure 9, the apparatus includes: a receiving module 801 and an executing module 802.
其中, 接收模块 801用于接收调整指令, 该调整指令用于指示内存管理器 对所述物理内存中的至少一对第二物理页进行交换处理,每对第二物理页包括 物理页号不连续的第一物理页中的一个和一个非空闲的物理页, 第一物理页为 待分配给进程的空闲的物理页。  The receiving module 801 is configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform exchange processing on at least one pair of second physical pages in the physical memory, where each pair of second physical pages includes a physical page number discontinuous One of the first physical pages and one non-idle physical page, the first physical page being the free physical page to be assigned to the process.
执行模块 802, 用于根据接收模块 801接收到的调整指令, 对物理内存中 的物理页进行交换处理,使得交换后得到的第一物理页与至少另一个第一物理 页是连续的。  The executing module 802 is configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module 801, so that the first physical page obtained after the exchange is continuous with at least another first physical page.
在本发明实施例的第一种实现方式中, 内存管理器中设有物理页号和内部 页号的映射表, 该调整指令携带第一物理页号和第二物理页号, 该调整指令用 于指示内存管理器交换第一物理页号和所述第二物理页号对应的内部页号, 内 存管理器用于才艮据内部页号访问物理内存。 In a first implementation manner of the embodiment of the present invention, a physical page number and an internal part are provided in the memory manager. a mapping table of the page number, the adjustment instruction carries a first physical page number and a second physical page number, the adjustment instruction is used to instruct the memory manager to exchange the first physical page number and the internal page number corresponding to the second physical page number The memory manager is used to access physical memory based on the internal page number.
在该第一种实现方式中, 接收模块 801还可以用于, 接收复位指令, 所述 复位指令用于指示所述内存管理器创建所述物理页号和内部页号的映射表; 执行模块 802还可以用于,根据复位指令创建物理页号和内部页号的映射 表。  In the first implementation, the receiving module 801 is further configured to receive a reset instruction, where the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and an internal page number; It can also be used to create a mapping table of physical page numbers and internal page numbers according to the reset instruction.
在该第一种实现方式中, 内存管理器可以为内存控制器或者片上网络的路 由器 (该实现方式可以参见实施例四, 在此省略详细描述)。  In this first implementation, the memory manager may be a memory controller or a router of an on-chip network (for the implementation, refer to Embodiment 4, and detailed description is omitted here).
进一步地,在该第一种实现方式中,该装置还可以包括:地址转换模块 803 和访存模块 804。  Further, in the first implementation manner, the apparatus may further include: an address conversion module 803 and a memory access module 804.
此时, 接收模块 801还可以用于, 接收访存指令, 该访存指令包括起始物 理地址和长度信息。地址转换模块 803用于根据所述物理页号和内部页号的映 射表, 将访存指令中的的起始物理地址转换为内部地址。 访存模块 804, 用于 才艮据地址转换模块 803得到的内部地址访问物理内存。  At this time, the receiving module 801 is further configured to receive a memory access instruction, where the memory access instruction includes a starting physical address and length information. The address conversion module 803 is configured to convert the starting physical address in the fetch instruction into an internal address according to the mapping table of the physical page number and the internal page number. The memory access module 804 is configured to access the physical memory according to the internal address obtained by the address translation module 803.
在本发明实施例的第二种实现方式中,调整指令携带第一物理页号和第二 物理页号, 调整指令用于指示内存管理器交换第一物理页号对应的物理页内的 数据和第二物理页号对应的物理页内的数据 (该实现方式可以参见实施例四, 在此省略详细描述)。  In a second implementation manner of the embodiment of the present invention, the adjustment instruction carries a first physical page number and a second physical page number, where the adjustment instruction is used to instruct the memory manager to exchange data in the physical page corresponding to the first physical page number and The data in the physical page corresponding to the second physical page number (for the implementation, refer to Embodiment 4, and detailed description is omitted here).
在该第二种实现方式中, 内存管理器可以为内存控制器。  In this second implementation, the memory manager can be a memory controller.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例九  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Example nine
本发明实施例提供了一种内存管理装置, 参见图 10, 该装置包括处理器 1001、 存储器 1002、 总线 1003和通信接口 1004。 其中, 存储器 1002用于存 储计算机执行指令, 处理器 1001与存储器 1002通过总线 1003连接, 当所述 计算机运行时, 处理器 1001执行存储器 1002存储的所述计算机执行指令, 以 使所述计算机执行实施例一或实施例三或实施例四中 CPU所执行的方法。 An embodiment of the present invention provides a memory management apparatus. Referring to FIG. 10, the apparatus includes a processor 1001, a memory 1002, a bus 1003, and a communication interface 1004. The memory 1002 is configured to store computer execution instructions, and the processor 1001 is connected to the memory 1002 via the bus 1003. When the computer is running, the processor 1001 executes the computer-executed instructions stored in the memory 1002 to cause the computer to execute the method executed by the CPU in the first embodiment or the third embodiment or the fourth embodiment.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例十  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Example ten
本发明实施例提供了一种内存管理装置, 参见图 11, 该装置包括处理器 1101、 存储器 1102、 总线 1103和通信接口 1104。 其中, 存储器 1102用于存 储计算机执行指令, 处理器 1101与存储器 1102通过总线 1103连接, 当所述 计算机运行时, 处理器 1101执行存储器 1102存储的所述计算机执行指令, 以 使所述计算机执行实施例二或实施例三或实施例四中内存控制器所执行的方 法。  The embodiment of the present invention provides a memory management apparatus. Referring to FIG. 11, the apparatus includes a processor 1101, a memory 1102, a bus 1103, and a communication interface 1104. The memory 1102 is used to store computer execution instructions, and the processor 1101 is connected to the memory 1102 via a bus 1103. When the computer is running, the processor 1101 executes the computer execution instructions stored in the memory 1102 to cause the computer to execute the implementation. The method performed by the memory controller in the second embodiment or the third embodiment or the fourth embodiment.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例十一  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. Embodiment 11
本发明实施例提供了一种内存管理系统,参见图 12,该系统包括: CPU1201 和内存控制器 1202;  The embodiment of the present invention provides a memory management system. Referring to FIG. 12, the system includes: a CPU 1201 and a memory controller 1202;
其中, CPU1201包括实施例五、 六或九提供的内存管理装置;  The CPU 1201 includes the memory management device provided in Embodiment 5, 6 or 9;
内存控制器 1202包括实施例七、 八或十提供的内存管理装置。  The memory controller 1202 includes the memory management device provided in the seventh, eighth or tenth embodiment.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 实施例十二 In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page. As an entry, it is added to the TLB page table of the process, which can reduce the number of TLB entries used by the process in address mapping, and thus reduce the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system, and is easy to popularize and apply. Example twelve
本发明实施例提供了一种片上网络, 参见图 13, 该片上网络包括: 多个处理器 1301、多个路由器 1302和多个内存控制器 1303,处理器 1301 通过路由器 1302与内存控制器 1303连接;  The embodiment of the present invention provides an on-chip network. Referring to FIG. 13, the on-chip network includes: a plurality of processors 1301, a plurality of routers 1302, and a plurality of memory controllers 1303. The processor 1301 is connected to the memory controller 1303 through the router 1302. ;
其中, 处理器 1301 包括实施例五、 六或九提供的内存管理装置; 路由器 1302包括实施例七、 八或十提供的内存管理装置。  The processor 1301 includes the memory management device provided in Embodiment 5, 6 or 9. The router 1302 includes the memory management device provided in Embodiment 7, 8, or 10.
本发明实施例通过先确定分配给进程的第一物理页, 然后对物理页号不连 续的第一物理页进行交换处理, 进而使得交换后得到的第一物理页与另一个物 理页是连续的,这样,可以将连续的至少两个第一物理页合并为一个大物理页, 作为一个表项添加到进程的 TLB页表中, 从而可以减少该进程在地址映射时, 所使用的 TLB表项的数量, 进而减少 TLB缺页开销。 另外, 本发明实施例对 操作系统的改动少, 易于推广应用。 需要说明的是: 上述实施例提供的内存管理装置在进行内存管理时, 仅以 上述各功能模块的划分进行举例说明, 实际应用中, 可以根据需要而将上述功 能分配由不同的功能模块完成, 即将装置的内部结构划分成不同的功能模块, 以完成以上描述的全部或者部分功能。 另外, 上述实施例提供的内存管理装置 与内存管理方法实施例属于同一构思, 其具体实现过程详见方法实施例, 这里 不再赘述。 上述本发明实施例序号仅仅为了描述, 不代表实施例的优劣。  In the embodiment of the present invention, the first physical page allocated to the process is first determined, and then the first physical page whose physical page number is discontinuous is exchanged, so that the first physical page obtained after the exchange is continuous with another physical page. In this way, at least two consecutive first physical pages can be merged into one large physical page, and added as an entry to the TLB page table of the process, thereby reducing the TLB entry used by the process in address mapping. The number, in turn, reduces the TLB page fault overhead. In addition, the embodiment of the present invention has few changes to the operating system and is easy to popularize and apply. It should be noted that, when the memory management device provided by the foregoing embodiment performs memory management, only the division of each functional module described above is used as an example. In actual applications, the function distribution may be completed by different functional modules as needed. The internal structure of the device is divided into different functional modules to perform all or part of the functions described above. In addition, the memory management device and the memory management method embodiment provided in the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again. The serial numbers of the embodiments of the present invention are merely for the description, and do not represent the advantages and disadvantages of the embodiments.
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通 过硬件来完成, 也可以通过程序来指令相关的硬件完成, 所述的程序可以存储 于一种计算机可读存储介质中, 上述提到的存储介质可以是只读存储器, 磁盘 或光盘等。  A person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium. The storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.
以上所述仅为本发明的较佳实施例, 并不用以限制本发明, 凡在本发明的 精神和原则之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的 保护范围之内。 The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., which are included in the spirit and scope of the present invention, should be included in the present invention. Within the scope of protection.

Claims

权 利 要 求 书 Claim
1、 一种内存分配方法, 其特征在于, 所述方法包括:  A memory allocation method, the method comprising:
当需要为进程分配物理内存时, 从空闲的物理页中确定分配给所述进程的 第一物理页;  When physical memory needs to be allocated for a process, the first physical page allocated to the process is determined from the free physical page;
当确定出的所述第一物理页为至少两个, 且确定出的所述至少两个第一物 理页中存在物理页号不连续的第一物理页时, 向内存管理器发送调整指令, 所 述调整指令用于指示所述内存管理器对所述物理内存中的至少一对第二物理页 进行交换处理, 每对所述第二物理页包括所述物理页号不连续的第一物理页中 的一个和一个非空闲的物理页, 使得交换后得到的第一物理页与至少另一个所 述第一物理页是连续的;  Sending an adjustment instruction to the memory manager when the first physical page is determined to be at least two, and the first physical page whose physical page number is discontinuous exists in the determined at least two first physical pages, The adjustment instruction is configured to instruct the memory manager to perform an exchange process on at least one pair of second physical pages in the physical memory, where each pair of the second physical pages includes the first physical body whose physical page number is discontinuous One of the pages and one non-idle physical page, such that the first physical page obtained after the exchange is continuous with at least one of the other first physical pages;
在所述进程的地址转换緩冲区 TLB页表中添加一条表项, 所述表项中记录 了至少两个连续的所述第一物理页合并为一个大物理页后与所述进程的虚拟页 的映射关系, 所述大物理页包括所述交换后得到的第一物理页。  Adding an entry in the address translation buffer TLB page table of the process, where the entry records that at least two consecutive first physical pages are merged into one large physical page and virtualized with the process A mapping relationship of pages, the large physical page including the first physical page obtained after the exchange.
2、 根据权利要求 1所述的方法, 其特征在于, 所述内存管理器中设有物理 页号和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述存储指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理 页号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。 The method according to claim 1, wherein the memory manager is provided with a mapping table of physical page numbers and internal page numbers, and the adjustment instruction carries a first physical page number and a second physical page number. The storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the internal page number according to the Physical memory.
3、 根据权利要求 2所述的方法, 其特征在于, 所述方法还包括: 向所述内存管理器发送复位指令, 所述复位指令用于指示所述内存管理器 创建所述物理页号和内部页号的映射表。 The method according to claim 2, wherein the method further comprises: sending a reset instruction to the memory manager, the reset instruction being used to instruct the memory manager to create the physical page number and A mapping table of internal page numbers.
4、 根据权利要求 1所述的方法, 其特征在于, 所述调整指令携带第一物理 页号和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物 理页号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 The method according to claim 1, wherein the adjustment instruction carries a first physical page number and a second physical page number, and the adjustment instruction is used to instruct the memory manager to exchange the first physical The data in the physical page corresponding to the page number and the data in the physical page corresponding to the second physical page number.
5、 一种内存管理方法, 其特征在于, 所述方法包括: 5. A memory management method, the method comprising:
内存管理器接收调整指令, 所述调整指令用于指示所述内存管理器对所述 物理内存中的至少一对第二物理页进行交换处理, 每对所述第二物理页包括所 述物理页号不连续的第一物理页中的一个和一个非空闲的物理页, 所述第一物 理页为待分配给进程的空闲的物理页; The memory manager receives an adjustment instruction, the adjustment instruction is used to instruct the memory manager to Exchanging at least one pair of second physical pages in the physical memory, each pair of the second physical pages including one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical page, the A physical page is an idle physical page to be assigned to a process;
根据所述调整指令对物理内存中的物理页进行交换处理, 使得交换后得到 的第一物理页与至少另一个所述第一物理页是连续的。  The physical page in the physical memory is exchanged according to the adjustment instruction, so that the first physical page obtained after the exchange is continuous with at least another of the first physical pages.
6、 根据权利要求 5所述的方法, 其特征在于, 所述内存管理器中设有物理 页号和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理 页号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。 The method according to claim 5, wherein the memory manager is provided with a mapping table of a physical page number and an internal page number, and the adjustment instruction carries a first physical page number and a second physical page number. The adjustment instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the internal page number according to the Physical memory.
7、 根据权利要求 6所述的方法, 其特征在于, 所述方法还包括: The method according to claim 6, wherein the method further comprises:
接收复位指令, 所述复位指令用于指示所述内存管理器创建所述物理页号 和内部页号的映射表;  Receiving a reset instruction, the reset instruction is used to instruct the memory manager to create a mapping table of the physical page number and an internal page number;
根据复位指令创建所述物理页号和内部页号的映射表。  A mapping table of the physical page number and the internal page number is created according to the reset instruction.
8、 根据权利要求 6所述的方法, 其特征在于, 所述方法还包括: The method according to claim 6, wherein the method further comprises:
接收访存指令, 所述访存指令包括起始物理地址和长度信息;  Receiving a memory access instruction, where the memory access instruction includes a starting physical address and length information;
根据所述物理页号和内部页号的映射表, 将所述访存指令中的的起始物理 地址转换为内部地址;  Converting a starting physical address in the memory access instruction to an internal address according to a mapping table of the physical page number and an internal page number;
才艮据所述内部地址访问所述物理内存。  The physical memory is accessed according to the internal address.
9、 根据权利要求 5所述的方法, 其特征在于, 所述调整指令携带第一物理 页号和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物 理页号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 The method according to claim 5, wherein the adjustment instruction carries a first physical page number and a second physical page number, the adjustment instruction is used to instruct the memory manager to exchange the first physical The data in the physical page corresponding to the page number and the data in the physical page corresponding to the second physical page number.
10、 一种内存管理装置, 其特征在于, 所述装置包括: 10. A memory management device, the device comprising:
内存分配模块, 用于当需要为进程分配物理内存时, 从空闲的物理页中确 定分配给所述进程的第一物理页;  a memory allocation module, configured to determine, from an idle physical page, a first physical page allocated to the process when physical memory needs to be allocated for the process;
发送模块, 用于当所述内存分配模块确定出的所述第一物理页为至少两个, 且确定出的所述第一物理页中存在物理页号不连续的第一物理页时, 向内存管 理器发送调整指令, 所述调整指令用于指示所述内存管理器对所述物理内存中 的至少一对第二物理页进行交换处理, 每对所述第二物理页包括所述物理页号 不连续的第一物理页中的一个和一个非空闲的物理页, 使得交换后得到的第一 物理页与至少另一个所述第一物理页是连续的; a sending module, configured to: when the first physical page determined by the memory allocation module is at least two, And determining, in the first physical page that the first physical page has a physical page number that is not continuous, sending an adjustment instruction to the memory manager, where the adjustment instruction is used to indicate that the memory manager is in the physical memory At least one pair of second physical pages are exchanged, and each pair of the second physical pages includes one of the first physical pages whose physical page numbers are discontinuous and one non-idle physical page, so that the first obtained after the exchange One physical page is continuous with at least one other of the first physical pages;
表项处理模块, 用于在所述进程的地址转换緩冲区 TLB页表中添加一条表 项, 所述表项中记录了至少两个连续的所述第一物理页合并为一个大物理页后 与所述进程的虚拟页的映射关系, 所述大物理页包括所述交换后得到的第一物 理页。  An entry processing module, configured to add an entry in the address translation buffer TLB page table of the process, where the entry records that at least two consecutive first physical pages are merged into one large physical page And a mapping relationship with the virtual page of the process, where the large physical page includes the first physical page obtained after the exchange.
11、 根据权利要求 10所述的装置, 其特征在于, 所述内存管理器中设有物 理页号和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述存储指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理 页号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。 The apparatus according to claim 10, wherein the memory manager is provided with a mapping table of a physical page number and an internal page number, and the adjustment instruction carries the first physical page number and the second physical page number. The storage instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the internal page number according to the Physical memory.
12、 根据权利要求 11所述的装置, 其特征在于, 所述发送模块还用于, 向 所述内存管理器发送复位指令, 所述复位指令用于指示所述内存管理器创建所 述物理页号和内部页号的映射表。 The device according to claim 11, wherein the sending module is further configured to send a reset instruction to the memory manager, where the reset instruction is used to instruct the memory manager to create the physical page A mapping table of numbers and internal page numbers.
13、 根据权利要求 10所述的装置, 其特征在于, 所述调整指令携带第一物 理页号和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一 物理页号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 The apparatus according to claim 10, wherein the adjustment instruction carries a first physical page number and a second physical page number, the adjustment instruction is used to instruct the memory manager to exchange the first physical The data in the physical page corresponding to the page number and the data in the physical page corresponding to the second physical page number.
14、 一种内存管理装置, 其特征在于, 所述装置包括: 14. A memory management device, the device comprising:
接收模块, 用于接收调整指令, 所述调整指令用于指示所述内存管理器对 所述物理内存中的至少一对第二物理页进行交换处理, 每对所述第二物理页包 括所述物理页号不连续的第一物理页中的一个和一个非空闲的物理页, 所述第 一物理页为待分配给进程的空闲的物理页;  a receiving module, configured to receive an adjustment instruction, where the adjustment instruction is used to instruct the memory manager to perform an exchange process on at least one pair of second physical pages in the physical memory, where each pair of the second physical page includes the One of the first physical pages whose physical page numbers are not consecutive and one non-idle physical page, the first physical page being an idle physical page to be allocated to the process;
执行模块, 用于根据所述接收模块接收到的所述调整指令, 对物理内存中 的物理页进行交换处理, 使得交换后得到的第一物理页与至少另一个所述第一 物理页是连续的。 An execution module, configured to exchange physical pages in the physical memory according to the adjustment instruction received by the receiving module, so that the first physical page obtained after the exchange and the at least another first Physical pages are contiguous.
15、 根据权利要求 14所述的装置, 其特征在于, 所述内存管理器中设有物 理页号和内部页号的映射表, 所述调整指令携带第一物理页号和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一物理页号和所述第二物理 页号对应的内部页号, 所述内存管理器用于根据所述内部页号访问所述物理内 存。 The apparatus according to claim 14, wherein the memory manager is provided with a mapping table of a physical page number and an internal page number, and the adjustment instruction carries the first physical page number and the second physical page number. The adjustment instruction is configured to instruct the memory manager to exchange an internal page number corresponding to the first physical page number and the second physical page number, where the memory manager is configured to access the internal page number according to the Physical memory.
16、 根据权利要求 15所述的装置, 其特征在于, 所述接收模块还用于, 接 收复位指令, 所述复位指令用于指示所述内存管理器创建所述物理页号和内部 页号的映射表; The device according to claim 15, wherein the receiving module is further configured to receive a reset instruction, where the reset instruction is used to instruct the memory manager to create the physical page number and an internal page number. Mapping table
所述执行模块还用于, 根据复位指令创建所述物理页号和内部页号的映射 表。  The execution module is further configured to create a mapping table of the physical page number and the internal page number according to the reset instruction.
17、 根据权利要求 15所述的装置, 其特征在于, 所述接收模块还用于, 接 收访存指令, 所述访存指令包括起始物理地址和长度信息; The device according to claim 15, wherein the receiving module is further configured to: receive a memory access instruction, where the memory access instruction includes a starting physical address and length information;
所述装置还包括:  The device also includes:
地址转换模块, 用于根据所述物理页号和内部页号的映射表, 将所述访存 指令中的的起始物理地址转换为内部地址;  An address conversion module, configured to convert a starting physical address in the memory access instruction into an internal address according to a mapping table of the physical page number and an internal page number;
访存模块, 用于根据所述地址转换模块得到的所述内部地址访问所述物理 内存。  And a memory access module, configured to access the physical memory according to the internal address obtained by the address translation module.
18、 根据权利要求 14所述的装置, 其特征在于, 所述调整指令携带第一物 理页号和第二物理页号, 所述调整指令用于指示所述内存管理器交换所述第一 物理页号对应的物理页内的数据和所述第二物理页号对应的物理页内的数据。 The apparatus according to claim 14, wherein the adjustment instruction carries a first physical page number and a second physical page number, and the adjustment instruction is used to instruct the memory manager to exchange the first physical The data in the physical page corresponding to the page number and the data in the physical page corresponding to the second physical page number.
19、 一种内存管理装置, 其特征在于, 所述装置包括: 处理器、 存储器、 总线和通信接口; 所述存储器用于存储计算机执行指令, 所述处理器与所述存 储器通过所述总线连接, 当所述计算机运行时, 所述处理器执行所述存储器存 储的所述计算机执行指令, 以使所述计算机执行如权利要求 1~4任意一项所述 的方法。 A memory management device, the device comprising: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, and the processor is connected to the memory through the bus The processor executes the computer-executed instructions stored in the memory to cause the computer to perform the method of any one of claims 1 to 4.
20、 一种内存管理装置, 其特征在于, 所述装置包括: 所述装置包括: 处 理器、 存储器、 总线和通信接口; 所述存储器用于存储计算机执行指令, 所述 处理器与所述存储器通过所述总线连接, 当所述计算机运行时, 所述处理器执 行所述存储器存储的所述计算机执行指令,以使所述计算机执行如权利要求 5~9 任意一项所述的方法。 20. A memory management device, the device comprising: the device comprising: a processor, a memory, a bus, and a communication interface; the memory is configured to store a computer execution instruction, the processor and the memory Through the bus connection, the processor executes the computer-executed instructions stored in the memory to cause the computer to perform the method of any one of claims 5-9 when the computer is running.
21、 一种内存管理系统, 其特征在于, 所述系统包括: 21. A memory management system, the system comprising:
中央处理器和内存控制器;  Central processor and memory controller;
其中, 所述中央处理器包括如权利要求 10-13任一项或权利要求 19所述的 内存管理装置;  The central processing unit includes the memory management device according to any one of claims 10-13 or claim 19;
所述内存控制器包括如权利要求 14-18任一项或权利要求 20所述的内存管 理装置。  The memory controller includes the memory management device of any one of claims 14-18 or 20.
22、 一种片上网络, 其特征在于, 所述片上网络包括: 22. An on-chip network, wherein the on-chip network includes:
多个处理器、 多个路由器和多个内存控制器, 所述处理器通过所述路由器 与所述内存控制器连接;  a plurality of processors, a plurality of routers, and a plurality of memory controllers, wherein the processor is connected to the memory controller through the router;
所述处理器包括如权利要求 10-13任一项或权利要求 19所述的内存管理装 置;  The processor includes the memory management device according to any one of claims 10-13 or claim 19;
所述路由器包括如权利要求 14-18任一项或权利要求 20所述的内存管理装 置。  The router includes the memory management device of any one of claims 14-18 or 20.
PCT/CN2014/083966 2014-08-08 2014-08-08 Memory management method, device and system and network-on-chip WO2016019566A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2014/083966 WO2016019566A1 (en) 2014-08-08 2014-08-08 Memory management method, device and system and network-on-chip
CN201480037710.XA CN105518631B (en) 2014-08-08 2014-08-08 EMS memory management process, device and system and network-on-chip

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/083966 WO2016019566A1 (en) 2014-08-08 2014-08-08 Memory management method, device and system and network-on-chip

Publications (1)

Publication Number Publication Date
WO2016019566A1 true WO2016019566A1 (en) 2016-02-11

Family

ID=55263043

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/083966 WO2016019566A1 (en) 2014-08-08 2014-08-08 Memory management method, device and system and network-on-chip

Country Status (2)

Country Link
CN (1) CN105518631B (en)
WO (1) WO2016019566A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11298272B2 (en) 2016-11-25 2022-04-12 The Procter & Gamble Company Wearable article having elastic belt

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017190266A1 (en) 2016-05-03 2017-11-09 华为技术有限公司 Method for managing translation lookaside buffer and multi-core processor
EP3454218B1 (en) * 2016-08-11 2023-02-01 Huawei Technologies Co., Ltd. Method for accessing table entry in translation lookaside buffer (tlb) and processing chip
CN107066393B (en) * 2017-01-12 2020-06-09 安徽大学 Method for improving mapping information density in address mapping table
CN108205472B (en) * 2017-08-15 2021-11-05 珠海市魅族科技有限公司 Memory release method, release device, computer device and readable storage medium
CN112560086B (en) * 2020-12-11 2022-11-08 海光信息技术股份有限公司 Configuration method and device for password coprocessor, CPU and electronic equipment
CN115129459A (en) * 2021-03-24 2022-09-30 华为技术有限公司 Memory management method and device
CN113778688A (en) * 2021-09-17 2021-12-10 Oppo广东移动通信有限公司 Memory management system, memory management method, and memory management device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1617113A (en) * 2003-11-13 2005-05-18 国际商业机器公司 Method of assigning virtual memory to physical memory, storage controller and computer system
CN101859279A (en) * 2010-05-21 2010-10-13 北京星网锐捷网络技术有限公司 Memory allocation and release method and device
CN102122268A (en) * 2010-01-07 2011-07-13 华为技术有限公司 Virtual machine memory allocation access method, device and system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7277999B1 (en) * 2004-08-12 2007-10-02 Vmware, Inc. Restricting memory access to protect data when sharing a common address space

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1617113A (en) * 2003-11-13 2005-05-18 国际商业机器公司 Method of assigning virtual memory to physical memory, storage controller and computer system
CN102122268A (en) * 2010-01-07 2011-07-13 华为技术有限公司 Virtual machine memory allocation access method, device and system
CN101859279A (en) * 2010-05-21 2010-10-13 北京星网锐捷网络技术有限公司 Memory allocation and release method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11298272B2 (en) 2016-11-25 2022-04-12 The Procter & Gamble Company Wearable article having elastic belt

Also Published As

Publication number Publication date
CN105518631A (en) 2016-04-20
CN105518631B (en) 2019-04-12

Similar Documents

Publication Publication Date Title
WO2016019566A1 (en) Memory management method, device and system and network-on-chip
US8250254B2 (en) Offloading input/output (I/O) virtualization operations to a processor
US10719463B1 (en) Hardware handling memory write request during memory data migration
WO2015078219A1 (en) Information caching method and apparatus, and communication device
US20190243757A1 (en) Systems and methods for input/output computing resource control
EP3441884B1 (en) Method for managing translation lookaside buffer and multi-core processor
JP6514329B2 (en) Memory access method, switch, and multiprocessor system
CN106560791B (en) Efficient virtual I/O address translation
US9584628B2 (en) Zero-copy data transmission system
WO2015180598A1 (en) Method, apparatus and system for processing access information of storage device
US20220179792A1 (en) Memory management device
AU2015402888B2 (en) Computer device and method for reading/writing data by computer device
US20210149815A1 (en) Technologies for offload device fetching of address translations
US9336158B2 (en) Method and system for simplified address translation support for static infiniband host channel adaptor structures
US9772776B2 (en) Per-memory group swap device
US10331570B2 (en) Real time memory address translation device
CN113010452A (en) Efficient virtual memory architecture supporting QoS
US9081764B2 (en) Iimplementing DMA migration of large system memory areas
WO2016119618A1 (en) Remote memory allocation method, device and system
WO2014101502A1 (en) Memory access processing method based on memory chip interconnection, memory chip, and system
WO2017031637A1 (en) Memory access method, apparatus and system
US11281612B2 (en) Switch-based inter-device notational data movement system
US20240103897A1 (en) Diversified virtual memory
KR20220014272A (en) Systems and methods for processing copy commands
CN114546902A (en) System, apparatus and method for multi-protocol based access to memory

Legal Events

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

Ref document number: 14899375

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14899375

Country of ref document: EP

Kind code of ref document: A1