On Wed, Feb 1, 2017 at 1:20 PM, David Laight <david.lai...@aculab.com> wrote: > From: Saeed Mahameed >> Sent: 31 January 2017 20:59 >> Cache skb_vlan_tag_present(skb) and pass it wherever needed in xmit >> routines. > ... > > Does this actually generate better code?
Only in case skb pointer is kept in memory (we will save up to 3 skb->vlan_tci dereferences in that case). > It is quite likely that your 'vlan_present' variable ends up being on stack. > Whereas the 'skb' is likely to be in a register. can i assume this to be likely true on all archs ? > In which case the two loads are likely to be must the same and your > change has added a write to the stack. > > David > >