Re: [PATCH] sched: QFQ - quick fair queue scheduler (v3.1)

Eric Dumazet
2011-03-03T23:13:00Z

Le jeudi 03 mars 2011 à 15:02 -0800, Stephen Hemminger a écrit :
> This is an implementation of the Quick Fair Queue scheduler developed
> by Fabio Checconi. The same algorithm is already implemented in ipfw
> in FreeBSD. Fabio had an earlier version developed on Linux, I just
> cleaned it up. Thanks to Eric Dumazet for doing the testing and
> finding bugs.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>

Oh well, did you read my previous mail ?

> +
> +static void qfq_reset_qdisc(struct Qdisc *sch)
> +{
> + struct qfq_sched *q = qdisc_priv(sch);
> + struct qfq_group *grp;
> + struct qfq_class *cl, **pp;
> + struct hlist_node *n;
> + unsigned int i, j;
> +
> + for (i = 0; i <= QFQ_MAX_INDEX; i++) {
> + grp = &q->groups[i];
> + for (j = 0; j < QFQ_MAX_SLOTS; j++) {
> + for (pp = &grp->slots[j]; *pp; pp = &(*pp)->next) {
> + cl = *pp;
> + if (cl->qdisc->q.qlen)
> + qfq_deactivate_class(q, cl, pp);

Here there is the problem of *pp = cl->next (possibly NULL)

maybe use

for (pp = &grp->slots[j]; (cl = *pp) != NULL;) {
if (cl->qdisc->q.len)
qfq_deactivate_class(...);
else
pp = &cl->next;
}

> + }
> + }
> + }
> +
> + for (i = 0; i < q->clhash.hashsize; i++) {
> + hlist_for_each_entry(cl, n, &q->clhash.hash[i], common.hnode)
> + qdisc_reset(cl->qdisc);
> + }
> + sch->q.qlen = 0;
> +}
> +