For Kernel_Newbies By a Kernel_Newbie
free_vma list,before doing the updation of te vmas. The do_brk call which sets
up the brk segment of the task,(end of the data segment,which is what malloc
does,)is a do_mmap in disguise. Examination of error_possibilities aside,it
unmaps the last segment, before setting up the new vma. It uses a
make_pages_present call,to force the pages to tasks memory,iFF the vm is
locked->VM_LOCKED. In other cases,the pages are faulted in by do_no_page
which faults in an anonymous page(do_anonymous_page), since the vma doesnt have
any vm_operations_struct defined for page_fault handlers. Now its time to switch
context to page_fault_handlers which indicates an indirect reference to
mm/memory.c As I said,do_mmap calls the file specific mmap_method,which sets up
the environment for faulting in the page, for the virtual address being
mapped.The mmap method can do 2 things.It can either fault in the page,and map
the virtual address by calling remap_page_range,or can initialise the
environment,and postpone the page fault operations to do_no_page handler if it
defines one,or can instead decide to fall back on the default do_no_page
handler,which tries to fault in an anonymous zeroed page,depending on whether
the write_access is set. Imagining that it falls back on the default no_page
handler do_no_page,a Process either gets a write_protected globally shared
anonymous page (ZERO_PAGE(addr)->empty_zero_page), or an anonymous zeroed new
page from do_anonymous_page.The pte entry (page table entry) is set by calling
set_pte(ptep,pte_entry), and thus the stage is set for a write_protected_fault
do_wp_page iFF the globally shared zero page was mapped to the process address
space.Considering that it was mapped,the process goes through do_wp_page,which
gets the cake for write_protected page faults.The stage is set for a COW
mapping which in other words is a COPY_ON_WRITE mapping-Meaning COPY
ME ON WRITE ACCESS.(break_cow).A new page is faulted in,and the contents of
the pte_wrprotect page are copied to the new page,and the page table entry is
set (set_pte)for the faulting address to the new one,whereas the shared_ness of
the old page gets decreased. If the page happens to be in the Swap Cache,then
the page is marked dirty before returning. The routine do_swap_page is called
for swapping in a page,if the page is not present.handle_mm_fault does that,if
- « first
- ‹ previous
- of 24
- next ›
- last »