Subject: Re: VM/pmap question - how to throw away mappings?
To: None <gwr@mc.com>
From: Charles M. Hannum <mycroft@gnu.ai.mit.edu>
List: tech-kern
Date: 12/04/1994 07:38:56
   When I said the pmap module does not allocate memory to store
   mappings, I meant "forward" mappings (virtual to physical) which
   are stored ONLY in the MUU.

I see.  So the only significant difference is where the page table is
stored.

   My concern about throwing away mappings is that the VM code may
   in some cases be able to benefit from knowlede of the fact that
   some mapping is no longer installed.

I'm not sure I believe this is going to buy you anything.  Maybe you
should generate some statistics on this behaviour under normal use
first.

   So, is there a convenient way to do this?

It seems pretty easy to me:

void
vm_page_maybe_deactivate(addr)
	vm_offset_t addr;
{
	register vm_page_t m;

	m = &vm_page_array[pmap_page_index(addr) - first_page];

	/*
	 * Only deactivate if the page is currently active.  This means that
	 * it's not locked and it's not wired, and it's not already inactive.
	 */
	if (m->flags & PG_ACTIVE)
		vm_page_deactivate(m);
}

(You'd probably want to inline this, though.)