From: Andi Kleen <ak@suse.de>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [PATCH] Shrink struct dst_entry a bit
Date: Tue, 13 Mar 2007 15:31:13 +0100 [thread overview]
Message-ID: <200703131531.14548.ak@suse.de> (raw)
In-Reply-To: <200703131510.41651.dada1@cosmosbay.com>
On Tuesday 13 March 2007 15:10, Eric Dumazet wrote:
> On Tuesday 13 March 2007 14:48, Andi Kleen wrote:
> > The ICMP rate limiting state can be shorts, we don't send that many ICMPs.
> > Changing flags to short and reorder fields to be sorted by size to avoid
> > holes. Move cold fields towards the end.
> >
>
> Nope, you cannot break the reordering I've done one month ago.
Ok. When you do such changes you should always add a comment, otherwise
it will be always destroyed with the next change.
But it seems highly fragile to me anyways because it depends on the exact
value of RTAX_MAX which tends to change regularly when someone invents
a new attribute. You should probably have moved next out of the dst entry.
Anyways here's a new patch with next still at the end and a comment.
-Andi
Shrink dst_entry a bit.
The ICMP rate limiting state can be shorts, we don't send that many ICMPs.
Changing flags to short and reorder fields to be sorted by size to avoid holes.
Move cold fields towards the end.
Signed-off-by: Andi Kleen <ak@suse.de>
Index: linux-2.6.21-rc3-net/include/net/dst.h
===================================================================
--- linux-2.6.21-rc3-net.orig/include/net/dst.h
+++ linux-2.6.21-rc3-net/include/net/dst.h
@@ -40,26 +40,24 @@ struct dst_entry
struct rcu_head rcu_head;
struct dst_entry *child;
struct net_device *dev;
- short error;
- short obsolete;
- int flags;
+ unsigned long expires;
+ short flags;
#define DST_HOST 1
#define DST_NOXFRM 2
#define DST_NOPOLICY 4
#define DST_NOHASH 8
#define DST_BALANCED 0x10
- unsigned long expires;
+ short error;
+ short obsolete;
unsigned short header_len; /* more space at head required */
unsigned short nfheader_len; /* more non-fragment space at head required */
unsigned short trailer_len; /* space to reserve at tail */
- u32 metrics[RTAX_MAX];
- struct dst_entry *path;
-
- unsigned long rate_last; /* rate limiting for ICMP */
- unsigned long rate_tokens;
+ unsigned short rate_last; /* rate limiting for ICMP */
+ unsigned short rate_tokens;
+ struct dst_entry *path;
struct neighbour *neighbour;
struct hh_cache *hh;
struct xfrm_state *xfrm;
@@ -67,21 +65,26 @@ struct dst_entry
int (*input)(struct sk_buff*);
int (*output)(struct sk_buff*);
-#ifdef CONFIG_NET_CLS_ROUTE
- __u32 tclassid;
-#endif
-
struct dst_ops *ops;
unsigned long lastuse;
atomic_t __refcnt; /* client references */
int __use;
+ u32 metrics[RTAX_MAX];
+
+#ifdef CONFIG_NET_CLS_ROUTE
+ __u32 tclassid;
+#endif
+
+ /* Should be at the end to be on the same cache line as
+ the flow information in rtable. */
union {
struct dst_entry *next;
struct rtable *rt_next;
struct rt6_info *rt6_next;
struct dn_route *dn_next;
};
+
char info[0];
};
next prev parent reply other threads:[~2007-03-13 14:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-13 13:48 [PATCH] Shrink struct dst_entry a bit Andi Kleen
2007-03-13 14:10 ` Eric Dumazet
2007-03-13 14:31 ` Andi Kleen [this message]
2007-03-13 14:44 ` Eric Dumazet
2007-03-13 14:58 ` Eric Dumazet
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=200703131531.14548.ak@suse.de \
--to=ak@suse.de \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.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;
as well as URLs for NNTP newsgroup(s).