lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOaVG17Cjj3epC2LRkDVdoqNWno=XjH4nhfiNVeceS=0d=Nyrw@mail.gmail.com>
Date:	Fri, 22 Mar 2013 15:27:01 -0700
From:	Stephen Hemminger <stephen@...workplumber.org>
To:	"Eric W. Biederman" <ebiederm@...ssion.com>
Cc:	netdev@...r.kernel.org, Serge Hallyn <serge.hallyn@...ntu.com>,
	Benoit Lourdelet <blourdel@...iper.net>
Subject: Re: [RFC][PATCH] iproute: Faster ip link add, set and delete

The whole ifindex map is a design mistake at this point.
Better off to do a lazy cache or something like that.


On Fri, Mar 22, 2013 at 3:23 PM, Eric W. Biederman
<ebiederm@...ssion.com> wrote:
>
> Because ip link add, set, and delete map the interface name to the
> interface index by dumping all of the interfaces before performing
> their respective commands.  Operations that should be constant time
> slow down when lots of network interfaces are in use.  Resulting
> in O(N^2) time to work with O(N) devices.
>
> Make the work that iproute does constant time by passing the interface
> name to the kernel instead.
>
> In small scale testing on my system this shows dramatic performance
> increases of ip link add from 120s to just 11s to add 5000 network
> devices.  And from longer than I cared to wait to just 58s to delete
> all of those interfaces again.
>
> Cc: Serge Hallyn <serge.hallyn@...ntu.com>
> Reported-by: Benoit Lourdelet <blourdel@...iper.net>
> Signed-off-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> ---
>
> I think I am bungling the case where people specify an ifindex as ifNNNN
> but does anyone care?
>
>  ip/iplink.c |   19 +------------------
>  1 files changed, 1 insertions(+), 18 deletions(-)
>
> diff --git a/ip/iplink.c b/ip/iplink.c
> index ad33611..6dffbf0 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -533,8 +533,6 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
>                 }
>         }
>
> -       ll_init_map(&rth);
> -
>         if (!(flags & NLM_F_CREATE)) {
>                 if (!dev) {
>                         fprintf(stderr, "Not enough information: \"dev\" "
> @@ -542,27 +540,12 @@ static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv)
>                         exit(-1);
>                 }
>
> -               req.i.ifi_index = ll_name_to_index(dev);
> -               if (req.i.ifi_index == 0) {
> -                       fprintf(stderr, "Cannot find device \"%s\"\n", dev);
> -                       return -1;
> -               }
> +               name = dev;
>         } else {
>                 /* Allow "ip link add dev" and "ip link add name" */
>                 if (!name)
>                         name = dev;
>
> -               if (link) {
> -                       int ifindex;
> -
> -                       ifindex = ll_name_to_index(link);
> -                       if (ifindex == 0) {
> -                               fprintf(stderr, "Cannot find device \"%s\"\n",
> -                                       link);
> -                               return -1;
> -                       }
> -                       addattr_l(&req.n, sizeof(req), IFLA_LINK, &ifindex, 4);
> -               }
>         }
>
>         if (name) {
> --
> 1.7.5.4
>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