diff mbox series

[net] test_bpf: reduce MAX_TESTRUNS

Message ID 1519835960.30253.3.camel@gmail.com
State Accepted, archived
Delegated to: BPF Maintainers
Headers show
Series [net] test_bpf: reduce MAX_TESTRUNS | expand

Commit Message

Eric Dumazet Feb. 28, 2018, 4:39 p.m. UTC
From: Eric Dumazet <edumazet@google.com>

For tests that are using the maximal number of BPF instruction, each
run takes 20 usec. Looping 10,000 times on them totals 200 ms, which
is bad when the loop is not preemptible.

test_bpf: #264 BPF_MAXINSNS: Call heavy transformations jited:1 19248
18548 PASS
test_bpf: #269 BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASS

Lets divide by ten the number of iterations, so that max latency is
20ms. We could use need_resched() to break the loop earlier if we
believe 20 ms is too much.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 lib/test_bpf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Borkmann Feb. 28, 2018, 4:51 p.m. UTC | #1
On 02/28/2018 05:39 PM, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
> 
> For tests that are using the maximal number of BPF instruction, each
> run takes 20 usec. Looping 10,000 times on them totals 200 ms, which
> is bad when the loop is not preemptible.
> 
> test_bpf: #264 BPF_MAXINSNS: Call heavy transformations jited:1 19248
> 18548 PASS
> test_bpf: #269 BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASS
> 
> Lets divide by ten the number of iterations, so that max latency is
> 20ms. We could use need_resched() to break the loop earlier if we
> believe 20 ms is too much.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied to bpf tree, thanks Eric!
David Miller Feb. 28, 2018, 4:58 p.m. UTC | #2
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 28 Feb 2018 08:39:20 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> For tests that are using the maximal number of BPF instruction, each
> run takes 20 usec. Looping 10,000 times on them totals 200 ms, which
> is bad when the loop is not preemptible.
> 
> test_bpf: #264 BPF_MAXINSNS: Call heavy transformations jited:1 19248
> 18548 PASS
> test_bpf: #269 BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASS
> 
> Lets divide by ten the number of iterations, so that max latency is
> 20ms. We could use need_resched() to break the loop earlier if we
> believe 20 ms is too much.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Acked-by: David S. Miller <davem@davemloft.net>
diff mbox series

Patch

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index b4e22345963f339ffe05c974bc111ae7da9dc58f..d8dc618b223bb5168b0c7e9d9f4316eef3fbfa34 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -27,7 +27,7 @@ 
 
 /* General test specific settings */
 #define MAX_SUBTESTS	3
-#define MAX_TESTRUNS	10000
+#define MAX_TESTRUNS	1000
 #define MAX_DATA	128
 #define MAX_INSNS	512
 #define MAX_K		0xffffFFFF