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 14:23:02 +0300 [thread overview]
Message-ID: <4BB08D96.8090909@iki.fi> (raw)
In-Reply-To: <20100329111025.GA23927@gondor.apana.org.au>
Herbert Xu wrote:
> On Mon, Mar 29, 2010 at 01:36:40PM +0300, Timo Teräs wrote:
>>>> 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.
>
> I don't see the point. As long as the data paths do not take
> the lock changing this doesn't buy us much. You're still making
> that cacheline exclusive.
To my understanding declaring an atomic_t, or reading it with
atomic_read does not make cache line exclusive. Only the atomic_*
writing to it take the cache line. And since this is done exactly
once for policy (or it's a bug/warn thingy) it does not impose
significant performance issue.
But looking at the code more. The check should not be needed.
xfrm_policy_kill() is only called if the entry is removed from
the hash list, which can happen only once.
Do you think we can just change it to unconditionally writing
to "policy->walk.dead = 1;" and be done with that?
Alternatively, we can move the ->dead check to be done while
holding the hash lock to guarantee no one else is writing
simultaneously.
next prev parent reply other threads:[~2010-03-29 11:23 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
2010-03-29 11:10 ` Herbert Xu
2010-03-29 11:23 ` Timo Teräs [this message]
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=4BB08D96.8090909@iki.fi \
--to=timo.teras@iki$(echo .)fi \
--cc=davem@davemloft$(echo .)net \
--cc=herbert@gondor$(echo .)apana.org.au \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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