* [PATCH] Evict tmp variable from the stack in ip6_evictor
@ 2007-10-10 14:29 Pavel Emelyanov
2007-10-10 14:37 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Emelyanov @ 2007-10-10 14:29 UTC (permalink / raw)
To: David Miller; +Cc: Linux Netdev List
The list_head *tmp is used to help getting the first entry in
the ip6_frag_lru_list list. There is a simpler way to do it.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 31601c9..8fad98b 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -261,7 +261,6 @@ static __inline__ void fq_kill(struct fr
static void ip6_evictor(struct inet6_dev *idev)
{
struct frag_queue *fq;
- struct list_head *tmp;
int work;
work = atomic_read(&ip6_frag_mem) - sysctl_ip6frag_low_thresh;
@@ -274,8 +273,9 @@ static void ip6_evictor(struct inet6_dev
read_unlock(&ip6_frag_lock);
return;
}
- tmp = ip6_frag_lru_list.next;
- fq = list_entry(tmp, struct frag_queue, lru_list);
+
+ fq = list_first_entry(&ip6_frag_lru_list,
+ struct frag_queue, lru_list);
atomic_inc(&fq->refcnt);
read_unlock(&ip6_frag_lock);
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Evict tmp variable from the stack in ip6_evictor
2007-10-10 14:29 [PATCH] Evict tmp variable from the stack in ip6_evictor Pavel Emelyanov
@ 2007-10-10 14:37 ` Patrick McHardy
2007-10-10 14:52 ` Pavel Emelyanov
0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2007-10-10 14:37 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List
Pavel Emelyanov wrote:
> The list_head *tmp is used to help getting the first entry in
> the ip6_frag_lru_list list. There is a simpler way to do it
The exact same code exists in ip_fragment.c and nf_conntrack_reasm.c,
please also change it there.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Evict tmp variable from the stack in ip6_evictor
2007-10-10 14:37 ` Patrick McHardy
@ 2007-10-10 14:52 ` Pavel Emelyanov
2007-10-10 15:06 ` Patrick McHardy
0 siblings, 1 reply; 5+ messages in thread
From: Pavel Emelyanov @ 2007-10-10 14:52 UTC (permalink / raw)
To: Patrick McHardy; +Cc: David Miller, Linux Netdev List
Patrick McHardy wrote:
> Pavel Emelyanov wrote:
>> The list_head *tmp is used to help getting the first entry in
>> the ip6_frag_lru_list list. There is a simpler way to do it
>
>
> The exact same code exists in ip_fragment.c and nf_conntrack_reasm.c,
> please also change it there.
Hm, indeed. But I see that the structs frag_queue in reassembly.c, ipq
in ip_fragment.c and nf_ct_frag6_queue in nf code looks VERY similar
and very much of code (like link/unlink or evict) looks the same too.
Maybe it's worth creating something like struct skb_fragment and
consolidate all the common stuff into some net/core/lib_frag.c? Or
is there some hidden reason for keeping this code splitted?
Thanks,
Pavel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Evict tmp variable from the stack in ip6_evictor
2007-10-10 14:52 ` Pavel Emelyanov
@ 2007-10-10 15:06 ` Patrick McHardy
2007-10-10 23:31 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Patrick McHardy @ 2007-10-10 15:06 UTC (permalink / raw)
To: Pavel Emelyanov; +Cc: David Miller, Linux Netdev List
Pavel Emelyanov wrote:
> Patrick McHardy wrote:
>> Pavel Emelyanov wrote:
>>> The list_head *tmp is used to help getting the first entry in
>>> the ip6_frag_lru_list list. There is a simpler way to do it
>>
>> The exact same code exists in ip_fragment.c and nf_conntrack_reasm.c,
>> please also change it there.
>
> Hm, indeed. But I see that the structs frag_queue in reassembly.c, ipq
> in ip_fragment.c and nf_ct_frag6_queue in nf code looks VERY similar
> and very much of code (like link/unlink or evict) looks the same too.
>
> Maybe it's worth creating something like struct skb_fragment and
> consolidate all the common stuff into some net/core/lib_frag.c? Or
> is there some hidden reason for keeping this code splitted?
I'm not sure if its possible between IPv4 and IPv6, but sharing code
between IPv6 reassembly and netfilter/ipv6 would be nice.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Evict tmp variable from the stack in ip6_evictor
2007-10-10 15:06 ` Patrick McHardy
@ 2007-10-10 23:31 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2007-10-10 23:31 UTC (permalink / raw)
To: kaber; +Cc: xemul, netdev
From: Patrick McHardy <kaber@trash.net>
Date: Wed, 10 Oct 2007 17:06:07 +0200
> Pavel Emelyanov wrote:
> > Patrick McHardy wrote:
> >> Pavel Emelyanov wrote:
> >>> The list_head *tmp is used to help getting the first entry in
> >>> the ip6_frag_lru_list list. There is a simpler way to do it
> >>
> >> The exact same code exists in ip_fragment.c and nf_conntrack_reasm.c,
> >> please also change it there.
> >
> > Hm, indeed. But I see that the structs frag_queue in reassembly.c, ipq
> > in ip_fragment.c and nf_ct_frag6_queue in nf code looks VERY similar
> > and very much of code (like link/unlink or evict) looks the same too.
> >
> > Maybe it's worth creating something like struct skb_fragment and
> > consolidate all the common stuff into some net/core/lib_frag.c? Or
> > is there some hidden reason for keeping this code splitted?
>
> I'm not sure if its possible between IPv4 and IPv6, but sharing code
> between IPv6 reassembly and netfilter/ipv6 would be nice.
And besides I think it's an independant change to this tmp
variable removal, so let's just do that first.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-10-10 23:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-10 14:29 [PATCH] Evict tmp variable from the stack in ip6_evictor Pavel Emelyanov
2007-10-10 14:37 ` Patrick McHardy
2007-10-10 14:52 ` Pavel Emelyanov
2007-10-10 15:06 ` Patrick McHardy
2007-10-10 23:31 ` David Miller
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).