From: Timo Teras <timo.teras@iki.fi>
To: netdev@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>, Timo Teras <timo.teras@iki.fi>
Subject: [PATCH 3/4] xfrm: remove policy garbage collection
Date: Thu, 1 Apr 2010 15:52:19 +0300 [thread overview]
Message-ID: <1270126340-30181-4-git-send-email-timo.teras@iki.fi> (raw)
In-Reply-To: <1270126340-30181-1-git-send-email-timo.teras@iki.fi>
Policies are now properly reference counted and destroyed from
all code paths. The delayed gc is just an overhead now and can
be removed.
Signed-off-by: Timo Teras <timo.teras@iki.fi>
---
net/xfrm/xfrm_policy.c | 39 +++++----------------------------------
1 files changed, 5 insertions(+), 34 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 3489e2d..0a80978 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -46,9 +46,6 @@ static struct xfrm_policy_afinfo *xfrm_policy_afinfo[NPROTO];
static struct kmem_cache *xfrm_dst_cache __read_mostly;
-static HLIST_HEAD(xfrm_policy_gc_list);
-static DEFINE_SPINLOCK(xfrm_policy_gc_lock);
-
static struct xfrm_policy_afinfo *xfrm_policy_get_afinfo(unsigned short family);
static void xfrm_policy_put_afinfo(struct xfrm_policy_afinfo *afinfo);
static void xfrm_init_pmtu(struct dst_entry *dst);
@@ -289,32 +286,6 @@ void xfrm_policy_destroy(struct xfrm_policy *policy)
}
EXPORT_SYMBOL(xfrm_policy_destroy);
-static void xfrm_policy_gc_kill(struct xfrm_policy *policy)
-{
- atomic_inc(&policy->genid);
-
- if (del_timer(&policy->timer))
- atomic_dec(&policy->refcnt);
-
- xfrm_pol_put(policy);
-}
-
-static void xfrm_policy_gc_task(struct work_struct *work)
-{
- struct xfrm_policy *policy;
- struct hlist_node *entry, *tmp;
- struct hlist_head gc_list;
-
- spin_lock_bh(&xfrm_policy_gc_lock);
- gc_list.first = xfrm_policy_gc_list.first;
- INIT_HLIST_HEAD(&xfrm_policy_gc_list);
- spin_unlock_bh(&xfrm_policy_gc_lock);
-
- hlist_for_each_entry_safe(policy, entry, tmp, &gc_list, bydst)
- xfrm_policy_gc_kill(policy);
-}
-static DECLARE_WORK(xfrm_policy_gc_work, xfrm_policy_gc_task);
-
/* Rule must be locked. Release descentant resources, announce
* entry dead. The rule must be unlinked from lists to the moment.
*/
@@ -323,11 +294,12 @@ static void xfrm_policy_kill(struct xfrm_policy *policy)
{
policy->walk.dead = 1;
- spin_lock_bh(&xfrm_policy_gc_lock);
- hlist_add_head(&policy->bydst, &xfrm_policy_gc_list);
- spin_unlock_bh(&xfrm_policy_gc_lock);
+ atomic_inc(&policy->genid);
- schedule_work(&xfrm_policy_gc_work);
+ if (del_timer(&policy->timer))
+ xfrm_pol_put(policy);
+
+ xfrm_pol_put(policy);
}
static unsigned int xfrm_policy_hashmax __read_mostly = 1 * 1024 * 1024;
@@ -2605,7 +2577,6 @@ static void xfrm_policy_fini(struct net *net)
audit_info.sessionid = -1;
audit_info.secid = 0;
xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info);
- flush_work(&xfrm_policy_gc_work);
WARN_ON(!list_empty(&net->xfrm.policy_all));
--
1.6.3.3
next prev parent reply other threads:[~2010-04-01 12:52 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-01 12:52 [PATCH 0/4] caching bundles, iteration 3 Timo Teras
2010-04-01 12:52 ` [PATCH 1/4] flow: virtualize flow cache entry methods Timo Teras
2010-04-01 13:05 ` Eric Dumazet
2010-04-01 13:07 ` Timo Teräs
2010-04-03 3:38 ` Herbert Xu
2010-04-03 8:36 ` Herbert Xu
2010-04-03 13:50 ` Timo Teräs
2010-04-03 14:17 ` Herbert Xu
2010-04-03 14:26 ` Timo Teräs
2010-04-03 15:53 ` Herbert Xu
2010-04-03 20:19 ` Timo Teräs
2010-04-04 2:06 ` Herbert Xu
2010-04-04 5:50 ` Timo Teräs
2010-04-04 5:58 ` Herbert Xu
2010-04-04 6:07 ` Timo Teräs
2010-04-04 6:19 ` Herbert Xu
2010-04-04 6:28 ` Timo Teräs
2010-04-04 8:35 ` Herbert Xu
2010-04-04 10:42 ` Herbert Xu
2010-04-04 10:50 ` Timo Teräs
2010-04-04 11:00 ` Herbert Xu
2010-04-04 11:06 ` Timo Teräs
2010-04-04 11:26 ` Herbert Xu
2010-04-04 11:31 ` Herbert Xu
2010-04-04 12:09 ` Timo Teräs
2010-04-01 12:52 ` [PATCH 2/4] xfrm: cache bundles instead of policies for outgoing flows Timo Teras
2010-04-01 12:52 ` Timo Teras [this message]
2010-04-01 12:52 ` [PATCH 4/4] flow: delayed deletion of flow cache entries Timo Teras
2010-04-02 3:00 ` [PATCH 0/4] caching bundles, iteration 3 David Miller
2010-04-02 13:12 ` Herbert Xu
-- strict thread matches above, loose matches on Subject: below --
2010-04-05 7:00 [PATCH 0/4] caching bundles, iteration 4 Timo Teras
2010-04-05 7:00 ` [PATCH 3/4] xfrm: remove policy garbage collection Timo Teras
2010-04-07 10:30 [PATCH 0/4] caching bundles, iteration 5 Timo Teras
2010-04-07 10:30 ` [PATCH 3/4] xfrm: remove policy garbage collection 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=1270126340-30181-4-git-send-email-timo.teras@iki.fi \
--to=timo.teras@iki.fi \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).