Subject: Re: [RFC PATCH 12/13] net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mq

From: John Fastabend <[email-masked]>
Date: Wed, 17 Aug 2016 12:49:34 -0700

On 16-08-17 12:38 PM, John Fastabend wrote:
> The sch_mq qdisc creates a sub-qdisc per tx queue which are then
> called independently for enqueue and dequeue operations. However
> statistics are aggregated and pushed up to the "master" qdisc.
> 
> This patch adds support for any of the sub-qdiscs to be per cpu
> statistic qdiscs. To handle this case add a check when calculating
> stats and aggregate the per cpu stats if needed.
> 
> Also exports __gnet_stats_copy_queue() to use as a helper function.
> 
> Signed-off-by: John Fastabend <[email-masked]>
> ---

[...]

> +		if (qdisc_is_percpu_stats(qdisc)) {
> +			cpu_bstats = qdisc->cpu_bstats;
> +			cpu_qstats = qdisc->cpu_qstats;
> +		}
> +
> +		qlen = qdisc_qlen_sum(qdisc);
> +
> +		__gnet_stats_copy_basic(NULL, &sch->bstats,
> +					cpu_bstats, &qdisc->bstats);
> +		__gnet_stats_copy_queue(&sch->qstats,
> +					cpu_qstats, &qdisc->qstats, qlen);

And also I forgot to bump this onto the atomic qlen and it is still
using the per cpu counters giving the incorrect qlen total.