test_bpf: add a schedule point
Subsystems (3)
PATCH 1/1 test_bpf: add a schedule point
From: Eric Dumazet <[email protected]>
test_bpf() is taking 1.6 seconds nowadays, it is time to add a schedule point in it.
---
lib/test_bpf.c | 2 ++
1 file changed, 2 insertions(+)
lib/test_bpf.c +2 -0
@@ -24,6 +24,7 @@#include <linux/if_vlan.h> #include <linux/random.h> #include <linux/highmem.h> +#include <linux/sched.h> /* General test specific settings */ #define MAX_SUBTESTS 3
@@ -6582,6 +6583,7 @@ static __init int test_bpf(void)struct bpf_prog *fp;int err; +cond_resched ();if (exclude_test (i))continue ;
Daniel Borkmann
AppliedQuoted 6 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
test_bpf()is taking 1.6 seconds nowadays, it is time to add a schedule point in it.Signed-off-by Eric Dumazet <[email protected]>
Applied to bpf tree, thanks Eric!
Quoted 9 lines · Daniel Borkmann
Quoted 6 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
test_bpf()is taking 1.6 seconds nowadays, it is time to add a schedule point in it.Signed-off-by Eric Dumazet <[email protected]>Applied to bpf tree, thanks Eric!
Thanks Daniel
Note that some BPF programs are quite expensive
[ 173.447471] test_bpf: #264 BPF_MAXINSNS: Call heavy transformations jited:1 19248 18548 PASS jited:1 12519 PASS
[ 173.509228] test_bpf: #269 BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASS
So we can still consume ~200 ms per test, without cond_resched()
Maybe reducing MAX_TESTRUNS from 10000 to 1000 would be the next step ?
Quoted 15 lines · Eric Dumazet
Quoted 9 lines · Daniel Borkmann
Quoted 6 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
test_bpf()is taking 1.6 seconds nowadays, it is time to add a schedule point in it.Signed-off-by Eric Dumazet <[email protected]>Applied to bpf tree, thanks Eric!
Thanks Daniel
Note that some BPF programs are quite expensive
Quoted 7 lines
[ 173.447471]
test_bpf: #264BPF_MAXINSNS: Call heavy transformations jited:1 19248 18548 PASS jited:1 12519 PASS
[ 173.509228]test_bpf: #269BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASSSo we can still consume ~200 ms per test, without
cond_resched()Maybe reducing
MAX_TESTRUNSfrom 10000 to 1000 would be the next step ?
Yeah, that's totally fine with me, please feel free to send a patch. Another step on todo is to reduce the test cases from test_bpf and move them into the test_verifier's run-time testing where applicable. Would be nice if at some point we can get rid of test_bpf and have everything consolidated within test_verifier.
PATCH 1/1 test_bpf: reduce MAX_TESTRUNS
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
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 PASStest_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.
---
lib/test_bpf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
lib/test_bpf.c +1 -1
@@ -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
Daniel Borkmann
AppliedRe: [PATCH net] test_bpf: reduce MAX_TESTRUNS
Quoted 10 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
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: #264BPF_MAXINSNS: Call heavy transformations jited:1 19248 18548 PASStest_bpf: #269BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASS
Quoted 5 lines
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 <[email protected]>
Applied to bpf tree, thanks Eric!
Re: [PATCH net] test_bpf: reduce MAX_TESTRUNS
In reply to Eric DumazetFrom: Eric Dumazet <[email protected]>
Date: Wed, 28 Feb 2018 08:39:20 -0800
Quoted 10 lines
From: Eric Dumazet <[email protected]>
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: #264BPF_MAXINSNS: Call heavy transformations jited:1 19248 18548 PASStest_bpf: #269BPF_MAXINSNS: ld_abs+get_processor_id jited:1 20896 PASS
Quoted 5 lines
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 <[email protected]>