Re: Difference between major page fault and minor page fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Minor faults can occur at many places:

1) Shared pages among processes/ Swap cache - A process can take a
page fault when the page is already present in the swap cache. This
will be minor fault since you will not go to disk.

2) COW but no fork - Memory is not allocated initially for malloc. It
will point to global zero page, however when the process attempts to
write to it you will get minor page fault.

3) Stack is expanding. Check if the fault occurred closed to the
bottom the stack, if yes then let's allocate page under the assumption
that stack is expanding.

4) Vmalloc address space. Page fault can occur in kernel address space
for vmalloc area. When this happens you sync up process' page tables
with master page table (init_mm).

5) COW for fork.


Shailesh Jain

On Mon, Nov 9, 2009 at 7:08 AM, Ed Cashin <ecashin@xxxxxxxxxx> wrote:
> Shameem Ahamed <shameem.ahamed@xxxxxxxxx> writes:
>
>> Hi,
>>
>> Can anyone explain the difference between major and minor page faults.
>>
>> As far as I know, major page fault follows a disk access to retrieve
>> the data. Minor page fault occurs mainly for COW pages. Is there any
>> other instances other than COW, where there will be a minor page
>> fault. Which kernel function handles the major page fault ?.
>
> Ignoring error cases, arch/x86/mm/fault.c:do_page_fault calls
> mm/memory.c:handle_mm_fault and looks for the flags, VM_FAULT_MAJOR or
> VM_FAULT_MINOR in the returned value, so the definitive answer is in
> how that return value gets set.  The handle_mm_fault value comes from
> called function hugetlb_fault or handle_pte_fault (again, ignoring
> error conditions).  I'd suggest starting your inquiry by looking at
> the logic in handle_pte_fault.
>
>> Also, can anyone please confirm that in 2.6 kernels, page cache and
>> buffer cache are normalized ?. Now we have only one cache, which
>> includes both buffer cache and page cache.
>
> They were last I heard.  Things move so fast these days that I can't
> keep up!  :)
>
> --
>  Ed Cashin <ecashin@xxxxxxxxxx>
>  Find experimental aoe Linux driver patches at
>  http://coraid.typepad.com/aoe_linux_proving_grounds/
>
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux