Re: [RFC][PATCH 0/5] Introduce checks for preemptable code forthis_cpu_read/write()

From: Christoph Lameter
Date: Mon Sep 19 2011 - 17:49:52 EST


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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/