Re: [PATCH nf-next 2/2] netfilter: conntrack: simplify the code by using nf_conntrack_get_ht

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Florian,

At 2016-07-12 21:03:03, "Florian Westphal" <fw@xxxxxxxxx> wrote:
>Liping Zhang <zlpnobody@xxxxxxx> wrote:
>> +inline void
>> +nf_conntrack_get_ht(struct hlist_nulls_head **hash, unsigned int *hsize)
>
>Which "inline void"?  This is very unusual.
>
>I would suggest to not add it, and ...

Yes, but we can still find a very few sample codes using inline without static in current kernel source tree.
For example:
inline void raise_softirq_irqoff(unsigned int nr) { ... }
inline const struct nf_nat_l3proto * __nf_nat_l3proto_find(u8 family) { ... }

And from the description of the gcc's document(https://gcc.gnu.org/onlinedocs/gcc/Inline.html):
"When an inline function is not static, then the compiler must assume that there may be calls from
other source files; since a global symbol can be defined only once in any program, the function must
not be defined in the other source files, so the calls therein cannot be integrated". 

We can find that "inline void nf_conntrack_get_ht() { ... }" here will be integrated in nf_conntrack_core.c
and in other places will be a function call. And I test this on my x86 mechain, it works as expected.

>leave ____nf_conntrack_find alone, but convert
>
>> @@ -801,18 +799,15 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
>
>This one ..
>
>> @@ -878,14 +873,11 @@ static noinline int early_drop(struct net *net, unsigned int _hash)
>
>... and this one too.
>

IMO, leave ____nf_conntrack_find alone seems not very good. If you strongly dislike "inline void",
I can keep nf_conntrack_get_ht unchanged. But I will convert all these three to use nf_conntrack_get_ht.
I think even in ____nf_conntrack_find, inline nf_conntrack_get_ht will earn very very little performace
here, almost none.
?韬{.n?壏煯壄?%娝?檩?w?{.n?壏租栕庄z_鉃豝n噐■?侂h櫒璀?{鄗夸z罐楘+€?zf"穐殘啳嗃i?飦?戧鐉_璁鎗:+v墾?撸鴐




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux