• Alexander Duyck's avatar
    fib_trie: Remove checks for index >= tnode_child_length from tnode_get_child · 21d1f11d
    Alexander Duyck authored
    For some reason the compiler doesn't seem to understand that when we are in
    a loop that runs from tnode_child_length - 1 to 0 we don't expect the value
    of tn->bits to change.  As such every call to tnode_get_child was rerunning
    tnode_chile_length which ended up consuming quite a bit of space in the
    resultant assembly code.
    
    I have gone though and verified that in all cases where tnode_get_child
    is used we are either winding though a fixed loop from tnode_child_length -
    1 to 0, or are in a fastpath case where we are verifying the value by
    either checking for any remaining bits after shifting index by bits and
    testing for leaf, or by using tnode_child_length.
    
    size net/ipv4/fib_trie.o
    Before:
       text	   data	    bss	    dec	    hex	filename
      15506	    376	      8	  15890	   3e12	net/ipv4/fib_trie.o
    
    After:
       text	   data	    bss	    dec	    hex	filename
      14827	    376	      8	  15211	   3b6b	net/ipv4/fib_trie.o
    Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    21d1f11d
fib_trie.c 56.5 KB