函数逻辑报告 |
Source Code:kernel\events\core.c |
Create Date:2022-07-27 14:55:46 |
Last Modify:2022-05-20 07:50:19 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:perf_mmap
函数原型:static int perf_mmap(struct file *file, struct vm_area_struct *vma)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct file * | file | |
struct vm_area_struct * | vma |
5793 | user等于current_user() |
5795 | struct ring_buffer * rb = NULL |
5798 | user_extra等于0, extra等于0 |
5809 | 如果非Flags, see mm.h. 按位与VM_SHARED的值则返回:负EINVAL |
5812 | ret等于security_perf_event_read(event) |
5818 | 如果Offset (within vm_file) in PAGE_SIZEunits 恒等于0则 |
5820 | 否则 |
5833 | mutex_lock( & mmap_mutex) |
5837 | 如果非rb则转到:aux_unlock |
5840 | aux_offset等于READ_ONCE(aux_offset) |
5843 | 如果aux_offset小于perf_data_size(rb)加PAGE_SIZE则转到:aux_unlock |
5846 | 如果aux_offset不等于Offset (within vm_file) in PAGE_SIZEunits 左移PAGE_SHIFT determines the page size 位则转到:aux_unlock |
5850 | 如果rb_has_aux(rb)且aux_pgoff不等于Offset (within vm_file) in PAGE_SIZEunits 则转到:aux_unlock |
5857 | 如果rb_has_aux(rb)且aux_nr_pages不等于nr_pages则转到:aux_unlock |
5866 | 如果rb_has_aux(rb)则 |
5872 | atomic_set( & aux_mmap_count, 1) |
5873 | user_extra等于nr_pages |
5875 | 转到:accounting |
5888 | WARN_ON_ONCE(parent_ctx) |
5889 | again : |
5890 | mutex_lock( & mmap_mutex) |
5891 | 如果rb则 |
5910 | user_extra等于nr_pages加1 |
5912 | accounting : |
5913 | user_lock_limit等于Minimum for 512 kiB + 1 user control page 右移PAGE_SHIFT determines the page size 减10位 |
5918 | user_lock_limit乘等于num_online_cpus() |
5920 | user_locked等于atomic_long_read( & locked_vm) |
5928 | user_locked加等于user_extra |
5930 | 如果user_locked大于user_lock_limit则 |
5935 | extra等于user_locked减user_lock_limit |
5936 | user_extra减等于extra |
5939 | lock_limit等于rlimit(RLIMIT_MEMLOCK) |
5941 | locked等于atomic64_read( & pinned_vm)加extra |
5943 | 如果locked大于lock_limit且perf_is_paranoid()且非操作权限检查则 |
5951 | 如果Flags, see mm.h. 按位与VM_WRITE则flags或等于Buffer handling |
5954 | 如果非rb则 |
5959 | 如果非rb则 |
5964 | atomic_set( & mmap_count, 1) |
5965 | mmap_user等于get_current_user - Get the current task's user_struct* Get the user record of the current task, pinning it so that it can't go* away.() |
5966 | mmap_locked等于extra |
5968 | ring_buffer_attach(event, rb) |
5972 | 否则 |
5973 | ret等于rb_alloc_aux(rb, event, Offset (within vm_file) in PAGE_SIZEunits , nr_pages, aux_watermark, flags) |
5975 | 如果非ret则aux_mmap_locked等于extra |
5979 | unlock : |
5980 | 如果非ret则 |
5981 | atomic_long_add(user_extra, & locked_vm) |
5982 | atomic64_add(extra, & pinned_vm) |
5984 | atomic_inc( & mmap_count) |
5985 | 否则如果rb则 |
5986 | atomic_dec( & mmap_count) |
5988 | aux_unlock : |
5995 | Flags, see mm.h. 或等于Do not copy this vma on fork 按位或Cannot expand with mremap() 按位或Do not include in the core dump |
6001 | 返回:ret |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |