Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:bpf_cgroup_storage_alloc

Proto:struct bpf_cgroup_storage *bpf_cgroup_storage_alloc(struct bpf_prog *prog, enum bpf_cgroup_storage_type stype)

Type:struct bpf_cgroup_storage

Parameter:

TypeParameterName
struct bpf_prog *prog
enum bpf_cgroup_storage_typestype
486  map = cgroup_storage[stype]
487  If Not map Then Return NULL
490  size = bpf_cgroup_storage_calculate_size(map, & pages)
492  If bpf_map_charge_memlock(map, pages) Then Return ERR_PTR( - EPERM)
495  storage = kmalloc_node( size of bpf_cgroup_storage , __GFP_ZERO | GFP_USER, numa_node)
497  If Not storage Then Go to enomem
500  flags = __GFP_ZERO | GFP_USER
502  If stype == BPF_CGROUP_STORAGE_SHARED Then
503  buf = kmalloc_node(size, flags, numa_node)
504  If Not buf Then Go to enomem
506  check_and_init_map_lock(map, data)
507  Else
508  percpu_buf = __alloc_percpu_gfp(size, 8, flags)
509  If Not percpu_buf Then Go to enomem
513  map = map
515  Return storage
517  enomem :
518  bpf_map_uncharge_memlock(map, pages)
519  kfree(storage)
520  Return ERR_PTR( - ENOMEM)
Caller
NameDescribe
__cgroup_bpf_attach__cgroup_bpf_attach() - Attach the program to a cgroup, and* propagate the change to descendants*@cgrp: The cgroup which descendants to traverse*@prog: A program to attach*@type: Type of attach operation*@flags: Option flags