Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\core.c Create Date:2022-07-28 12:47:30
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bpf_prog_realloc

Proto:struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size, gfp_t gfp_extra_flags)

Type:struct bpf_prog

Parameter:

TypeParameterName
struct bpf_prog *fp_old
unsigned intsize
gfp_tgfp_extra_flags
220  gfp_flags = GFP_KERNEL | __GFP_ZERO | gfp_extra_flags
225  BUG_ON(fp_old == NULL)
227  size = und_up - round up to next specified power of 2*@x: the value to round*@y: multiple to round up to (must be a power of 2)* Rounds @x up to next multiple of @y (which must be a power of 2).* To perform arbitrary rounding up, use roundup() below.(size, PAGE_SIZE)
228  pages = size / PAGE_SIZE
229  If pages <= Number of allocated pages Then Return fp_old
232  delta = pages - Number of allocated pages
233  ret = __bpf_prog_charge(user, delta)
234  If ret Then Return NULL
237  fp = __vmalloc(size, gfp_flags, PAGE_KERNEL)
238  If (fp == NULL) Then
239  __bpf_prog_uncharge(user, delta)
240  Else
241  No 3D Now!(fp, fp_old, Number of allocated pages * PAGE_SIZE)
242  Number of allocated pages = pages
243  prog = fp
248  Auxiliary fields = NULL
249  __bpf_prog_free(fp_old)
252  Return fp
Caller
NameDescribe
bpf_patch_insn_single