On Thu, May 10, 2018 at 4:28 AM, <gfree.w...@vip.163.com> wrote: > From: Gao Feng <gfree.w...@vip.163.com> > > The skb flow limit is implemented for each CPU independently. In the > current codes, the function skb_flow_limit gets the softnet_data by > this_cpu_ptr. But the target cpu of enqueue_to_backlog would be not > the current cpu when enable RPS. As the result, the skb_flow_limit checks > the stats of current CPU, while the skb is going to append the queue of > another CPU. It isn't the expected behavior. > > Now pass the softnet_data as a param to softnet_data to make consistent.
The local cpu softnet_data is used on purpose. The operations in skb_flow_limit() on sd fields could race if not executed on the local cpu. Flow limit tries to detect large ("elephant") DoS flows with a fixed four-tuple. These would always hit the same RPS cpu, so that cpu being backlogged may be an indication that such a flow is active. But the flow will also always arrive on the same initial cpu courtesy of RSS. So storing the lookup table on the initial CPU is also fine. There may be false positives on other CPUs with the same RPS destination, but that is unlikely with a highly concurrent traffic server mix ("mice"). Note that the sysctl net.core.flow_limit_cpu_bitmap enables the feature for the cpus on which traffic initially lands, not the RPS destination cpus. See also Documentation/networking/scaling.txt That said, I had to reread the code, as it does seem sensible that the same softnet_data is intended to be used both when testing qlen and flow_limit.