[PATCH] Add ktrace records for user page faults

Kostik Belousov kostikbel at gmail.com
Mon May 2 20:35:08 UTC 2011


On Mon, May 02, 2011 at 03:37:19PM -0400, John Baldwin wrote:
> One thing I have found useful is knowing when processes are in the kernel 
> instead of in userland.  ktrace already provides records for syscall 
> entry/exit.  The other major source of time spent in the kernel that I've seen 
> is page fault handling.  To that end, I have a patch that adds ktrace records 
> to the beginning and end of VM faults.  This gives a pair of records so a user 
> can see how long a fault took (similar to how one can see how long a syscall 
> takes now).  Sample output from kdump is below:
> 
>  47565 echo     CALL  mmap(0x800a87000,0x179000,PROT_READ|
> PROT_WRITE,MAP_PRIVATE|MAP_ANON,0xffffffff,0)
>  47565 echo     RET   mmap 34370777088/0x800a87000
>  47565 echo     PFLT  0x800723000 VM_PROT_EXECUTE
>  47565 echo     RET   KERN_SUCCESS
>  47565 echo     CALL  munmap(0x800887000,0x179000)
>  47565 echo     RET   munmap 0
>  47565 echo     PFLT  0x800a00000 VM_PROT_WRITE
>  47565 echo     RET   KERN_SUCCESS
> 
> The patch is available at www.freebsd.org/~jhb/patches/ktrace_fault.patch and 
> included below.

One immediate detail is that trap() truncates the fault address to the
page address, that arguably looses useful information.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20110502/92a9d851/attachment.pgp


More information about the freebsd-arch mailing list