• Roopa Prabhu's avatar
    rtnetlink: fdb dump: optimize by saving last interface markers · d297653d
    Roopa Prabhu authored
    fdb dumps spanning multiple skb's currently restart from the first
    interface again for every skb. This results in unnecessary
    iterations on the already visited interfaces and their fdb
    entries. In large scale setups, we have seen this to slow
    down fdb dumps considerably. On a system with 30k macs we
    see fdb dumps spanning across more than 300 skbs.
    To fix the problem, this patch replaces the existing single fdb
    marker with three markers: netdev hash entries, netdevs and fdb
    index to continue where we left off instead of restarting from the
    first netdev. This is consistent with link dumps.
    In the process of fixing the performance issue, this patch also
    re-implements fix done by
    commit 472681d5
     ("net: ndo_fdb_dump should report -EMSGSIZE to rtnl_fdb_dump")
    (with an internal fix from Wilson Kok) in the following ways:
    - change ndo_fdb_dump handlers to return error code instead
    of the last fdb index
    - use cb->args strictly for dump frag markers and not error codes.
    This is consistent with other dump functions.
    Below results were taken on a system with 1000 netdevs
    and 35085 fdb entries:
    before patch:
    $time bridge fdb show | wc -l
    real    1m11.791s
    user    0m0.070s
    sys 1m8.395s
    (existing code does not return all macs)
    after patch:
    $time bridge fdb show | wc -l
    real    0m2.017s
    user    0m0.113s
    sys 0m1.942s
    Signed-off-by: default avatarRoopa Prabhu <roopa@cumulusnetworks.com>
    Signed-off-by: default avatarWilson Kok <wkok@cumulusnetworks.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>