[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAH5vBdKc09Oseb2P=K9X2xqzy4UYHtKW5UCS+9NV_EyYEKJxDA@mail.gmail.com>
Date: Sat, 24 May 2014 19:58:12 -0700
From: crquan <crquan@...il.com>
To: David Miller <davem@...emloft.net>
Cc: Networking Team <netdev@...r.kernel.org>
Subject: Re: [PATCH] dev-alloc-name-by-check-name-existence.patch
On Sat, May 24, 2014 at 2:57 PM, David Miller <davem@...emloft.net> wrote:
> The cost is iterating creating the string over and over again
> and then doing the hash lookup each time.
The original code calls sscanf / snprintf / strncmp for each existing intf,
new code is not creating the string, it calls snprintf only, and it won't call
more than original times of snprintf, right? I think here it depends on
hash lookup performance,
>
> Whereas the bitmap lookup is one word sized load for every
> BITS_PER_LONG indexes checked.
>
> Did you even test your change with large numbers of devices?
the worst case might be "eth0", "eth1", ... "eth4096", ... all exists, and
try to allocate next "eth%d", then it equals to N times hash lookup,
in general case, if allocating for a different prefix "veth%d" or not
all sequential
existing, it returns faster
The benefit is not requiring extra page of memory
--
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