Re: act_mirred: remove spinlock in fast path

2016-06-18 Thread Eric Dumazet
On Sat, 2016-06-18 at 11:24 -0400, Jamal Hadi Salim wrote: > On 16-06-18 11:16 AM, Eric Dumazet wrote: > > >> Given an update/replace of an action is such a rare occassion, what > >> is wrong with init doing a spin lock on existing action? > >> Sure, there is performance impact on fast path at tha

Re: act_mirred: remove spinlock in fast path

2016-06-18 Thread Jamal Hadi Salim
On 16-06-18 11:16 AM, Eric Dumazet wrote: Given an update/replace of an action is such a rare occassion, what is wrong with init doing a spin lock on existing action? Sure, there is performance impact on fast path at that point - but: as established update/replace is _a rare occassion_ ;-> The

Re: act_mirred: remove spinlock in fast path

2016-06-18 Thread Eric Dumazet
On Sat, 2016-06-18 at 09:45 -0400, Jamal Hadi Salim wrote: > On 16-06-17 06:03 PM, Eric Dumazet wrote: > > On Fri, Jun 17, 2016 at 2:59 PM, Cong Wang wrote: > > > >> Generally speaking I worry about we change multiple fields in a struct > >> meanwhile we could still read them any time in the middl

Re: act_mirred: remove spinlock in fast path

2016-06-18 Thread Jamal Hadi Salim
On 16-06-17 06:03 PM, Eric Dumazet wrote: On Fri, Jun 17, 2016 at 2:59 PM, Cong Wang wrote: Generally speaking I worry about we change multiple fields in a struct meanwhile we could still read them any time in the middle, we may get them correct for some easy case, but it is hard to insure the

Re: act_mirred: remove spinlock in fast path

2016-06-17 Thread Eric Dumazet
On Fri, Jun 17, 2016 at 2:59 PM, Cong Wang wrote: > Generally speaking I worry about we change multiple fields in a struct > meanwhile we could still read them any time in the middle, we may > get them correct for some easy case, but it is hard to insure the > correctness when the struct becomes

Re: act_mirred: remove spinlock in fast path

2016-06-17 Thread Cong Wang
On Fri, Jun 17, 2016 at 2:40 PM, Eric Dumazet wrote: > On Fri, Jun 17, 2016 at 2:35 PM, Cong Wang wrote: >> On Fri, Jun 17, 2016 at 2:24 PM, Eric Dumazet wrote: >>> Well, I added a READ_ONCE() to read tcf_action once. >>> >>> Adding rcu here would mean adding a pointer and extra cache line, to >

Re: act_mirred: remove spinlock in fast path

2016-06-17 Thread Eric Dumazet
On Fri, Jun 17, 2016 at 2:35 PM, Cong Wang wrote: > On Fri, Jun 17, 2016 at 2:24 PM, Eric Dumazet wrote: >> Well, I added a READ_ONCE() to read tcf_action once. >> >> Adding rcu here would mean adding a pointer and extra cache line, to >> deref the values. >> >> IMHO the race here has no effect .

Re: act_mirred: remove spinlock in fast path

2016-06-17 Thread Cong Wang
On Fri, Jun 17, 2016 at 2:24 PM, Eric Dumazet wrote: > Well, I added a READ_ONCE() to read tcf_action once. > > Adding rcu here would mean adding a pointer and extra cache line, to > deref the values. > > IMHO the race here has no effect . You either read the old or new value. Sure, the point is

Re: act_mirred: remove spinlock in fast path

2016-06-17 Thread Eric Dumazet
On Fri, Jun 17, 2016 at 2:03 PM, Cong Wang wrote: > Hi, Eric > > During code review, I notice we might have some problem after we go > lockless for the fast path in act_mirred. > > That is, what prevents us from the following possible race condition? > > change a standalone action with tcf_mirred_