Subject: Re: Looking for advice on using pageable memory
To: Jason Thorpe <>
From: Chuck Silvers <>
List: tech-kern
Date: 11/19/2006 10:49:46
On Mon, Nov 13, 2006 at 09:46:27AM -0800, Jason Thorpe wrote:
> The right thing for you to do is to simply define your own pool page  
> allocator for your tmpfs pools, and use uvm_km_alloc(kernel_map, ...,  
> UVM_KMF_PAGEABLE) within that allocator to allocate the pages.

when accessing non-wired memory from the kernel, all access must be through
fault-safe mechanisms such as kcopy(), so that the kernel doesn't panic if
reading the page from its backing store fails.  so tmpfs would either need
to do that for every access to any item from such a pageable pool, or else
re-wire each pageable page while accessing it.  dealing with all the error
cases involved in either of these approaches seems like a nightmare.
also, think of how MP locking will make this more complicated...
you can't be holding any spin locks when you do something that might
trigger a page-fault.

I think it would be much better to simply use an aobj as backing store for
data that looks very much like a traditional disk-based file system.
paging the kernel in-memory data structures themselves creates a snarly mess.