• Marcelo Ricardo Leitner's avatar
    ipv4: avoid parallel route cache gc executions · ad5ca98f
    Marcelo Ricardo Leitner authored
    When rt_intern_hash() has to deal with neighbour cache overflowing,
    it triggers the route cache garbage collector in an attempt to free
    some references on neighbour entries.
    
    Such call cannot be done async but should also not run in parallel with
    an already-running one, so that they don't collapse fighting over the
    hash lock entries.
    
    This patch thus blocks parallel executions with spinlocks:
    - A call from worker and from rt_intern_hash() are not the same, and
    cannot be merged, thus they will wait each other on rt_gc_lock.
    - Calls to gc from rt_intern_hash() may happen in parallel but we must
    wait for it to finish in order to try again. This dedup and
    synchrinozation is then performed by the locking just before calling
    __do_rt_garbage_collect().
    Signed-off-by: default avatarMarcelo Ricardo Leitner <mleitner@redhat.com>
    Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    ad5ca98f
route.c 86.9 KB