Skip to content

Commit

Permalink
[IPV4]: align inet_protos[] on SMP
Browse files Browse the repository at this point in the history
As IPPROTO_TCP is 6, it makes sense to make sure inet_protos[] array
is properly cache line aligned to avoid false sharing on SMP.

c0680540 b peer_total
c0680544 b inet_peer_unused_head
c0680560 B inet_protos

On i386 this example, we can see that inet_protos[IPPROTO_TCP] shares
a potentially hot (and modified) cache line.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 26, 2007
1 parent 4103f8c commit 03d4f87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <net/ipip.h>
#include <linux/igmp.h>

struct net_protocol *inet_protos[MAX_INET_PROTOS];
struct net_protocol *inet_protos[MAX_INET_PROTOS] ____cacheline_aligned_in_smp;
static DEFINE_SPINLOCK(inet_proto_lock);

/*
Expand Down

0 comments on commit 03d4f87

Please sign in to comment.