WO2015024451A1 - 内存物理地址查询方法和装置 - Google Patents

内存物理地址查询方法和装置 Download PDF

Info

Publication number
WO2015024451A1
WO2015024451A1 PCT/CN2014/083875 CN2014083875W WO2015024451A1 WO 2015024451 A1 WO2015024451 A1 WO 2015024451A1 CN 2014083875 W CN2014083875 W CN 2014083875W WO 2015024451 A1 WO2015024451 A1 WO 2015024451A1
Authority
WO
WIPO (PCT)
Prior art keywords
buffer
page table
stored
physical address
cache
Prior art date
Application number
PCT/CN2014/083875
Other languages
English (en)
French (fr)
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 KR1020167005743A priority Critical patent/KR101768828B1/ko
Priority to JP2016535319A priority patent/JP6198952B2/ja
Priority to EP14838503.2A priority patent/EP3023878B1/en
Publication of WO2015024451A1 publication Critical patent/WO2015024451A1/zh
Priority to US15/047,938 priority patent/US10114762B2/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]
    • G06F12/1045Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB] associated with a data cache
    • 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/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0806Multiuser, multiprocessor or multiprocessing cache systems
    • G06F12/0842Multiuser, multiprocessor or multiprocessing cache systems for multiprocessing or multitasking
    • 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
    • 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/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0862Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches with prefetch
    • 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/1009Address translation using page tables, e.g. page table structures
    • 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
    • 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
    • G06F2212/1021Hit rate improvement
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/60Details of cache memory
    • G06F2212/6022Using a prefetch buffer or dedicated prefetch cache
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/65Details of virtual memory and virtual address translation
    • G06F2212/654Look-ahead translation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/68Details of 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/68Details of translation look-aside buffer [TLB]
    • G06F2212/681Multi-level TLB, e.g. microTLB and main TLB

