bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: daniel@iogearbox.net, ast@kernel.org, andrii@kernel.org
Cc: bpf@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH bpf-next v5 0/3] bpf: remove the cgroup -> bpf header dependecy
Date: Wed, 15 Dec 2021 18:55:35 -0800	[thread overview]
Message-ID: <20211216025538.1649516-1-kuba@kernel.org> (raw)

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/20211215061916.715513-1-kuba@kernel.org/
Merge bpf-includes.h into bpf.h.

v4: https://lore.kernel.org/all/20211215181231.1053479-1-kuba@kernel.org/
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

-- 
2.31.1


             reply	other threads:[~2021-12-16  2:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16  2:55 Jakub Kicinski [this message]
2021-12-16  2:55 ` [PATCH bpf-next v5 1/3] add includes masked by cgroup -> bpf dependency Jakub Kicinski
2021-12-16  2:55 ` [PATCH bpf-next v5 2/3] add missing bpf-cgroup.h includes Jakub Kicinski
2021-12-16  2:55 ` [PATCH bpf-next v5 3/3] bpf: remove the cgroup -> bpf header dependecy Jakub Kicinski
2021-12-16 23:05 ` [PATCH bpf-next v5 0/3] " Alexei Starovoitov
2021-12-16 23:44   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211216025538.1649516-1-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).