All of lore.kernel.org
 help / color / mirror / Atom feed
From: jamal <hadi@cyberus.ca>
To: David Miller <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	netdev <netdev@vger.kernel.org>
Subject: [PATCH] [IPSEC]: pfkey should ignore events when no listeners
Date: Sat, 07 Jun 2008 09:23:10 -0400	[thread overview]
Message-ID: <1212844990.4615.68.camel@localhost> (raw)

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

I have only tested with SAs but i expect similar results with SPs.

cheers,
jamal

[-- Attachment #2: pfkey-perf --]
[-- Type: text/plain, Size: 1251 bytes --]

[IPSEC]: pfkey should ignore events when no listeners

When pfkey has no km listeners, it still does a lot of work
before finding out there aint nobody out there.
If a tree falls in a forest and no one is around to hear it, does it make
a sound? In this case it makes a lot of noise:
With this short-circuit adding 10s of thousands of SAs using
netlink improves performance by ~10%.

Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>

---
commit ad610c01e537679b1529c6f6c026a95a4e694dd2
tree 9c9ccda8b8a55aa29ba632d8ca6e1de5964c4c65
parent aab2545fdd6641b76af0ae96456c4ca9d1e50dad
author Jamal Hadi Salim <hadi@cyberus.ca> Sat, 07 Jun 2008 09:19:09 -0400
committer Jamal Hadi Salim <hadi@cyberus.ca> Sat, 07 Jun 2008 09:19:09 -0400

 net/key/af_key.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/key/af_key.c b/net/key/af_key.c
index 9bba7ac..7470e36 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -3030,6 +3030,9 @@ static int key_notify_sa_expire(struct xfrm_state *x, struct km_event *c)
 
 static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c)
 {
+	if (atomic_read(&pfkey_socks_nr) == 0)
+		return 0;
+
 	switch (c->event) {
 	case XFRM_MSG_EXPIRE:
 		return key_notify_sa_expire(x, c);

             reply	other threads:[~2008-06-07 13:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-07 13:23 jamal [this message]
2008-06-10 21:25 ` [PATCH] [IPSEC]: pfkey should ignore events when no listeners 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=1212844990.4615.68.camel@localhost \
    --to=hadi@cyberus.ca \
    --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.