Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__mcopy_atomic processing for HUGETLB vmas. Note that this routine is* called with mmap_sem held, it will release mmap_sem before returning.

Proto:static __always_inline ssize_t __mcopy_atomic_hugetlb(struct mm_struct *dst_mm, struct vm_area_struct *dst_vma, unsigned long dst_start, unsigned long src_start, unsigned long len, bool zeropage)

Type:ssize_t

Parameter:

TypeParameterName
struct mm_struct *dst_mm
struct vm_area_struct *dst_vma
unsigned longdst_start
unsigned longsrc_start
unsigned longlen
boolzeropage
210  vm_alloc_shared = Flags, see mm.h. & VM_SHARED
211  vm_shared = Flags, see mm.h. & VM_SHARED
228  If zeropage Then
229  lease a read lock
230  Return -EINVAL
233  src_addr = src_start
234  dst_addr = dst_start
235  copied = 0
236  page = NULL
237  vma_hpagesize = Return the size of the pages allocated when backing a VMA. In the majority* cases this will be same size as used by the page table entries.
242  err = -EINVAL
243  If dst_start & vma_hpagesize - 1 || len & vma_hpagesize - 1 Then Go to out_unlock
246  retry :
251  If Not dst_vma Then
252  err = -ENOENT
253  dst_vma = find_dst_vma(dst_mm, dst_start, len)
254  If Not dst_vma || Not is_vm_hugetlb_page(dst_vma) Then Go to out_unlock
257  err = -EINVAL
258  If vma_hpagesize != Return the size of the pages allocated when backing a VMA. In the majority* cases this will be same size as used by the page table entries. Then Go to out_unlock
261  vm_shared = Flags, see mm.h. & VM_SHARED
267  err = -ENOMEM
268  If Not vm_shared Then
269  If Value for the false possibility is greater at compile time(anon_vma_prepare(dst_vma)) Then Go to out_unlock
273  When src_addr < src_start + len cycle
276  BUG_ON(dst_addr >= dst_start + len)
281  idx = linear_page_index(dst_vma, dst_addr)
282  mapping = f_mapping
283  hash = For uniprocesor systems we always use a single mutex, so just* return 0 and avoid the hashing overhead.
284  mutex_lock( & hugetlb_fault_mutex_table[hash])
286  err = -ENOMEM
287  dst_pte = arch callbacks
288  If Not dst_pte Then
290  Go to out_unlock
293  err = -EEXIST
294  dst_pteval = huge_ptep_get(dst_pte)
295  If Not huge_pte_none(dst_pteval) Then
297  Go to out_unlock
300  err = Used by userfaultfd UFFDIO_COPY. Based on mcopy_atomic_pte with* modifications for huge pages.
303  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
304  vm_alloc_shared = vm_shared
306  cond_resched()
310  BUG_ON(!page)
317  err = -EFAULT
318  Go to out
322  dst_vma = NULL
323  Go to retry
324  Else BUG_ON(page)
327  If Not err Then
335  If err Then Break
339  out_unlock :
340  lease a read lock
341  out :
342  If page Then
384  If vm_alloc_shared Then Private page markings that may be used by the filesystem that owns the page* for its own purposes.* - PG_private and PG_private_2 cause releasepage() and co to be invoked
386  Else Private page markings that may be used by the filesystem that owns the page* for its own purposes.* - PG_private and PG_private_2 cause releasepage() and co to be invoked
388  Perform a free_page(), also freeing any swap cache associated with* this page if it is the last user of the page.
390  BUG_ON(copied < 0)
391  BUG_ON(err > 0)
392  BUG_ON(!copied && !err)
393  Return If copied Then copied Else err
Caller
NameDescribe
__mcopy_atomic