Description
In #1769, @zmyzheng suggested introducing Total Page Fault
to process.PageFaultStat
. Before merging it, I would like to study Page Fault values across platforms and summarize the findings in this issue. Therefore, this issue will be updated as the investigation progresses.
About page fault
https://en.wikipedia.org/wiki/Page_fault
Linux
https://www.kernel.org/doc/Documentation/filesystems/proc.rst
- MinorFaults (min_flt)
- number of minor faults
- MajorFaults (maj_flt)
- number of major faults
- ChildMinorFaults (cmin_flt)
- number of minor faults with child's
- ChildMajorFaults (cmaj_flt)
- number of major faults with child's
Windows
-
PageFaultCount (UInt32)
- The number of memory page faults.
In this circumstance, however, the missing data is identified as being located within an area of memory that cannot be paged out to disk.
related
https://techcommunity.microsoft.com/blog/askperf/the-basics-of-page-faults/373120
hard page fault requires disk access to occur, which could be the first access to contents in a file or accesses to memory blocks that were paged
- (shirou): This means
PageFaultCount
is same asMajor Fault
in linux?- according to the comment, this is wrong. Windows just does not have a differences between major and minor.
Darwin
- https://developer.apple.com/documentation/kernel/task_info_t
- https://developer.apple.com/documentation/kernel/task_events_info_data_t
- https://newosxbook.com/code/xnu-1699.32.7/osfmk/mach/task_info.h
- cow_faults
- number of copy-on-write faults
- faults
- number of page faults
- csw (not related to page fault though)
- number of context switches
- https://developer.apple.com/documentation/coreservices/mptaskinfo
- codePageFaults
The number of page faults that occurred during code execution. - dataPageFaults
- The number of page faults that occurred during data access.
- codePageFaults
FreeBSD
- https://man.freebsd.org/cgi/man.cgi?query=getrusage
- ru_minflt; /* page reclaims */
- ru_majflt; /* page faults */
- ru_nvcsw; /* voluntary context switches */
- ru_nivcsw; /* involuntary context switches */
OpenBSD
Solaris
Table 65 List of vminfo Probes
- as_fault
- Fires whenever a fault is taken on a page and the fault is neither a protection fault nor a copy-on-write fault.
- cow_fault
- Fires whenever a copy-on-write fault is taken on a page. arg0 contains the number of pages that are created as a result of the copy-on-write.
- kernel_asflt
- Fires whenever a page fault is taken by the kernel on a page in its own address space. Whenever kernel_asflt fires, it will be immediately preceded by a firing of the as_fault probe.
- maj_fault
- Fires whenever a page fault is taken that results in I/O from a backing store or swap device. Whenever maj_fault fires, it will be immediately preceded by a firing of the pgin probe.
- prot_fault
- Fires whenever a page fault is taken due to a protection violation.