Skip to content

Commit

Permalink
[FIB]: Reduce text size of net/ipv4/fib_trie.o
Browse files Browse the repository at this point in the history
In struct tnode, we use two fields of 5 bits for 'pos' and 'bits'.
Switching to plain 'unsigned char' (8 bits) take the same space
because of compiler alignments, and reduce text size by 435 bytes
on i386.

On i386 :
$ size net/ipv4/fib_trie.o.before_patch net/ipv4/fib_trie.o
    text    data     bss     dec     hex filename
   13714       4      64   13782    35d6 net/ipv4/fib_trie.o.before
   13279       4      64   13347    3423 net/ipv4/fib_trie.o

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Acked-by: Stephen Hemminger <stephen.hemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 28, 2008
1 parent b9aed45 commit 112d8cf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ipv4/fib_trie.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ struct leaf_info {
struct tnode {
t_key key;
unsigned long parent;
unsigned short pos:5; /* 2log(KEYLENGTH) bits needed */
unsigned short bits:5; /* 2log(KEYLENGTH) bits needed */
unsigned char pos; /* 2log(KEYLENGTH) bits needed */
unsigned char bits; /* 2log(KEYLENGTH) bits needed */
unsigned short full_children; /* KEYLENGTH bits needed */
unsigned short empty_children; /* KEYLENGTH bits needed */
struct rcu_head rcu;
Expand Down

0 comments on commit 112d8cf

Please sign in to comment.