From: "Timo Teräs" <timo.teras@iki.fi>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David Miller <davem@davemloft.net>, netdev@vger.kernel.org
Subject: Re: [PATCH RFC 1/2] flow: virtualize get and entry deletion methods
Date: Mon, 29 Mar 2010 13:36:40 +0300 [thread overview]
Message-ID: <4BB082B8.9030400@iki.fi> (raw)
In-Reply-To: <20100329102639.GA23414@gondor.apana.org.au>
Herbert Xu wrote:
> On Mon, Mar 29, 2010 at 01:07:50PM +0300, Timo Teräs wrote:
>>> For the flow cache we didn't need this because the policy code
>>> would flush the cache synchronously so we can always grab a ref
>>> count safely as long as BH is still off.
>> The old code could return policy object that was killed. It
>
> Which is fine. I'd rather have that than this new behaviour
> which adds a lock. We don't delete policies all the time, so
> optimising for that case and pessimising the normal case is wrong!
>
>> The reason for policy GC calling flush was there for two
>> reasons:
>> - purging the stale entries
>> - making sure that refcount of policy won't go to zero after
>> releasing flow cache's reference (because the flow cache
>> did only atomic_dec but did not call destructor)
>>
>> Both issues are handled otherwise in the patch. By refreshing
>> stale entries immediately. Or calling virtual destructor when
>> the object gets deleted. Thus the slow flushing is not needed
>> as often now.
>
> Let's step back one second. It's best to not accumulate unrelated
> changes in one patch. So is there a reason why you must remove
> the synchronous flow cache flushing from the policy destruction
> path? If not please move that into a different patch.
Yes, I'm splitting up the patch to more fine grained pieces.
The synchronous flow cache flushing does not have to be removed,
but I consider it an improvement.
>> We can still drop the locking, as ->dead can be made atomic_t.
>
> No it doesn't need to be atomic, reading an int is always atomic.
The only reason why it needs to be atomic is because of
xfrm_policy_kill() which writes '1' and checks if it was zero
previously. Since the idea is to get rid of the policy lock, we
can turn ->dead flag to atomic_t and use atomic_xchg for that.
Otherwise it would be ok to have it as just regular int.
>> Checking ->dead improves cache's speed to react to policy object
>> changes. And the virtual ->get is especially needed for bundles
>> as they can get stale a lot more often.
>
> I really see no point to optimising for such an unlikely case
> but as long as you kill the locks I guess I'm not too bothered.
Agreed. But as the lockless check is cheap, why not to have it.
And some system do get policy changes quite a bit. IKE daemon
sometimes is configured to create policies on-demand so this does
have a real use case.
>> Yeah. Just a note that the road map to RCU policies is trivial
>> and fixes some races in locking currently.
>
> Please do one change at a time. Let's just focus on the original
> issue of the bundle linked list for now.
Yes. The way to do that is just a bit long. I've already added
some other stuff and split existing stuff in the patch. It's
currently seven patches. I'm still tracking one reference leak,
but I'll send in the new set soonish.
- Timo
next prev parent reply other threads:[~2010-03-29 10:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-25 9:24 [PATCH RFC 0/2] caching bundles instead of policies Timo Teras
2010-03-25 9:24 ` [PATCH RFC 1/2] flow: virtualize get and entry deletion methods Timo Teras
2010-03-25 19:26 ` David Miller
2010-03-26 6:17 ` Timo Teräs
2010-03-29 8:40 ` Herbert Xu
2010-03-29 9:00 ` Timo Teräs
2010-03-29 9:09 ` Herbert Xu
2010-03-29 10:07 ` Timo Teräs
2010-03-29 10:26 ` Herbert Xu
2010-03-29 10:36 ` Timo Teräs [this message]
2010-03-29 11:10 ` Herbert Xu
2010-03-29 11:23 ` Timo Teräs
2010-03-29 11:32 ` Herbert Xu
2010-03-29 11:39 ` Timo Teräs
2010-03-29 11:57 ` Herbert Xu
2010-03-29 12:03 ` Timo Teräs
2010-03-29 12:11 ` Herbert Xu
2010-03-29 12:20 ` Timo Teräs
2010-03-29 12:25 ` Herbert Xu
2010-03-29 12:33 ` Timo Teräs
2010-03-29 12:45 ` Herbert Xu
2010-03-25 9:24 ` [PATCH RFC 2/2] xfrm: cache bundles instead of policies for outgoing flows Timo Teras
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=4BB082B8.9030400@iki.fi \
--to=timo.teras@iki.fi \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.