Skip to contentSkip to conversation

How to use perf to log page faults

DISCUSSION Taras Glek 3 participants 5 messages May 12, 2010

lore
Share & tools
lore

Taras Glek

author
#0 lore raw

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

#1 lore raw
Quoted 11 lines · Taras Glek

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.

author
#2 lore raw
Quoted 12 lines · Frederic Weisbecker
Quoted 10 lines · Taras Glek

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?

Quoted 7 lines
Quoted 2 lines

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

#3 lore raw
Quoted 18 lines · Taras Glek
Quoted 17 lines · Frederic Weisbecker
Quoted 6 lines · Taras Glek

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.

Quoted 6 lines

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 ?

Quoted 7 lines
Quoted 2 lines

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.

#4 lore raw
In reply to Taras Glek
Quoted 9 lines · Taras Glek

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); 
	}

}

Signature · 1 line
[email protected] -- Speaking for myself only.