diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2008-06-10 17:25:34 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-06-10 17:25:34 -0400 |
commit | 99c6f60e72f112b57ddb07abb2e5f771ee211f43 (patch) | |
tree | b955bdf6f02ad700adb0bffd4bcd1c3fc0a20366 /net/key | |
parent | bc6cffd177f9266af38dba96a2cea06c1e7ff932 (diff) |
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key')
-rw-r--r-- | 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 9bba7ac5fee0..7470e367272b 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) | |||
3030 | 3030 | ||
3031 | static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) | 3031 | static int pfkey_send_notify(struct xfrm_state *x, struct km_event *c) |
3032 | { | 3032 | { |
3033 | if (atomic_read(&pfkey_socks_nr) == 0) | ||
3034 | return 0; | ||
3035 | |||
3033 | switch (c->event) { | 3036 | switch (c->event) { |
3034 | case XFRM_MSG_EXPIRE: | 3037 | case XFRM_MSG_EXPIRE: |
3035 | return key_notify_sa_expire(x, c); | 3038 | return key_notify_sa_expire(x, c); |