lkml.org 
[lkml]   [2017]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH net-next 1/7] net: dsa: hide dsa_uses_tagged_protocol code
Date
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?

Thanks,

Vivien

\
 
 \ /
  Last update: 2017-05-30 17:59    [W:0.048 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site