函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Called from syscall

函数原型:static struct bpf_map *stack_map_alloc(union bpf_attr *attr)

返回类型:struct bpf_map

参数:

类型参数名称
union bpf_attr *attr
87  value_size等于 size of value in bytes
93  如果非操作权限检查则返回:错误号
96  如果 BPF_MAP_CREATE related * flags defined above.按位与STACK_CREATE_FLAG_MASK的反则返回:错误号
100  如果 max number of entries in a map 恒等于0或 size of key in bytes 不等于4或value_size小于8或value_size取模8则返回:错误号
104  BUILD_BUG_ON - break compile if a condition is true(sizeof(structbpf_stack_build_id) % sizeof(u64))
105  如果 BPF_MAP_CREATE related * flags defined above.按位与Flag for stack_map, store build_id+offset instead of pointer
106  如果value_size取模sizeof(structbpf_stack_build_id)或value_sizesizeof(structbpf_stack_build_id)大于sysctl_perf_event_max_stack则返回:错误号
110  否则如果value_size除8大于sysctl_perf_event_max_stack则返回:错误号
114  n_buckets等于undup_pow_of_two - round the given value up to nearest power of two*@n: parameter* round the given value up to the nearest power of two* - the result is undefined when n == 0* - this can be used to initialise global variables from constant data( max number of entries in a map )
116  cost等于n_buckets乘*的长度加smap的长度
117  cost加等于n_bucketsvalue_sizesizeof(structstack_map_bucket)的和
118  err等于bpf_map_charge_init( & mem, cost)
119  如果err则返回:错误号
122  smap等于bpf_map_area_alloc(cost, bpf_map_attr_numa_node(attr))
123  如果非smap
124  bpf_map_charge_finish( & mem)
125  返回:错误号
128  bpf_map_init_from_attr( & map, attr)
129  value_size等于value_size
130  n_buckets等于n_buckets
132  err等于get_callchain_buffers(sysctl_perf_event_max_stack)
133  如果err则转到:free_charge
136  err等于prealloc_elems_and_freelist(smap)
137  如果err则转到:put_buffers
140  bpf_map_charge_move( & memory, & mem)
142  返回:map
144  put_buffers :
145  put_callchain_buffers()
146  free_charge :
147  bpf_map_charge_finish( & mem)
148  bpf_map_area_free(smap)
149  返回:错误号