Definitions

  • the present invention relates to the field of information technology, and in particular, to a memory physical address query method and apparatus.
  • VA virtual address
  • PA physical address
  • MMU Memory Management Unit
  • TLB Translation Lookaside Buffer
  • the memory management unit MMU When the virtual address is used for memory addressing, after receiving the virtual address sent by the application, the memory management unit MMU first searches in the TLB of the bypass conversion buffer, if the TLB caches the virtual address corresponding to the virtual address. Page table entry, ie TLB hit ( Hit ), then Data access is performed through the physical address in the page table entry to the Level 1 Cache. If the data corresponding to the physical address in the Levell Cache is missing, the second level cache is accessed.
  • Level2 Cache performs data access. If the data corresponding to the physical address in the Level2 Cache is missing, the data is accessed in the memory. If the TLB does not contain the page table entry corresponding to the virtual address, the TLB misses. (Miss), you need software or operating system
  • O S Operations System, referred to as O S
  • O S searches for the physical address corresponding to the virtual address, and stores the mapping relationship between the virtual address and the physical address as a page table entry in the TLB for subsequent search by the memory management unit MMU.
  • a prefetch buffer is provided in the memory management unit MMU, and multiple page table entries are stored in the PB.
  • the corresponding physical address is searched for in the TLB.
  • the PB is searched for the corresponding physical address. If the corresponding physical address exists in the PB, the physical address is used.
  • the data access and the hit page table entry are stored in the TLB. If there is no corresponding physical address in the PB, the multiple page table entries in the memory are stored in the PB, and the current stored data in the PB is overwritten.
  • the present invention provides a memory physical address query method and apparatus for solving the problem of long addressing time existing in the prior art.
  • the present invention provides a memory physical address query method, including: determining, according to a preset thread switching policy, that a memory addressing operation is changed from a first thread to a second thread in a future set time;
  • the backup buffer stores a page table entry that is not queried within a set time in a page table cache TLB stored in the bypass translation buffer;
  • the querying, according to the virtual address, a physical address corresponding to the virtual address in a page table entry stored in the bypass conversion buffer and the prefetch buffer Address including:
  • the method further includes:
  • the memory is in the memory Finding a third physical address corresponding to the virtual address.
  • the method further includes:
  • the method further includes: A page table entry corresponding to the virtual address and the third physical address found in the memory is stored into the bypass conversion buffer.
  • the method further includes:
  • the page entry that is not queried in the set time in the bypass conversion buffer is stored in the After the backup buffer is described, the method further includes:
  • the storing, by using the page entry of the second thread stored in the spare buffer, into the prefetch buffer includes: if the spare buffer is stored in the And storing, by the pre-fetching, the page table entries of all the second threads stored in the backup buffer, the number of page table entries of the second thread being less than or equal to the storage capacity of the prefetch buffer In the buffer, and overwriting the current stored data of the prefetch buffer; or
  • the method further includes: if the number of the page entries of the second thread stored in the spare buffer is greater than the storage capacity of the prefetch buffer, the method further includes:
  • the backup cache If there is no first physical address corresponding to the virtual address in the bypass translation buffer, and a second physical address corresponding to the virtual address exists in the prefetch buffer, the backup cache is used A page table entry other than the page table entry stored in the prefetch buffer in the page table entry of the second thread stored in the device is stored in the prefetch buffer.
  • the present invention provides a memory physical address query device, including: a determining module, configured to determine, according to a preset thread switching policy, that a memory addressing operation is changed from a first thread to a second thread in a future set time ;
  • An execution module configured to store, in a prefetch buffer, a page table entry of the second thread stored in the spare buffer, where the backup buffer stores a page table cache TLB stored in the bypass conversion buffer a page table entry that has not been queried in time;
  • the receiving module receives a memory addressing request message sent by the second thread, where the memory addressing request message carries a virtual address;
  • the query module queries the physical address corresponding to the virtual address in the page table entry stored in the bypass translation buffer and the prefetch buffer according to the virtual address.
  • the query module is specifically configured to: if the first physical address corresponding to the virtual address exists in the bypass conversion buffer, pass the first Physical address access memory for data access; or,
  • the query module is further configured to:
  • the memory is in the memory Finding a third physical address corresponding to the virtual address.
  • the query module is further configured to:
  • the prefetching is performed Storing the virtual table address corresponding to the virtual address and the second physical address in the bypass conversion buffer, and deleting the virtual address stored in the prefetch buffer and the The page table entry corresponding to the second physical address.
  • the query module is further configured to:
  • a page table entry corresponding to the virtual address and the third physical address found in the memory is stored in the bypass conversion buffer.
  • the performing The module is also used to:
  • the executing module is further configured to:
  • the executing module is specifically configured to: If the number of page table entries of the second thread stored in the spare buffer is less than or equal to the storage capacity of the prefetch buffer, then all the second threads stored in the spare buffer are a page table entry is stored in the prefetch buffer and overwrites current storage data of the prefetch buffer; or
  • the execution module is further configured to:
  • the present invention provides a memory physical address query apparatus, including: a memory, a bypass conversion buffer, a backup buffer, a prefetch buffer, and a processor;
  • the memory is configured to store an instruction
  • the bypass conversion buffer is configured to store a page table cache TLB
  • the backup buffer is configured to store a page table entry that is not queried within a set time in the TLB stored by the bypass conversion buffer;
  • the prefetch buffer is configured to store a page table entry of a corresponding thread stored in the spare buffer
  • the processor is configured to execute the instructions stored in the memory to perform the memory physical address query method as described in the first aspect.
  • the method and device for querying a physical address of a memory provided by the present invention simultaneously query in a bypass conversion buffer and a prefetch buffer according to a virtual address of a second thread to be addressed, and pre-fetch
  • the page table entry of the second thread that is not queried within the set time in the bypass conversion buffer is stored in the memory, thereby increasing the probability of querying the physical address corresponding to the virtual address and shortening the addressing time.
  • FIG. 1 is a schematic flow chart of an embodiment of a method for querying a physical address of a memory provided by the present invention
  • FIG. 2 is a schematic flow chart of still another embodiment of a method for querying a physical address of a memory provided by the present invention
  • FIG. 3 is a schematic diagram of a cache page table of a bypass conversion buffer in a TLB for a set time in a TLB to be stored in a spare buffer of a corresponding thread;
  • FIG. 4 is a schematic diagram of a page table entry in a backup buffer of a corresponding thread stored in a prefetch buffer P B;
  • FIG. 6 is a schematic structural diagram of an embodiment of a memory physical address query device provided by the present invention.
  • FIG. 7 is a schematic structural diagram of still another embodiment of a memory physical address query apparatus according to the present invention.
  • FIG. 1 is a schematic flow chart of an embodiment of a method for querying a physical address of a memory provided by the present invention.
  • the method provided by the following method embodiments can be applied to various types of terminal devices, such as a PC, a PAD, a mobile phone, and the like.
  • the executor of the following steps may be a central processing unit (CPU) in the various terminal devices, and may be a memory management unit MMU in the CPU.
  • the method may specifically include:
  • the thread switching policy includes which threads are used to perform memory addressing operations during each time period in which the terminal device operates.
  • the first thread is a thread that performs a memory addressing operation in a previous period of time
  • the second thread is a thread that performs a memory addressing operation after the first thread, that is, a thread to be addressed.
  • the thread to be addressed determined according to S101 that is, the second thread, stores the page table entry of the second thread stored in the spare buffer into the prefetch buffer PB, and the spare buffer stores The page table entry stored in the bypass table buffer cache TLB is not queried within the set time.
  • the number of spare buffers may be one or more, for example: each thread may correspond to one spare buffer, which is used to store the cache bypass conversion buffer in the thread set time is not queried. Page table entry.
  • bypass conversion buffer and pre-fetch The number of registers can be one or more, for example: Each thread can have one bypass conversion buffer and one prefetch buffer.
  • the memory addressing request message is sent by the thread to be addressed, that is, the second thread, and the memory addressing request message carries the virtual address VA to be addressed.
  • Query according to the virtual address, a physical address corresponding to the virtual address in a page table entry stored in the bypass conversion buffer and the prefetch buffer.
  • the query may be performed in the page table entry stored in the bypass conversion buffer and the prefetch buffer PB, if the virtual address VA exists in the bypass conversion buffer and the prefetch buffer PB. If the corresponding physical address is used, the physical address is used for data access. If the physical address corresponding to the virtual address VA does not exist in the bypass conversion buffer and the prefetch buffer PB, the query is performed in the memory to A physical address corresponding to the virtual address VA is obtained.
  • FIG. 2 is a schematic flow chart of still another embodiment of a method for querying a physical address of a memory provided by the present invention.
  • the method provided by the following method embodiments can be applied to various types of terminal devices, such as a PC, a PAD, a mobile phone, and the like.
  • the execution body of the following steps may be a CPU of the central processing unit, and may specifically be a memory management unit MMU in the CPU.
  • the method may specifically include:
  • S201 Determine, according to a preset thread switching policy, that the memory addressing operation is changed from the first thread to the second thread in a future set time.
  • the thread switching policy includes the time period in which the terminal device runs, Which threads are used to perform memory addressing operations.
  • the first thread is a thread that performs a memory addressing operation in a previous period
  • the second thread is a thread that performs a memory addressing operation after the first thread, that is, a thread to be addressed.
  • the following steps S203 or S204 may be selectively performed.
  • S203 If the number of page table entries of the second thread stored in the standby buffer is less than or equal to the storage capacity of the prefetch buffer, store the page table entries of all the second threads stored in the spare buffer to the prefetch cache. In the device, and overwrite the current stored data of the prefetch buffer.
  • the thread to be addressed determined according to S201 that is, the second thread, stores part or all of the page table entries of the second thread stored in the spare buffer into the prefetch buffer PB, and deletes the current storage in the PB.
  • the data The backup buffer stores the page table entries that are not queried within the set time in the page table cache TLB stored in the bypass conversion buffer.
  • each thread may correspond to one spare buffer
  • the page table entry stored in each spare buffer may be a page table entry of a corresponding thread that is not queried within a set time in the TLB.
  • 3 is a schematic diagram of a page table entry that is not queried within a set time in a cache page table TLB of a bypass conversion buffer, stored in a spare buffer of a corresponding thread, as shown in FIG.
  • a buffer of a bypass conversion buffer The page table entry stored in the page table TLB may specifically include: a correspondence between the virtual address and the physical address and an identifier of the corresponding thread, and the page table entry stored in the backup buffer corresponding to each thread may specifically include: a virtual address and Correspondence of physical addresses, the spare buffer selection unit receives the unqueried time within the set time stored in the TLB The page table entry and the corresponding thread identifier are stored in the alternate buffer of the corresponding thread according to the thread identifier.
  • FIG. 4 is a schematic diagram of storing a page table entry in a spare buffer of a corresponding thread into a prefetch buffer PB.
  • the spare buffer selection unit will be a thread to be addressed according to the determined thread to be addressed.
  • Some or all of the page table entries in the spare buffer and the corresponding thread identifier are stored in the prefetch buffer PB, so that the prefetch buffer PB stores the page table entry in which the to-be-addressed thread is replaced by the TLB.
  • These page entries that are replaced by TLB are not replaced because they are not needed. However, because TLB has limited storage capacity and many threads, the common page table entries of some threads are replaced.
  • the storage capacity of the spare buffer corresponding to each thread and the storage capacity of the prefetch buffer PB can be set to 32 page tables. All the page entries in the spare buffer corresponding to the thread to be addressed may be stored in the prefetch buffer PB and the data currently stored in the prefetch buffer PB may be deleted before being addressed by the to-be-addressed thread. .
  • the bypass conversion buffer and the prefetch buffer PB can use the Content Addressable Memory (CAM) to complete the comparison of the virtual address VA, but the storage capacity of the prefetch buffer PB is increased.
  • CAM Content Addressable Memory
  • a prefetch buffer PB with a small storage capacity can be selected, for example, a prefetch buffer PB having a storage capacity of 8 page table entries, and then waiting for the to-be-addressed thread to address
  • the eight page table entries with the shortest storage time in the spare buffer corresponding to the addressing thread are stored in the prefetch buffer PB, and the data currently stored in the prefetch buffer PB is deleted.
  • the memory addressing request message is sent by the thread to be addressed, that is, the second thread, and the memory addressing request message carries the virtual address VA to be addressed.
  • the page table entries of the second thread stored in the spare buffer are stored in the prefetch buffer.
  • a page table entry other than the page table entry is stored in the prefetch buffer.
  • PB-Hit or miss (PB-Miss)
  • data access is performed according to the physical address found in the bypass conversion buffer, that is, the first physical address PA1.
  • PB-Hit based on the physical address found in the prefetch buffer PB, that is, the second object
  • the address PA2 is used for data access, and the found page table entry, that is, the hit page table entry, is stored in the TLB of the bypass conversion buffer.
  • the prefetch buffer PB stores only the page table entries of some second threads in the spare buffer, for example, the prefetch buffer PB described above only stores the 8 seconds with the shortest storage time in the spare buffer.
  • the page table entry of the second thread with the shorter storage time can be retrieved from the spare buffer to the pre-reserved Take the buffer PB.
  • the thread identifier searches the memory in the page table scanning unit to find the physical address corresponding to the virtual address VA, that is, the third physical address PA3, and performs data access according to the found third physical address PA3, and simultaneously finds the page table that is found.
  • the item that is hit is the page table entry and the corresponding thread identifier is stored in the TLB of the bypass conversion buffer.
  • the page table entry with the lowest hit rate that is, the page table entry that is missed within the set time is preferentially stored to the backup buffer. , and delete the page table entry that was missed within the set time.
  • the backup buffer can capture the storage mode of "First Input First Output (FIFO)", that is, When the number of page table entries stored in the spare buffer exceeds its own storage capacity, the page table entry with the longest storage time is preferentially deleted.
  • FIFO First Input First Output
  • FIG. 6 is a schematic structural diagram of an embodiment of a memory physical address query apparatus according to the present invention. As shown in FIG.
  • the memory physical address querying device 60 in this embodiment is a specific entity that performs the above-mentioned memory physical address query method, and may specifically include: a determining module 61, an executing module 62 receiving module 63, and a querying module 64, where:
  • the determining module 61 is configured to determine, according to the preset thread switching policy, that the memory addressing operation is changed from the first thread to the second thread in a future set time.
  • the thread switching policy includes which threads are used to perform memory addressing operations during each time period in which the terminal device operates.
  • the first thread is a thread that performs a memory addressing operation in a previous period of time
  • the second thread is a thread that performs a memory addressing operation after the first thread, that is, a thread to be addressed.
  • the execution module 62 is configured to store the page table entry of the second thread stored in the spare buffer into the prefetch buffer, where the backup buffer stores the page table cache TLB stored in the bypass conversion buffer. The page table item being queried.
  • the relationship between the number of page table entries of the second thread stored in the spare buffer and the storage capacity of the prefetch buffer PB is divided into the following two cases:
  • Case 1 If the number of page table entries of the second thread stored in the spare buffer is less than or equal to the storage capacity of the prefetch buffer, the page table entries of all the second threads stored in the spare buffer are stored to the prefetch In the buffer, and overwriting the current stored data of the prefetch buffer;
  • Case 2 if the number of page table entries of the second thread stored in the spare buffer is greater than the storage capacity of the prefetch buffer, the second thread of the spare buffer is stored in the same amount as the storage capacity of the prefetch buffer.
  • the page table entry is stored in the prefetch buffer and covers the current stored data of the prefetch buffer;
  • the determining module 61 storing part or all of the page table entries of the second thread stored in the spare buffer to the prefetch buffer PB
  • the page table entry that is not queried within the set time in the page table cache TLB stored in the bypass conversion buffer is stored in the spare buffer.
  • the number of spare buffers may be one or more, for example: each thread may correspond to one spare buffer, which is used to store the cache bypass conversion buffer in the thread set time is not queried. Page table entry.
  • the number of bypass translation buffers and prefetch buffers can be one or more. For example: Each thread can have one bypass translation buffer and one prefetch buffer.
  • the receiving module 63 is configured to receive a memory addressing request message sent by the second thread, where the memory addressing request message carries a virtual address.
  • the memory addressing request message is sent by the thread to be addressed, that is, the second thread, and the memory addressing request message carries the virtual address VA to be addressed.
  • the query module 64 is configured to query, according to the virtual address, a physical address corresponding to the virtual address in the page table entry stored in the bypass conversion buffer and the prefetch buffer.
  • the query can be performed in the page table entries stored in the bypass conversion buffer and the prefetch buffer PB, respectively, according to the addressing result in the bypass conversion buffer and the prefetch buffer PB.
  • the query can be divided into the following three cases:
  • Case 1 If there is a first physical address corresponding to the virtual address in the bypass conversion buffer, the memory is accessed through the first physical address for data access.
  • the prefetch buffer A second physical address corresponding to the virtual address is stored, and a page table entry other than the page table entry stored in the prefetch buffer in the page table entry of the second thread stored in the spare buffer is stored to the prefetch In the cache.
  • the prefetch buffer PB stores only the page table entries of some of the second threads in the spare buffer, after the page table entries hit in the prefetch buffer PB are stored in the TLB, one of the spare buffers may be taken out.
  • the page table entry is stored in the prefetch buffer PB.
  • Case 3 If there is no first physical address corresponding to the virtual address in the bypass conversion buffer, and the second physical address corresponding to the virtual address does not exist in the prefetch buffer, the corresponding address corresponding to the virtual address is searched in the memory.
  • the third physical address stores the page table entry corresponding to the virtual address and the third physical address found in the memory into the bypass conversion buffer.
  • the physical address corresponding to the virtual address VA needs to be searched in the memory.
  • the third physical address, and the found page table entry, that is, the hit page table entry is stored in the TLB of the bypass conversion buffer.
  • execution module 62 can also be used to:
  • the page table entry with the lowest hit rate that is, the page table entry that is missed within the set time is preferentially stored to the backup buffer. , and delete the page table entry that was missed within the set time.
  • execution module 62 can also be used to:
  • the spare buffer After storing the unqueried page table entry in the standby buffer in the set time of the bypass conversion buffer, if the number of page table entries stored in the spare buffer exceeds its own storage capacity, the spare buffer is deleted. The longest page table entry in storage.
  • the backup buffer can retrieve the storage mode of the first-in first-out FIFO, that is, the page stored in the spare buffer.
  • the page entry with the longest storage time is deleted first.
  • FIG. 7 is a schematic structural diagram of still another embodiment of a memory physical address query apparatus according to the present invention.
  • the memory physical address querying apparatus of this embodiment includes: a memory 71, a bypass conversion buffer 72, a backup buffer 73, a prefetch buffer 74, and a processor 75, wherein: the memory 71 is configured to store Instruction
  • a bypass conversion buffer 72 configured to store a page table cache TLB
  • the backup buffer 73 is configured to store a page table entry that is not queried within a set time in the TLB stored in the bypass conversion buffer;
  • a prefetch buffer 74 configured to store a page table entry of a corresponding thread stored in the spare buffer;
  • the processor 75 is configured to execute an instruction stored in the memory to execute the memory physical address query method as shown in FIG. 1 or FIG. 2.
  • the memory 71 may include a high speed RAM memory, and may also include a non-volatile memory such as at least one disk memory.
  • the memory 71 can optionally include at least one storage device.
  • the memory 71 stores instructions that, when the memory physical address query device is running, communicate between the processor 75 and the memory 71, and the processor 75 executes the instructions such that the memory physical address query device can perform the memory physical address query provided by the embodiments of the present invention. method.
  • the backup buffer 73 may store a page table entry including a correspondence between a virtual address and a physical address and a corresponding identifier of each thread, and the bypass conversion buffer 72 may store a page including a correspondence relationship between the virtual address and the physical address.
  • the table entry and the identifier of the corresponding thread may be stored in the prefetch buffer 74 with a page table entry including a correspondence between the virtual address and the physical address and an identifier of the corresponding thread to be addressed.
  • the number of the backup buffers 73 may be one or more, for example: each thread may correspond to one spare buffer, and is used to store the cache bypass conversion buffer in the thread set time is not set.
  • the page table entry for the query may be one or more, for example: Each thread may correspond to a bypass conversion buffer and a prefetch buffer.
  • the processor in this embodiment may be an integrated circuit chip with signal processing capabilities.
  • each step of the above method may be completed by an integrated logic circuit of hardware in a processor or an instruction in a form of software.
  • the above processor may be a general purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. .
  • DSP digital signal processor
  • ASIC application specific integrated circuit
  • FPGA off-the-shelf programmable gate array
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present invention may be implemented or executed.
  • the above processor may be a microprocessor or the above processor or any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present invention may be directly implemented as a hardware processor, or may be performed by a combination of hardware and software modules in the processor.
  • Software module It can be located in a conventional storage medium such as random access memory, flash memory, read only memory, programmable read only memory or electrically erasable programmable memory, registers, and the like.
  • the storage medium is located in the memory, and the processor reads the information in the memory and combines the hardware to complete the steps of the foregoing method.
  • the embodiment of the present invention further provides a chip for performing physical address inquiry of a memory, and the chip may include the foregoing processor.
  • the memory physical address querying apparatus executes the instruction stored in the memory 71 by the processor 75, and simultaneously performs the query in the bypass conversion buffer and the prefetch buffer according to the virtual address of the second thread to be addressed, and pre- The page entry of the second thread that is not queried in the bypass conversion buffer is stored in the buffer, thereby increasing the probability of querying the physical address corresponding to the virtual address and shortening the addressing time.
  • the aforementioned program can be stored in a computer readable storage medium.
  • the program when executed, performs the steps including the above-described method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk.
  • the invention is not limited thereto; although the invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that the technical solutions described in the foregoing embodiments may be modified, or some or all of them may be modified.
  • the technical features are equivalently substituted; and the modifications or substitutions do not detract from the essence of the technical solutions of the embodiments of the present invention.

