• Eric Dumazet's avatar
    fib_hash: embed initial hash table in fn_zone · 9bef83ed
    Eric Dumazet authored
    While looking for false sharing problems, I noticed
    sizeof(struct fn_zone) was small (28 bytes) and possibly sharing a cache
    line with an often written kernel structure.
    
    Most of the time, fn_zone uses its initial hash table of 16 slots.
    
    We can avoid the false sharing problem by embedding this initial hash
    table in fn_zone itself, so that sizeof(fn_zone) > L1_CACHE_BYTES
    
    We did a similar optimization in commit a6501e08 (Reduce memory needs
    and speedup lookups)
    
    Add a fz_revorder field to speedup fn_hash() a bit.
    Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    9bef83ed
fib_hash.c 23.4 KB