4.4do_swap_page
仍然有很多参数: http://lxr.free-electrons.com/source/mm/memory.c?v=4.4 #L2439
2446 static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
2447 unsigned long address, pte_t *page_table, pmd_t *pmd,
2448 unsigned int flags, pte_t orig_pte)
它是从函数 http://lxr.free-electrons.com/source/mm/memory.c?v=4.4#L3257调用的handle_pte_fault
3272 static int handle_pte_fault(struct mm_struct *mm,
3273 struct vm_area_struct *vma, unsigned long address,
3274 pte_t *pte, pmd_t *pmd, unsigned int flags)
3275 {
3276 pte_t entry;
3287 entry = *pte;
3289 if (!pte_present(entry)) {
3298 return do_swap_page(mm, vma, address,
3299 pte, pmd, flags, entry);
因此,第二个pte_t orig_pte
只是原始 pte 的副本,并且pte_t *page_table
是指向将使用新 pte 修改的 pte 条目的指针(实际代码将类似于*page_table = pte
):
2560 pte = mk_pte(page, vma->vm_page_prot);
2570 set_pte_at(mm, address, page_table, pte);