Landscapes

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

Abstract

一种内存物理地址査询方法和装置,该方法包括:将备用缓存器中存储的待寻址的第二线程的页表项存储至预取缓存器中,备用缓存器中存储旁路转换缓存器中设定时间内未被査询的页表项;接收第二线程发送的携带虚拟地址的内存寻址请求消息;根据虚拟地址在旁路转换缓存器和预取缓存器中査询对应的物理地址。提供的内存物理地址査询方法和装置,根据待寻址第二线程的虚拟地址在旁路转换缓存器和预取缓存器中同时进行査询,且预取缓存器中存储有旁路转换缓存器中设定时间内未被査询的第二线程的页表项,从而提高对虚拟地址对应的物理地址的査询命中几率,缩短寻址时间。

Description

内存物理地址查询方法和装置 本申请要求于 2013 年 8 月 20 日提交中国专利局、 申请号为 201310364417.1、发明名称为"内存物理地址查询方法和装置"的中国专利申请 的优先权, 其全部内容通过引用结合在本申请中。
技术领域
本发明涉及信息技术领域, 尤其涉及一种内存物理地址查询方法和 装置。
背景技术
目前, 处理器大多釆用虚拟地址 ( Virtual Address , 简称 VA ) 来进 行内存寻址, 使用虚拟地址技术可以创建比实际物理地址 (Physical Address , 简称 PA ) 大得多的寻址空间。 釆用虚拟存储器的处理器大多 釆用一种分页 (Paging ) 机制, 虚拟地址空间以页 (Page ) 为单位进行 划分, 相应的, 物理地址空间也以页 (Page ) 为单位进行划分。 在釆用 虚拟地址进行内存寻址的过程中, 处理器中的内存管理单元 (Memory Management Unit, 简称 MMU ) 需要将接收到的虚拟地址转换为物理地 址。 目前处理器大多釆用旁路转换緩存器来緩存包含有处理器最近访问 的内存的虚拟地址和物理地址之间的映射关系的页表緩存 ( Translation Lookaside Buffer, 简称 TLB ) , TLB中緩存的数据和内存页表区存储的 数据是一致的, 在内存页表区中, 每一条包含虚拟地址和物理地址映射 关系的记录称为一个页表项 ( Page Table Entry, 简称 PTE ) , 同样的, 在 TLB中也緩存了部分甚至全部的页表项 PTE。
在釆用虚拟地址进行内存寻址时, 内存管理单元 MMU接收到应用 程序发来的虚拟地址后, 首先在旁路转换緩存器的 TLB中进行搜索, 如 果 TLB中緩存有与该虚拟地址对应的页表项, 即 TLB命中 ( Hit ) , 则 通过该页表项中的物理地址到一级緩存 (Levell Cache ) 进行数据存取, 如果 Levell Cache 中与该物理地址对应的数据缺失, 则到二级緩存
( Level2 Cache )进行数据存取, 如果 Level2 Cache中与该物理地址对应 的数据缺失, 则到内存中进行数据存取; 如果 TLB中不包含与该虚拟地 址对应的页表项, 即 TLB 未命中 (Miss ) , 则需要软件或操作系统
( Operating System , 简称 O S ) 搜索与该虚拟地址对应的物理地址, 并 将该虚拟地址与该物理地址的映射关系作为一个页表项存入 TLB中, 以 供内存管理单元 MMU进行后续搜索。
现有技术中, 在内存管理单元 MMU中设置有预取緩存器 (Prefetch Buffer, 简称 PB ) , PB中存储有多个页表项。 在进行内存物理地址寻址 时, 首先在 TLB中搜索对应的物理地址, 当 TLB未命中后, 继续在 PB 中搜索对应的物理地址, 若 PB 中存在对应的物理地址, 则通过该物理 地址进行数据存取并将命中的页表项存储至 TLB中, 若 PB中不存在对 应的物理地址, 则将内存中的多个页表项存储至 PB中, 并覆盖 PB中的 当前存储数据。
然而, 对于多线程处理器, 多个硬件线程共享一个 TLB , 由于 TLB 的容量有限, 当硬件线程数目较多时, TLB 中页表项的数目无法满足多 线程需求,从而导致每个硬件线程在釆用虚拟地址进行内存寻址时, TLB 未命中率很高,且 TLB 未命中后才去内存获取并緩存与该虚拟地址对应 的页表项, 因此寻址时间较长。
发明内容
本发明提供一种内存物理地址查询方法和装置, 用以解决现有技术 中存在的寻址时间较长的问题。
第一方面, 本发明提供了一种内存物理地址查询方法, 包括: 根据预设的线程切换策略, 确定未来设定时间内内存寻址操作由第 一线程变更为第二线程;
将备用緩存器中存储的所述第二线程的页表项存储至预取緩存器 中, 所述备用緩存器中存储旁路转换緩存器存储的页表緩存 TLB中设定 时间内未被查询的页表项;
接收所述第二线程发送的内存寻址请求消息, 所述内存寻址请求消 息中携带虚拟地址;
根据所述虚拟地址在所述旁路转换緩存器和所述预取緩存器存储的 页表项中查询所述虚拟地址对应的物理地址。
在第一方面的第一种可能的实现方式中, 所述根据所述虚拟地址在 所述旁路转换緩存器和所述预取緩存器存储的页表项中查询所述虚拟地 址对应的物理地址, 包括:
若所述旁路转换緩存器中存在与所述虚拟地址对应的第一物理地 址, 则通过所述第一物理地址访问内存进行数据存取; 或者,
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地 址, 且所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则 通过所述第二物理地址访问所述内存进行数据存取。
根据第一方面的第一种可能的实现方式, 在第二种可能的实现方式 中, 所述方法还包括:
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地 址, 且所述预取緩存器中不存在与所述虚拟地址对应的第二物理地址, 则在所述内存中查找与所述虚拟地址对应的第三物理地址。
根据第一方面的第一种可能的实现方式和第二种可能的实现方式, 在第三种可能的实现方式中, 若所述旁路转换緩存器中不存在与所述虚 拟地址对应的第一物理地址, 且所述预取緩存器中存在与所述虚拟地址 对应的第二物理地址, 则所述方法还包括:
将所述预取緩存器中存储的所述虚拟地址和所述第二物理地址对应 的页表项存储至所述旁路转换緩存器中, 并删除所述预取緩存器中存储 的所述虚拟地址和所述第二物理地址对应的页表项。
根据第一方面的第二种可能的实现方式, 在第四种可能的实现方式 中, 所述方法还包括: 将在内存中查找到的与所述虚拟地址和所述第三物理地址对应的页 表项存储至所述旁路转换緩存器中。
根据第一方面的第一种可能的实现方式、 第二种可能的实现方式、 第三种可能的实现方式和第四种可能的实现方式, 在第五种可能的实现 方式中, 所述将备用緩存器中存储的所述第二线程的页表项存储至预取 緩存器中之前, 所述方法还包括:
若所述旁路转换緩存器中存储的页表项的数目超过自身的存储容 量, 则将所述旁路转换緩存器中所述设定时间内未被查询的页表项存储 至所述备用緩存器中, 并删除所述旁路转换緩存器中所述设定时间内未 被查询的页表项。
根据第一方面的第五种可能的实现方式, 在第六种可能的实现方式 中, 所述将所述旁路转换緩存器中所述设定时间内未被查询的页表项存 储至所述备用緩存器中之后, 所述方法还包括:
若所述备用緩存器中存储的页表项的数目超过自身的存储容量, 则 删除所述备用緩存器中存储时间最长的页表项。
根据第一方面的第一种可能的实现方式、 第二种可能的实现方式、 第三种可能的实现方式、 第四种可能的实现方式、 第五种可能的实现方 式和第六种可能的实现方式, 在第七种可能的实现方式中, 所述将备用 緩存器中存储的所述第二线程的页表项存储至预取緩存器中, 包括: 若所述备用緩存器中存储的所述第二线程的页表项的数目小于或等 于所述预取緩存器的存储容量, 则将所述备用緩存器中存储的所有所述 第二线程的页表项存储至所述预取緩存器中, 并覆盖所述预取緩存器的 当前存储数据; 或者,
若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述 预取緩存器的存储容量, 则将所述备用緩存器中存储的与所述预取緩存 器的存储容量相等数目的所述第二线程的页表项存储至所述预取緩存器 中, 并覆盖所述预取緩存器的当前存储数据。
根据第一方面的第七种可能的实现方式, 在第八种可能的实现方式 中, 若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述 预取緩存器的存储容量, 则所述方法还包括:
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地 址, 且所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则 将所述备用緩存器中存储的所述第二线程的页表项中除所述预取緩存器 中存储的页表项之外的一个页表项存储至所述预取緩存器中。
第二方面, 本发明提供了一种内存物理地址查询装置, 包括: 确定模块, 用于根据预设的线程切换策略, 确定未来设定时间内内 存寻址操作由第一线程变更为第二线程;
执行模块, 用于将备用緩存器中存储的所述第二线程的页表项存储 至预取緩存器中, 所述备用緩存器中存储旁路转换緩存器存储的页表緩 存 TLB中设定时间内未被查询的页表项;
接收模块, 接收所述第二线程发送的内存寻址请求消息, 所述内存 寻址请求消息中携带虚拟地址;
查询模块, 根据所述虚拟地址在所述旁路转换緩存器和所述预取緩 存器存储的页表项中查询所述虚拟地址对应的物理地址。
在第二方面的第一种可能的实现方式中, 所述查询模块具体用于: 若所述旁路转换緩存器中存在与所述虚拟地址对应的第一物理地 址, 则通过所述第一物理地址访问内存进行数据存取; 或者,
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地 址, 且所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则 通过所述第二物理地址访问所述内存进行数据存取。
根据第二方面的第一种可能的实现方式, 在第二种可能的实现方式 中, 所述查询模块还用于:
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地 址, 且所述预取緩存器中不存在与所述虚拟地址对应的第二物理地址, 则在所述内存中查找与所述虚拟地址对应的第三物理地址。
根据第二方面的第一种可能的实现方式和第二种可能的实现方式, 在第三种可能的实现方式中, 所述查询模块还用于:
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地 址, 且所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则 将所述预取緩存器中存储的所述虚拟地址和所述第二物理地址对应的页 表项存储至所述旁路转换緩存器中, 并删除所述预取緩存器中存储的所 述虚拟地址和所述第二物理地址对应的页表项。
根据第二方面的第二种可能的实现方式, 在第四种可能的实现方式 中, 所述查询模块还用于:
将在内存中查找到的与所述虚拟地址和所述第三物理地址对应的页 表项存储至所述旁路转换緩存器中。
根据第二方面的第一种可能的实现方式、 第二种可能的实现方式、 第三种可能的实现方式和第四种可能的实现方式, 在第五种可能的实现 方式中, 所述执行模块还用于:
在所述将备用緩存器中存储的所述第二线程的页表项存储至预取緩 存器中之前, 若所述旁路转换緩存器中存储的页表项的数目超过自身的 存储容量, 则将所述旁路转换緩存器中所述设定时间内未被查询的页表 项存储至所述备用緩存器中, 并删除所述旁路转换緩存器中所述设定时 间内未被查询的页表项。
根据第一方面的第五种可能的实现方式, 在第六种可能的实现方式 中, 所述执行模块还用于:
在所述将所述旁路转换緩存器中所述设定时间内未被查询的页表项 存储至所述备用緩存器中之后, 若所述备用緩存器中存储的页表项的数 目超过自身的存储容量, 则删除所述备用緩存器中存储时间最长的页表 项。
根据第二方面的第一种可能的实现方式、 第二种可能的实现方式、 第三种可能的实现方式、 第四种可能的实现方式、 第五种可能的实现方 式和第六种可能的实现方式, 在第七种可能的实现方式中, 所述执行模 块具体用于: 若所述备用緩存器中存储的所述第二线程的页表项的数目小于或等 于所述预取緩存器的存储容量, 则将所述备用緩存器中存储的所有所述 第二线程的页表项存储至所述预取緩存器中, 并覆盖所述预取緩存器的 当前存储数据; 或者,
若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述 预取緩存器的存储容量, 则将所述备用緩存器中存储的与所述预取緩存 器的存储容量相等数目的所述第二线程的页表项存储至所述预取緩存器 中, 并覆盖所述预取緩存器的当前存储数据。
根据第二方面的第七种可能的实现方式, 在第八种可能的实现方式 中, 所述执行模块还用于:
若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述 预取緩存器的存储容量, 且所述旁路转换緩存器中不存在与所述虚拟地 址对应的第一物理地址, 所述预取緩存器中存在与所述虚拟地址对应的 第二物理地址, 则将所述备用緩存器中存储的所述第二线程的页表项中 除所述预取緩存器中存储的页表项之外的一个页表项存储至所述预取緩 存器中。
第三方面, 本发明提供了一种内存物理地址查询装置, 包括: 存储 器、 旁路转换緩存器、 备用緩存器、 预取緩存器和处理器;
所述存储器, 用于存储指令;
所述旁路转换緩存器, 用于存储页表緩存 TLB;
所述备用緩存器, 用于存储所述旁路转换緩存器存储的所述 TLB中 设定时间内未被查询的页表项;
所述预取緩存器, 用于存储所述备用緩存器中存储的对应线程的页 表项;
所述处理器, 用于运行所述存储器中存储的所述指令以执行如第一 方面所述的内存物理地址查询方法。
本发明提供的内存物理地址查询方法和装置, 根据待寻址第二线程 的虚拟地址在旁路转换緩存器和预取緩存器中同时进行查询, 且预取緩 存器中存储有旁路转换緩存器中设定时间内未被查询的第二线程的页表 项, 从而提高对虚拟地址对应的物理地址的查询命中几率 , 缩短寻址时 间。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将 对实施例或现有技术描述中所需要使用的附图做一简单地介绍, 显而易 见地, 下面描述中的附图是本发明的一些实施例, 对于本领域普通技术 人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其 他的附图。
图 1为本发明提供的内存物理地址查询方法一个实施例的流程示意 图;
图 2为本发明提供的内存物理地址查询方法又一个实施例的流程示 意图;
图 3为旁路转换緩存器的緩存页表 TLB中设定时间内未被查询的页 表项存储至对应线程的备用緩存器中的示意图;
图 4为对应线程的备用緩存器中的页表项存储至预取緩存器 P B中的 示意图; 图 6为本发明提供的内存物理地址查询装置一个实施例的结构示意 图;
图 7为本发明提供的内存物理地址查询装置又一个实施例的结构示 意图。
具体实施方式
为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合 本发明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整 地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的 实施例。 基于本发明中的实施例, 本领域普通技术人员在没有做出创造 性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
图 1 为本发明提供的内存物理地址查询方法一个实施例的流程示意 图。 如图 1 所示, 以下方法实施例提供的方法可以适用于各种类型的终 端设备, 例如: PC机, PAD , 手机等。 以下各步骤的执行主体可以为上 述各种终端设备中的中央处理器 ( Central Processing Unit, 简称 CPU ) , 具体可以为 CPU中的内存管理单元 MMU等。 该方法具体可以包括:
5101 , 根据预设的线程切换策略, 确定未来设定时间内内存寻址操 作由第一线程变更为第二线程。
具体的, 线程切换策略中包括了在终端设备运行的各时间段内, 釆 用哪些线程来执行内存寻址操作。 本发明实施例中, 第一线程即为前一 时间段内执行内存寻址操作的线程, 第二线程为在第一线程之后执行内 存寻址操作的线程, 即待寻址线程。
5102 , 将备用緩存器中存储的第二线程的页表项存储至预取緩存器 中, 备用緩存器中存储旁路转换緩存器存储的页表緩存 TLB中设定时间 内未被查询的页表项。
具体的, 根据 S101确定的待寻址的线程, 即第二线程, 将备用緩存 器中存储的第二线程的页表项存储至预取緩存器 PB 中, 且该备用緩存 器中存储的是旁路转换緩存器存储的页表緩存 TLB中设定时间内未被查 询的页表项。 可选的, 备用緩存器中存储的页表项具体可以包括: 虚拟 地址和物理地址的对应关系以及对应的各线程的标识; 类似的, 旁路转 换緩存器中存储的页表项具体也可以包括: 虚拟地址和物理地址的对应 关系以及对应的各线程的标识; 预取緩存器 PB 中存储的页表项可以包 括: 虚拟地址和物理地址的对应关系以及对应的待寻址线程的标识。
此处需要说明的是, 备用緩存器的数量可以是一个或多个, 例如: 每个线程可以对应一个备用緩存器, 用于存储緩存旁路转换緩存器中该 线程设定时间内未被查询的页表项。 类似的, 旁路转换緩存器和预取緩 存器的数量都可以是一个或多个, 例如: 可以每个线程对应一个旁路转 换緩存器和一个预取緩存器。
5103 , 接收第二线程发送的内存寻址请求消息, 内存寻址请求消息 中携带虚拟地址。
具体的, 接收待寻址线程, 即第二线程, 发送的内存寻址请求消息, 该内存寻址请求消息中携带待寻址的虚拟地址 VA。
5104 , 根据虚拟地址在旁路转换緩存器和预取緩存器存储的页表项 中查询虚拟地址对应的物理地址。
具体的,根据虚拟地址 VA, 可以同时在旁路转换緩存器和预取緩存 器 PB存储的页表项中进行查询, 若旁路转换緩存器和预取緩存器 PB中 存在与该虚拟地址 VA对应的物理地址, 则釆用该物理地址进行数据存 取,若旁路转换緩存器和预取緩存器 PB中均不存在与该虚拟地址 VA对 应的物理地址, 则到内存中进行查询, 以获得与该虚拟地址 VA对应的 物理地址。
本实施例提供的内存物理地址查询方法, 根据待寻址第二线程的虚 拟地址在旁路转换緩存器和预取緩存器中同时进行查询, 且预取緩存器 中存储有旁路转换緩存器中设定时间内未被查询的第二线程的页表项, 从而提高对虚拟地址对应的物理地址的查询命中几率, 缩短寻址时间。 图 2为本发明提供的内存物理地址查询方法又一个实施例的流程示 意图。 如图 2所示, 以下方法实施例提供的方法可以适用于各种类型的 终端设备, 例如: PC机, PAD, 手机等。 以下各步骤的执行主体可以为 中央处理器 CPU, 具体可以为 CPU中的内存管理单元 MMU等。 该方法 具体可以包括:
S201 , 根据预设的线程切换策略, 确定未来设定时间内内存寻址操 作由第一线程变更为第二线程。
具体的, 线程切换策略中包括了在终端设备运行的各时间段内, 釆 用哪些线程来执行内存寻址操作。 本发明实施例中, 第一线程即为前一 时间段内执行内存寻址操作的线程, 第二线程为在第一线程之后执行内 存寻址操作的线程, 即待寻址线程。
5202 , 将备用緩存器中存储的第二线程的页表项存储至预取緩存器 中, 备用緩存器中存储旁路转换緩存器存储的页表緩存 TLB中设定时间 内未被查询的页表项。
这里根据备用緩存器中存储的第二线程的页表项的数目和预取緩存 器 PB的存储容量之间的关系, 可以选择执行以下步骤 S203或 S204。
5203 , 若备用緩存器中存储的第二线程的页表项的数目小于或等于 预取緩存器的存储容量, 则将备用緩存器中存储的所有第二线程的页表 项存储至预取緩存器中, 并覆盖预取緩存器的当前存储数据。
S204: 若备用緩存器中存储的第二线程的页表项的数目大于预取緩 存器的存储容量, 则将备用緩存器中存储的与预取緩存器的存储容量相 等数目的第二线程的页表项存储至预取緩存器中, 并覆盖预取緩存器的 当前存储数据。
具体的, 根据 S201确定的待寻址的线程, 即第二线程, 将备用緩存 器中存储的部分或全部第二线程的页表项存储至预取緩存器 PB 中, 并 删除 PB 中当前存储的数据。 其中, 该备用緩存器中存储的是旁路转换 緩存器存储的页表緩存 TLB中设定时间内未被查询的页表项。
作为一种可选的实施方式, 每个线程可以对应一个备用緩存器, 且 每个备用緩存器中存储的页表项可以是 TLB中设定时间内未被查询的对 应线程的页表项。 图 3为旁路转换緩存器的緩存页表 TLB中设定时间内 未被查询的页表项存储至对应线程的备用緩存器中的示意图, 如图 3所 示, 旁路转换緩存器的緩存页表 TLB中存储的页表项具体可以包括: 虚 拟地址和物理地址的对应关系以及对应的各线程的标识, 每个线程对应 的备用緩存器中存储的页表项具体可以包括: 虚拟地址和物理地址的对 应关系, 备用緩存器选择单元接收 TLB中存储的设定时间内未被查询的 页表项以及对应的线程标识, 并才艮据线程标识将该页表项存储至对应线 程的备用緩存器中。
图 4为对应线程的备用緩存器中的页表项存储至预取緩存器 PB 中 的示意图, 如图 4所示, 备用緩存器选择单元根据确定的待寻址的线程, 将待寻址线程的备用緩存器中的部分或全部页表项以及对应的线程标识 存储至预取緩存器 PB中,从而使预取緩存器 PB中存储有待寻址线程被 替换出 TLB 的页表项。 这些被替换出 TLB 的页表项, 大都不是因为不 需要而被替换的, 而是由于 TLB存储容量有限, 而线程又多, 使得一些 线程的常用页表项被替换出去。
这里假设 32个线程共享一个存储容量为 128个页表项的旁路转换緩 存器, 则每个线程对应的备用緩存器的存储容量和预取緩存器 PB 的存 储容量可以设置为 32个页表项, 在待寻址线程进行寻址之前, 可将待寻 址线程对应的备用緩存器中的全部页表项存储至预取緩存器 PB 中, 并 删除预取緩存器 PB 中当前存储的数据。 其中, 旁路转换緩存器和预取 緩存器 PB可釆用内容可寻址的存储器 ( Content Addressable Memory, 简称 CAM ) 完成虚拟地址 VA的比较, 但由于增大预取緩存器 PB的存 储容量会增大芯片功耗, 因此可选择存储容量较小的预取緩存器 PB , 例 如存储容量为 8个页表项的预取緩存器 PB , 则在待寻址线程进行寻址 之前, 可将待寻址线程对应的备用緩存器中存储时间最短的 8个页表项 存储至预取緩存器 PB中, 并删除预取緩存器 PB中当前存储的数据。
5205 , 接收第二线程发送的内存寻址请求消息, 内存寻址请求消息 中携带虚拟地址。
具体的, 接收待寻址线程, 即第二线程, 发送的内存寻址请求消息, 该内存寻址请求消息中携带待寻址的虚拟地址 VA。
5206 , 根据虚拟地址在旁路转换緩存器和预取緩存器存储的页表项 中查询虚拟地址对应的物理地址。
这里根据在旁路转换緩存器和预取緩存器 PB 中的寻址结果, 可以 选择执行以下步骤 S207、 S208或 S209。
S207: 若旁路转换緩存器中存在与虚拟地址对应的第一物理地址, 则通过第一物理地址访问内存进行数据存取。
S208:若旁路转换緩存器中不存在与虚拟地址对应的第一物理地址, 且预取緩存器中存在与虚拟地址对应的第二物理地址, 则通过第二物理 地址访问内存进行数据存取, 并将预取緩存器中存储的虚拟地址和第二 物理地址对应的页表项存储至旁路转换緩存器中, 并删除预取緩存器中 存储的虚拟地址和第二物理地址对应的页表项。
其中, 若备用緩存器中存储的第二线程的页表项的数目大于预取緩 存器的存储容量, 则将备用緩存器中存储的第二线程的页表项中除预取 緩存器中存储的页表项之外的一个页表项存储至预取緩存器中。
S209:若旁路转换緩存器中不存在与虚拟地址对应的第一物理地址, 且预取緩存器中不存在与虚拟地址对应的第二物理地址, 则在内存中查 找与虚拟地址对应的第三物理地址, 并将在内存中查找到的与虚拟地址 和第三物理地址对应的页表项存储至旁路转换緩存器中。 如图 5所示,根据虚拟地址 VA, 可以同时在旁路转换緩存器和预取緩存 器 PB存储的页表项中进行查询。
当旁路转换緩存器中存在与该虚拟地址 VA对应的物理地址时, 即 当旁路转换緩存器中的 TLB命中 (TLB-Hit )时, 不管预取緩存器 PB中 是否存在与该虚拟地址 VA 对应的物理地址, 即预取緩存器 PB 命中
( PB-Hit ) 或未命中 (PB-Miss ) , 都根据在旁路转换緩存器中查找到的 物理地址, 即第一物理地址 PA1 , 进行数据存取。
当旁路转换緩存器中不存在与该虚拟地址 VA对应的物理地址, 即 当旁路转换緩存器中的 TLB未命中 (TLB-Miss ) , 但预取緩存器 PB中 存在与该虚拟地址 VA 对应的物理地址时, 即预取緩存器 PB 命中
( PB-Hit )时, 则根据在预取緩存器 PB中查找到的物理地址, 即第二物 理地址 PA2 , 进行数据存取, 并将查找到的页表项即命中的页表项存储 至旁路转换緩存器的 TLB中。 其中, 当预取緩存器 PB只存储了备用緩 存器中部分第二线程的页表项时, 例如上面所述预取緩存器 PB 中只存 储了备用緩存器中存储时间最短的 8个第二线程的页表项, 则在将预取 緩存器 PB中命中的页表项存储至 TLB中后, 可以从备用緩存器中取出 下一个存储时间较短的第二线程的页表项存储至预取緩存器 PB中。
当旁路转换緩存器和预取緩存器 P B中均不存在与虚拟地址 V A对应 的物理地址时 , 即均未命中 ( TLB-Miss且 PB-Miss ) 时 , 则根据该虚拟 地址 VA和对应的线程标识通过页表扫描单元到内存中查找与该虚拟地 址 VA对应的物理地址, 即第三物理地址 PA3 , 并根据查找到的第三物 理地址 PA3进行数据存取, 同时将查找到的页表项即命中的页表项以及 对应的线程标识存储至旁路转换緩存器的 TLB中。
其中, 对于步骤 S208或 S209:
若旁路转换緩存器中存储的页表项的数目超过自身的存储容量, 则 将旁路转换緩存器中设定时间内未被查询的页表项存储至备用緩存器 中, 并删除旁路转换緩存器中设定时间内未被查询的页表项。
具体的, 当旁路转换緩存器中存储的页表项的数目超过自身的存储 容量时, 优先将命中率最低的页表项, 即设定时间内未命中的页表项存 储至备用緩存器中, 并删除该设定时间内未命中的页表项。
若备用緩存器中存储的页表项的数目超过自身的存储容量, 则删除 备用緩存器中存储时间最长的页表项。
具体的, 由于备用緩存器中的页表项存储时间越长, 命中的几率越 小, 因此对备用緩存器可以釆取"先入先出 ( First Input First Output, 简 称 FIFO ) "的存储模式, 即当备用緩存器中存储的页表项的数目超过自 身的存储容量时, 优先删除存储时间最长的页表项。
本实施例提供的内存物理地址查询方法, 根据待寻址第二线程的虚 拟地址在旁路转换緩存器和预取緩存器中同时进行查询, 且预取緩存器 中存储有旁路转换緩存器中设定时间内未被查询的第二线程的页表项, 从而提高对虚拟地址对应的物理地址的查询命中几率, 缩短寻址时间。 图 6为本发明提供的内存物理地址查询装置一个实施例的结构示意 图。 如图 6所示, 本实施例中的内存物理地址查询装置 60为执行上述内 存物理地址查询方法的特定主体, 具体可以包括: 确定模块 61、 执行模 块 62接收模块 63和查询模块 64 , 其中:
确定模块 61 , 用于根据预设的线程切换策略, 确定未来设定时间内 内存寻址操作由第一线程变更为第二线程。
具体的, 线程切换策略中包括了在终端设备运行的各时间段内, 釆 用哪些线程来执行内存寻址操作。 本发明实施例中, 第一线程即为前一 时间段内执行内存寻址操作的线程, 第二线程为在第一线程之后执行内 存寻址操作的线程, 即待寻址线程。
执行模块 62 , 用于将备用緩存器中存储的第二线程的页表项存储至 预取緩存器中, 备用緩存器中存储旁路转换緩存器存储的页表緩存 TLB 中设定时间内未被查询的页表项。
具体的, 这里根据备用緩存器中存储的第二线程的页表项的数目和 预取緩存器 PB的存储容量之间的关系分为以下两种情况:
情况一: 若备用緩存器中存储的第二线程的页表项的数目小于或等 于预取緩存器的存储容量, 则将备用緩存器中存储的所有第二线程的页 表项存储至预取緩存器中, 并覆盖预取緩存器的当前存储数据;
情况二: 若备用緩存器中存储的第二线程的页表项的数目大于预取 緩存器的存储容量, 则将备用緩存器中存储的与预取緩存器的存储容量 相等数目的第二线程的页表项存储至预取緩存器中, 并覆盖预取緩存器 的当前存储数据;
具体的, 根据确定模块 61确定的待寻址的线程, 即第二线程, 将备 用緩存器中存储的第二线程的部分或全部页表项存储至预取緩存器 PB 中, 且该备用緩存器中存储的是旁路转换緩存器存储的页表緩存 TLB中 设定时间内未被查询的页表项。 可选的, 备用緩存器中存储的页表项具 体可以包括:虚拟地址和物理地址的对应关系以及对应的各线程的标识; 类似的, 旁路转换緩存器中存储的页表项具体也可以包括: 虚拟地址和 物理地址的对应关系以及对应的各线程的标识; 预取緩存器 PB 中存储 的页表项具体可以包括: 虚拟地址和物理地址的对应关系以及对应的待 寻址线程的标识。
此处需要说明的是, 备用緩存器的数量可以是一个或多个, 例如: 每个线程可以对应一个备用緩存器, 用于存储緩存旁路转换緩存器中该 线程设定时间内未被查询的页表项。 类似的, 旁路转换緩存器和预取緩 存器的数量都可以是一个或多个, 例如: 可以每个线程对应一个旁路转 换緩存器和一个预取緩存器。
接收模块 63 , 用于接收第二线程发送的内存寻址请求消息, 内存寻 址请求消息中携带虚拟地址。
具体的, 接收待寻址线程, 即第二线程, 发送的内存寻址请求消息, 该内存寻址请求消息中携带待寻址的虚拟地址 VA。
查询模块 64 , 用于根据虚拟地址在旁路转换緩存器和预取緩存器存 储的页表项中查询虚拟地址对应的物理地址。
具体的,根据虚拟地址 VA, 可以同时在旁路转换緩存器和预取緩存 器 PB 存储的页表项中进行查询, 这里根据在旁路转换緩存器和预取緩 存器 PB中的寻址结果可以分为以下三种情况:
情况一:若旁路转换緩存器中存在与虚拟地址对应的第一物理地址, 则通过第一物理地址访问内存进行数据存取。
具体的, 当旁路转换緩存器中存在与该虚拟地址 VA对应的物理地 址时,不管预取緩存器 P B中是否存在与该虚拟地址 V A对应的物理地址, 都根据在旁路转换緩存器中查找到的物理地址, 即第一物理地址, 进行 数据存取。 情况二: 若旁路转换緩存器中不存在与虚拟地址对应的第一物理地 址, 且预取緩存器中存在与虚拟地址对应的第二物理地址, 则通过第二 物理地址访问内存进行数据存取, 并将预取緩存器中存储的虚拟地址和 第二物理地址对应的页表项存储至旁路转换緩存器中, 并删除预取緩存 器中存储的虚拟地址和第二物理地址对应的页表项。
其中, 若备用緩存器中存储的第二线程的页表项的数目大于预取緩 存器的存储容量, 且旁路转换緩存器中不存在与虚拟地址对应的第一物 理地址, 预取緩存器中存在与虚拟地址对应的第二物理地址, 则将备用 緩存器中存储的第二线程的页表项中除预取緩存器中存储的页表项之外 的一个页表项存储至预取緩存器中。
具体的, 当旁路转换緩存器中不存在与该虚拟地址 VA对应的物理 地址,但预取緩存器 PB中存在与该虚拟地址 VA对应的物理地址时, 则 根据在预取緩存器 PB 中查找到的物理地址, 即第二物理地址, 进行数 据存取, 并将查找到的页表项即命中的页表项存储至旁路转换緩存器的 TLB 中。 当预取緩存器 PB只存储了备用緩存器中部分第二线程的页表 项时, 在将预取緩存器 PB中命中的页表项存储至 TLB中后, 可以从备 用緩存器中取出一个页表项存储至预取緩存器 PB中。
情况三: 若旁路转换緩存器中不存在与虚拟地址对应的第一物理地 址, 且预取緩存器中不存在与虚拟地址对应的第二物理地址, 则在内存 中查找与虚拟地址对应的第三物理地址, 并将在内存中查找到的与虚拟 地址和第三物理地址对应的页表项存储至旁路转换緩存器中。
具体的, 当旁路转换緩存器和预取緩存器 PB 中均不存在与虚拟地 址 VA对应的物理地址时, 即均未命中时, 则需到内存中查找与该虚拟 地址 VA对应的物理地址, 即第三物理地址, 并将查找到的页表项即命 中的页表项存储至旁路转换緩存器的 TLB中。
进一步的, 执行模块 62还可以用于:
在将备用緩存器中存储的第二线程的页表项存储至预取緩存器中之 前, 若旁路转换緩存器中存储的页表项的数目超过自身的存储容量, 则 将旁路转换緩存器中设定时间内未被查询的页表项存储至备用緩存器 中, 并删除旁路转换緩存器中设定时间内未被查询的页表项。
具体的, 当旁路转换緩存器中存储的页表项的数目超过自身的存储 容量时, 优先将命中率最低的页表项, 即设定时间内未命中的页表项存 储至备用緩存器中, 并删除该设定时间内未命中的页表项。
进一步的, 执行模块 62还可以用于:
在将旁路转换緩存器中设定时间内未被查询的页表项存储至备用緩 存器中之后,若备用緩存器中存储的页表项的数目超过自身的存储容量, 则删除备用緩存器中存储时间最长的页表项。
具体的, 由于备用緩存器中的页表项存储时间越长, 命中的几率越 小, 因此对备用緩存器可以釆取 "先入先出 FIFO"的存储模式, 即当备用 緩存器中存储的页表项的数目超过自身的存储容量时, 优先删除存储时 间最长的页表项。
本实施例提供的内存物理地址查询装置, 根据待寻址第二线程的虚 拟地址在旁路转换緩存器和预取緩存器中同时进行查询, 且预取緩存器 中存储有旁路转换緩存器中设定时间内未被查询的第二线程的页表项, 从而提高对虚拟地址对应的物理地址的查询命中几率, 缩短寻址时间。 图 7为本发明提供的内存物理地址查询装置又一个实施例的结构示 意图。 如图 7所示, 本实施例的内存物理地址查询装置包括: 存储器 71、 旁路转换緩存器 72、备用緩存器 73、 预取緩存器 74和处理器 75 , 其中: 存储器 71 , 用于存储指令;
旁路转换緩存器 72 , 用于存储页表緩存 TLB;
备用緩存器 73 ,用于存储旁路转换緩存器存储的 TLB中设定时间内 未被查询的页表项;
预取緩存器 74 , 用于存储备用緩存器中存储的对应线程的页表项; 处理器 75 , 用于运行存储器中存储的指令以执行如图 1或图 2所示 的内存物理地址查询方法。
具体的, 存储器 71可能包含高速 RAM存储器, 也可能还包含非不 稳定的存储器( non-volatile memory ) , 例如至少一个磁盘存储器。 存储 器 71可选的可以包含至少一个存储装置。 存储器 71存储了指令, 当内 存物理地址查询装置运行时, 处理器 75与存储器 71之间通信, 处理器 75执行指令使得内存物理地址查询装置可以执行本发明各实施例所提供 的内存物理地址查询方法。
备用緩存器 73 中可以存储有包括虚拟地址和物理地址的对应关系 的页表项以及对应的各线程的标识,旁路转换緩存器 72中可以存储有包 括虚拟地址和物理地址的对应关系的页表项以及对应的各线程的标识, 预取緩存器 74 中可以存储有包括虚拟地址和物理地址的对应关系的页 表项以及对应的待寻址线程的标识。
此处需要说明的是,备用緩存器 73的数量可以是一个或多个,例如: 每个线程可以对应一个备用緩存器, 用于存储緩存旁路转换緩存器中该 线程设定时间内未被查询的页表项。 类似的, 旁路转换緩存器 72和预取 緩存器 74的数量都可以是一个或多个, 例如: 可以每个线程对应一个旁 路转换緩存器和一个预取緩存器。
本实施例中的处理器可能是一种集成电路芯片,具有信号处理能力。 在实现过程中, 上述方法的各步骤可以通过处理器中的硬件的集成逻辑 电路或者软件形式的指令完成。 上述的处理器可以是通用处理器、 数字 信号处理器(DSP )、专用集成电路(ASIC )、现成可编程门阵列(FPGA ) 或者其他可编程逻辑器件、 分立门或者晶体管逻辑器件、 分立硬件组件。 可以实现或者执行本发明实施例中的公开的各方法、 步骤及逻辑框图。 上述处理器可以是微处理器或者上述处理器也可以是任何常规的处理器 等。 结合本发明实施例所公开的方法的步骤可以直接体现为硬件处理器 执行完成, 或者用处理器中的硬件及软件模块组合执行完成。 软件模块 可以位于随机存储器, 闪存、 只读存储器, 可编程只读存储器或者电可 擦写可编程存储器、 寄存器等本领域成熟的存储介质中。 该存储介质位 于存储器, 处理器读取存储器中的信息, 结合其硬件完成上述方法的步 骤。
本发明实施例还提供一种芯片,该芯片用于进行内存物理地址查询, 该芯片可以包括上述的处理器。
本实施例提供的内存物理地址查询装置,通过处理器 75执行存储器 71存储的指令, 根据待寻址第二线程的虚拟地址在旁路转换緩存器和预 取緩存器中同时进行查询, 且预取緩存器中存储有旁路转换緩存器中设 定时间内未被查询的第二线程的页表项, 从而提高对虚拟地址对应的物 理地址的查询命中几率, 缩短寻址时间。
本领域普通技术人员可以理解: 实现上述各方法实施例的全部或部 分步骤可以通过程序指令相关的硬件来完成。 前述的程序可以存储于一 计算机可读取存储介质中。 该程序在执行时, 执行包括上述各方法实施 例的步骤; 而前述的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种 可以存储程序代码的介质。 非对其限制; 尽管参照前述各实施例对本发明进行了详细的说明, 本领 域的普通技术人员应当理解: 其依然可以对前述各实施例所记载的技术 方案进行修改, 或者对其中部分或者全部技术特征进行等同替换; 而这 些修改或者替换, 并不使相应技术方案的本质脱离本发明各实施例技术 方案的范围。

