Re: page locking from application

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

 



mlock() is the solution.
I was actually trying to understand the mlock system
call implementation to find out how the pages are
locked in the RAM so that they are not pagged out.

But I could not find any such thing in code walk
through of sys_mlock().

Question:
Page locking is handled in software or in MMU?
I don't find any bit in the PTE (Page table entry) for
page saying it to be locked.

Same thing applies to pci_alloc_consistent(), and
kernel text, data segment memory also.

Can any one guide me to understand this?

Regards,
Parav Pandit




--- Jiri Kosina <jikos@xxxxxxxx> wrote:

> On Fri, 21 Jul 2006, Mulyadi Santosa wrote:
> 
> > > Is it possible to do some kind of page locking
> or pinning from
> > > application, so that kernel doesn't swap out the
> page as long as
> > use mmap(MAP_NORESERVE) to make the user mode
> pages unswappable...
> 
> Wrong. MAP_NORESERVE tells kernel not to reserve
> space in swap space for 
> this mapping (which is otherwise done, so that the
> page could be safely 
> swapped out when needed). In case you have a
> MAP_NORESERVE mapping and you 
> try to write into it when the system is low on
> memory, you will get 
> segfault.
> 
> mlock() makes user pages nonswappable. But it needs
> root privileges to do 
> so.
> 
> -- 
> JiKos.
> 
> --
> Kernelnewbies: Help each other learn about the Linux
> kernel.
> Archive:      
> http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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