Per-CPU variables are a performance-improving technology. They allow
processors to work with data without having to worry about locking or cache
contention. One would want these operations to be well optimized, but, as
it turns out, they can be improved; Tejun Heo and Christoph Lameter have
done just that for
2.6.33. In the process, they have changed the way developers work with these
There is a set of new operations:
In each case, scalar is either a per-CPU variable obtained with a
new allocator or a static per-CPU variable as obtained from
per_cpu_var(). All of them are atomic, in that the operation will
not be interrupted part-way through on the current processor. It is not
necessary to call put_cpu() after using these operations.
See, for example, the VM
statistics conversion for an example of how operations on per-CPU
variables change under the new scheme.
to post comments)