Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\swap_state.c Create Date:2022-07-28 15:15:06
Last Modify:2020-03-17 22:02:06 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:swap_ra_info

Proto:static void swap_ra_info(struct vm_fault *vmf, struct vma_swap_readahead *ra_info)

Type:void

Parameter:

TypeParameterName
struct vm_fault *vmf
struct vma_swap_readahead *ra_info
643  vma = Target VMA
654  max_win = 1 << min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(unsignedint, READ_ONCE(How many pages do we try to swap or page in/out together? ), Avoid stack overflow, because we need to save part of page table )
656  If max_win == 1 Then
657  win = 1
658  Return
661  faddr = Faulting virtual address
662  orig_pte = pte = pte_offset_map(Pointer to pmd entry matching* the 'address' , faddr)
663  entry = Convert the arch-dependent pte representation of a swp_entry_t into an* arch-independent swp_entry_t.
664  If Value for the false possibility is greater at compile time(non_swap_entry(entry)) Then
665  pte_unmap(orig_pte)
666  Return
669  fpfn = PFN_DOWN(faddr)
670  ra_val = Initial readahead hits is 4 to start up with a small window (vma)
671  pfn = PFN_DOWN(SWAP_RA_ADDR(ra_val))
672  prev_win = SWAP_RA_WIN(ra_val)
673  hits = SWAP_RA_HITS(ra_val)
674  win = win = __swapin_nr_pages(pfn, fpfn, hits, max_win, prev_win)
676  atomic_long_set( & swap_readahead_info, SWAP_RA_VAL(faddr, win, 0))
679  If win == 1 Then
680  pte_unmap(orig_pte)
681  Return
685  If fpfn == pfn + 1 Then swap_ra_clamp_pfn(vma, faddr, fpfn, fpfn + win, & start, & end)
687  Else if pfn == fpfn + 1 Then swap_ra_clamp_pfn(vma, faddr, fpfn - win + 1, fpfn + 1, & start, & end)
690  Else
691  left = (win - 1) / 2
692  swap_ra_clamp_pfn(vma, faddr, fpfn - left, fpfn + win - left, & start, & end)
695  nr_pte = end - start
696  offset = fpfn - start
697  pte -= offset
701  tpte = ptes
702  When pfn != end cycle tpte++ = pte++
705  pte_unmap(orig_pte)
Caller
NameDescribe
swap_vma_readaheadswap_vma_readahead - swap in pages in hope we need them soon*@entry: swap entry of this memory*@gfp_mask: memory allocation flags*@vmf: fault information* Returns the struct page for entry and addr, after queueing swapin.* Primitive swap readahead code