Re: Difference between major page fault and minor page fault

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

 



Hi All,

Sorry for making some confusions. I missed the nopage call back in the vm_operations struct.

This call back function is responsible for locating the pages in page cache and getting data from disk.

In case of backed files, filemap_nopage in mm/filemap.c does this.


Regards,
Shameem



----- Original Message ----
> From: Shameem Ahamed <shameem.ahamed@xxxxxxxxx>
> To: shailesh jain <coolworldofshail@xxxxxxxxx>; Ed Cashin <ecashin@xxxxxxxxxx>
> Cc: kernelnewbies@xxxxxxxxxxxx
> Sent: Tue, November 10, 2009 6:00:20 PM
> Subject: Re: Difference between major page fault and minor page fault
> 
> Hi Ed, Shailesh,
> 
> Thanks for the replies.
> 
> I have gone through the handle_pte_fault function in memory.c
> 
> It seems like, it handles VM page faults. I am more concerned with the physical 
> page faults. As i can see from the code,  it allocates new pages for the VMA. 
> But if the VMA is backed by a disk file the contents of the file should also be 
> read to the RAM. VM_FAULT_MINOR and VM_FAULT_MAJOR are related to VM minor 
> faults and major faults.
> 
> I want to get more information regarding the physical page faults. Once the 
> process is created VMA for the process created, and VM pages are allocated on 
> demand (when the fault occurs) and the data will be read from DISK to RAM if it 
> is not present.
> 
> Eg: I am running an application, called EG. When EG is started VMA for EG will 
> be created, virtual pages will be allocated and a txt, data, and other required 
> parts of EG will be loaded and mapped to the virtual pages. 
> 
> 
> I am looking out for the function which copies pages from disk to ram.
> 
> Can anyone please help me ?.
> 
> Regards,
> Shameem
> 
> ----- Original Message ----
> > From: shailesh jain 
> > To: Ed Cashin 
> > Cc: kernelnewbies@xxxxxxxxxxxx
> > Sent: Tue, November 10, 2009 3:23:59 AM
> > Subject: Re: Difference between major page fault and minor page fault
> > 
> > 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 wrote:
> > > Shameem Ahamed 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 
> > >  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
> 
> 
> 
>       
> 
> --
> 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