All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.h.duyck@redhat.com>
To: David Ahern <dsa@cumulusnetworks.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: increase in time to delete an interface with 4.x kernels
Date: Mon, 27 Jul 2015 10:36:26 -0700	[thread overview]
Message-ID: <55B66C1A.4000804@redhat.com> (raw)
In-Reply-To: <55B6612C.7050506@cumulusnetworks.com>

On 07/27/2015 09:49 AM, David Ahern wrote:
> Hi Alex:
>
> I believe you did the recent overhaul to the fib implementation. I am
> seeing dramatically higher times to delete an interface with an ipv4
> address in 4.2-rc3. perf-top points to update_suffix:
>
>     PerfTop:   15834 irqs/sec  kernel:97.3%  exact:  0.0% [4000Hz
> cpu-clock],  (all, 4 CPUs)
> -------------------------------------------------------------------------------------------
>
>
>      74.69%  [kernel]       [k] update_suffix
>       2.38%  [kernel]       [k] fib_table_flush
>       2.20%  [kernel]       [k] fib6_walk_continue
>       2.03%  [kernel]       [k] fib6_ifdown
>       1.31%  [kernel]       [k] fib6_age
>
>
> I have a simple script to create and assign an ipv4 address to 10k dummy
> interfaces:
>
> l=0
> for (( j = 1; j <= 40; j += 1))
> do
>      for (( k = 1 ; k <= 250  ; k += 1 ))
>      do
>          l=$((l + 1))
>          ip link add dev dummy${l} type dummy
>            ip addr add  72.$j.$k.1/24 dev dummy${l}
>            ifconfig dummy${l} up
>      done
> done
>
>
> and a counter script to delete them all:
>
> k=$(ip link show | grep dummy | wc -l)
> for (( j = 1; j <= k; j += 1))
> do
>      ip link del dev dummy${j}
> done
>

Okay so looking over what this script does it looks like it really 
exposes the worst case scenerio for update_suffix.  You have a monstrous 
tnode that is 15 bits ins size.  That is roughly 32K entries, and 
unfortunately the suffix is 8 bits long with a position of 7.

The result is that for every removal the code is scanning 16K entries in 
order to relevel things after an entry is removed.

Let me try a couple of quick things and I should have a patch for you in 
the next couple of hours.

Thanks.

- Alex

  reply	other threads:[~2015-07-27 17:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 16:49 increase in time to delete an interface with 4.x kernels David Ahern
2015-07-27 17:36 ` Alexander Duyck [this message]
2015-07-27 20:08 ` [net PATCH] fib_trie: Drop unnecessary calls to leaf_pull_suffix Alexander Duyck
2015-07-27 21:02   ` David Ahern
2015-07-27 21:51   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B66C1A.4000804@redhat.com \
    --to=alexander.h.duyck@redhat.com \
    --cc=dsa@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.