Re: [patch] VM accounting change

From: Andrew Morton
Date: Thu Nov 11 2004 - 19:35:27 EST

Terence Ripperda <tripperda@xxxxxxxxxx> wrote:
> On Thu, Nov 11, 2004 at 03:07:10PM -0800, akpm@xxxxxxxx wrote:
> > VM_LOCKED|VM_IO doesn't seem to be a sane combination. VM_LOCKED means
> > "don't page it out" and VM_IO means "an IO region". The kernel never even
> > attempts to page out IO regions because they don't have reverse mappings.
> > Heck, they don't even have pageframes.
> >
> > How about you drop the VM_LOCKED?
> sounds good, I can do that.
> on a related note, there are a couple of flags that I'm not 100% clear
> on the difference between, mainly:
> PG_locked
> PG_reserved
> everything I've seen in the past has suggested that drivers set the
> PG_reserved flag for memory allocations intended to be locked down in
> memory for extensive dma (the bttv driver had always been pointed to
> as an example of that).
> I'm not clear how that differs from PG_locked and VM_LOCKED. is
> PG_reserved still the suggested way to properly lock memory down, or
> is there a more generally accepted method?

VM_LOCKED means that someone did mlock() and the VMA isn't eligible for

PG_locked is very different: it provides the caller with exclusive access
the page while its actual contents are being changed. It's also used as a
synchronisation point for adding to and removing from pagecache. It's
pretty much a pagecache concept rather than an MM concept.

PG_reserved does mean that the page is "special" and the VM should just
leave the thing alone - some device driver owns the page and knows how to
manage it.

VM_RESERVED is a bit of a mystery, really and we've had some trouble over
the semantics of this vs PG_reserved. Presumably it's supposed to be like
PG_reserved, only for whole mmap regions. It may not work properly because
it gets damn little testing.

We really should have gone through and rationalised, consolidated and
documented the PageReserved/VM_RESERVED code in the 2.5 cycle but it didn't
happen. The most noxious part is all the testing of PG_reserved in the
core kernel page refcounting logic.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at