* [PATCH] test_bpf: add a schedule point
@ 2018-02-26 18:52 Eric Dumazet
2018-02-26 20:11 ` Daniel Borkmann
0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2018-02-26 18:52 UTC (permalink / raw)
To: Alexei Starovoitov; +Cc: Daniel Borkmann, netdev
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>
---
lib/test_bpf.c | 2 ++
1 file changed, 2 insertions(+)
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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] test_bpf: add a schedule point
2018-02-26 18:52 [PATCH] test_bpf: add a schedule point Eric Dumazet
@ 2018-02-26 20:11 ` Daniel Borkmann
2018-02-27 0:12 ` Eric Dumazet
0 siblings, 1 reply; 7+ messages in thread
From: Daniel Borkmann @ 2018-02-26 20:11 UTC (permalink / raw)
To: Eric Dumazet, Alexei Starovoitov; +Cc: netdev
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!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] test_bpf: add a schedule point
2018-02-26 20:11 ` Daniel Borkmann
@ 2018-02-27 0:12 ` Eric Dumazet
2018-02-27 8:51 ` Daniel Borkmann
2018-02-28 16:39 ` [PATCH net] test_bpf: reduce MAX_TESTRUNS Eric Dumazet
0 siblings, 2 replies; 7+ messages in thread
From: Eric Dumazet @ 2018-02-27 0:12 UTC (permalink / raw)
To: Daniel Borkmann, Alexei Starovoitov; +Cc: netdev
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 ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] test_bpf: add a schedule point
2018-02-27 0:12 ` Eric Dumazet
@ 2018-02-27 8:51 ` Daniel Borkmann
2018-02-28 16:39 ` [PATCH net] test_bpf: reduce MAX_TESTRUNS Eric Dumazet
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Borkmann @ 2018-02-27 8:51 UTC (permalink / raw)
To: Eric Dumazet, Alexei Starovoitov; +Cc: netdev
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net] test_bpf: reduce MAX_TESTRUNS
2018-02-27 0:12 ` Eric Dumazet
2018-02-27 8:51 ` Daniel Borkmann
@ 2018-02-28 16:39 ` Eric Dumazet
2018-02-28 16:51 ` Daniel Borkmann
2018-02-28 16:58 ` David Miller
1 sibling, 2 replies; 7+ messages in thread
From: Eric Dumazet @ 2018-02-28 16:39 UTC (permalink / raw)
To: Daniel Borkmann, Alexei Starovoitov; +Cc: netdev
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(-)
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net] test_bpf: reduce MAX_TESTRUNS
2018-02-28 16:39 ` [PATCH net] test_bpf: reduce MAX_TESTRUNS Eric Dumazet
@ 2018-02-28 16:51 ` Daniel Borkmann
2018-02-28 16:58 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: Daniel Borkmann @ 2018-02-28 16:51 UTC (permalink / raw)
To: Eric Dumazet, Alexei Starovoitov; +Cc: netdev
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!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] test_bpf: reduce MAX_TESTRUNS
2018-02-28 16:39 ` [PATCH net] test_bpf: reduce MAX_TESTRUNS Eric Dumazet
2018-02-28 16:51 ` Daniel Borkmann
@ 2018-02-28 16:58 ` David Miller
1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2018-02-28 16:58 UTC (permalink / raw)
To: eric.dumazet; +Cc: daniel, ast, netdev
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>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-02-28 16:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-26 18:52 [PATCH] test_bpf: add a schedule point Eric Dumazet
2018-02-26 20:11 ` Daniel Borkmann
2018-02-27 0:12 ` Eric Dumazet
2018-02-27 8:51 ` Daniel Borkmann
2018-02-28 16:39 ` [PATCH net] test_bpf: reduce MAX_TESTRUNS Eric Dumazet
2018-02-28 16:51 ` Daniel Borkmann
2018-02-28 16:58 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).