As I know, when program try to access virtual address that the corresponding PTE is NO present , kernel will trigger page fault and page fault handler will handle it.
In handler, if fault is caused by no physical mapping to the PTE, kernel should allocate free physical page and write physical address to PTE.
I found many functions like __handle_mm_fault
or handle_pte_fault
, but I cannot find the location where kernel actually allocate physical page. Could anyone give some suggestion?
Thanks.
Advertisement
Answer
In kernel 3.18, the procedure is like this: handle_mm_fault
->handle_pte_falut
->do_anonymous_page
->alloc_zeroed_user_highpage_movable