函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:The madvise(2) system call

函数原型:SYSCALL_DEFINE3(madvise, unsigned long, start, size_t, len_in, int, behavior)

返回类型:

参数:

1051  unmapped_error等于0
1052  error等于负EINVAL
1057  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)
1059  如果非madvise_behavior_valid(behavior)则返回:error
1062  如果非st whether an address (unsigned long or pointer) is aligned to PAGE_SIZE (start)则返回:error
1064  len等于 align the pointer to the (next) page boundary (len_in)
1067  如果len_in且非len则返回:error
1070  end等于startlen
1071  如果end小于start则返回:error
1074  error等于0
1075  如果end恒等于start则返回:error
1079  如果(behavior == poison a page for testing || behavior == soft offline page for testing )则返回:Error injection support for memory error handling.
1083  write等于Any behaviour which results in changes to the vma->vm_flags needs to* take mmap_sem for writing. Others, which simply traverse vmas, need* to only take it for reading.
1084  如果write
1085  如果lock for writing则返回:负EINTR
1087  否则
1088  lock for reading
1096  vma等于Same as find_vma, but also return a pointer to the previous VMA in *pprev.
1097  如果vmastart大于Our start address within vm_mm. prev等于vma
1100  blk_start_plug( & plug)
1101  循环
1103  error等于负ENOMEM
1104  如果非vma则转到:out
1109  unmapped_error等于负ENOMEM
1111  如果start大于等于end则转到:out
1116  tmp等于The first byte after our end addresswithin vm_mm.
1117  如果end小于tmptmp等于end
1121  error等于madvise_vma(vma, & prev, start, tmp, behavior)
1122  如果error则转到:out
1124  start等于tmp
1125  如果prevstart小于The first byte after our end addresswithin vm_mm. start等于The first byte after our end addresswithin vm_mm.
1127  error等于unmapped_error
1128  如果start大于等于end则转到:out
1130  如果prevvma等于linked list of VM areas per task, sorted by address
1132  否则vma等于Look up the first VMA which satisfies addr < vm_end, NULL if none.
1135  out :
1136  blk_finish_plug( & plug)
1137  如果writelease a write lock
1139  否则lease a read lock
1142  返回:error