diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-10-15 05:40:06 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-15 15:26:42 -0400 |
commit | 8e7999c44ee95e1e90ac91c83557a04e2948f160 (patch) | |
tree | 4295add7b91114fd43eef37d70b664858776dd0d /net/ipv6 | |
parent | 1e4b82873af0f21002e37a81ef063d2e5410deb3 (diff) |
[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/ipv6')
-rw-r--r-- | net/ipv6/netfilter/nf_conntrack_reasm.c | 29 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 30 |
2 files changed, 5 insertions, 54 deletions
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 785f5cda188e..e4fbe5ba88f1 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -163,34 +163,7 @@ static __inline__ void fq_kill(struct nf_ct_frag6_queue *fq) | |||
163 | 163 | ||
164 | static void nf_ct_frag6_evictor(void) | 164 | static void nf_ct_frag6_evictor(void) |
165 | { | 165 | { |
166 | struct nf_ct_frag6_queue *fq; | 166 | inet_frag_evictor(&nf_frags); |
167 | struct list_head *tmp; | ||
168 | unsigned int work; | ||
169 | |||
170 | work = atomic_read(&nf_frags.mem); | ||
171 | if (work <= nf_frags_ctl.low_thresh) | ||
172 | return; | ||
173 | |||
174 | work -= nf_frags_ctl.low_thresh; | ||
175 | while (work > 0) { | ||
176 | read_lock(&nf_frags.lock); | ||
177 | if (list_empty(&nf_frags.lru_list)) { | ||
178 | read_unlock(&nf_frags.lock); | ||
179 | return; | ||
180 | } | ||
181 | tmp = nf_frags.lru_list.next; | ||
182 | BUG_ON(tmp == NULL); | ||
183 | fq = list_entry(tmp, struct nf_ct_frag6_queue, q.lru_list); | ||
184 | atomic_inc(&fq->q.refcnt); | ||
185 | read_unlock(&nf_frags.lock); | ||
186 | |||
187 | spin_lock(&fq->q.lock); | ||
188 | if (!(fq->q.last_in&COMPLETE)) | ||
189 | fq_kill(fq); | ||
190 | spin_unlock(&fq->q.lock); | ||
191 | |||
192 | fq_put(fq, &work); | ||
193 | } | ||
194 | } | 167 | } |
195 | 168 | ||
196 | static void nf_ct_frag6_expire(unsigned long data) | 169 | static void nf_ct_frag6_expire(unsigned long data) |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 940b7d2383ec..02e4e855b927 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -185,33 +185,11 @@ static __inline__ void fq_kill(struct frag_queue *fq) | |||
185 | 185 | ||
186 | static void ip6_evictor(struct inet6_dev *idev) | 186 | static void ip6_evictor(struct inet6_dev *idev) |
187 | { | 187 | { |
188 | struct frag_queue *fq; | 188 | int evicted; |
189 | struct list_head *tmp; | ||
190 | int work; | ||
191 | |||
192 | work = atomic_read(&ip6_frags.mem) - ip6_frags_ctl.low_thresh; | ||
193 | if (work <= 0) | ||
194 | return; | ||
195 | |||
196 | while(work > 0) { | ||
197 | read_lock(&ip6_frags.lock); | ||
198 | if (list_empty(&ip6_frags.lru_list)) { | ||
199 | read_unlock(&ip6_frags.lock); | ||
200 | return; | ||
201 | } | ||
202 | tmp = ip6_frags.lru_list.next; | ||
203 | fq = list_entry(tmp, struct frag_queue, q.lru_list); | ||
204 | atomic_inc(&fq->q.refcnt); | ||
205 | read_unlock(&ip6_frags.lock); | ||
206 | 189 | ||
207 | spin_lock(&fq->q.lock); | 190 | evicted = inet_frag_evictor(&ip6_frags); |
208 | if (!(fq->q.last_in&COMPLETE)) | 191 | if (evicted) |
209 | fq_kill(fq); | 192 | IP6_ADD_STATS_BH(idev, IPSTATS_MIB_REASMFAILS, evicted); |
210 | spin_unlock(&fq->q.lock); | ||
211 | |||
212 | fq_put(fq, &work); | ||
213 | IP6_INC_STATS_BH(idev, IPSTATS_MIB_REASMFAILS); | ||
214 | } | ||
215 | } | 193 | } |
216 | 194 | ||
217 | static void ip6_frag_expire(unsigned long data) | 195 | static void ip6_frag_expire(unsigned long data) |