Subject: Re: [PATCH 4/5] netem: avoid excessive requeues

From: Patrick McHardy <[email-masked]>
Date: Thu, 22 Mar 2007 21:40:43 +0100

Stephen Hemminger wrote:
> @@ -315,6 +316,7 @@ void qdisc_watchdog_schedule(struct qdis
>  	ktime_t time;
>  
>  	wd->qdisc->flags |= TCQ_F_THROTTLED;
> +	smp_wmb();
>  	time = ktime_set(0, 0);
>  	time = ktime_add_ns(time, PSCHED_US2NS(expires));
>  	hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS);
> @@ -325,6 +327,7 @@ void qdisc_watchdog_cancel(struct qdisc_
>  {
>  	hrtimer_cancel(&wd->timer);
>  	wd->qdisc->flags &= ~TCQ_F_THROTTLED;
> +	smp_wmb();
>  }
>  EXPORT_SYMBOL(qdisc_watchdog_cancel);

These two look unnecessary, we're holding the queue lock.

> --- net-2.6.22.orig/net/sched/sch_netem.c
> +++ net-2.6.22/net/sched/sch_netem.c
> @@ -272,6 +272,10 @@ static struct sk_buff *netem_dequeue(str
>  	struct netem_sched_data *q = qdisc_priv(sch);
>  	struct sk_buff *skb;
>  
> +	smp_mb();
> +	if (sch->flags & TCQ_F_THROTTLED)
> +		return NULL;
> +

Perhaps we should put this in qdisc_restart, other qdiscs have the
same problem.