Function report |
Source Code:kernel\bpf\cpumap.c |
Create Date:2022-07-28 13:23:39 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:cpu_map_alloc
Proto:static struct bpf_map *cpu_map_alloc(union bpf_attr *attr)
Type:struct bpf_map
Parameter:
| Type | Parameter | Name |
|---|---|---|
| union bpf_attr * | attr |
| 87 | If Not Check operation authority Then Return ERR_PTR( - EPERM) |
| 91 | If max number of entries in a map == 0 || size of key in bytes != 4 || size of value in bytes != 4 || BPF_MAP_CREATE related * flags defined above. & ~Specify numa node during map creation Then Return ERR_PTR( - EINVAL) |
| 95 | cmap = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 99 | bpf_map_init_from_attr( & map, attr) |
| 108 | cost = max_entries * size of * |
| 109 | cost += sizeof(structlist_head) * num_possible_cpus() |
| 112 | ret = bpf_map_charge_init( & memory, cost) |
| 113 | If ret Then |
| 118 | flush_list = alloc_percpu(structlist_head) |
| 119 | If Not flush_list Then Go to free_charge |
| 122 | for_each_possible_cpu(cpu) |
| 126 | Below members specific for map type = bpf_map_area_alloc(max_entries * size of * , numa_node) |
| 129 | If Not Below members specific for map type Then Go to free_percpu |
| 132 | Return map |
| 133 | free_percpu : |
| 135 | free_charge : |
| 136 | bpf_map_charge_finish( & memory) |
| 137 | free_cmap : |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |