Re: VM subsystem bug in 2.4.0 ?

Linus Torvalds
2001-01-09T18:24:29Z

On Tue, 9 Jan 2001, Stephen C. Tweedie wrote:
>
> But again, how do you clear the bit? Locking is a per-vma property,
> not per-page. I can mmap a file twice and mlock just one of the
> mappings. If you get a munlock(), how are you to know how many other
> locked mappings still exist?

Note that this would be solved very cleanly if the SHM code would use the
"VM_LOCKED" flag, and actually lock the pages in the VM, instead of trying
to lock them down for writepage().

That would mean that such a segment would still get swapped out when it is
not mapped anywhere, but I wonder if that semantic difference really
matters.

If the vma is marked VM_LOCKED, the VM subsystem will do the right thing
(the page will never get removed from the page tables, so it won't ever
make it into that back-and-forth bounce between the active and the
inactive lists).

Linus