Does anybody know if TLBs (L1 and L2) support simultaneous accesses with multiple page sizes in modern x86_64 microprocessor (Intel SandyBridge, AMD Bulldozer)? Does x86 core pipeline provides information about page size to MMU?
Best regards,
Alex
Does anybody know if TLBs (L1 and L2) support simultaneous accesses with multiple page sizes in modern x86_64 microprocessor (Intel SandyBridge, AMD Bulldozer)? Does x86 core pipeline provides information about page size to MMU?
Best regards,
Alex
This is not a question of what the TLBs allow, but rather of what the architecture allows. The architecture says that you can mix small (4k), large (2M) and huge (1G) pages in the same page hierarchy, by setting the PS
bit in the page directory entry at the appropriate level.
Not all levels of TLBs will necessarily be able to cache pages of all sizes, but that shouldn't stop you from mixing pages if you so wish.
Now, there's nothing in the x86 pipe before the MMU that should actually require data about the page size. That is all encoded in the page hierarchy itself.
Regarding page splits, if you have a page boundary at address x
, and you have a memory access that starts at x - 1
that is more than 1 byte wide, it'll access both pages. This will work even if the two pages are different sizes.
The TLB is typically divided in two: code and data. Each of these might be divided into a number of levels but typically a L1 and possibly a L2. Each level might support a single page size or mixed page sizes.
For example on my processor, I have I-L1 TLB for 2mb/4mb pages, mixed, a D-L1 TLB for 2mb/4mb pages, mixed, a I-L1 TLB for 4kb pages, a D-L1 TLB for 4kb pages and finally a D-L2 TLB for 4kb pages.
When a TLB supports mixed pages, the TLB stores the page size associated with a particular virtual address tag.
When a TLB level has multiple separate caches per page size, the lookup is performed in parallel since the page size is yet unknown.
In either case, if the L1 TLB misses, the L2 will be checked before attempting a page table walk.
Now that the specifics are out of the way, we can finally answer your question. You can use multiple page sizes at the same time, they however can never overlap (the OS will not let you map 2 virtual pages at the same location). In fact, the kernel internally uses multiple page sizes for various things.
Depending on the OS, using multiple page sizes in a user space process can be easy or painful. See Linux Huge page support and Windows Large Pages support for further details about this. Other OSes will have details about this in their documentation.
© 2022 - 2024 — McMap. All rights reserved.