perf_counters: page fault trace record

From: Corey Ashford
Date: Fri Jun 12 2009 - 21:27:41 EST


Hi,

One of the tools we are working on needs to be able to look not only at counts of page faults, but where they are occurring (ip and faulting page address).

What would you think about adding a new bit to the config record, something like:

diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h
index 6e13395..c27d0bc 100644
--- a/include/linux/perf_counter.h
+++ b/include/linux/perf_counter.h
@@ -167,8 +167,9 @@ struct perf_counter_attr {
mmap : 1, /* include mmap data */
comm : 1, /* include comm data */
freq : 1, /* use freq, not period */
-
- __reserved_2 : 53;
+ page_fault : 1, /* include page fault data
*/
+
+ __reserved_2 : 52;

We'd need a new event type too - PERF_EVENT_PAGE_FAULT which would have:

/*
* struct {
* struct perf_event_header header;
* u64 ip;
* u64 fault_address;
* };
*/

etc.

I would guess that special care would need to be taken to post an event record like this on the thread of a page fault handler.

Any objection to this idea?



Regards,

- Corey

Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
cjashfor@xxxxxxxxxx

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/