Claims

权 利 要求 书
1、 一种内存物理地址查询方法, 其特征在于, 包括:
根据预设的线程切换策略, 确定未来设定时间内内存寻址操作由第一线程 变更为第二线程;
将备用緩存器中存储的所述第二线程的页表项存储至预取緩存器中, 所述 备用緩存器中存储旁路转换緩存器存储的页表緩存 TLB中设定时间内未被查询 的页表项;
接收所述第二线程发送的内存寻址请求消息, 所述内存寻址请求消息中携 带虚拟地址;
根据所述虚拟地址在所述旁路转换緩存器和所述预取緩存器存储的页表项 中查询所述虚拟地址对应的物理地址。
2、 根据权利要求 1所述的方法, 其特征在于, 所述根据所述虚拟地址在所 述旁路转换緩存器和所述预取緩存器存储的页表项中查询所述虚拟地址对应的 物理地址, 包括:
若所述旁路转换緩存器中存在与所述虚拟地址对应的第一物理地址, 则通 过所述第一物理地址访问内存进行数据存取; 或者,
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地址, 且 所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则通过所述第二 物理地址访问所述内存进行数据存取。
3、 根据权利要求 2所述的方法, 其特征在于, 所述方法还包括: 若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地址, 且 所述预取緩存器中不存在与所述虚拟地址对应的第二物理地址, 则在所述内存 中查找与所述虚拟地址对应的第三物理地址。
4、 根据权利要求 2或 3所述的方法, 其特征在于, 若所述旁路转换緩存器 中不存在与所述虚拟地址对应的第一物理地址, 且所述预取緩存器中存在与所 述虚拟地址对应的第二物理地址, 则所述方法还包括:
将所述预取緩存器中存储的所述虚拟地址和所述第二物理地址对应的页表 项存储至所述旁路转换緩存器中, 并删除所述预取緩存器中存储的所述虚拟地 址和所述第二物理地址对应的页表项。
5、 根据权利要求 3所述的方法, 其特征在于, 所述方法还包括:
将在内存中查找到的与所述虚拟地址和所述第三物理地址对应的页表项存 储至所述旁路转换緩存器中。
6、 根据权利要求 1-5任一项所述的方法, 其特征在于, 所述将备用緩存器 中存储的所述第二线程的页表项存储至预取緩存器中之前, 所述方法还包括: 若所述旁路转换緩存器中存储的页表项的数目超过自身的存储容量, 则将 所述旁路转换緩存器中所述设定时间内未被查询的页表项存储至所述备用緩存 器中, 并删除所述旁路转换緩存器中所述设定时间内未被查询的页表项。
7、 根据权利要求 6所述的方法, 其特征在于, 所述将所述旁路转换緩存器 中所述设定时间内未被查询的页表项存储至所述备用緩存器中之后, 所述方法 还包括:
若所述备用緩存器中存储的页表项的数目超过自身的存储容量, 则删除所 述备用緩存器中存储时间最长的页表项。
8、 根据权利要求 1-7任一项所述的方法, 其特征在于, 所述将备用緩存器 中存储的所述第二线程的页表项存储至预取緩存器中, 包括:
若所述备用緩存器中存储的所述第二线程的页表项的数目小于或等于所述 预取緩存器的存储容量 , 则将所述备用緩存器中存储的所有所述第二线程的页 表项存储至所述预取緩存器中, 并覆盖所述预取緩存器的当前存储数据; 或者, 若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述预取緩 存器的存储容量 , 则将所述备用緩存器中存储的与所述预取緩存器的存储容量 相等数目的所述第二线程的页表项存储至所述预取緩存器中, 并覆盖所述预取 緩存器的当前存储数据。
9、 根据权利要求 8所述的方法, 其特征在于, 若所述备用緩存器中存储的 所述第二线程的页表项的数目大于所述预取緩存器的存储容量, 则所述方法还 包括:
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地址, 且 所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则将所述备用緩 存器中存储的所述第二线程的页表项中除所述预取緩存器中存储的页表项之外 的一个页表项存储至所述预取緩存器中。
10、 一种内存物理地址查询装置, 其特征在于, 包括:
确定模块, 用于根据预设的线程切换策略, 确定未来设定时间内内存寻址 操作由第一线程变更为第二线程;
执行模块 , 用于将备用緩存器中存储的所述第二线程的页表项存储至预取 緩存器中, 所述备用緩存器中存储旁路转换緩存器存储的页表緩存 TLB中设定 时间内未被查询的页表项;
接收模块, 接收所述第二线程发送的内存寻址请求消息, 所述内存寻址请 求消息中携带虚拟地址;
查询模块, 根据所述虚拟地址在所述旁路转换緩存器和所述预取緩存器存 储的页表项中查询所述虚拟地址对应的物理地址。
11、 根据权利要求 10所述的装置, 其特征在于, 所述查询模块具体用于: 若所述旁路转换緩存器中存在与所述虚拟地址对应的第一物理地址, 则通 过所述第一物理地址访问内存进行数据存取; 或者,
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地址, 且 所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则通过所述第二 物理地址访问所述内存进行数据存取。
12、 根据权利要求 11所述的装置, 其特征在于, 所述查询模块还用于: 若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地址, 且 所述预取緩存器中不存在与所述虚拟地址对应的第二物理地址, 则在所述内存 中查找与所述虚拟地址对应的第三物理地址。
13、 根据权利要求 11或 12所述的装置, 其特征在于, 所述查询模块还用 于:
若所述旁路转换緩存器中不存在与所述虚拟地址对应的第一物理地址, 且 所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则将所述预取緩 存器中存储的所述虚拟地址和所述第二物理地址对应的页表项存储至所述旁路 转换緩存器中, 并删除所述预取緩存器中存储的所述虚拟地址和所述第二物理 地址对应的页表项。
14、 根据权利要求 12所述的装置, 其特征在于, 所述查询模块还用于: 将在内存中查找到的与所述虚拟地址和所述第三物理地址对应的页表项存 储至所述旁路转换緩存器中。
15、根据权利要求 10-14任一项所述的装置, 其特征在于, 所述执行模块还 用于:
在所述将备用緩存器中存储的所述第二线程的页表项存储至预取緩存器中 之前, 若所述旁路转换緩存器中存储的页表项的数目超过自身的存储容量, 则 将所述旁路转换緩存器中所述设定时间内未被查询的页表项存储至所述备用緩 存器中, 并删除所述旁路转换緩存器中所述设定时间内未被查询的页表项。
16、 根据权利要求 15所述的装置, 其特征在于, 所述执行模块还用于: 在所述将所述旁路转换緩存器中所述设定时间内未被查询的页表项存储至 所述备用緩存器中之后, 若所述备用緩存器中存储的页表项的数目超过自身的 存储容量, 则删除所述备用緩存器中存储时间最长的页表项。
17、根据权利要求 10-16任一项所述的装置, 其特征在于, 所述执行模块具 体用于:
若所述备用緩存器中存储的所述第二线程的页表项的数目小于或等于所述 预取緩存器的存储容量 , 则将所述备用緩存器中存储的所有所述第二线程的页 表项存储至所述预取緩存器中, 并覆盖所述预取緩存器的当前存储数据; 或者, 若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述预取緩 存器的存储容量 , 则将所述备用緩存器中存储的与所述预取緩存器的存储容量 相等数目的所述第二线程的页表项存储至所述预取緩存器中, 并覆盖所述预取 緩存器的当前存储数据。
18、 根据权利要求 17所述的装置, 其特征在于, 所述执行模块还用于: 若所述备用緩存器中存储的所述第二线程的页表项的数目大于所述预取緩 存器的存储容量, 且所述旁路转换緩存器中不存在与所述虚拟地址对应的第一 物理地址, 所述预取緩存器中存在与所述虚拟地址对应的第二物理地址, 则将 所述备用緩存器中存储的所述第二线程的页表项中除所述预取緩存器中存储的 页表项之外的一个页表项存储至所述预取緩存器中。
19、 一种内存物理地址查询装置, 其特征在于, 包括: 存储器、 旁路转换 緩存器、 备用緩存器、 预取緩存器和处理器;
所述存储器, 用于存储指令;
所述旁路转换緩存器, 用于存储页表緩存 TLB;
所述备用緩存器, 用于存储所述旁路转换緩存器存储的所述 TLB中设定时 间内未被查询的页表项;
所述预取緩存器, 用于存储所述备用緩存器中存储的对应线程的页表项; 所述处理器, 用于运行所述存储器中存储的所述指令以执行如权利要求 1 至 9任一项所述的内存物理地址查询方法。
PCT/CN2014/083875 2013-08-20 2014-08-07 内存物理地址查询方法和装置 WO2015024451A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
KR1020167005743A KR101768828B1 (ko) 2013-08-20 2014-08-07 메모리 물리 어드레스 조회 방법 및 장치
JP2016535319A JP6198952B2 (ja) 2013-08-20 2014-08-07 物理メモリアドレスを問い合わせる方法及び装置
EP14838503.2A EP3023878B1 (en) 2013-08-20 2014-08-07 Memory physical address query method and apparatus
US15/047,938 US10114762B2 (en) 2013-08-20 2016-02-19 Method and apparatus for querying physical memory address

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310364417.1 2013-08-20
CN201310364417.1A CN104424117B (zh) 2013-08-20 2013-08-20 内存物理地址查询方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/047,938 Continuation US10114762B2 (en) 2013-08-20 2016-02-19 Method and apparatus for querying physical memory address

