Subject: Re: Looking for advice on using pageable memory
To: Julio M.Merino Vidal <jmmv84@gmail.com>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 11/13/2006 09:46:27
On Nov 13, 2006, at 4:26 AM, Julio M. Merino Vidal wrote:

> 2) Then I tried to tweak the uvm_km_alloc_poolpage and other
>   related functions (their *_cached and *free* counterparts) to  
> request
>   pageable kernel memory by using the UVM_KMF_PAGEABLE flag
>   (instead of the UVM_KMF_WIRED currently used).  Similarly I changed
>   usages of pmap_kenter_va for pmap_enter which allows me to _not_
>   pass the wired flag.
>
>   This worked (the system didn't crash, that is) but the system could
>   not send them to swap at all.  It also reached a limit were it could
>   not allocate more pages (even when there was plenty of free swap
>   space), so it started thrashing as crazy.
>
>   Does it have any effect to set a page UVM_KMF_PAGEABLE in the
>   main kernel map?  It doesn't seem so...

kernel_map is already pageable:

         uvm_map_setup_kernel(&kernel_map_store, base, end,  
VM_MAP_PAGEABLE);

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.

-- thorpej