public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Return values for vm.pagefault.return changed with newer kernels
@ 2009-02-04 21:49 William Cohen
  2009-02-05 16:56 ` Frank Ch. Eigler
  0 siblings, 1 reply; 5+ messages in thread
From: William Cohen @ 2009-02-04 21:49 UTC (permalink / raw)
  To: SystemTAP

I am going through and redistributing the scripts in
testsuite/systemtap.samples. I run the scripts to make sure that the still
return reasonable data. I found that the the pfault.stp script was return only
VM_FAULT_OOM on the F10 machine (2.6.27.12-170.2.5.fc10.x86_64). This is due
some changes in the the page fault handler. The pfault.stp locally defines the
events:

global VM_FAULT_OOM, VM_FAULT_SIGBUS, VM_FAULT_MINOR, VM_FAULT_MAJOR
probe begin {
  VM_FAULT_OOM=-1
  VM_FAULT_SIGBUS=0
  VM_FAULT_MINOR=1
  VM_FAULT_MAJOR=2
}

This matches up with the v2.6.22 in kernel/include/linux/mm.h:

/*
 * Different kinds of faults, as returned by handle_mm_fault().
 * Used to decide whether a process gets delivered SIGBUS or
 * just gets major/minor fault counters bumped up.
 */
#define VM_FAULT_OOM    0x00
#define VM_FAULT_SIGBUS 0x01
#define VM_FAULT_MINOR  0x02
#define VM_FAULT_MAJOR  0x03

However, this doesn't work with the 2.6.23 and newer kernels. In v2.6.23 in
kernel/include/linux/mm.h things changed to a bit flag method:

/*
 * Different kinds of faults, as returned by handle_mm_fault().
 * Used to decide whether a process gets delivered SIGBUS or
 * just gets major/minor fault counters bumped up.
 */

#define VM_FAULT_MINOR  0 /* For backwards compat. Remove me quickly. */

#define VM_FAULT_OOM    0x0001
#define VM_FAULT_SIGBUS 0x0002
#define VM_FAULT_MAJOR  0x0004
#define VM_FAULT_WRITE  0x0008  /* Special case for get_user_pages */

#define VM_FAULT_NOPAGE 0x0100  /* ->fault installed the pte, not return page */
#define VM_FAULT_LOCKED 0x0200  /* ->fault locked the returned page */

#define VM_FAULT_ERROR  (VM_FAULT_OOM | VM_FAULT_SIGBUS)


Seems like the saner way to take care of this is to move the this information
into the tapsets/memory.stp However direct equality comparisons might not work
due to VM_FAULT_NOPAGE or VM_FAULT_LOCKED being bit or'ed in. Also notice that
the VM_FAULT_MINOR may be removed from future kernels. Would it make sense to
have a functions that test to see whether a fault is a particular kind of fault:

function vm_fault_minor(long:fault_no)
function vm_fault_major(long:fault_no)
function vm_fault_oom(long:fault_no)
function vm_fault_sigbus(long:fault_no)
function vm_fault_error(long:fault_no)

optionally:

function vm_fault_nopage(long:fault_no)
function vm_fault_locked(long:fault_no)

What do people think about including these functions in tapsets/memory.stp?

-Will

-Will

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-02-12 14:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-04 21:49 Return values for vm.pagefault.return changed with newer kernels William Cohen
2009-02-05 16:56 ` Frank Ch. Eigler
2009-02-05 21:07   ` William Cohen
2009-02-05 22:12     ` Frank Ch. Eigler
2009-02-12 16:25   ` William Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).