This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Return values for vm.pagefault.return changed with newer kernels


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]