Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\madvise.c Create Date:2022-07-28 15:12:29
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:madvise_free_pte_range

Proto:static int madvise_free_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk)

Type:int

Parameter:

TypeParameterName
pmd_t *pmd
unsigned longaddr
unsigned longend
struct mm_walk *walk
560  tlb = private
561  mm = mm
562  vma = vma
566  nr_swap = 0
569  next = pmd_addr_end(addr, end)
570  If pmd_trans_huge( * pmd) Then If Return true if we do MADV_FREE successfully on entire pmd page.* Otherwise, return false. Then
572  Go to next
574  If This is a noop if Transparent Hugepage Support is not built into* the kernel Then Return 0
577  tlb_change_page_size(tlb, PAGE_SIZE)
578  orig_pte = pte = pte_offset_map_lock(mm, pmd, addr, & ptl)
579  flush_tlb_batched_pending(mm)
580  A facility to provide lazy MMU batching()
581  When addr != end cycle
582  ptent = pte
584  If pte_none(ptent) Then Continue
591  If Not pte_present(ptent) Then
595  If non_swap_entry(entry) Then Continue
597  nr_swap--
600  Continue
603  page = vm_normal_page -- This function gets the "struct page" associated with a pte.* "Special" mappings do not wish to be associated with a "struct page" (either* it doesn't exist, or it exists but they don't want to touch it). In this
604  If Not page Then Continue
613  If page_mapcount(page) != 1 Then Go to out
615  get_page(page)
617  put_page(page)
618  Go to out
621  If split_huge_page(page) Then
628  put_page(page)
630  pte--
631  addr -= PAGE_SIZE
632  Continue
635  VM_BUG_ON_PAGE(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., page)
637  If PageSwapCache(page) || PageDirty(page) Then
644  If page_mapcount(page) != 1 Then
649  If PageSwapCache(page) && Not try_to_free_swap(page) Then
668  ptent = pte_mkold(ptent)
670  set_pte_at(mm, addr, pte, ptent)
673  mark_page_lazyfree - make an anon page lazyfree*@page: page to deactivate* mark_page_lazyfree() moves @page to the inactive file list.* This is done to accelerate the reclaim of @page.
675  out :
676  If nr_swap Then
677  If mm == mm Then sync_mm_rss(mm)
680  add_mm_counter(mm, MM_SWAPENTS, nr_swap)
682  arch_leave_lazy_mmu_mode()
683  pte_unmap_unlock(orig_pte, ptl)
684  cond_resched()
685  :
686  Return 0