Re: Locking - 2

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

 



On Fri, 7 Sep 2001, Martin Maletinsky wrote:

> I have another question concerning the pinning of a process's pages in
> memory (i.e. preventing them from being swapped out). I noticed there
> are several ways to pin a page:
>
> - Setting the page descriptors PG_reserved flag.

This should never be used.

> - Incrementing the page's usage count (used by map_user_kiobuf()).
> - Setting the VM_LOCKED flag of the vmarea descriptor the page is in (used by do_mlock()).

These two are the valid methods.

> (2) Are there any reason to use one or the other method, or can they
>     be considered equivalent?

Incrementing the usage count will always keep the page in
memory, even if it isn't mapped by any process, this allows
the kernel to pin things independently of user processes.

Setting the VM_LOCKED flag of a vma has other advantages,
first the page will become freeable when the program exits;
secondly all pages which will be added to this vma in the
future will also be locked into memory automatically.
This is best used when you want to pin the pages of some
process into memory.

regards,

Rik
-- 
IA64: a worthy successor to i860.

http://www.surriel.com/		http://distro.conectiva.com/

Send all your spam to aardvark@nl.linux.org (spam digging piggy)

-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
IRC Channel:   irc.openprojects.net / #kernelnewbies
Web Page:      http://www.kernelnewbies.org/


[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