datapath: Use __read_mostly annotations where appropriate.
authorJesse Gross <jesse@nicira.com>
Wed, 24 Nov 2010 00:34:22 +0000 (16:34 -0800)
committerJesse Gross <jesse@nicira.com>
Fri, 3 Dec 2010 01:10:15 +0000 (17:10 -0800)
Variables which are changed only infrequently should be annotated
with __read_mostly, which will group them together in a special
linker section.  This prevents them from sharing cache lines with
data on the hot path.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/datapath.c
datapath/flow.c
datapath/tunnel.c

index 522d4ec100c71c9329c5cd889ae74537bbeb3f82..bed48039b63a2e0d9a8b1b0870b53f96a1bbe7e4 100644 (file)
@@ -54,7 +54,6 @@
 
 #include "compat.h"
 
-
 int (*dp_ioctl_hook)(struct net_device *dev, struct ifreq *rq, int cmd);
 EXPORT_SYMBOL(dp_ioctl_hook);
 
index 496f11cdb7284cb43bc013fcb0133385dcf32aa3..d30fb73fa21595a154112bdd527bd9ee51e20776 100644 (file)
@@ -32,7 +32,7 @@
 #include "compat.h"
 
 struct kmem_cache *flow_cache;
-static unsigned int hash_seed;
+static unsigned int hash_seed __read_mostly;
 
 static inline bool arphdr_ok(struct sk_buff *skb)
 {
index f0ae98d0500f9efca1f849d9a479bbf84ebe918e..e666a91766369f212355965afc0f49c04a454563 100644 (file)
@@ -68,7 +68,7 @@
 #define CACHE_DATA_ALIGN 16
 
 /* Protected by RCU. */
-static struct tbl *port_table;
+static struct tbl *port_table __read_mostly;
 
 static void cache_cleaner(struct work_struct *work);
 DECLARE_DELAYED_WORK(cache_cleaner_wq, cache_cleaner);
@@ -78,10 +78,10 @@ DECLARE_DELAYED_WORK(cache_cleaner_wq, cache_cleaner);
  * synchronization because we could have just as easily read the value before
  * the port change happened.
  */
-static unsigned int key_local_remote_ports;
-static unsigned int key_remote_ports;
-static unsigned int local_remote_ports;
-static unsigned int remote_ports;
+static unsigned int key_local_remote_ports __read_mostly;
+static unsigned int key_remote_ports __read_mostly;
+static unsigned int local_remote_ports __read_mostly;
+static unsigned int remote_ports __read_mostly;
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
 #define rt_dst(rt) (rt->dst)