All of lore.kernel.org
 help / color / mirror / Atom feed
* [BUG] net_sched: pfifo_head_drop problem
@ 2011-01-05 17:00 Eric Dumazet
  2011-01-05 17:15 ` Stephen Hemminger
  2011-01-05 20:35 ` [PATCH] " Eric Dumazet
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2011-01-05 17:00 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Florian Westphal, Patrick McHardy, Hagen Paul Pfeifer,
	Stephen Hemminger, Jarek Poplawski

While reviewing CHOKe stuff, I found following problem :

commit 57dbb2d83d100ea (sched: add head drop fifo queue)
introduced pfifo_head_drop, and broke the invariant that
sch->bstats.bytes and sch->bstats.packets are COUNTER (increasing
counters only)

This can break estimators because est_timer() handle unsigned deltas
only. A decreasing counter can then give a huge unsigned delta.

My suggestion would be to change things so that sch->bstats.bytes and
sch->bstats.packets are incremented in dequeue() only, not at enqueue()
time.

It would be more sensible anyway for very low speeds, and big bursts.
Right now, if we drop packets, they still are accounted in estimators.

Or maybe my understanding of estimators is wrong, and only apply to
enqueue rate, not dequeue rate ?

If so, we should remove the 

sch->bstats.bytes -= qdisc_pkt_len(skb_head);
sch->bstats.packets--;

done in pfifo_tail_enqueue() in case we drop the head skb.


My preference would be to add dropped pack/byte rates to estimators...
It might be good for tuning.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [BUG] net_sched: pfifo_head_drop problem
  2011-01-05 17:00 [BUG] net_sched: pfifo_head_drop problem Eric Dumazet
@ 2011-01-05 17:15 ` Stephen Hemminger
  2011-01-05 20:35 ` [PATCH] " Eric Dumazet
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2011-01-05 17:15 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev, Florian Westphal, Patrick McHardy,
	Hagen Paul Pfeifer, Jarek Poplawski

On Wed, 05 Jan 2011 18:00:50 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:

> While reviewing CHOKe stuff, I found following problem :
> 
> commit 57dbb2d83d100ea (sched: add head drop fifo queue)
> introduced pfifo_head_drop, and broke the invariant that
> sch->bstats.bytes and sch->bstats.packets are COUNTER (increasing
> counters only)
> 
> This can break estimators because est_timer() handle unsigned deltas
> only. A decreasing counter can then give a huge unsigned delta.
> 
> My suggestion would be to change things so that sch->bstats.bytes and
> sch->bstats.packets are incremented in dequeue() only, not at enqueue()
> time.
> 
> It would be more sensible anyway for very low speeds, and big bursts.
> Right now, if we drop packets, they still are accounted in estimators.
> 
> Or maybe my understanding of estimators is wrong, and only apply to
> enqueue rate, not dequeue rate ?
> 
> If so, we should remove the 
> 
> sch->bstats.bytes -= qdisc_pkt_len(skb_head);
> sch->bstats.packets--;
> 
> done in pfifo_tail_enqueue() in case we drop the head skb.
> 
> 
> My preference would be to add dropped pack/byte rates to estimators...
> It might be good for tuning.

Agreed counters should reflect dequeued packets not enqueued packets.


