Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use perf to log page faults

336 views
Skip to first unread message

Taras Glek

unread,
May 12, 2010, 3:40:02 PM5/12/10
to
Hi,
From the docs it seems that perf may be useful for logging page faults.
I tried
perf record -g -d -f -e page-faults <mycommand>
but all I got were PERF_RECORD_MMAP events.

I'm using 2.6.32. Ideally I'd like to collect fault addresses and
userspace stacks that caused them. Isn't this what the page-fault event
is for?

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

Frederic Weisbecker

unread,
May 12, 2010, 4:10:02 PM5/12/10
to
On Wed, May 12, 2010 at 12:38:30PM -0700, Taras Glek wrote:
> Hi,
> From the docs it seems that perf may be useful for logging page faults.
> I tried
> perf record -g -d -f -e page-faults <mycommand>
> but all I got were PERF_RECORD_MMAP events.
>
> I'm using 2.6.32. Ideally I'd like to collect fault addresses and
> userspace stacks that caused them. Isn't this what the page-fault event
> is for?
>
> Taras


Could you try with -c 1 ?

Otherwise, does that work on the latest kernel?

Thanks.

Andi Kleen

unread,
May 12, 2010, 4:10:01 PM5/12/10
to
Taras Glek <tg...@mozilla.com> writes:

> Hi,
> From the docs it seems that perf may be useful for logging page
> faults. I tried
> perf record -g -d -f -e page-faults <mycommand>
> but all I got were PERF_RECORD_MMAP events.
>
> I'm using 2.6.32. Ideally I'd like to collect fault addresses and
> userspace stacks that caused them. Isn't this what the page-fault
> event is for?

Some time ago I used systemtap to do this for my pbitmaps
works. This was the old systemtap script.

-Andi

probe vm.pagefault {
if (task_execname(task_current()) == "executable" && address < 0x100000000) {
printf("%u\n", address);
}

}

--
a...@linux.intel.com -- Speaking for myself only.

Taras Glek

unread,
May 12, 2010, 5:20:01 PM5/12/10
to
On 05/12/2010 12:59 PM, Frederic Weisbecker wrote:
> On Wed, May 12, 2010 at 12:38:30PM -0700, Taras Glek wrote:
>
>> Hi,
>> From the docs it seems that perf may be useful for logging page faults.
>> I tried
>> perf record -g -d -f -e page-faults<mycommand>
>> but all I got were PERF_RECORD_MMAP events.
>>
>> I'm using 2.6.32. Ideally I'd like to collect fault addresses and
>> userspace stacks that caused them. Isn't this what the page-fault event
>> is for?
>>
>> Taras
>>
>
> Could you try with -c 1 ?
>
> Otherwise, does that work on the latest kernel?
>
this just gets me PERF_RECORD_SAMPLE events which don't seem to be
related to page-faults(ie they show up with/without -e page-faults).

I don't have the latest kernel installed here. Can you get perf
page-fault events on your system?

Taras

Frederic Weisbecker

unread,
May 12, 2010, 5:30:03 PM5/12/10
to
On Wed, May 12, 2010 at 02:18:08PM -0700, Taras Glek wrote:
> On 05/12/2010 12:59 PM, Frederic Weisbecker wrote:
>> On Wed, May 12, 2010 at 12:38:30PM -0700, Taras Glek wrote:
>>
>>> Hi,
>>> From the docs it seems that perf may be useful for logging page faults.
>>> I tried
>>> perf record -g -d -f -e page-faults<mycommand>
>>> but all I got were PERF_RECORD_MMAP events.
>>>
>>> I'm using 2.6.32. Ideally I'd like to collect fault addresses and
>>> userspace stacks that caused them. Isn't this what the page-fault event
>>> is for?
>>>
>>> Taras
>>>
>>
>> Could you try with -c 1 ?
>>
>> Otherwise, does that work on the latest kernel?
>>
> this just gets me PERF_RECORD_SAMPLE events which don't seem to be
> related to page-faults(ie they show up with/without -e page-faults).
>
> I don't have the latest kernel installed here. Can you get perf
> page-fault events on your system?


Yeah, no problem on 2.6.34-rc7.

0 new messages