函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\mlock.c Create Date:2022-07-27 16:13:19
Last Modify:2022-05-23 14:12:58 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称: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.

函数原型:static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end, vm_flags_t newflags)

返回类型:int

参数:

类型参数名称
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等于非非newflags按位与VM_LOCKED的值
527  old_flags等于Flags, see mm.h.
529  如果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)则转到:out
535  pgoff等于Offset (within vm_file) in PAGE_SIZEunits startOur 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  如果prev
540  vma等于prev
541  转到:success
544  如果start不等于Our start address within vm_mm.
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  如果ret则转到:out
550  如果end不等于The first byte after our end addresswithin vm_mm.
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  如果ret则转到:out
556  success :
560  nr_pages等于endstart右移PAGE_SHIFT determines the page size
561  如果非locknr_pages等于负nr_pages
563  否则如果old_flags按位与VM_LOCKEDnr_pages等于0
565  Pages that have PG_mlocked set 加等于nr_pages
573  如果lockFlags, see mm.h. 等于newflags
575  否则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  返回:ret
调用者
名称描述
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