-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] net_sched: pfifo_head_drop problem
  2011-01-05 17:00 [BUG] net_sched: pfifo_head_drop problem Eric Dumazet
  2011-01-05 17:15 ` Stephen Hemminger
@ 2011-01-05 20:35 ` Eric Dumazet
  2011-01-05 20:52   ` Hagen Paul Pfeifer
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Dumazet @ 2011-01-05 20:35 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Florian Westphal, Patrick McHardy, Hagen Paul Pfeifer,
	Stephen Hemminger, Jarek Poplawski

commit 57dbb2d83d100ea (sched: add head drop fifo queue)
introduced pfifo_head_drop, and broke the invariant that
sch->bstats.bytes and sch->bstats.packets are COUNTER (increasing
counters only)

This can break estimators because est_timer() handles unsigned deltas
only. A decreasing counter can then give a huge unsigned delta.

My mid term suggestion would be to change things so that
sch->bstats.bytes and sch->bstats.packets are incremented in dequeue()
only, not at enqueue() time. We also could add drop_bytes/drop_packets
and provide estimations of drop rates.

It would be more sensible anyway for very low speeds, and big bursts.
Right now, if we drop packets, they still are accounted in byte/packets
abolute counters and rate estimators.

Before this mid term change, this patch makes pfifo_head_drop behavior
similar to other qdiscs in case of drops :
Dont decrement sch->bstats.bytes and sch->bstats.packets

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/sched/sch_fifo.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/net/sched/sch_fifo.c b/net/sched/sch_fifo.c
index 4dfecb0..aa4d633 100644
--- a/net/sched/sch_fifo.c
+++ b/net/sched/sch_fifo.c
@@ -54,8 +54,6 @@ static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc* sch)
 
 	/* queue full, remove one skb to fulfill the limit */
 	skb_head = qdisc_dequeue_head(sch);
-	sch->bstats.bytes -= qdisc_pkt_len(skb_head);
-	sch->bstats.packets--;
 	sch->qstats.drops++;
 	kfree_skb(skb_head);
 



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] net_sched: pfifo_head_drop problem
  2011-01-05 20:35 ` [PATCH] " Eric Dumazet
@ 2011-01-05 20:52   ` Hagen Paul Pfeifer
  2011-01-05 21:39     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Hagen Paul Pfeifer @ 2011-01-05 20:52 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David Miller, netdev, Florian Westphal, Patrick McHardy,
	Stephen Hemminger, Jarek Poplawski

* Eric Dumazet | 2011-01-05 21:35:02 [+0100]:

>My mid term suggestion would be to change things so that
>sch->bstats.bytes and sch->bstats.packets are incremented in dequeue()
>only, not at enqueue() time. We also could add drop_bytes/drop_packets
>and provide estimations of drop rates.
>
>It would be more sensible anyway for very low speeds, and big bursts.
>Right now, if we drop packets, they still are accounted in byte/packets
>abolute counters and rate estimators.
>
>Before this mid term change, this patch makes pfifo_head_drop behavior
>similar to other qdiscs in case of drops :
>Dont decrement sch->bstats.bytes and sch->bstats.packets

Thanks Stephen and Erik for spotting this bug!

>Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Acked-by: Hagen Paul Pfeifer <hagen@jauu.net>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net_sched: pfifo_head_drop problem
  2011-01-05 20:52   ` Hagen Paul Pfeifer
@ 2011-01-05 21:39     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-01-05 21:39 UTC (permalink / raw)
  To: hagen; +Cc: eric.dumazet, netdev, fw, kaber, shemminger, jarkao2

From: Hagen Paul Pfeifer <hagen@jauu.net>
Date: Wed, 5 Jan 2011 21:52:17 +0100

> * Eric Dumazet | 2011-01-05 21:35:02 [+0100]:
> 
>>My mid term suggestion would be to change things so that
>>sch->bstats.bytes and sch->bstats.packets are incremented in dequeue()
>>only, not at enqueue() time. We also could add drop_bytes/drop_packets
>>and provide estimations of drop rates.
>>
>>It would be more sensible anyway for very low speeds, and big bursts.
>>Right now, if we drop packets, they still are accounted in byte/packets
>>abolute counters and rate estimators.
>>
>>Before this mid term change, this patch makes pfifo_head_drop behavior
>>similar to other qdiscs in case of drops :
>>Dont decrement sch->bstats.bytes and sch->bstats.packets
> 
> Thanks Stephen and Erik for spotting this bug!
> 
>>Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> Acked-by: Hagen Paul Pfeifer <hagen@jauu.net>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-05 21:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-05 17:00 [BUG] net_sched: pfifo_head_drop problem Eric Dumazet
2011-01-05 17:15 ` Stephen Hemminger
2011-01-05 20:35 ` [PATCH] " Eric Dumazet
2011-01-05 20:52   ` Hagen Paul Pfeifer
2011-01-05 21:39     ` 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.