diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2008-01-18 06:33:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:02:46 -0500 |
commit | a6501e080c318f8d4467679d17807f42b3a33cd5 (patch) | |
tree | 02ba4422ec6603b2bfddace52b2fabaaa6725496 /net/ipv4/fib_lookup.h | |
parent | b59cfbf77dc8368c2c90b012c79553613f4d70c3 (diff) |
[IPV4] FIB_HASH: Reduce memory needs and speedup lookups
Currently, sizeof(struct fib_alias) is 24 or 48 bytes on 32/64 bits
arches.
Because of SLAB_HWCACHE_ALIGN requirement, these are rounded to 32 and
64 bytes respectively.
This patch moves rcu to the end of fib_alias, and conditionally
defines it only for CONFIG_IP_FIB_TRIE.
We also remove SLAB_HWCACHE_ALIGN requirement for fib_alias and
fib_node objects because it is not necessary.
(BTW SLUB currently denies it for objects smaller than
cache_line_size() / 2, but not SLAB)
Finally, sizeof(fib_alias) go back to 16 and 32 bytes.
Then, we can embed one fib_alias on each fib_node, to favor locality.
Most of the time access to the fib_alias will be free because one
cache line contains both the list head (fn_alias) and (one of) the
list element.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_lookup.h')
-rw-r--r-- | net/ipv4/fib_lookup.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/fib_lookup.h b/net/ipv4/fib_lookup.h index 26ee66d78c18..2c1623d2768b 100644 --- a/net/ipv4/fib_lookup.h +++ b/net/ipv4/fib_lookup.h | |||
@@ -7,12 +7,14 @@ | |||
7 | 7 | ||
8 | struct fib_alias { | 8 | struct fib_alias { |
9 | struct list_head fa_list; | 9 | struct list_head fa_list; |
10 | struct rcu_head rcu; | ||
11 | struct fib_info *fa_info; | 10 | struct fib_info *fa_info; |
12 | u8 fa_tos; | 11 | u8 fa_tos; |
13 | u8 fa_type; | 12 | u8 fa_type; |
14 | u8 fa_scope; | 13 | u8 fa_scope; |
15 | u8 fa_state; | 14 | u8 fa_state; |
15 | #ifdef CONFIG_IP_FIB_TRIE | ||
16 | struct rcu_head rcu; | ||
17 | #endif | ||
16 | }; | 18 | }; |
17 | 19 | ||
18 | #define FA_S_ACCESSED 0x01 | 20 | #define FA_S_ACCESSED 0x01 |