summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2013-04-09 21:02:20 +0000
committerandre <andre@FreeBSD.org>2013-04-09 21:02:20 +0000
commit306fddaf7801d7fae1206025486e9d9a97f52ad4 (patch)
treee754fcc273d884acf419c8faf5d21332f374104e /sys/netinet
parentf70f4c314a94a4324c5dc34b2660fd66a18f35b4 (diff)
downloadFreeBSD-src-306fddaf7801d7fae1206025486e9d9a97f52ad4.zip
FreeBSD-src-306fddaf7801d7fae1206025486e9d9a97f52ad4.tar.gz
Change certain heavily used network related mutexes and rwlocks to
reside on their own cache line to prevent false sharing with other nearby structures, especially for those in the .bss segment. NB: Those mutexes and rwlocks with variables next to them that get changed on every invocation do not benefit from their own cache line. Actually it may be net negative because two cache misses would be incurred in those cases.
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/in_pcb.h2
-rw-r--r--sys/netinet/ip_id.c2
-rw-r--r--sys/netinet/ip_input.c4
-rw-r--r--sys/netinet/tcp_subr.c2
4 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index 2df90b0..5274a90 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -330,7 +330,7 @@ struct inpcbinfo {
/*
* Global lock protecting non-pcbgroup hash lookup tables.
*/
- struct rwlock ipi_hash_lock;
+ struct rwlock_padalign ipi_hash_lock;
/*
* Global hash of inpcbs, hashed by local and foreign addresses and
diff --git a/sys/netinet/ip_id.c b/sys/netinet/ip_id.c
index ce8c6b4..7b9710f 100644
--- a/sys/netinet/ip_id.c
+++ b/sys/netinet/ip_id.c
@@ -97,7 +97,7 @@ static int array_ptr = 0;
static int array_size = 8192;
static int random_id_collisions = 0;
static int random_id_total = 0;
-static struct mtx ip_id_mtx;
+static struct mtx_padalign ip_id_mtx;
static void ip_initid(void);
static int sysctl_ip_id_change(SYSCTL_HANDLER_ARGS);
diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c
index f38c6fa..17a4e1d 100644
--- a/sys/netinet/ip_input.c
+++ b/sys/netinet/ip_input.c
@@ -85,7 +85,7 @@ __FBSDID("$FreeBSD$");
CTASSERT(sizeof(struct ip) == 20);
#endif
-struct rwlock in_ifaddr_lock;
+struct rwlock_padalign in_ifaddr_lock;
RW_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock");
VNET_DEFINE(int, rsvp_on);
@@ -155,7 +155,7 @@ VNET_DEFINE(u_long, in_ifaddrhmask); /* mask for hash table */
static VNET_DEFINE(uma_zone_t, ipq_zone);
static VNET_DEFINE(TAILQ_HEAD(ipqhead, ipq), ipq[IPREASS_NHASH]);
-static struct mtx ipqlock;
+static struct mtx_padalign ipqlock;
#define V_ipq_zone VNET(ipq_zone)
#define V_ipq VNET(ipq)
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 24e4db2..ed00af3 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -255,7 +255,7 @@ static VNET_DEFINE(uma_zone_t, tcpcb_zone);
#define V_tcpcb_zone VNET(tcpcb_zone)
MALLOC_DEFINE(M_TCPLOG, "tcplog", "TCP address and flags print buffers");
-static struct mtx isn_mtx;
+static struct mtx_padalign isn_mtx;
#define ISN_LOCK_INIT() mtx_init(&isn_mtx, "isn_mtx", NULL, MTX_DEF)
#define ISN_LOCK() mtx_lock(&isn_mtx)
OpenPOWER on IntegriCloud