Publications (1)

Publication Number Publication Date
WO2015024451A1 true WO2015024451A1 (zh) 2015-02-26

Family

ID=52483060

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/083875 WO2015024451A1 (zh) 2013-08-20 2014-08-07 内存物理地址查询方法和装置

Country Status (6)

Country Link
US (1) US10114762B2 (zh)
EP (1) EP3023878B1 (zh)
JP (1) JP6198952B2 (zh)
KR (1) KR101768828B1 (zh)
CN (2) CN107608912B (zh)
WO (1) WO2015024451A1 (zh)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9740621B2 (en) * 2014-05-21 2017-08-22 Qualcomm Incorporated Memory controllers employing memory capacity and/or bandwidth compression with next read address prefetching, and related processor-based systems and methods
US10838862B2 (en) 2014-05-21 2020-11-17 Qualcomm Incorporated Memory controllers employing memory capacity compression, and related processor-based systems and methods
US10503661B2 (en) 2014-05-21 2019-12-10 Qualcomm Incorporated Providing memory bandwidth compression using compressed memory controllers (CMCs) in a central processing unit (CPU)-based system
US9672159B2 (en) * 2015-07-02 2017-06-06 Arm Limited Translation buffer unit management
CN109684238A (zh) * 2018-12-19 2019-04-26 湖南国科微电子股份有限公司 一种固态硬盘映射关系的存储方法、读取方法及固态硬盘
CN111552653B (zh) * 2020-05-14 2021-01-29 上海燧原科技有限公司 页表的读取方法、装置、设备及计算机存储介质
CN114238167B (zh) * 2021-12-14 2022-09-09 海光信息技术股份有限公司 信息预取方法、处理器、电子设备

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050050296A1 (en) * 2003-08-28 2005-03-03 Intel Corporation Method for page sharing in a processor with multiple threads and pre-validated caches
US20090327649A1 (en) * 2005-03-08 2009-12-31 Mips Technologies, Inc. Three-Tiered Translation Lookaside Buffer Hierarchy in a Multithreading Microprocessor
US20110029755A1 (en) * 2009-07-28 2011-02-03 Fujitsu Limited Processor and arithmatic operation method
CN102498477A (zh) * 2009-07-13 2012-06-13 苹果公司 Tlb预取

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS5998367A (ja) * 1982-11-26 1984-06-06 Nec Corp アドレス変換バツフア方式
JPH0652058A (ja) * 1992-07-30 1994-02-25 Matsushita Electric Ind Co Ltd アドレス変換装置
US8219780B2 (en) * 2005-09-16 2012-07-10 Hewlett-Packard Development Company, L.P. Mitigating context switch cache miss penalty
US8213393B2 (en) * 2006-08-21 2012-07-03 Citrix Systems, Inc. Methods for associating an IP address to a user via an appliance
CN100487660C (zh) * 2007-05-28 2009-05-13 中兴通讯股份有限公司 一种多线程处理器动态内存管理系统及方法
US8868847B2 (en) * 2009-03-11 2014-10-21 Apple Inc. Multi-core processor snoop filtering
US8161246B2 (en) * 2009-03-30 2012-04-17 Via Technologies, Inc. Prefetching of next physically sequential cache line after cache line that includes loaded page table entry
US8880844B1 (en) * 2010-03-12 2014-11-04 Trustees Of Princeton University Inter-core cooperative TLB prefetchers
CN101833440B (zh) * 2010-04-30 2013-01-02 西安交通大学 编译器支持下的推测多线程内存数据同步执行方法及装置
WO2012149723A1 (zh) 2011-09-02 2012-11-08 华为技术有限公司 虚拟内存区域的查询、遍历方法及装置
CN102708211A (zh) * 2012-05-30 2012-10-03 福建星网视易信息系统有限公司 一种基于多线程检索并加载数据的方法
US20140108766A1 (en) * 2012-10-17 2014-04-17 Advanced Micro Devices, Inc. Prefetching tablewalk address translations
US9349386B2 (en) * 2013-03-07 2016-05-24 Analog Device Global System and method for processor wake-up based on sensor data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050050296A1 (en) * 2003-08-28 2005-03-03 Intel Corporation Method for page sharing in a processor with multiple threads and pre-validated caches
US20090327649A1 (en) * 2005-03-08 2009-12-31 Mips Technologies, Inc. Three-Tiered Translation Lookaside Buffer Hierarchy in a Multithreading Microprocessor
CN102498477A (zh) * 2009-07-13 2012-06-13 苹果公司 Tlb预取
US20110029755A1 (en) * 2009-07-28 2011-02-03 Fujitsu Limited Processor and arithmatic operation method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3023878A4 *

