Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread David Miller
From: jamal <[EMAIL PROTECTED]> Date: Mon, 04 Dec 2006 15:58:03 -0500 > This one has undergone more scrutiny and testing. Against net-2.6.20 Applied, thanks Jamal. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info

[PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
Dave, This one has undergone more scrutiny and testing. Against net-2.6.20 cheers, jamal [XFRM] Optimize policy dumping This change optimizes the dumping of Security policies. 1) Before this change .. speedopolis:~# time ./ip xf pol real0m22.274s user0m0.000s sys 0m22.269s 2) Turn

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
On Mon, 2006-04-12 at 18:59 +0100, Patrick McHardy wrote: > jamal wrote: > I'd prefer if you did it since you're already testing the thing :) Ok, will do shortly. cheers, jamal - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
jamal wrote: > 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're r

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
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_d

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
Patrick McHardy wrote: > jamal wrote: > >>All the way down, you call func with a NULL entry. You could add a check >>to make sure it only gets invoked when last is not null, but the result >>is in such a case, you will never send a 0 count element. I am sure >>there could be other tricky scenarios

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
jamal wrote: > On Mon, 2006-04-12 at 09:05 -0500, jamal wrote: > >>Patrick, >> >>Your approach is much cleaner. Let me give these a few tests then >>I will repost later today; forget about the callback approach for now. >> > > > I have just applied the policy patch; havent compiled or tested (th

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
On Mon, 2006-04-12 at 09:05 -0500, jamal wrote: > Patrick, > > Your approach is much cleaner. Let me give these a few tests then > I will repost later today; forget about the callback approach for now. > I have just applied the policy patch; havent compiled or tested (the setup takes me a while

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
jamal wrote: > On Mon, 2006-04-12 at 15:06 +0100, Patrick McHardy wrote: > > >>Both ways are fine I guess. But the counting has almost no >>overhead with the patch I sent, so I'm not sure if its worth >>adding a callback (which still needs to get the last policy/SA >>as argument, so that part won

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
On Mon, 2006-04-12 at 15:06 +0100, Patrick McHardy wrote: > Both ways are fine I guess. But the counting has almost no > overhead with the patch I sent, so I'm not sure if its worth > adding a callback (which still needs to get the last policy/SA > as argument, so that part won't get any nicer). >

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
Patrick, Your approach is much cleaner. Let me give these a few tests then I will repost later today; forget about the callback approach for now. cheers, jamal On Mon, 2006-04-12 at 08:58 -0500, jamal wrote: > On Mon, 2006-04-12 at 14:57 +0100, Patrick McHardy wrote: > > > I think the complica

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
jamal wrote: > On Mon, 2006-04-12 at 14:57 +0100, Patrick McHardy wrote: > > >> I think the complications come from the fact that you remeber two >> policies, but only one seems necessary. How about this (completely >> untested) patch? It simply uses increasing sequence numbers for all >> but th

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
On Mon, 2006-04-12 at 14:57 +0100, Patrick McHardy wrote: > I think the complications come from the fact that you remeber two > policies, but only one seems necessary. How about this (completely > untested) patch? It simply uses increasing sequence numbers for all > but the last entry and use

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
Patrick McHardy wrote: > jamal wrote: > >>All very valid points. >>Yikes, the directionality is not something i thought clearly about or >>tested well. I can fix this but this code will only get fuglier. How >>about the following approach: >> >>I add a new callback which is passed in the invocatio

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
jamal wrote: > All very valid points. > Yikes, the directionality is not something i thought clearly about or > tested well. I can fix this but this code will only get fuglier. How > about the following approach: > > I add a new callback which is passed in the invocation to walk. > This callback

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread jamal
On Mon, 2006-04-12 at 13:24 +0100, Patrick McHardy wrote: > A few cases that will behave incorrectly: > > - two policies in xfrm_policy_inexact with the same direction: > after the first iteration we have last_pol = send_pol = first policy > and no messages sent, after the second iteration we

Re: [PATCH][XFRM] Optimize policy dumping

2006-12-04 Thread Patrick McHardy
jamal wrote: > diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c > index 64d3938..c8a98ca 100644 > --- a/net/xfrm/xfrm_policy.c > +++ b/net/xfrm/xfrm_policy.c > @@ -860,57 +860,70 @@ EXPORT_SYMBOL(xfrm_policy_flush); > int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int,

[PATCH][XFRM] Optimize policy dumping

2006-12-03 Thread jamal
This improves dumping performance of xfrm policies. I started getting bothered when i noticed it took upto a minute dumping 60K policies from the kernel. I have another one i am testing that uses the same approach for SAs. Will send in the next hour. Against net-2.6.20. cheers, jamal [XFRM] Opti