diff options
author | andre <andre@FreeBSD.org> | 2013-04-09 21:02:20 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2013-04-09 21:02:20 +0000 |
commit | 306fddaf7801d7fae1206025486e9d9a97f52ad4 (patch) | |
tree | e754fcc273d884acf419c8faf5d21332f374104e /sys/net | |
parent | f70f4c314a94a4324c5dc34b2660fd66a18f35b4 (diff) | |
download | FreeBSD-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/net')
-rw-r--r-- | sys/net/if.c | 2 | ||||
-rw-r--r-- | sys/net/if_llatbl.c | 2 | ||||
-rw-r--r-- | sys/net/if_var.h | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index be6d006..712cd13 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -206,7 +206,7 @@ VNET_DEFINE(struct ifindex_entry *, ifindex_table); * also to stablize it over long-running ioctls, without introducing priority * inversions and deadlocks. */ -struct rwlock ifnet_rwlock; +struct rwlock_padalign ifnet_rwlock; struct sx ifnet_sxlock; /* diff --git a/sys/net/if_llatbl.c b/sys/net/if_llatbl.c index 84ea6c6..f19f6cf 100644 --- a/sys/net/if_llatbl.c +++ b/sys/net/if_llatbl.c @@ -67,7 +67,7 @@ static VNET_DEFINE(SLIST_HEAD(, lltable), lltables); static void vnet_lltable_init(void); -struct rwlock lltable_rwlock; +struct rwlock_padalign lltable_rwlock; RW_SYSINIT(lltable_rwlock, &lltable_rwlock, "lltable_rwlock"); /* diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 6ccf364..d60d0de 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -191,9 +191,9 @@ struct ifnet { void *if_unused[2]; void *if_afdata[AF_MAX]; int if_afdata_initialized; - struct rwlock if_afdata_lock; struct task if_linktask; /* task for link change events */ - struct rwlock if_addr_lock; /* lock to protect address lists */ + struct rwlock_padalign if_afdata_lock; + struct rwlock_padalign if_addr_lock; /* lock to protect address lists */ LIST_ENTRY(ifnet) if_clones; /* interfaces of a cloner */ TAILQ_HEAD(, ifg_list) if_groups; /* linked list of groups per if */ |