Could some one direct me to a command to measure TLB misses on LINUX, please? Is it okay to consider (or approximate) minor page faults as TLB misses?
3 Answers
You can use perf to access the hardware performance counters:
$ perf stat -e dTLB-load-misses,iTLB-load-misses /path/to/command
e.g. :
$ perf stat -e dTLB-load-misses,iTLB-load-misses /bin/ls > /dev/null
Performance counter stats for '/bin/ls':
5,775 dTLB-load-misses
1,059 iTLB-load-misses
0.001897682 seconds time elapsed
A minor fault and a TLB miss are not good analogues. A minor fault occurs when a requested page is in memory but is not mapped in the current page table. It would certainly be the case that a minor fault will be associated with a TLB miss (as the TLB entries are shortcuts to page table entries) but TLB misses will be caused by many other things eg hard faults, or a transition in a program's locality.
- 373
- 1
- 7
Minor page faults occur when the page is already loaded in memory, but the associated page table entry is not yet created. As a side effect, minor page faults always incur TLB misses. On the other hand, a TLB miss occurs when the the translation entry for a page is not residing in the TLB (which is a cache), which may happen when that TLB entry had previously been evicted due to the limited capacity of the TLB.
- 11
- 1