• David S. Miller's avatar
    [IPV4]: Make fib_semantics algorithms scale better. · c862855d
    David S. Miller authored
    A singly linked list was previously used to
    do fib_info object lookup for various actions
    in the routing code.  This does not scale very
    well with many devices and even a moderate number
    of routes.  This was noted by Benjamin Lahaise.
    
    To fix all of this we use 3 hash tables, two of
    which grow dynamically as the number fib_info
    objects increases while the final one is fixes in
    size.
    
    The statically sized table hashes on device index.
    This is used for fib_sync_down, fib_sync_up, and
    ip_fib_check_default.
    
    The first dynamically sized table is keyed on
    protocol, prefsrc, and priority.  This is used
    by fib_create_info() to look for existing fib_info
    objects matching the new one being constructed.
    
    The last dynamically sized table is keyed on
    the preferred source of the route if it has one
    specified.  This is used by fib_sync_down when
    a local address disappears.
    
    There are still some scalability problems for
    Bens test case in fib_hash.c and I will try to
    attack those next.
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c862855d
fib_semantics.c 28.4 KB