Download presentation
Presentation is loading. Please wait.
Published byConstance Carson Modified over 6 years ago
1
SWE3015 Operating System Project Assignment 2 박은수, 박경원, 김지원
Demand Paging SWE3015 Operating System Project Assignment 2 박은수, 박경원, 김지원
2
Contents Concept Example Path
3
Demand Paging Concept http://csl.skku.edu/SWE3004S13/Overview
When you need memory additionally, the demand paging allocates just VMA. And when you access them, it makes page-fault which allocates real physical memory.
4
Example: malloc() Example
User level function for memory allocation only uses mmap() or brk() which don’t allocate physical memory but just virtual memory area. <※If the page which has been tried to access is not present, page fault handler allocates physical page : Demand paging>
5
Path do_page_fault(), __do_page_fault()
handle_mm_fault(), __handle_mm_fault() handle_pte_fault() There are 5 functions to get the demand page in page-fault.
6
/linux-3.13/arch/x86/mm/fault.c
do_page_fault(struct pt_regs *regs, unsigned long error_code) {} L.1253: __do_page_fault(regs, error_code); /linux-3.13/arch/x86/mm/fault.c
7
/linux-3.13/arch/x86/mm/fault.c
unlikely(kmmio_fault(regs, address)) L.1058: unlikely(fault_in_kernel_space(address)) L.1084: unlikely(kprobes_fault(regs)) L.1090: static_cpu_has(X86_FEATURE_SMAP) L.1091: unlikely(smap_violation(error_code, regs)) L.1101: unlikely(in_atomic() || !mm) L.1143: unlikely(!down_read_trylock(&mm->mmap_sem)) L.1161: unlikely(!vma) L.1144: (error_code & PF_USER) == 0 && !search_exception_tables(regs->ip) L.1165: likely(vma->vm_start <= address) L.1167: unlikely(!(vma->vm_flags & VM_GROWSDOWN)) L.1171: error_code & PF_USER L.1193: unlikely(access_error(error_code, vma)) L.1178: unlikely(address * sizeof(unsigned long) < regs->sp) L.1183: unlikely(expand_stack(vma, address)) L.1019: __do_page_fault(struct pt_regs *regs, unsigned long error_code) {} L.1203: handle_mm_fault(mm, vma, address, flags); False True /linux-3.13/arch/x86/mm/fault.c
8
__handle_mm_fault(mm, vma, address, flags);
handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags) {} L.3803: __handle_mm_fault(mm, vma, address, flags); /linux-3.13/mm/memory.c
9
/linux-3.13/mm/memory.c L.3692:
unlikely(is_vm_hugetlb_page(vma)) L.3706: !pud L.3709: !pmd L.3711: pmd_none(*pmd) && transparent_hugepage_enabled(vma) L.3716: !(ret & VM_FAULT_FALLBACK) L.3723: pmd_trans_huge(orig_pmd) L.3766: unlikely(pmd_none(*pmd)) && unlikely(__pte_alloc(mm, vma, pmd, address)) L.3770: unliely(pmd_trans_huge(*pmd)) L.3692: __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags) {} L.3778: handle_pte_fault(mm, vma, address, pte, pmd, flags); False True /linux-3.13/mm/memory.c
10
/linux-3.13/mm/memory.c (+ do_anonymous_page: allocate free page,
!pte_present(entry) L.3633: handle_pte_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *pte, pmd_t *pmd, unsigned int flags) {} /* Demand Paging */ True /linux-3.13/mm/memory.c (+ do_anonymous_page: allocate free page, do_swap_page: swap in)
11
Q & A
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.