Skip to contentSkip to conversation

samples: bpf: offwaketime: define MAX_ENTRIES instead of a magic number

PATCH Applied Muhammad Falak R Wani 2 participants 2 messages Aug 15, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples: bpf: offwaketime: define MAX_ENTRIES instead of a magic number

Define MAX_ENTRIES instead of using 10000 as a magic number in various places.

---
 samples/bpf/offwaketime_kern.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
samples/bpf/offwaketime_kern.c +5 -4
index 14b792915a9c..4866afd054da 100644
@@ -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)
Signature · 1 line
2.17.1
#1 lore raw
This patch was applied to bpf/bpf-next.git (refs/heads/master):

Hello:

This patch was applied to bpf/bpf-next.git (refs/heads/master):

Quoted 7 lines · On Sun, 15 Aug 2021 12:20:13 +0530 you wrote:

Define MAX_ENTRIES instead of using 10000 as a magic number in various places.

---
 samples/bpf/offwaketime_kern.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Here is the summary with links:
- samples: bpf: offwaketime: define MAX_ENTRIES instead of a magic number

    https://git.kernel.org/bpf/bpf-next/c/d1bf7c4d5dea

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html