Skip to content

Commit

Permalink
Merge branch 'fib_trie_remove_leaf_info'
Browse files Browse the repository at this point in the history
Alexander Duyck says:

====================
fib_trie: Remove leaf_info structure

This patch set removes the leaf_info structure from the IPv4 fib_trie.  The
general idea is that the leaf_info structure itself only held about 6
actual bits of data, beyond that it was mostly just waste.  As such we can
drop the structure, move the 1 byte representing the prefix/suffix length
into the fib_alias and just link it all into one list.

My testing shows that this saves somewhere between 4 to 10ns depending on
the type of test performed.  I'm suspecting that this represents 1 to 2 L1
cache misses saved per look-up.

One side effect of this change is that semantic_match_miss will now only
increment once per leaf instead of once per leaf_info miss.  However the
stat is already skewed now that we perform a preliminary check on the leaf
as a part of the look-up.

I also have gone through and addressed a number of ordering issues in the
first patch since I had misread the behavior of list_add_tail.

I have since run some additional testing and verified the resulting lists
are in the same order when combining multiple prefix length and tos values
in a single leaf.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Feb 27, 2015
2 parents 7705f73 + 79e5ad2 commit 7eb6034
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 322 deletions.
2 changes: 1 addition & 1 deletion include/net/ip_fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct fib_result {
u32 tclassid;
struct fib_info *fi;
struct fib_table *table;
struct list_head *fa_head;
struct hlist_head *fa_head;
};

struct fib_result_nl {
Expand Down
3 changes: 2 additions & 1 deletion net/ipv4/fib_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
#include <net/ip_fib.h>

struct fib_alias {
struct list_head fa_list;
struct hlist_node fa_list;
struct fib_info *fa_info;
u8 fa_tos;
u8 fa_type;
u8 fa_state;
u8 fa_slen;
struct rcu_head rcu;
};

Expand Down
4 changes: 2 additions & 2 deletions net/ipv4/fib_semantics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,12 +1163,12 @@ int fib_sync_down_dev(struct net_device *dev, int force)
void fib_select_default(struct fib_result *res)
{
struct fib_info *fi = NULL, *last_resort = NULL;
struct list_head *fa_head = res->fa_head;
struct hlist_head *fa_head = res->fa_head;
struct fib_table *tb = res->table;
int order = -1, last_idx = -1;
struct fib_alias *fa;

list_for_each_entry_rcu(fa, fa_head, fa_list) {
hlist_for_each_entry_rcu(fa, fa_head, fa_list) {
struct fib_info *next_fi = fa->fa_info;

if (next_fi->fib_scope != res->scope ||
Expand Down
Loading

0 comments on commit 7eb6034

Please sign in to comment.