public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: netdev@vger.kernel.org
Cc: Patrick McHardy <kaber@trash.net>
Subject: net 01/05: fib_rules: rearrange struct fib_rule
Date: Mon, 30 Nov 2009 18:55:31 +0100 (MET)	[thread overview]
Message-ID: <20091130175531.7555.50079.sendpatchset@x2.localnet> (raw)
In-Reply-To: <20091130175529.7555.10132.sendpatchset@x2.localnet>

commit 0d9a871c9888ef8f7a08531beaa69220edf4bea3
Author: Patrick McHardy <kaber@trash.net>
Date:   Mon Nov 30 15:45:49 2009 +0100

    net: fib_rules: rearrange struct fib_rule
    
    The ifname member is only used to resolve interface names and is not needed
    during rule lookups. The target and ctarget members however are used during
    rule lookups and are currently located in a second cacheline.
    
    Move ifname further to the end to make sure both target and ctarget are
    located in the same cacheline as other members used during rule lookups.
    
    The layout on 64 bit changes from:
    
    struct fib_rule {
    	...
            u32                        table;                /*    56     4 */
            u8                         action;               /*    60     1 */
    
            /* XXX 3 bytes hole, try to pack */
    
            /* --- cacheline 1 boundary (64 bytes) --- */
            u32                        target;               /*    64     4 */
    
            /* XXX 4 bytes hole, try to pack */
    
            struct fib_rule *          ctarget;              /*    72     8 */
            struct rcu_head            rcu;                  /*    80    16 */
            struct net *               fr_net;               /*    96     8 */
    };
    
    to:
    
    struct fib_rule {
    	...
            u32                        table;                /*    40     4 */
            u8                         action;               /*    44     1 */
    
            /* XXX 3 bytes hole, try to pack */
    
            u32                        target;               /*    48     4 */
    
            /* XXX 4 bytes hole, try to pack */
    
            struct fib_rule *          ctarget;              /*    56     8 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            char                       ifname[16];           /*    64    16 */
            struct rcu_head            rcu;                  /*    80    16 */
            struct net *               fr_net;               /*    96     8 */
    
    };
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 2cd707b..22fb323 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -11,7 +11,6 @@ struct fib_rule {
 	struct list_head	list;
 	atomic_t		refcnt;
 	int			ifindex;
-	char			ifname[IFNAMSIZ];
 	u32			mark;
 	u32			mark_mask;
 	u32			pref;
@@ -20,6 +19,7 @@ struct fib_rule {
 	u8			action;
 	u32			target;
 	struct fib_rule *	ctarget;
+	char			ifname[IFNAMSIZ];
 	struct rcu_head		rcu;
 	struct net *		fr_net;
 };

  reply	other threads:[~2009-11-30 17:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 17:55 RFC: net 00/05: routing based send-to-self implementation Patrick McHardy
2009-11-30 17:55 ` Patrick McHardy [this message]
2009-11-30 17:55 ` net 02/05: fib_rules: rename ifindex/ifname/FRA_IFNAME to iifindex/iifname/FRA_IIFNAME Patrick McHardy
2009-11-30 20:21   ` Jarek Poplawski
2009-11-30 20:23     ` Patrick McHardy
2009-11-30 17:55 ` net 03/05: fib_rules: add oif classification Patrick McHardy
2009-11-30 22:31   ` Jarek Poplawski
2009-12-01  9:32     ` Patrick McHardy
2009-12-01  9:48       ` Jarek Poplawski
2009-11-30 17:55 ` net 04/05: fib_rules: allow to delete local rule Patrick McHardy
2009-12-01 13:23   ` jamal
2009-12-01 17:12     ` Alexey Kuznetsov
2009-12-01 17:38       ` Patrick McHardy
2009-11-30 17:55 ` ipv4 05/05: add sysctl to accept packets with local source addresses Patrick McHardy
2009-11-30 19:32 ` RFC: net 00/05: routing based send-to-self implementation Eric W. Biederman
2009-11-30 19:37   ` Ben Greear
2009-11-30 20:04     ` Benjamin LaHaise
2009-11-30 20:15       ` Patrick McHardy
2009-11-30 20:15       ` Ben Greear
2009-11-30 20:23         ` Benjamin LaHaise
2009-12-03  6:32 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2009-12-03 11:25 Patrick McHardy
2009-12-03 11:25 ` net 01/05: fib_rules: rearrange struct fib_rule Patrick McHardy

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=20091130175531.7555.50079.sendpatchset@x2.localnet \
    --to=kaber@trash.net \
    --cc=netdev@vger.kernel.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