Reasons for Using Per-CPU Data There are a couple benefits to
using per-CPU data. The first is the reduction in locking
requirements. Depending on the semantics by which processors
access the per-CPU data, you might not need any locking at all.
Keep in mind that the "only this processor accesses this data"
rule is only a programming convention. You need to ensure that
the local processor accesses only its unique data. Nothing stops
you from cheating. Second, per-CPU data greatly reduces cache
invalidation. This occurs as processors try to keep their caches
in sync. If one processor manipulates data held in another
processor's cache, that processor must flush or otherwise update
its cache. Constant cache invalidation is called thrashing the
cache and wreaks havoc on system performance. The use of per-CPU
data keeps cache effects to a minimum because processors ideally
access only their own data. The percpu interface cache-aligns
all data to ensure that accessing one processor's data does not
bring in another p