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 v3 3/3] bpf: remove the cgroup -> bpf header dependecy
Date: Tue, 14 Dec 2021 22:19:16 -0800 [thread overview]
Message-ID: <20211215061916.715513-4-kuba@kernel.org> (raw)
In-Reply-To: <20211215061916.715513-1-kuba@kernel.org>
Remove the dependency from cgroup.h to bpf.h. This reduces
the incremental build size of x86 allmodconfig after bpf.h
was touched from ~17k objects rebuilt to ~5k objects.
bpf.h is 2.2kLoC and is modified relatively often.
cgroup_storage_type() needs to be moved to bpf.h because
it dereferences struct bpf_map.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
include/linux/bpf-cgroup.h | 12 ++----------
include/linux/bpf.h | 9 +++++++++
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 11820a430d6c..d966b3dc7666 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -2,7 +2,7 @@
#ifndef _BPF_CGROUP_H
#define _BPF_CGROUP_H
-#include <linux/bpf.h>
+#include <linux/bpf-cgroup-types.h>
#include <linux/errno.h>
#include <linux/jump_label.h>
#include <linux/percpu.h>
@@ -16,6 +16,7 @@ struct cgroup;
struct sk_buff;
struct bpf_map;
struct bpf_prog;
+struct bpf_prog_aux;
struct bpf_sock_ops_kern;
struct bpf_cgroup_storage;
struct ctl_table;
@@ -194,15 +195,6 @@ int __cgroup_bpf_run_filter_getsockopt_kern(struct sock *sk, int level,
int optname, void *optval,
int *optlen, int retval);
-static inline enum bpf_cgroup_storage_type cgroup_storage_type(
- struct bpf_map *map)
-{
- if (map->map_type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE)
- return BPF_CGROUP_STORAGE_PERCPU;
-
- return BPF_CGROUP_STORAGE_SHARED;
-}
-
struct bpf_cgroup_storage *
cgroup_storage_lookup(struct bpf_cgroup_storage_map *map,
void *key, bool locked);
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 1e16243623fe..8ea70c26acb5 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -288,6 +288,15 @@ static inline bool bpf_map_support_seq_show(const struct bpf_map *map)
map->ops->map_seq_show_elem;
}
+static inline enum bpf_cgroup_storage_type cgroup_storage_type(
+ struct bpf_map *map)
+{
+ if (map->map_type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE)
+ return BPF_CGROUP_STORAGE_PERCPU;
+
+ return BPF_CGROUP_STORAGE_SHARED;
+}
+
int map_check_no_btf(const struct bpf_map *map,
const struct btf *btf,
const struct btf_type *key_type,
--
2.31.1
prev parent reply other threads:[~2021-12-15 6:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-15 6:19 [PATCH bpf-next v3 0/3] bpf: remove the cgroup -> bpf header dependecy Jakub Kicinski
2021-12-15 6:19 ` [PATCH bpf-next v3 1/3] add includes masked by cgroup -> bpf dependency Jakub Kicinski
2021-12-15 6:19 ` [PATCH bpf-next v3 2/3] bpf: add header for enum bpf_cgroup_storage_type and bpf_link Jakub Kicinski
2021-12-15 6:19 ` Jakub Kicinski [this message]
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=20211215061916.715513-4-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