summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorMuhammad Falak R Wani <falakreyaz@gmail.com>2021-08-15 08:50:13 +0200
committerAndrii Nakryiko <andrii@kernel.org>2021-08-15 09:08:40 +0200
commitd1bf7c4d5deae6685a42463f4d29418fd2515d05 (patch)
treef8acd9f186661e700a285eb1b8bd8f8bf84419a8 /samples
parentMerge branch 'bpf: Allow bpf_get_netns_cookie in BPF_PROG_TYPE_CGROUP_SOCKOPT' (diff)
downloadlinux-d1bf7c4d5deae6685a42463f4d29418fd2515d05.tar.xz
linux-d1bf7c4d5deae6685a42463f4d29418fd2515d05.zip
samples/bpf: Define MAX_ENTRIES instead of a magic number in offwaketime
Define MAX_ENTRIES instead of using 10000 as a magic number in various places. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20210815065013.15411-1-falakreyaz@gmail.com
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/offwaketime_kern.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/samples/bpf/offwaketime_kern.c b/samples/bpf/offwaketime_kern.c
index 14b792915a9c..4866afd054da 100644
--- a/samples/bpf/offwaketime_kern.c
+++ b/samples/bpf/offwaketime_kern.c
@@ -20,6 +20,7 @@
})
#define MINBLOCK_US 1
+#define MAX_ENTRIES 10000
struct key_t {
char waker[TASK_COMM_LEN];
@@ -32,14 +33,14 @@ struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, struct key_t);
__type(value, u64);
- __uint(max_entries, 10000);
+ __uint(max_entries, MAX_ENTRIES);
} counts SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u32);
__type(value, u64);
- __uint(max_entries, 10000);
+ __uint(max_entries, MAX_ENTRIES);
} start SEC(".maps");
struct wokeby_t {
@@ -51,14 +52,14 @@ struct {
__uint(type, BPF_MAP_TYPE_HASH);
__type(key, u32);
__type(value, struct wokeby_t);
- __uint(max_entries, 10000);
+ __uint(max_entries, MAX_ENTRIES);
} wokeby SEC(".maps");
struct {
__uint(type, BPF_MAP_TYPE_STACK_TRACE);
__uint(key_size, sizeof(u32));
__uint(value_size, PERF_MAX_STACK_DEPTH * sizeof(u64));
- __uint(max_entries, 10000);
+ __uint(max_entries, MAX_ENTRIES);
} stackmap SEC(".maps");
#define STACKID_FLAGS (0 | BPF_F_FAST_STACK_CMP)