Subject: Re: uvm_vslock / uvm_vsunlock problems
To: Stephan Uphoff <>
From: Simon Burge <>
List: tech-kern
Date: 07/11/2003 10:10:54
Hi Stephan,

Stephan Uphoff wrote:

> uvm_vslock() is used in physio and sys___sysctl to wire user process memory.
> uvm_vsunlock() later unwires the memory if it is not in a wired map entry.
> Problem 1:
> -----------
> uvm_vslock assumes that once a page is wired - it will stay wired until
> uvm_vsunlock (potentially) unwires it.
> This is not true for mmaped file pages when the file is truncated.
> (All managed mappings are released - page is freed)
> [ ... ]
> Solutions:
> ----------
> sys___sysctl can probably use a kernel buffer for the (hopefully few) 
> occasions
> where copying is not allowed to block. (And copyout from the kernel buffer
> when it is save to do so)
> ( I assume this is the reason for the wiring but was too lazy to verify ) 

At least for the sysctl case, we could be talking about a reasonably
significant chunk of memory here - ps's fetching of the process table
comes to mind.  On my home server, this is 225 processes * 608 bytes
= 136kB right now.  It seems silly to malloc all that when the user
program has that storage available too.

Or am I misunderstanding what you're suggesting?

Simon Burge                            <>
NetBSD Support and Service: