From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH iproute2] ip link: Do not call ll_name_to_index when creating a new link Date: Thu, 17 May 2018 18:17:12 -0600 Message-ID: References: <20180517222237.72388-1-dsahern@kernel.org> <20180517153604.0d905a36@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Stephen Hemminger Return-path: Received: from mail-pl0-f65.google.com ([209.85.160.65]:43450 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750924AbeERAR0 (ORCPT ); Thu, 17 May 2018 20:17:26 -0400 Received: by mail-pl0-f65.google.com with SMTP id c41-v6so3490260plj.10 for ; Thu, 17 May 2018 17:17:26 -0700 (PDT) In-Reply-To: <20180517153604.0d905a36@xeon-e3> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 5/17/18 4:36 PM, Stephen Hemminger wrote: > On Thu, 17 May 2018 16:22:37 -0600 > dsahern@kernel.org wrote: > >> From: David Ahern >> >> Using iproute2 to create a bridge and add 4094 vlans to it can take from >> 2 to 3 *minutes*. The reason is the extraneous call to ll_name_to_index. >> ll_name_to_index results in an ioctl(SIOCGIFINDEX) call which in turn >> invokes dev_load. If the index does not exist, which it won't when >> creating a new link, dev_load calls modprobe twice -- once for >> netdev-NAME and again for NAME. This is unnecessary overhead for each >> link create. >> >> When ip link is invoked for a new device, there is no reason to >> call ll_name_to_index for the new device. With this patch, creating >> a bridge and adding 4094 vlans takes less than 3 *seconds*. >> >> Signed-off-by: David Ahern > > Yes this looks like a real problem. > Isn't the cache supposed to reduce this? > > Don't like to make lots of special case flags. > The device does not exist, so it won't be in any cache. ll_name_to_index already checks it though before calling if_nametoindex.