Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1653347

Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code

From Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code
Date 2017-05-30 18:20 +0200
Message-ID <tMS2d-1ag-5@gated-at.bofh.it> (permalink)
References (1 earlier) <tMQjN-8vK-27@gated-at.bofh.it> <tMQWt-wG-11@gated-at.bofh.it> <tMR6a-A4-19@gated-at.bofh.it> <tMRIR-Op-1@gated-at.bofh.it> <tMS2d-1ag-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Andrew,

Andrew Lunn <andrew@lunn.ch> writes:

> On Tue, May 30, 2017 at 11:56:30AM -0400, Vivien Didelot wrote:
>> Hi Andrew, David,
>> 
>> David Miller <davem@davemloft.net> writes:
>> 
>> >>> +bool dsa_uses_tagged_protocol(struct dsa_switch_tree *dst)
>> >>> +{
>> >>> +	return !!dst->rcv;
>> >>> +}
>> >>> +
>> >> 
>> >> You need to be careful here. This is in the hot path. Every frame
>> >> received uses this code. And think about a distro kernel, which might
>> >> have DSA enabled by default, yet is unlikely to have any switches. You
>> >> are adding a function call which can be called millions of times per
>> >> second....
>> >
>> > Yeah, we really can't make this change.
>> >
>> > This isn't glibc where we're trying to hide the implementation of "FILE *"
>> > behind accessor functions that caller can't see.  We inline things when
>> > performance dictates, and it does here.
>> 
>> Thanks for the explanation, this wasn't obvious to me at all. So inline
>> is mandatory here. Would a dereference like "!!dst->tag_ops->rcv" have
>> an significant impact on performance?
>
> The additional dereference could cause a cache miss when accessing
> tag_ops, which is expensive. dst will be in cache, so dst->rcv should
> always be cheap.

OK! That was interesting. I'm dropping the first 2 patches.

Thanks,

        Vivien

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/7] net: dsa: tagger simplification Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
  [PATCH net-next 3/7] net: dsa: remove unused arguments of tagger rcv Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
    Re: [PATCH net-next 3/7] net: dsa: remove unused arguments of tagger  rcv Andrew Lunn <andrew@lunn.ch> - 2017-05-30 17:20 +0200
  [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
    Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code Andrew Lunn <andrew@lunn.ch> - 2017-05-30 17:10 +0200
      Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol  code David Miller <davem@davemloft.net> - 2017-05-30 17:20 +0200
        Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 18:00 +0200
          Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 18:20 +0200
          Re: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code Andrew Lunn <andrew@lunn.ch> - 2017-05-30 18:20 +0200
  [PATCH net-next 7/7] net: dsa: factor skb freeing on xmit Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
    Re: [PATCH net-next 7/7] net: dsa: factor skb freeing on xmit Andrew Lunn <andrew@lunn.ch> - 2017-05-30 17:40 +0200
  [PATCH net-next 5/7] net: dsa: remove useless goto label in tagger rcv Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
  [PATCH net-next 2/7] net: dsa: remove useless rcv copy in DSA tree Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-05-30 16:30 +0200
    Re: [PATCH net-next 2/7] net: dsa: remove useless rcv copy in DSA  tree Andrew Lunn <andrew@lunn.ch> - 2017-05-30 17:10 +0200
      Re: [PATCH net-next 2/7] net: dsa: remove useless rcv copy in DSA  tree David Miller <davem@davemloft.net> - 2017-05-30 17:20 +0200
  Re: [PATCH net-next 0/7] net: dsa: tagger simplification Andrew Lunn <andrew@lunn.ch> - 2017-05-30 17:20 +0200

csiph-web