The main page error handler in the Linux kernel

I am wondering where the main page error handler is located.

I wrote an algorithm to minimize page errors in the kernel. Therefore, I need to write something whenever a page error occurs. I am currently writing a page error in do_page_fault (...) in arch / x86 / mm / fault_32.c

However, it seems that both the minor and the main page errors will go to do_page_fault (...) ... And minor page errors occur all the time and ruined the algorithm.

I think I only want to record material when the main page_fault happens. So, kernel hackers, could you tell me where should I put my code? Which file and which function.

By the way, I crack the kernel 2.6.24

Many thanks! Alfred

+6
source share
1 answer

The handle_mm_fault function handles the page error. Its return value is a set of flags. if VM_FAULT_MAJOR set, then this is the main page error. The kernel calls perf_sw_event(PERF_COUNT_SW_PAGE_FAULT_MAJ, 1, 0, ... for every serious page error.

+7
source

Source: https://habr.com/ru/post/914856/


All Articles