netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: Patrick McHardy <kaber@trash.net>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH][XFRM] Optimize policy dumping
Date: Mon, 04 Dec 2006 12:43:33 -0500	[thread overview]
Message-ID: <1165254213.3643.25.camel@localhost> (raw)
In-Reply-To: <457444E0.8060801@trash.net>

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

On Mon, 2006-04-12 at 16:55 +0100, Patrick McHardy wrote:


> This patch should fix it (and is even simpler), by moving the
> check for pol->type != type before sending, we make sure that
> last always contains a valid element unless count == 0.
> 
> Also fixed an incorrect gcc warning about last_dir potentially
> being used uninitialized.


Ok, both looked good except for the test of a single entry.
This was because you would break out of the loop with count of 0.
The patch against yours would look like something attached for the state
case. Dont forget there are two spots on the policy side of things;->

You can either submit both patches or i could later today. If you do,
please look at some of the comments i made in the first patch and
include them. 
Just from the outset the numbers improvement looked the same as the way
i had it.

With these changes, 40K SPDs and 20K SAs dumping (subpolicies compiled
out)

---
speedopolis:~# time ./ip x state

real    0m1.985s
user    0m0.000s
sys     0m1.984s


speedopolis:~# time ./ip x policy

real    0m7.901s
user    0m0.008s
sys     0m7.896s
---

As a reference point, the old numbers:

---
speedopolis:~# ./ip xf pol

real    0m13.496s
user    0m0.000s
sys     0m13.493s
speedopolis:~#
speedopolis:~# time ./ip xf sta

real    0m5.321s
user    0m0.004s
sys     0m5.316s

----


Thanks a lot for your efforts Patrick.

cheers,
jamal

[-- Attachment #2: state-patch --]
[-- Type: text/x-patch, Size: 399 bytes --]

--- a/net/xfrm/xfrm_state.c	2006-12-04 12:06:23.000000000 -0500
+++ b/net/xfrm/xfrm_state.c	2006-12-04 12:07:09.000000000 -0500
@@ -1159,11 +1159,12 @@
 			if (!xfrm_id_proto_match(x->id.proto, proto))
 				continue;
 			if (last) {
-				err = func(last, ++count, data);
+				err = func(last, count, data);
 				if (err)
 					goto out;
 			}
 			last = x;
+			count++;
 		}
 	}
 	if (count == 0) {

  parent reply	other threads:[~2006-12-04 17:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-03 15:11 [PATCH][XFRM] Optimize policy dumping jamal
2006-12-04 12:24 ` Patrick McHardy
2006-12-04 13:26   ` jamal
2006-12-04 13:52     ` Patrick McHardy
2006-12-04 13:57       ` Patrick McHardy
2006-12-04 13:58         ` jamal
2006-12-04 14:05           ` jamal
2006-12-04 15:37             ` jamal
2006-12-04 15:55               ` Patrick McHardy
2006-12-04 15:57                 ` Patrick McHardy
2006-12-04 17:43                 ` jamal [this message]
2006-12-04 17:59                   ` Patrick McHardy
2006-12-04 20:46                     ` jamal
2006-12-04 14:06           ` Patrick McHardy
2006-12-04 14:11             ` jamal
2006-12-04 14:26               ` Patrick McHardy
  -- strict thread matches above, loose matches on Subject: below --
2006-12-04 20:58 jamal
2006-12-05  4:03 ` 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=1165254213.3643.25.camel@localhost \
    --to=hadi@cyberus.ca \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --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 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).