From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jesse Gross <jesse@nicira.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next-2.6] net: inet_add_protocol() can use cmpxchg()
Date: Thu, 09 Sep 2010 07:23:14 +0200 [thread overview]
Message-ID: <1284009794.2428.32.camel@edumazet-laptop> (raw)
In-Reply-To: <AANLkTimZ=i1=c3SaEsw2_ncWJenuOgoSmHpMuN_UiG4K@mail.gmail.com>
Le mercredi 08 septembre 2010 à 16:49 -0700, Jesse Gross a écrit :
> On Wed, Sep 8, 2010 at 3:56 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Use cmpxchg() to get rid of spinlocks in inet_add_protocol() and
> > friends.
> >
> > inet_protos[] & inet6_protos[] are moved to read_mostly section
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> What's the benefit to this? It's hard to imagine that add/deleting
> protocols is highly contended. On the other hand, a simple spinlock
> is very easy to look at and verify correct, while this takes a little
> more thought.
Good question.
Did you know that _bh() was not necessary for example at this point ?
Its a leftover of an RCU conversion, done many years ago. It _was_
working of course, but it really hurts my mind. We could use
stop_machine or other brute force thing too ;)
Before patch :
# size net/ipv4/protocol.o net/ipv6/protocol.o
text data bss dec hex filename
340 0 2052 2392 958 net/ipv4/protocol.o
342 0 2052 2394 95a net/ipv6/protocol.o
After patch :
# size net/ipv4/protocol.o net/ipv6/protocol.o
text data bss dec hex filename
220 2048 0 2268 8dc net/ipv4/protocol.o
222 2048 0 2270 8de net/ipv6/protocol.o
45 lines removed, 240 bytes of text removed, I found this interesting.
Removing the ____cacheline_aligned_in_smp is also good, because
the .data alignement, is reduced and linker is not force to propagate
this alignement to upper .o files, with many holes.
If you take a look at most patches flying around, this one at least took
me to think a bit ;)
Thanks
next prev parent reply other threads:[~2010-09-09 5:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-08 22:56 [PATCH net-next-2.6] net: inet_add_protocol() can use cmpxchg() Eric Dumazet
2010-09-08 23:49 ` Jesse Gross
2010-09-09 4:30 ` David Miller
2010-09-09 6:42 ` Jarek Poplawski
2010-09-09 6:55 ` Eric Dumazet
2010-09-09 7:09 ` Jarek Poplawski
2010-09-09 7:24 ` Jarek Poplawski
2010-09-09 9:08 ` Jarek Poplawski
2010-09-09 9:23 ` Eric Dumazet
2010-09-09 9:42 ` Jarek Poplawski
2010-09-09 9:59 ` Jarek Poplawski
2010-09-09 12:57 ` Eric Dumazet
2010-09-09 15:38 ` Jarek Poplawski
2010-09-09 5:23 ` Eric Dumazet [this message]
2010-09-09 4:31 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1284009794.2428.32.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=jesse@nicira.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox