diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-15 02:40:06 -0700 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-15 12:26:42 -0700 |
commit | 8e7999c44ee95e1e90ac91c83557a04e2948f160 (patch) | |
tree | 4295add7b91114fd43eef37d70b664858776dd0d /net/ipv4/ip_fragment.c | |
parent | 1e4b82873af0f21002e37a81ef063d2e5410deb3 (diff) | |
download | kernel-crypto-8e7999c44ee95e1e90ac91c83557a04e2948f160.tar.gz kernel-crypto-8e7999c44ee95e1e90ac91c83557a04e2948f160.tar.xz kernel-crypto-8e7999c44ee95e1e90ac91c83557a04e2948f160.zip |
[INET]: Consolidate the xxx_evictor
The evictors collect some statistics for ipv4 and ipv6,
so make it return the number of evicted queues and account
them all at once in the caller.
The XXX_ADD_STATS_BH() macros are just for this case,
but maybe there are places in code, that can make use of
them as well.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r-- | net/ipv4/ip_fragment.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index e8736632094..ee6e0415962 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c @@ -174,33 +174,11 @@ static void ipq_kill(struct ipq *ipq) */ static void ip_evictor(void) { - struct ipq *qp; - struct list_head *tmp; - int work; - - work = atomic_read(&ip4_frags.mem) - ip4_frags_ctl.low_thresh; - if (work <= 0) - return; - - while (work > 0) { - read_lock(&ip4_frags.lock); - if (list_empty(&ip4_frags.lru_list)) { - read_unlock(&ip4_frags.lock); - return; - } - tmp = ip4_frags.lru_list.next; - qp = list_entry(tmp, struct ipq, q.lru_list); - atomic_inc(&qp->q.refcnt); - read_unlock(&ip4_frags.lock); + int evicted; - spin_lock(&qp->q.lock); - if (!(qp->q.last_in&COMPLETE)) - ipq_kill(qp); - spin_unlock(&qp->q.lock); - - ipq_put(qp, &work); - IP_INC_STATS_BH(IPSTATS_MIB_REASMFAILS); - } + evicted = inet_frag_evictor(&ip4_frags); + if (evicted) + IP_ADD_STATS_BH(IPSTATS_MIB_REASMFAILS, evicted); } /* |