Messages in this thread | | | Date | Thu, 13 Nov 2008 12:32:23 -0500 (EST) | From | Steven Rostedt <> | Subject | Re: [PATCH 1/2] tracing/function-return-tracer: Make the function return tracer lockless |
| |
On Thu, 13 Nov 2008, Andi Kleen wrote:
> > So the answer to this is: > > > > i = index++; > > barrier(); > > write to index i (not index); > > That was my first thought when I wrote the original email, > but the disadvantage is that barrier() is a big hammer > that flushes everything and can make the code much worse. > That is why I suggested local_add_return() instead.
barrier() is a compiler barrier, does nothing with the caches, and is quite cheap. We only need a compiler barrier because we are only protecting ourselves from things that happen on the current CPU. No other devices or other CPUs are involved.
-- Steve
| |