Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:vma_to_resize

Proto:static struct vm_area_struct *vma_to_resize(unsigned long addr, unsigned long old_len, unsigned long new_len, unsigned long *p)

Type:struct vm_area_struct

Parameter:

TypeParameterName
unsigned longaddr
unsigned longold_len
unsigned longnew_len
unsigned long *p
436  mm = mm
437  vma = Look up the first VMA which satisfies addr < vm_end, NULL if none.
440  If Not vma || Our start address within vm_mm. > addr Then Return ERR_PTR( - EFAULT)
451  If Not old_len && Not (Flags, see mm.h. & (VM_SHARED | VM_MAYSHARE)) Then
452  pr_warn_once("%s (%d): attempted to duplicate a private mapping with mremap. This is not supported.\n", comm, pid)
453  Return ERR_PTR( - EINVAL)
456  If is_vm_hugetlb_page(vma) Then Return ERR_PTR( - EINVAL)
460  If old_len > The first byte after our end addresswithin vm_mm. - addr Then Return ERR_PTR( - EFAULT)
463  If new_len == old_len Then Return vma
467  pgoff = addr - Our start address within vm_mm. >> PAGE_SHIFT determines the page size
468  pgoff += Offset (within vm_file) in PAGE_SIZEunits
469  If pgoff + (new_len >> PAGE_SHIFT determines the page size ) < pgoff Then Return ERR_PTR( - EINVAL)
472  If Flags, see mm.h. & (Cannot expand with mremap() | Page-ranges managed without "struct page", just pure PFN ) Then Return ERR_PTR( - EFAULT)
475  If Flags, see mm.h. & VM_LOCKED Then
477  locked = Pages that have PG_mlocked set << PAGE_SHIFT determines the page size
478  lock_limit = rlimit(RLIMIT_MEMLOCK)
479  locked += new_len - old_len
480  If locked > lock_limit && Not Check operation authority Then Return ERR_PTR( - EAGAIN)
484  If Not Return true if the calling process may expand its vm space by the passed* number of pages Then Return ERR_PTR( - ENOMEM)
488  If Flags, see mm.h. & Is a VM accounted object Then
489  charged = new_len - old_len >> PAGE_SHIFT determines the page size
490  If security_vm_enough_memory_mm(mm, charged) Then Return ERR_PTR( - ENOMEM)
492  p = charged
495  Return vma
Caller
NameDescribe
mremap_to
SYSCALL_DEFINE5Expand (or shrink) an existing mapping, potentially moving it at the* same time (controlled by the MREMAP_MAYMOVE flag and available VM space)* MREMAP_FIXED option added 5-Dec-1999 by Benjamin LaHaise* This option implies MREMAP_MAYMOVE.