函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\ksm.c Create Date:2022-07-27 17:14:07
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:write_protect_page

函数原型:static int write_protect_page(struct vm_area_struct *vma, struct page *page, pte_t *orig_pte)

返回类型:int

参数:

类型参数名称
struct vm_area_struct *vma
struct page *page
pte_t *orig_pte
1035  mm等于The address space we belong to.
1036  struct page_vma_mapped_walk pvmw = {page = page, vma = vma, }
1041  err等于负EFAULT
1044  address等于At what user virtual address is page expected in vma?* Caller should check the page is actually part of the vma.
1045  如果address恒等于负EFAULT则转到:out
1048  BUG_ON(PageTransCompound returns true for both transparent huge pages* and hugetlbfs pages, so it should only be called when it's known* that hugetlbfs pages aren't involved.)
1050  mmu_notifier_range_init( & range, MMU_NOTIFY_CLEAR, 0, vma, mm, address, address + PAGE_SIZE)
1053  mmu_notifier_invalidate_range_start( & range)
1055  如果非page_vma_mapped_walk - check if @pvmw->page is mapped in @pvmw->vma at*@pvmw->address*@pvmw: pointer to struct page_vma_mapped_walk. page, vma, address and flags* must be set. pmd, pte and ptl must be NULL.* Returns true if the page is mapped in the vma则转到:out_mn
1057  如果WARN_ONCE(!pte, "Unexpected PMD mapping?")则转到:out_unlock
1060  如果pte_write( * pte)或The following only work if pte_present() is true.* Undefined behaviour if not..Technically a PTE can be PROTNONE even when not doing NUMA balancing but* the only case the kernel cares is for NUMA balancing and is only ever set* when the VMA is accessible. For PROT_NONE VMAs, the PTEs are not markedpte_savedwrite( * pte)或mm_tlb_flush_pending(mm)则
1065  swapped等于PageSwapCache(page)
1066  flush_cache_page(vma, address, page_to_pfn(page))
1081  entry等于ptep_clear_flush(vma, address, pte)
1086  如果page_mapcount(page)加1加swapped不等于page_count(page)则
1088  转到:out_unlock
1090  如果The following only work if pte_present() is true.* Undefined behaviour if not..Dirty a page
1093  如果Technically a PTE can be PROTNONE even when not doing NUMA balancing but* the only case the kernel cares is for NUMA balancing and is only ever set* when the VMA is accessible. For PROT_NONE VMAs, the PTEs are not markedentry等于pte_mkclean(pte_clear_savedwrite(entry))
1095  否则entry等于pte_mkclean(pte_wrprotect(entry))
1097  set_pte_at_notify() sets the pte _after_ running the notifier.* This is safe to start by updating the secondary MMUs, because the primary MMU* pte invalidate must have already happened with a ptep_clear_flush() before* set_pte_at_notify() has been invoked(mm, address, pte, entry)
1099  orig_pte等于pte
1100  err等于0
1102  out_unlock :
1103  page_vma_mapped_walk_done( & pvmw)
1104  out_mn :
1105  mmu_notifier_invalidate_range_end( & range)
1106  out :
1107  返回:err
调用者
名称描述
try_to_merge_one_pagery_to_merge_one_page - take two pages and merge them into one*@vma: the vma that holds the pte pointing to page*@page: the PageAnon page that we want to replace with kpage*@kpage: the PageKsm page that we want to map instead of page,