Messages in this thread | | | Date | Mon, 19 Sep 2011 16:49:47 -0500 (CDT) | From | Christoph Lameter <> | Subject | Re: [RFC][PATCH 0/5] Introduce checks for preemptable code for this_cpu_read/write() |
| |
On Mon, 19 Sep 2011, Steven Rostedt wrote:
> I just found out that the this_cpu_*() functions do not perform the > test to see if the usage is in atomic or not. Thus, the blind > conversion of the per_cpu(*, smp_processor_id()) and the get_cpu_var() > code to this_cpu_*() introduce the regression to detect the hard > to find case where a per cpu variable is used in preempt code that > migrates and causes bugs.
this_cpu_* function can be used either way. There is no point in checking for atomic or not since the this_cpu_* implementations are required to take care of disabling preemption. Those operations are generally safe to use regardless of the context.
It can be replaced by __this_cpu_* only when we know that the context prevents races through disabling preemption.
| |