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

From: Steven Rostedt
Date: Tue Sep 20 2011 - 12:56:52 EST


On Tue, 2011-09-20 at 12:31 -0400, Steven Rostedt wrote:

> I personally believe that we shouldn't even have a modification version
> of the snapshot code. But perhaps it is fine for inc and dec and
> cmpxchg. Put "snapshot" in the name to document that this is a hack to
> make things work, and let all other users in the kernel use a name that
> is not confusing.

Looking at some of the uses that this_cpu() is used outside of
preemption seems to be just statistic counters (or buggy). Talking with
Peter and Thomas on IRC, we come to realize that the entire problem with
your API is the "this_cpu". Because it has nothing to do with the
current CPU.

Here are some names that we should change it to:

snapshot_cpu_*() // my idea

random_cpu_*() // Thomas's idea

any_cpu_*() // Thomas's idea


Basically, the English term of "this_cpu" is patently wrong. It has
nothing to do with this cpu as you could be on any cpu at the time.

Lets rename the this_cpu() to something not so confusing and use them in
really the only locations that need them, and change all the
__this_cpu() users into this_cpu() which is exactly what they mean, and
also include the debug checking that we lost with the initial
conversions.

-- Steve


--
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/