Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mlock.c Create Date:2022-07-28 14:45:40
Last Modify:2022-05-23 14:12:58 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:mlock_fixup - handle mlock[all]/munlock[all] requests.* Filters out "special" vmas -- VM_LOCKED never gets set for these, and* munlock is a no-op. However, for some special vmas, we go ahead and* populate the ptes.

Proto:static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, vm_flags_t newflags)

Type:int

Parameter:

TypeParameterName
struct vm_area_struct *vma
struct vm_area_struct **prev
unsigned longstart
unsigned longend
vm_flags_tnewflags
522  mm = The address space we belong to.
525  ret = 0
526  lock = Not Not (newflags & VM_LOCKED)
527  old_flags = Flags, see mm.h.
529  If newflags == Flags, see mm.h. || Flags, see mm.h. & Special vmas that are non-mergable, non-mlock()able.* Note: mm/huge_memory.c VM_NO_THP depends on this definition. || is_vm_hugetlb_page(vma) || vma == get_gate_vma(mm) || vma_is_dax(vma) Then Go to out
535  pgoff = Offset (within vm_file) in PAGE_SIZEunits + ( start - Our start address within vm_mm. >> PAGE_SHIFT determines the page size )
536  prev = vma_merge(mm, * prev, start, end, newflags, Serialized by page_table_lock , File we map to (can be NULL). , pgoff, vma_policy(vma), vm_userfaultfd_ctx)
539  If prev Then
540  vma = prev
541  Go to success
544  If start != Our start address within vm_mm. Then
545  ret = split a vma into two pieces at address 'addr', a new vma is allocated either* for the first part or the tail.
546  If ret Then Go to out
550  If end != The first byte after our end addresswithin vm_mm. Then
551  ret = split a vma into two pieces at address 'addr', a new vma is allocated either* for the first part or the tail.
552  If ret Then Go to out
556  success :
560  nr_pages = end - start >> PAGE_SHIFT determines the page size
561  If Not lock Then nr_pages = -nr_pages
563  Else if old_flags & VM_LOCKED Then nr_pages = 0
565  Pages that have PG_mlocked set += nr_pages
573  If lock Then Flags, see mm.h. = newflags
575  Else munlock_vma_pages_range() - munlock all pages in the vma range.'*@vma - vma containing range to be munlock()ed.*@start - start address in @vma of the range*@end - end of range in @vma.* For mremap(), munmap() and exit().* Called with @vma VM_LOCKED.
578  out :
579  prev = vma
580  Return ret
Caller
NameDescribe
apply_vma_lock_flags
apply_mlockall_flagsTake the MCL_* flags passed into mlockall (or 0 if called from munlockall)* and translate into the appropriate modifications to mm->def_flags and/or the* flags for all current VMAs.* There are a couple of subtleties with this