lkml.org 
[lkml]   [2010]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC] mlock/stack guard interaction fixup
From
Date
On Mon, 2010-08-23 at 11:50 -0700, Jeremy Fitzhardinge wrote:
> On 08/23/2010 10:34 AM, Linus Torvalds wrote:
> > Quite frankly, I personally believe that people who play games with
> > mlock are misguided. The _one_ special case is for protecting keys or
> > private data that you do not want to hit the disk in some unencrypted
> > mode, and quite frankly, you should strive to handle those way more
> > specially than just putting them in some random place ("on the stack"
> > or "in some malloc()'ed area"). The sane model for doing that is
> > generally to explicitly mmap() and mlock the area, so that you get a
> > very controlled access pattern, and never have to worry about things
> > like COW etc.
>
> Is that guaranteed to work (in Linux or in general)? mlock has always
> meant "won't generate disk IO to fault in/evicted", but does it prevent
> dirty pages from being written out so long as they also remain
> resident? Or does it depend on the precise type of page you're
> mlocking? For example, what does mlock on a shared writeable mapping mean?

mlock() simply avoids major faults, nothing more.

I think both page migration and page-out for shared pages where some
maps are !mlocked can cause unmaps and thus minor faults.

mlock and dirty do not interact, they will still be cleaned/written out
as normal.


\
 
 \ /
  Last update: 2010-08-23 21:11    [W:0.132 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site