Subject: Re: [RFC Patch net-next] net_sched: make classifying lockless on ingress

From: Jamal Hadi Salim <[email-masked]>
Date: Sun, 22 Dec 2013 11:01:06 -0500

On 12/21/13 18:09, John Fastabend wrote:

>
> I solved this by making them per CPU and synchronizing when I hit
> an operation that required sync'ing them. Going forward if folks
> have the time to write SMP aware qdisc's that work with eventually
> consistent counters that would be great.
>

I think what you describe is reasonable as well. Need to weigh pro/con
of both.

> You could make this fully generic by having a classifer to match
> the cpu id and then forwarding the skb to a qdisc based on the
> cpu_id.
>

Indeed. More a "generic stateless metadata" classifier which may
look at more than just cpu id to make the systolic decision.
Probably at pre-enqueu that you had.
I would assume the amount of config update on such a table would be
very very minimal - so RCU would do well.
If someone wants more deeper lookup, then a tc classifier would make
more sense. But by default the generic stateless classifier maybe
sufficient.

> Then per-netdev-ingress-per-cpu is really just a configured policy.
> If we wanted to make it the default configuration that would be
> fine.
>

Perhaps thats just defensive talk on my part when people say "qdiscs
are slow". No - netdevs are slow. Rephrase: Netdevs are shared across
CPUs, you MUST lock. Locks create cache misses etc.
As an example, I dont know why something like RPS could not have 
benefited from the rich classifier-action if someone wanted it to.
So there may still be need for per-netdev-ingress-per-cpu.

cheers,
jamal