Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mathieu Desnoyers
Date: Tuesday, July 7, 2009 - 7:01 am

* Jiri Olsa (jolsa@redhat.com) wrote:

As with any optimization (and this is one that adds a semantic that will
just grow the memory barrier/locking rule complexity), it should come
with performance benchmarks showing real-life improvements.

Otherwise I'd recommend sticking to smp_mb() if this execution path is
not that critical, or to move to RCU if it's _that_ critical.

A valid argument would be if the data structures protected are so
complex that RCU is out of question but still the few cycles saved by
removing a memory barrier are really significant. And even then, the
proper solution would be more something like a
__read_lock()+smp_mb+smp_mb+__read_unlock(), so we get the performance
improvements on architectures other than x86 as well.

So in all cases, I don't think the smp_mb__after_lock() is the
appropriate solution.

Mathieu


-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv5 0/2] net: fix race in the receive/select, Jiri Olsa, (Fri Jul 3, 1:12 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Fri Jul 3, 7:04 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Fri Jul 3, 8:40 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Fri Jul 3, 8:47 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Paul E. McKenney, (Fri Jul 3, 10:06 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Fri Jul 3, 10:31 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Tue Jul 7, 7:01 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Tue Jul 7, 7:57 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Tue Jul 7, 8:04 am)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Tue Jul 7, 12:45 pm)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Tue Jul 7, 4:28 pm)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Mathieu Desnoyers, (Tue Jul 7, 9:34 pm)
Re: [PATCHv5 2/2] memory barrier: adding smp_mb__after_lock, Jarek Poplawski, (Wed Jul 8, 12:18 am)