Re: [PATCH net-next 1/2] tcp/dccp: Move initialisation of refcounted into if block.
Eric Dumazet <[email protected]>
| Newsgroups | org.kernel.vger.dccp,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CANn89iJzxqF8j6uUO9BqmMY0tVh+intVj-v-tygXc_8r6-wjkg@mail.gmail.com> |
On Mon, Mar 23, 2020 at 11:18 AM Kuniyuki Iwashima <[email protected]> wrote: > > The refcounted is initialised at most three times. > > - __inet_lookup_skb() sets it true. > - skb_steal_sock() is false and __inet_lookup() sets it true. > - __inet_lookup_established() is false and __inet_lookup() sets it false. > > We do not need to initialise refcounted again and again, so we should do > it just before return. > > Signed-off-by: Kuniyuki Iwashima <[email protected]> > --- Well, I do not believe this patch (and the following one) makes things more readable. I doubt setting a boolean in a register or a stack variable has any cost, I prefer letting the compiler optimize this. The ehash lookup cost is at least 2 or 3 cache lines, this is the major contribution.