Alex, On Fri, Jun 15, 2007 at 11:21:38AM -0700, Alex Shye wrote: > Hi, > > I am trying to understand hardware counts on a Core 2 Duo machine. I am > using pfmon/libpfm-3.2.070206 with a 2.6.20 kernel on Ubuntu. > > I have a toy program I have written to cache miss. It allocates a large > chunk of memory and steps through at page-sized increment. It should miss > at all levels of the cache. The memory access strides are predictable, but > beyond a page boundary so prefetching shouldn't work. I am using pfmon and > various counts to try to understand which counts I can use for memory > profiling. It looks like LAST_LEVEL_CACHE_MISSES gives me approximately the > correct number, but the MEM_LOAD_RETIRED.* counts look puzzling to me. The > counts I get look like this: > > 1001947629 LAST_LEVEL_CACHE_MISSES > 86844 MEM_LOAD_RETIRED:L1D_MISS > 47181 MEM_LOAD_RETIRED:L1D_LINE_MISS > 33648 MEM_LOAD_RETIRED:L2_MISS > 31765 MEM_LOAD_RETIRED:L2_LINE_MISS > 21525 MEM_LOAD_RETIRED:DTLB_MISS > > I would think if something misses at the last level, it means it should also > miss in the L1 and L2 cache. And since I am stepping through at page-sized > boundaries, there should be many DTLB misses. Also, shouldn't > LAST_LEVEL_CACHE_MISSES equal MEM_LOAD_RETIRED:L2_MISS? > > Anyone know why this occurs? >
I suspect prefetching applies. But something else to keep in mind. If you use pfmon, it will by default only measure user level execution. Although your program is probably 100% user code, a page fault requires kernel level execution. Linux does lazy allocation of pages, thus the physical page is allocated on first touch. Any page given to user must be zeroed by the kernel. Thus the kernel code gets the cache misses not the user level code. Make sure you use pfmon with -the -u -k options. > Thanks! > > --alexshye > _______________________________________________ > perfmon mailing list > [email protected] > http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/ -- -Stephane _______________________________________________ perfmon mailing list [email protected] http://www.hpl.hp.com/hosted/linux/mail-archives/perfmon/
