函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\memory.c Create Date:2022-07-27 16:11:02
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:By the time we get here, we already hold the mm semaphore* The mmap_sem may have been released depending on flags and our* return value. See filemap_fault() and __lock_page_or_retry().

函数原型:vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address, unsigned int flags)

返回类型:vm_fault_t

参数:

类型参数名称
struct vm_area_struct *vma
unsigned longaddress
unsigned intflags
4160  set_current_state() includes a barrier so that the write of current->state* is correctly serialised wrt the caller's subsequent test of whether to* actually sleep:* for (;;) {* set_current_state(TASK_UNINTERRUPTIBLE);* if (!need_sleep)* break;* (就绪态)
4162  Disable counters
4163  count_memcg_event_mm(The address space we belong to. , PGFAULT)
4166  check_sync_rss_stat(当前进程)
4168  如果非arch_vma_access_permitted(vma, flags & Fault was a write access , flags & The fault was during an instruction fetch , flags & aulting for non current tsk/mm )则返回:VM_FAULT_SIGSEGV
4177  如果flags按位与The fault originated in userspace mem_cgroup_enter_user_fault()
4180  如果此条件成立可能性小(为编译器优化)(is_vm_hugetlb_page(vma))则ret等于hugetlb_fault(The address space we belong to. , vma, address, flags)
4182  否则ret等于By the time we get here, we already hold the mm semaphore* The mmap_sem may have been released depending on flags and our* return value. See filemap_fault() and __lock_page_or_retry().
4185  如果flags按位与The fault originated in userspace
4186  mem_cgroup_exit_user_fault()
4193  如果task_in_memcg_oom(当前进程)且非ret按位与VM_FAULT_OOM的值则mem_cgroup_oom_synchronize(false)
4197  返回:ret
调用者
名称描述
fixup_user_faultxup_user_fault() - manually resolve a user page fault*@tsk: the task_struct to use for page fault accounting, or* NULL if faults are not to be recorded
break_ksmWe use break_ksm to break COW on a ksm page: it's a stripped down* if (get_user_pages(addr, 1, 1, 1, &page, NULL) == 1)* put_page(page);* but taking great care only to touch a ksm page, in a VM_MERGEABLE vma,
hmm_vma_do_fault
faultin_pagemmap_sem must be held on entry. If @nonblocking != NULL and* *@flags does not include FOLL_NOWAIT, the mmap_sem may be released.* If it is, *@nonblocking will be set to 0 and -EBUSY returned.