@@ -90,6 +90,24 @@
};
extern struct tcp_hashinfo {
+ rwlock_t __tcp_lhash_lock;
+ atomic_t __tcp_lhash_users;
+ wait_queue_head_t __tcp_lhash_wait;
+ spinlock_t __tcp_portalloc_lock;
+
+ /* All sockets in TCP_LISTEN state will be in here. This is the only
+ * table where wildcard'd TCP sockets can exist. Hash function here
+ * is just local port number.
+ */
+ struct sock *__tcp_listening_hash[TCP_LHTABLE_SIZE];
+
+ /*
+ * All the below members are written once at bootup and are
+ * never written again _or_ are predominantly read-access.
+ * Hence we align to a new cache line as all the preceding members
+ * are often dirty.
+ */
+
/* This is for sockets with full identity only. Sockets here will
* always be without wildcards and will have the following invariant:
*
@@ -97,8 +115,10 @@
*
* First half of the table is for sockets not in TIME_WAIT, second half
* is for TIME_WAIT sockets only.
+ *
*/
- struct tcp_ehash_bucket *__tcp_ehash;
+ struct tcp_ehash_bucket *__tcp_ehash
+ __attribute__((__aligned__(SMP_CACHE_BYTES)));
/* Ok, let's try this, I give up, we do need a local binding
* TCP hash as well as the others for fast bind/connect.
@@ -107,24 +127,6 @@
int __tcp_bhash_size;
int __tcp_ehash_size;
-
- /* All sockets in TCP_LISTEN state will be in here. This is the only
- * table where wildcard'd TCP sockets can exist. Hash function here
- * is just local port number.
- */
- struct sock *__tcp_listening_hash[TCP_LHTABLE_SIZE];
-
- /* All the above members are written once at bootup and
- * never written again _or_ are predominantly read-access.
- *
- * Now align to a new cache line as all the following members
- * are often dirty.
- */
- rwlock_t __tcp_lhash_lock
- __attribute__((__aligned__(SMP_CACHE_BYTES)));
- atomic_t __tcp_lhash_users;
- wait_queue_head_t __tcp_lhash_wait;
- spinlock_t __tcp_portalloc_lock;
} tcp_hashinfo;
#define tcp_ehash (tcp_hashinfo.__tcp_ehash)