mbox series

[bpf-next,0/2] Add new bpf_cpumask_weight() kfunc

Message ID 20231207210843.168466-1-void@manifault.com (mailing list archive)
Headers show
Series Add new bpf_cpumask_weight() kfunc | expand

Message

David Vernet Dec. 7, 2023, 9:08 p.m. UTC
It can be useful to query how many bits are set in a cpumask. For
example, if you want to perform special logic for the last remaining
core that's set in a mask. This logic is already exposed through the
main kernel's cpumask header as cpumask_weight(), so it would be useful
to add a new bpf_cpumask_weight() kfunc which wraps it and does the
same.

This patch series was built and tested on top of commit 2146f7fe6e02
("Merge branch 'allocate-bpf-trampoline-on-bpf_prog_pack'").

David Vernet (2):
  bpf: Add bpf_cpumask_weight() kfunc
  selftests/bpf: Add test for bpf_cpumask_weight() kfunc

 Documentation/bpf/cpumasks.rst                |  2 +-
 kernel/bpf/cpumask.c                          | 12 ++++++
 .../selftests/bpf/prog_tests/cpumask.c        |  1 +
 .../selftests/bpf/progs/cpumask_common.h      |  1 +
 .../selftests/bpf/progs/cpumask_success.c     | 43 +++++++++++++++++++
 5 files changed, 58 insertions(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Dec. 10, 2023, 5:40 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Thu,  7 Dec 2023 15:08:41 -0600 you wrote:
> It can be useful to query how many bits are set in a cpumask. For
> example, if you want to perform special logic for the last remaining
> core that's set in a mask. This logic is already exposed through the
> main kernel's cpumask header as cpumask_weight(), so it would be useful
> to add a new bpf_cpumask_weight() kfunc which wraps it and does the
> same.
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/2] bpf: Add bpf_cpumask_weight() kfunc
    https://git.kernel.org/bpf/bpf-next/c/a6de18f310a5
  - [bpf-next,2/2] selftests/bpf: Add test for bpf_cpumask_weight() kfunc
    https://git.kernel.org/bpf/bpf-next/c/88f6047191e6

You are awesome, thank you!