Thread (12 messages) 12 messages, 3 authors, 2016-05-17

Re: [PATCH net-next] fq_codel: add memory limitation per queue

From: Cong Wang <hidden>
Date: 2016-05-09 04:14:33

On Fri, May 6, 2016 at 8:55 AM, Eric Dumazet [off-list ref] wrote:
quoted hunk ↗ jump to hunk
@@ -193,6 +199,7 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        unsigned int idx, prev_backlog, prev_qlen;
        struct fq_codel_flow *flow;
        int uninitialized_var(ret);
+       bool memory_limited;

        idx = fq_codel_classify(skb, sch, &ret);
        if (idx == 0) {
@@ -215,7 +222,9 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
                flow->deficit = q->quantum;
                flow->dropped = 0;
        }
-       if (++sch->q.qlen <= sch->limit)
+       q->memory_usage += skb->truesize;
+       memory_limited = q->memory_usage > q->memory_limit;
+       if (++sch->q.qlen <= sch->limit && !memory_limited)
                return NET_XMIT_SUCCESS;

        prev_backlog = sch->qstats.backlog;
@@ -229,7 +238,8 @@ static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
        ret = fq_codel_drop(sch, q->drop_batch_size);

        q->drop_overlimit += prev_qlen - sch->q.qlen;
-
+       if (memory_limited)
+               q->drop_overmemory += prev_qlen - sch->q.qlen;
So when the packet is dropped due to memory over limit, should
we return failure for this case? Or I miss anything?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help