Skip to content

bpf: remove the cgroup -> bpf header dependecy

Jakub Kicinski bpf cgroups linux-perf-users linux-s390 linux-security-module 5 versions – Applied

Status from this message: Applied. Thanks

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest3 patches 2 repliesApplied
  2. v43 patches 3 repliesSuperseded
  3. v33 patches 0 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v24 patches2 repliesSuperseded
v15 patches4 repliesSuperseded

Changes in v5 from the cover letter

Add forward declaration of struct bpf_prog to perf_event.h when !CONFIG_BPF_SYSCALL (kbuild bot).

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/3add includes masked by cgroup -> bpf dependencyarch/s390/mm/hugetlbpage.c include/linux/perf_event.h+2 -00 replies
2/3add missing bpf-cgroup.h includeskernel/bpf/helpers.c kernel/bpf/syscall.c kernel/bpf/verifier.c +7 more+10 -00 replies
3/3bpf: remove the cgroup -> bpf header dependecyinclude/linux/bpf-cgroup-defs.h include/linux/bpf-cgroup.h include/linux/cgroup-defs.h+72 -570 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchTejun Heo
1/3
2/3A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH bpf-next v5 0/3] bpf: remove the cgroup -> bpf header dependecy

Changes to bpf.h tend to clog up our build systems. The netdev/bpf build bot does incremental builds to save time (reusing the build directory to only rebuild changed objects).

This is the rough breakdown of how many objects needs to be rebuilt based on file touched:

kernel.h      40633
bpf.h         17881
bpf-cgroup.h  17875
skbuff.h      10696
bpf-netns.h    7604
netdevice.h    7452
filter.h       5003
sock.h         4959
tcp.h          4048

As the stats show touching bpf.h is _very_ expensive.

Bulk of the objects get rebuilt because MM includes cgroup headers. Luckily bpf-cgroup.h does not fundamentally depend on bpf.h so we can break that dependency and reduce the number of objects.

With the patches applied touching bpf.h causes 5019 objects to be rebuilt (17881 / 5019 = 3.56x). That's pretty much down to filter.h plus noise.

v2:
Try to make the new headers wider in scope. Collapse bpf-link and bpf-cgroup-types into one header, which may serve as "BPF kernel API" header in the future if needed. Rename bpf-cgroup-storage.h to bpf-inlines.h.

Add a fix for the s390 build issue.

v3: https://lore.kernel.org/all/[email protected]/
Merge bpf-includes.h into bpf.h.

v4: https://lore.kernel.org/all/[email protected]/
Change course - break off cgroup instead of breaking off bpf.

v5:
Add forward declaration of struct bpf_prog to perf_event.h when !CONFIG_BPF_SYSCALL (kbuild bot).

Jakub Kicinski (3):
add includes masked by cgroup -> bpf dependency
add missing bpf-cgroup.h includes
bpf: remove the cgroup -> bpf header dependecy

 arch/s390/mm/hugetlbpage.c      |  1 +
 include/linux/bpf-cgroup-defs.h | 70 +++++++++++++++++++++++++++++++++
 include/linux/bpf-cgroup.h      | 57 +--------------------------
 include/linux/cgroup-defs.h     |  2 +-
 include/linux/perf_event.h      |  1 +
 kernel/bpf/helpers.c            |  1 +
 kernel/bpf/syscall.c            |  1 +
 kernel/bpf/verifier.c           |  1 +
 kernel/cgroup/cgroup.c          |  1 +
 kernel/trace/trace_kprobe.c     |  1 +
 kernel/trace/trace_uprobe.c     |  1 +
 net/ipv4/udp.c                  |  1 +
 net/ipv6/udp.c                  |  1 +
 net/socket.c                    |  1 +
 security/device_cgroup.c        |  1 +
 15 files changed, 84 insertions(+), 57 deletions(-)
 create mode 100644 include/linux/bpf-cgroup-defs.h
Signature · 1 line
2.31.1