* [PATCH] pkt_sched: fq: clear time_next_packet for reused flows
@ 2013-10-24 11:01 Eric Dumazet
2013-10-27 20:52 ` David Miller
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Eric Dumazet @ 2013-10-24 11:01 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
When a socket is freed/reallocated, we need to clear time_next_packet
or else we can inherit a prior value and delay first packets of the
new flow.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/sched/sch_fq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index a9dfdda..fdc041c 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -255,6 +255,7 @@ static struct fq_flow *fq_classify(struct sk_buff
*skb, struct fq_sched_data *q)
f->socket_hash != sk->sk_hash)) {
f->credit = q->initial_quantum;
f->socket_hash = sk->sk_hash;
+ f->time_next_packet = 0ULL;
}
return f;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] pkt_sched: fq: clear time_next_packet for reused flows
2013-10-24 11:01 [PATCH] pkt_sched: fq: clear time_next_packet for reused flows Eric Dumazet
@ 2013-10-27 20:52 ` David Miller
2013-10-27 22:06 ` Vijay Subramanian
2013-10-27 23:26 ` [PATCH v2] " Eric Dumazet
2 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-10-27 20:52 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 24 Oct 2013 04:01:48 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> When a socket is freed/reallocated, we need to clear time_next_packet
> or else we can inherit a prior value and delay first packets of the
> new flow.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Eric this has been mangled by your email client, please fix.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pkt_sched: fq: clear time_next_packet for reused flows
2013-10-24 11:01 [PATCH] pkt_sched: fq: clear time_next_packet for reused flows Eric Dumazet
2013-10-27 20:52 ` David Miller
@ 2013-10-27 22:06 ` Vijay Subramanian
2013-10-27 23:35 ` Eric Dumazet
2013-10-27 23:26 ` [PATCH v2] " Eric Dumazet
2 siblings, 1 reply; 7+ messages in thread
From: Vijay Subramanian @ 2013-10-27 22:06 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
On 24 October 2013 04:01, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> When a socket is freed/reallocated, we need to clear time_next_packet
> or else we can inherit a prior value and delay first packets of the
> new flow.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Eric,
By the way, it looks like fq_flow_set_throttled() uses
f->time_next_packet in an incorrect way.
It is used as key to insert the flow into the delayed rb-tree but does
not seem to check for duplicates.
This could lead to rb tree corruption. I assume it is possible for
different flows to have same f->time_next_packet.
Do we at least we need a BUG_ON(f->time_next_packet ==
aux->time_next_packet) here?
Code in fq_flow_set_throttled():
while (*p) {
struct fq_flow *aux;
parent = *p;
aux = container_of(parent, struct fq_flow, rate_node);
if (f->time_next_packet >= aux->time_next_packet)
p = &parent->rb_right;
else
p = &parent->rb_left;
}
rb_link_node(&f->rate_node, parent, p);
rb_insert_color(&f->rate_node, &q->delayed);
Thanks!
-vijay
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] pkt_sched: fq: clear time_next_packet for reused flows
2013-10-24 11:01 [PATCH] pkt_sched: fq: clear time_next_packet for reused flows Eric Dumazet
2013-10-27 20:52 ` David Miller
2013-10-27 22:06 ` Vijay Subramanian
@ 2013-10-27 23:26 ` Eric Dumazet
2013-10-28 4:19 ` David Miller
2 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2013-10-27 23:26 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
When a socket is freed/reallocated, we need to clear time_next_packet
or else we can inherit a prior value and delay first packets of the
new flow.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
v2: wrapping issue
net/sched/sch_fq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c
index a9dfdda..fdc041c 100644
--- a/net/sched/sch_fq.c
+++ b/net/sched/sch_fq.c
@@ -255,6 +255,7 @@ static struct fq_flow *fq_classify(struct sk_buff *skb, struct fq_sched_data *q)
f->socket_hash != sk->sk_hash)) {
f->credit = q->initial_quantum;
f->socket_hash = sk->sk_hash;
+ f->time_next_packet = 0ULL;
}
return f;
}
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] pkt_sched: fq: clear time_next_packet for reused flows
2013-10-27 22:06 ` Vijay Subramanian
@ 2013-10-27 23:35 ` Eric Dumazet
2013-10-28 7:02 ` Vijay Subramanian
0 siblings, 1 reply; 7+ messages in thread
From: Eric Dumazet @ 2013-10-27 23:35 UTC (permalink / raw)
To: Vijay Subramanian; +Cc: David Miller, netdev
On Sun, 2013-10-27 at 15:06 -0700, Vijay Subramanian wrote:
> Eric,
> By the way, it looks like fq_flow_set_throttled() uses
> f->time_next_packet in an incorrect way.
> It is used as key to insert the flow into the delayed rb-tree but does
> not seem to check for duplicates.
> This could lead to rb tree corruption. I assume it is possible for
> different flows to have same f->time_next_packet.
> Do we at least we need a BUG_ON(f->time_next_packet ==
> aux->time_next_packet) here?
>
What exact RB corruptions do you see ?
RB trees allow items with the same key.
HTB and netem use this property and I never saw any corruption,
but you could be right so please elaborate, thanks !
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] pkt_sched: fq: clear time_next_packet for reused flows
2013-10-27 23:26 ` [PATCH v2] " Eric Dumazet
@ 2013-10-28 4:19 ` David Miller
0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2013-10-28 4:19 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Sun, 27 Oct 2013 16:26:43 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> When a socket is freed/reallocated, we need to clear time_next_packet
> or else we can inherit a prior value and delay first packets of the
> new flow.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied, thanks Eric.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] pkt_sched: fq: clear time_next_packet for reused flows
2013-10-27 23:35 ` Eric Dumazet
@ 2013-10-28 7:02 ` Vijay Subramanian
0 siblings, 0 replies; 7+ messages in thread
From: Vijay Subramanian @ 2013-10-28 7:02 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
>>
>
> What exact RB corruptions do you see ?
>
> RB trees allow items with the same key.
>
Thanks for the clarification. I incorrectly thought duplicates are not allowed.
Sorry for the noise.
Vijay
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-10-28 7:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-24 11:01 [PATCH] pkt_sched: fq: clear time_next_packet for reused flows Eric Dumazet
2013-10-27 20:52 ` David Miller
2013-10-27 22:06 ` Vijay Subramanian
2013-10-27 23:35 ` Eric Dumazet
2013-10-28 7:02 ` Vijay Subramanian
2013-10-27 23:26 ` [PATCH v2] " Eric Dumazet
2013-10-28 4:19 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.