All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] [INET]: Get cirtical word in first 64bit of cache line
@ 2012-11-26  3:29 ling.ma.program
  2012-11-26  6:44 ` Eric Dumazet
  2013-02-02 15:03 ` [PATCH v2 net-next] inet: Get critical " Eric Dumazet
  0 siblings, 2 replies; 14+ messages in thread
From: ling.ma.program @ 2012-11-26  3:29 UTC (permalink / raw)
  To: edumazet; +Cc: linux-kernel, Ma Ling

From: Ma Ling <ling.ma.program@gmail.com>

In order to reduce memory latency when last level cache miss occurs,
modern CPUs i.e. x86 and arm introduced Critical Word First(CWF) or
Early Restart(ER) to get data ASAP. For CWF if critical word is first member
in cache line, memory feed CPU with critical word, then fill others
data in cache line one by one, otherwise after critical word it must
cost more cycle to fill the remaining cache line. For Early First CPU will
restart until critical word in cache line reaches.

Hash value is critical word, so in this patch we place it as first member
in cache line(sock address is cache-line aligned), and it is also good for
Early Restart platform as well .

Thanks
Ling

---
 include/net/sock.h |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 4a45216..312cf31 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -128,10 +128,10 @@ struct net;
 
 /**
  *	struct sock_common - minimal network layer representation of sockets
- *	@skc_daddr: Foreign IPv4 addr
- *	@skc_rcv_saddr: Bound local IPv4 addr
  *	@skc_hash: hash value used with various protocol lookup tables
  *	@skc_u16hashes: two u16 hash values used by UDP lookup tables
+ *	@skc_daddr: Foreign IPv4 addr
+ *	@skc_rcv_saddr: Bound local IPv4 addr
  *	@skc_family: network address family
  *	@skc_state: Connection state
  *	@skc_reuse: %SO_REUSEADDR setting
@@ -149,16 +149,16 @@ struct net;
  *	for struct sock and struct inet_timewait_sock.
  */
 struct sock_common {
+	/* skc_hash belongs to first member in sock with cache-line aligned*/
+	union  {
+		unsigned int	skc_hash;
+		__u16		skc_u16hashes[2];
+	};
 	/* skc_daddr and skc_rcv_saddr must be grouped :
 	 * cf INET_MATCH() and INET_TW_MATCH()
 	 */
 	__be32			skc_daddr;
 	__be32			skc_rcv_saddr;
-
-	union  {
-		unsigned int	skc_hash;
-		__u16		skc_u16hashes[2];
-	};
 	unsigned short		skc_family;
 	volatile unsigned char	skc_state;
 	unsigned char		skc_reuse;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-04  3:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-26  3:29 [PATCH RFC] [INET]: Get cirtical word in first 64bit of cache line ling.ma.program
2012-11-26  6:44 ` Eric Dumazet
2012-11-26 20:40   ` Ben Hutchings
2012-11-27 13:48   ` Ling Ma
2012-11-27 13:58     ` Eric Dumazet
2012-12-02 13:25       ` Ling Ma
2012-12-02 17:20         ` Eric Dumazet
2013-02-02 15:03 ` [PATCH v2 net-next] inet: Get critical " Eric Dumazet
2013-02-03 21:00   ` saeed bishara
2013-02-03 21:08   ` David Miller
2013-02-04  0:18     ` Eric Dumazet
2013-02-04  0:25       ` Eric Dumazet
2013-02-04  2:53         ` Ling Ma
2013-02-04  3:11           ` Eric Dumazet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.