RE: [PATCH 2.6.x] additional kernel event notifications

Villacis, Juan
2003-09-22T05:59:26Z

Hi,

"Andi Kleen" <ak@muc.de> writes:
> Can you explain why profiling dynamically generated code needs kernel
> support? The kernel should not know anything about this.

In some cases, a profiler can figure out information regarding
Dynamically Generate Code (DGC) with help from the generator of the
code, but in other cases it cannot.

In the case of Java jitted code, our userspace tools obtain sufficient
information through JVMPI, when it is implemented by the JVM. However,
for DGC which does not have such userspace support, it is important to
be able to spot and accurately attribute samples to DGC. The 4
additional profiling hooks we proposed can be used for such purposes.

> The original oprofile patch also added similar hooks, but they were
> not merged. Instead the "dcookies" mechanism was added to assign
samples
> to specific executables. Why can't you use the same mechanism?

If the generator of DGC frees memory used for DGC that subsequently gets
a loaded image (or reuses memory that may have once had an executable
image), you can mis-attribute samples so that instead of attributing the
samples to the DGC, you will attribute the samples to an image. The
dcookie mechanism will indicate information about an image, but doesn't
help prevent mis-attribution of samples if DGC is intermixed with images
that are loaded/unloaded in the same memory region.

-juan