netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: David Miller <davem@davemloft.net>
Cc: shemminger@osdl.org, netdev@vger.kernel.org
Subject: [PATCH] NET : force a cache line split in hh_cache in SMP
Date: Fri, 08 Dec 2006 09:06:32 +0100	[thread overview]
Message-ID: <45791D08.7070804@cosmosbay.com> (raw)
In-Reply-To: <20061207.150718.41636608.davem@davemloft.net>

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

hh_lock was converted from rwlock to seqlock by Stephen.

To have a 100% benefit of this change, I suggest to place read mostly fields 
of hh_cache in a separate cache line, because hh_refcnt may be changed quite 
frequently on some busy machines.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>


[-- Attachment #2: hh_cache.patch --]
[-- Type: text/plain, Size: 869 bytes --]

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 631cec4..6be767c 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -193,7 +193,14 @@ struct hh_cache
 {
 	struct hh_cache *hh_next;	/* Next entry			     */
 	atomic_t	hh_refcnt;	/* number of users                   */
-	__be16		hh_type;	/* protocol identifier, f.e ETH_P_IP
+/*
+ * We want hh_output, hh_len, hh_lock and hh_data be a in a separate
+ * cache line on SMP.
+ * They are mostly read, but hh_refcnt may be changed quite frequently,
+ * incurring cache line ping pongs.
+ */
+	__be16		hh_type ____cacheline_aligned_in_smp;
+					/* protocol identifier, f.e ETH_P_IP
                                          *  NOTE:  For VLANs, this will be the
                                          *  encapuslated type. --BLG
                                          */

  reply	other threads:[~2006-12-08  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-07 19:33 [PATCH] convert hh_lock to seqlock Stephen Hemminger
2006-12-07 20:23 ` Eric Dumazet
2006-12-07 21:15   ` Stephen Hemminger
2006-12-07 22:27     ` Eric Dumazet
2006-12-07 22:53       ` Stephen Hemminger
2006-12-07 23:02         ` Eric Dumazet
2006-12-07 23:07           ` David Miller
2006-12-08  8:06             ` Eric Dumazet [this message]
2006-12-08  8:08               ` [PATCH] NET : force a cache line split in hh_cache in SMP David Miller
2006-12-07 23:08 ` [PATCH] convert hh_lock to seqlock David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45791D08.7070804@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).