bpf_percpu_obj_new(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ‘‘ 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-supplied struct btf_struct_meta metadata. 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:

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