A method, apparatus, and computer instructions in a data processing system
for processing instructions are provided. Instructions are received at a
processor in the data processing system. If a selected indicator is
associated with the instruction, counting of each event associated with
the execution of the instruction is enabled. In some embodiments, when it
is determined that a cache line is being falsely shared using the
performance indicators and counters, an interrupt may be generated and
sent to a performance monitoring application. An interrupt handler of the
performance monitoring application will recognize this interrupt as
indicating false sharing of a cache line. Rather than reloading the cache
line in a normal fashion, the data or instructions being accessed may be
written to a separate area of cache or memory area dedicated to false
cache line sharing data. The code may then be modified by inserting a
pointer to this new area of cache or memory. Thus, when the code again
attempts to access this area of the cache, the access is redirected to
the new cache or memory area rather than to the previous area of the
cache that was subject to false sharing. In this way, reloads of the
cache line may be avoided.