Message ID | 1519671166.3258.10.camel@gmail.com |
---|---|
State | Accepted, archived |
Delegated to: | BPF Maintainers |
Headers | show |
Series | test_bpf: add a schedule point | expand |
On 02/26/2018 07:52 PM, Eric Dumazet wrote: > From: Eric Dumazet <edumazet@google.com> > > test_bpf() is taking 1.6 seconds nowadays, it is time > to add a schedule point in it. > > Signed-off-by: Eric Dumazet <edumazet@google.com> Applied to bpf tree, thanks Eric!
On Mon, 2018-02-26 at 21:11 +0100, Daniel Borkmann wrote: > On 02/26/2018 07:52 PM, Eric Dumazet wrote: > > From: Eric Dumazet <edumazet@google.com> > > > > test_bpf() is taking 1.6 seconds nowadays, it is time > > to add a schedule point in it. > > > > Signed-off-by: Eric Dumazet <edumazet@google.com> > > 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 ?
On 02/27/2018 01:12 AM, Eric Dumazet wrote: > On Mon, 2018-02-26 at 21:11 +0100, Daniel Borkmann wrote: >> On 02/26/2018 07:52 PM, Eric Dumazet wrote: >>> From: Eric Dumazet <edumazet@google.com> >>> >>> test_bpf() is taking 1.6 seconds nowadays, it is time >>> to add a schedule point in it. >>> >>> Signed-off-by: Eric Dumazet <edumazet@google.com> >> >> 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 ? 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.
diff --git a/lib/test_bpf.c b/lib/test_bpf.c index b4e22345963f339ffe05c974bc111ae7da9dc58f..e6f550608d7220f434b45828549d36820923a51d 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -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;