netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Denys Fedoryshchenko <denys@visp.net.lb>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: netdev@vger.kernel.org
Subject: iproute2 proposal
Date: Wed, 6 Aug 2008 01:25:38 +0300	[thread overview]
Message-ID: <200808060125.38260.denys@visp.net.lb> (raw)

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

While using iproute2 in batch mode i notice that adding 11362 rules, on system 
with 500+ interfaces takes up to 1minute on Xeon 3.0 Ghz.
After "oprofiling" i got result:

CPU: P4 / Xeon with 2 hyper-threads, speed 2992.84 MHz (estimated)
Counted GLOBAL_POWER_EVENTS events (time during which processor is not 
stopped) with a unit mask of 0x01 (mandatory) count 100000
samples  %        image name               symbol name
86166    57.3473  tc                       ll_remember_index
48103    32.0147  tc                       parse_rtattr
8497      5.6551  tc                       rtnl_dump_filter
1751      1.1654  [vdso] (tgid:22801 range:0xb7f66000-0xb7f67000) (no symbols)
1085      0.7221  tc                       tc_calc_xmittime
672       0.4472  tc                       .plt

I did small patch, and voila! batch finished in 2 seconds successfully!

Proof of concept patch is attached. Not sure if it is not breaking any other 
things. Waiting for any comments.

[-- Attachment #2: iproute2-proposal.patch --]
[-- Type: text/x-diff, Size: 594 bytes --]

diff -Naur iproute2-original/lib/ll_map.c iproute2-patched/lib/ll_map.c
--- iproute2-original/lib/ll_map.c	2008-08-05 19:15:56.000000000 +0000
+++ iproute2-patched/lib/ll_map.c	2008-08-05 22:22:36.000000000 +0000
@@ -23,6 +23,7 @@
 #include "ll_map.h"
 
 extern unsigned int if_nametoindex (const char *);
+static int ifacecache=0;
 
 struct idxmap
 {
@@ -160,6 +161,10 @@
 
 int ll_init_map(struct rtnl_handle *rth)
 {
+	if (ifacecache == 1)
+	    return 0;
+	ifacecache = 1;
+
 	if (rtnl_wilddump_request(rth, AF_UNSPEC, RTM_GETLINK) < 0) {
 		perror("Cannot send dump request");
 		exit(1);

             reply	other threads:[~2008-08-05 22:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-05 22:25 Denys Fedoryshchenko [this message]
2008-08-06  8:28 ` iproute2 proposal Patrick McHardy
2008-08-06 10:04   ` Denys Fedoryshchenko
2008-08-06 10:09     ` Patrick McHardy
2008-08-06 10:09       ` Patrick McHardy
2008-08-06 10:22       ` Denys Fedoryshchenko
2008-08-06 10:25         ` Patrick McHardy
2008-08-06 10:38           ` Denys Fedoryshchenko

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=200808060125.38260.denys@visp.net.lb \
    --to=denys@visp.net.lb \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).