bpf_percpu_obj_new(9)
π bpf_percpu_obj_new(9) β the Kernel API Manual glow-up β¨
okay bestie, welcome to the Kernel API Manual page for bpf_percpu_obj_new(9) β a little kfunc that literally hands you a percpu object and says "here, it's yours, slay" π
no cap.
πΈ NAME πΈ
bpf_percpu_obj_new β allocate a percpu object described by program BTF π¦
β¨ SYNOPSIS β¨
__bpf_kfunc void * bpf_percpu_obj_new (u64 local_type_id__k ,
struct btf_struct_meta *meta );
that's the whole flex, bestie. two args, one pointer back. periodt.
π ARGUMENTS π
local_type_id__kβ the type ID in the program BTF. it's giving "which type am I even allocating bestie" πmetaβ verifier-suppliedstruct btf_struct_metametadata. you're not the one setting this, the verifier is. main character energy, honestly π
π DESCRIPTION π
So what it does is: it allocates a percpu object of the type identified by local_type_id__k π.
BPF programs can use bpf_core_type_id_local to provide that local_type_id__k value β super handy, iykyk π₯.
And the meta situation? The verifier rewrites meta itself. BPF programs do not set it, like at all π. don't touch it, bestie, it's not yours.
π«Ά RETURN π«Ά
A pointer to the allocated percpu object π« β or NULL on failure π (yes, bestie, failure exists, vibe check failed, check your returns fr fr).
π§ SEE ALSO π§
the kernel file ./kernel/bpf/helpers.c and honestly the whole friend group:
bpf_obj_new(9)bpf_obj_drop(9)bpf_percpu_obj_drop(9)bpf_refcount_acquire(9)bpf_list_push_front(9)bpf_list_push_back(9)bpf_rbtree_add(9)bpf_task_acquire(9)bpf_task_release(9)bpf_cgroup_acquire(9)bpf_cgroup_release(9)bpf_cgroup_ancestor(9)bpf_cgroup_from_id(9)bpf_task_under_cgroup(9)bpf_task_get_cgroup1(9)bpf_task_from_pid(9)bpf_task_from_vpid(9)bpf_dynptr_slice(9)bpf_dynptr_slice_rdwr(9)bpf_dynptr_copy(9)bpf_dynptr_memset(9)bpf_iter_bits_new(9)bpf_iter_bits_next(9)bpf_iter_bits_destroy(9)bpf_copy_from_user_str(9)bpf_copy_from_user_task_str(9)bpf_strcmp(9)bpf_strcasecmp(9)bpf_strnchr(9)bpf_strchr(9)bpf_strchrnul(9)bpf_strrchr(9)bpf_strnlen(9)bpf_strlen(9)bpf_strspn(9)bpf_strcspn(9)bpf_strstr(9)bpf_strcasestr(9)bpf_strnstr(9)bpf_strncasestr(9)bpf_lookup_user_key(9)bpf_lookup_system_key(9)bpf_key_put(9)bpf_verify_pkcs7_signature(9)bpf_task_work_schedule_signal(9)bpf_task_work_schedule_resume(9)bpf_timer_cancel_async(9)
like, the entire roster. read them, love them, cite them π
π reminder bestie: meta is verifier business only β if your BPF program is out here trying to set it, that's not the move, that's a bug.
anyway that's the page! brought to you straight out of ./kernel/bpf, version October 2026, filed under bpf_percpu_obj_new(9) β mwah, go allocate something cute πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms