Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:do_mlock

Proto:static __must_check int do_mlock(unsigned long start, size_t len, vm_flags_t flags)

Type:int

Parameter:

TypeParameterName
unsigned longstart
size_tlen
vm_flags_tflags
675  error = -ENOMEM
677  start = Architectures that support memory tagging (assigning tags to memory regions,* embedding these tags into addresses that point to these memory regions, and* checking that the memory and the pointer tags match on memory accesses)(start)
679  If Not can_do_mlock() Then Return -EPERM
682  len = align the pointer to the (next) page boundary (len + (offset_in_page(start)))
683  start &= PAGE_MASK
685  lock_limit = rlimit(RLIMIT_MEMLOCK)
686  lock_limit >>= PAGE_SHIFT determines the page size
687  locked = len >> PAGE_SHIFT determines the page size
689  If lock for writing Then Return -EINTR
692  locked += locked_vm
693  If locked > lock_limit && Not Check operation authority Then
700  locked -= Go through vma areas and sum size of mlocked* vma pages, as return value.* Note deferred memory locking case(mlock2(,,MLOCK_ONFAULT)* is also counted.* Return value: previously mlocked page counts
705  If locked <= lock_limit || Check operation authority Then error = apply_vma_lock_flags(start, len, flags)
708  lease a write lock
709  If error Then Return error
712  error = __mm_populate - populate and/or mlock pages within a range of address space.* This is used to implement mlock() and the MAP_POPULATE / MAP_LOCKED mmap* flags. VMAs must be already marked with the desired vm_flags, and* mmap_sem must not be held.
713  If error Then Return vert get_user_pages() return value to posix mlock() error
715  Return 0
Caller
NameDescribe
SYSCALL_DEFINE2
SYSCALL_DEFINE3