Subject: Re: SysV SHM locking and reallocating support
To: None <>
From: YAMAMOTO Takashi <>
List: tech-kern
Date: 09/29/2006 12:29:38
> (YAMAMOTO Takashi) wrote:
> > if they are supposed to lock backing store (ie. aobj) even when
> > there is no mappings, uvm_map_pageable is not appropriate.
> I am not sure, but according to Solaris source they maps a memory if
> she is not already mapped. At shmem_lock():
> Am I wrong? Wouldn't uvm_map_pageable() be fine in this case?

i'm not sure about solaris api.
my guess is:

	1. allocate a temporary address space.  (as_alloc)
	2. map a shm it into #1.
	3. call a uvm_map_pageable equivalent,
	   which pins pages into #1.  (as_ctl)
	4. pin pages again.  (lock_again)
	5. cleanup side effects (#1 - #3.)

is it right?

> > what you need is something like getpages -> pagewire -> dropswap.
> Sorry, for my poor knowlege of UVM, but can you explain more how to do
> this? At least I understand it should be something like:
> (*uobj->pgops->pgo_get)(..);
> loop for each page {
> 	uvm_pagewire(pg);
> 	uvmpd_dropswap(pg) or uao_dropswap(uobj, page_index)?
> }

yes, something like that.
you should ensure to break page loans as well.

solaris's way seems inefficient, but can be simpler.  it's a tradeoff.