Also Published As

Publication number Publication date
EP3023878B1 (en) 2019-01-30
KR20160040665A (ko) 2016-04-14
CN107608912A (zh) 2018-01-19
JP2016528640A (ja) 2016-09-15
CN104424117A (zh) 2015-03-18
US10114762B2 (en) 2018-10-30
CN104424117B (zh) 2017-09-05
KR101768828B1 (ko) 2017-08-16
JP6198952B2 (ja) 2017-09-20
US20160170904A1 (en) 2016-06-16
EP3023878A4 (en) 2016-07-06
EP3023878A1 (en) 2016-05-25
CN107608912B (zh) 2020-10-16

Similar Documents

Publication Publication Date Title
WO2015024451A1 (zh) 内存物理地址查询方法和装置
KR100562906B1 (ko) 시리얼 플래시 메모리에서의 xip를 위한 우선순위기반의 플래시 메모리 제어 장치 및 이를 이용한 메모리관리 방법, 이에 따른 플래시 메모리 칩
US10474580B2 (en) Memory management supporting huge pages
KR102448124B1 (ko) 가상 주소들을 사용하여 액세스된 캐시
KR101667772B1 (ko) 프리페칭을 갖는 변환 색인 버퍼
TWI531912B (zh) 具有用於多上下文計算引擎的轉譯後備緩衝之處理器、用於致能多執行緒以存取於處理器中之資源之系統和方法
JPH07200399A (ja) マイクロプロセッサ、およびマイクロプロセッサにおいてメモリにアクセスするための方法
US8037281B2 (en) Miss-under-miss processing and cache flushing
JP6088951B2 (ja) キャッシュメモリシステムおよびプロセッサシステム
KR20080063512A (ko) 변환 색인 버퍼들(tlbs) 필드의 다중 레벨 갱신
JP6027562B2 (ja) キャッシュメモリシステムおよびプロセッサシステム
WO2018119773A1 (zh) 非易失内存访问方法、装置和系统
CN110389911A (zh) 一种设备内存管理单元的预取方法、装置及系统
US9436610B2 (en) Enhanced pre-fetch in a memory management system
US8543791B2 (en) Apparatus and method of reducing page fault rate in virtual memory system
US8880845B2 (en) Memory system and operating method thereof
KR102482516B1 (ko) 메모리 어드레스 변환
CN110941565B (zh) 用于芯片存储访问的内存管理方法和装置
US20130145097A1 (en) Selective Access of a Store Buffer Based on Cache State
CN111198827B (zh) 页表预取方法及装置
US20180157493A1 (en) Reduced stack usage in a multithreaded processor
Bletsch ECE 650 Systems Programming & Engineering Spring 2018
JP2019096307A (ja) 複数のデータ・タイプのためのデータ・ストレージ
TW201527977A (zh) 資料處理裝置

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: 14838503

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2014838503

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2016535319

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 20167005743

Country of ref document: KR

Kind code of ref document: A