Some BPF programs like scx schedulers have their own internal CPU mask types, mask types, which they must transform into struct bpf_cpumask instances before passing them to scheduling-related kfuncs. There is currently no way to efficiently populate the bitfield of a bpf_cpumask from BPF memory, and programs must use multiple bpf_cpumask_[set, clear] calls to do so. Introduce a kfunc helper to populate the bitfield of a bpf_cpumask from valid BPF memory with a single call. Signed-off-by: Emil Tsalapatis (Meta) <emil@xxxxxxxxxxxxxxx> Emil Tsalapatis (2): bpf: add kfunc for populating cpumask bits selftests: bpf: add bpf_cpumask_fill selftests kernel/bpf/cpumask.c | 21 +++++ .../selftests/bpf/prog_tests/verifier.c | 2 + .../selftests/bpf/progs/cpumask_success.c | 23 ++++++ .../selftests/bpf/progs/verifier_cpumask.c | 77 +++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 tools/testing/selftests/bpf/progs/verifier_cpumask.c -- 2.47.1