[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB3ECB8@AcuExch.aculab.com>
Date: Tue, 26 May 2015 15:13:28 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Eric Dumazet' <eric.dumazet@...il.com>
CC: 'Alexei Starovoitov' <ast@...mgrid.com>,
"David S. Miller" <davem@...emloft.net>,
Daniel Borkmann <daniel@...earbox.net>,
Eric Dumazet <edumazet@...gle.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net] x86: bpf_jit: fix compilation of large bpf programs
From: Eric Dumazet
> Sent: 26 May 2015 15:35
> On Tue, 2015-05-26 at 13:40 +0000, David Laight wrote:
>
> > If the JIT compiler is only changing the encoding of the constants
> > in the x86 instructions (rather than changing the instructions themselves)
> > then there is likely to me an unmeasurable change in the execution time.
> > For instance I don't remember there being a difference in execution time
> > between long and short branches - the only difference is the amount of
> > cache they use.
>
> icache is precisely the matter here. In the end, it makes a difference.
>
> You could check this interesting study Ingo did recently :
>
> https://lkml.org/lkml/2015/5/19/1009
Yes, interesting, a benchmark that manages to run a lot of code 'cold cache'.
Possibly dominated by having a full cache line of code to execute at the
beginning of each function.
My guess is that aligning function bodies helps, aligning branch targets
(as some old versions of gcc used to do aggressively) is more likely to
have a negative effect (increases the icache footprint too much).
Unrolling loops further than needed to avoid data stalls needs very
careful study.
For JIT, once the obviously short branches have been reduced, further code
size reduction might not be worth while.
David
Powered by blists - more mailing lists