出于性能原因,我发现 TLB 包含每个进程的 PID,这意味着将每个进程的 VA 到 PA 映射保留在 TLB 中以节省上下文切换成本。所以,我的问题是内核可以操纵 TLB 中的 PID 条目吗?
我真的很好奇,因为我听说TLB是在MMU内部维护的缓存。请给我答案:)
*我假设 x86 :)
最佳答案
Intel® 64 and IA-32 Architectures Software Developer's Manual
Process-Context Identifiers (PCIDs)
Process-context identifiers (PCIDs) are a facility by which a logical processor may cache information for multiple linear-address spaces. The processor may retain cached information when software switches to a different linear-address space with a different PCID (e.g., by loading CR3; see Section 4.10.4.1 for details). A PCID is a 12-bit identifier.
...
When a logical processor creates entries in the TLBs (Section 4.10.2) and paging structure caches (Section 4.10.3), it associates those entries with the current PCID. When using entries in the TLBs and paging-structure caches to translate a linear address, a logical processor uses only those entries associated with the current PCID
相关:Does Linux use x86 CPU's PCID feature for TLB? If not, why?
关于caching - 内核可以管理写在TLB条目上的进程ID吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34435753/