Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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 activityDownload SCCTChinese

Name:cpu_map_alloc

Proto:static struct bpf_map *cpu_map_alloc(union bpf_attr *attr)

Type:struct bpf_map

Parameter:

TypeParameterName
union bpf_attr *attr
83  err = -ENOMEM
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).
96  If Not cmap Then Return ERR_PTR( - ENOMEM)
99  bpf_map_init_from_attr( & map, attr)
102  If max_entries > Places which use this should consider cpumask_var_t. Then
103  err = -E2BIG
104  Go to free_cmap
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
114  err = ret
115  Go to free_cmap
118  flush_list = alloc_percpu(structlist_head)
119  If Not flush_list Then Go to free_charge
122  for_each_possible_cpu(cpu)
123  Initialization list head
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 :
134  free previously allocated percpu memory
135  free_charge :
136  bpf_map_charge_finish( & memory)
137  free_cmap :
138  kfree(cmap)
139  Return ERR_PTR(err)