netem: update backlog after drop
Subsystems (4)
Stephen Hemminger
maintainerPATCH 1/1 netem: update backlog after drop
When packet is dropped from rb-tree netem the backlog statistic should also be updated.
---
Should be reviewed by Eric (he added the rb-tree stuff), and added to stable as well.
net/sched/sch_netem.c +1 -0
@@ -520,6 +520,7 @@ static unsigned int netem_drop(struct Qd skb->next =NULL ; skb->prev =NULL ; len =qdisc_pkt_len (skb); + sch->qstats.backlog -= len;kfree_skb (skb); } }
Stephen Hemminger
maintainerRe: [PATCH net] netem: free skb's in tree on reset
Netem can leak memory because packets get stored in red-black tree and it is not cleared on reset.
Reported by: Сергеев Сергей <[email protected]>
net/sched/sch_netem.c +16 -0
@@ -358,6 +358,21 @@ static psched_time_t packet_len_2_sched_return PSCHED_NS2TICKS (ticks); } +static void tfifo_reset (struct Qdisc *sch) +{ +struct netem_sched_data *q =qdisc_priv (sch); +struct rb_node *p; + + while ((p = rb_first(&q->t_root)) { +struct sk_buff *skb =netem_rb_to_skb (p); + +rb_erase (p, &q->t_root); + skb->next =NULL ; + skb->prev =NULL ; +kfree_skb (skb); + } +} +static void tfifo_enqueue (struct sk_buff *nskb,struct Qdisc *sch) {struct netem_sched_data *q =qdisc_priv (sch);
@@ -610,6 +625,7 @@ static void netem_reset(struct Qdisc *scstruct netem_sched_data *q =qdisc_priv (sch);qdisc_reset_queue (sch); +tfifo_reset (sch);if (q->qdisc)qdisc_reset (q->qdisc);qdisc_watchdog_cancel (&q->watchdog);
Re: [PATCH net] netem: free skb's in tree on reset
From: Stephen Hemminger <[email protected]>
Date: Sun, 6 Oct 2013 15:16:49 -0700
Quoted 5 lines
Netem can leak memory because packets get stored in red-black tree and it is not cleared on reset.
Reported by: Сергеев Сергей <[email protected]>
Signed-off-by Stephen Hemminger <[email protected]>
Applied, thanks.
David Miller
maintainerFrom: Stephen Hemminger <[email protected]>
Date: Sun, 6 Oct 2013 15:15:33 -0700
Quoted 9 lines
When packet is dropped from rb-tree netem the backlog statistic should also be updated.
Reported-by Сергеев Сергей <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>---
Should be reviewed by Eric (he added the rb-tree stuff), and added to stable as well.
Eric please review this patch, thanks.
Eric Dumazet
Acked-byQuoted 6 lines · David Miller
From: Stephen Hemminger <[email protected]>
Date: Sun, 6 Oct 2013 15:15:33 -0700Quoted 3 lines
When packet is dropped from rb-tree netem the backlog statistic should also be updated.
Quoted 8 lines
Quoted 6 lines
Reported-by Сергеев Сергей <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>---
Should be reviewed by Eric (he added the rb-tree stuff), and added to stable as well.Eric please review this patch, thanks.
It somehow escaped from my radar ;)
From: Stephen Hemminger <[email protected]>
Date: Sun, 6 Oct 2013 15:15:33 -0700
Quoted 5 lines
When packet is dropped from rb-tree netem the backlog statistic should also be updated.
Reported-by Сергеев Сергей <[email protected]>Signed-off-by Stephen Hemminger <[email protected]>
Applied.