cvs commit: src/sys/kern kern_proc.c kern_switch.c src/sys/sys sched.h src/sys/vm vm_glue.c

David Schultz das at FreeBSD.ORG
Sun Sep 19 11:35:33 PDT 2004

On Sun, Sep 19, 2004, David Schultz wrote:
> das         2004-09-19 18:34:17 UTC
>   FreeBSD src repository
>   Modified files:
>     sys/kern             kern_proc.c kern_switch.c 
>     sys/sys              sched.h 
>     sys/vm               vm_glue.c 
>   Log:
>   The zone from which proc structures are allocated is marked
>   UMA_ZONE_NOFREE to guarantee type stability, so proc_fini() should
>   never be called.  Move an assertion from proc_fini() to proc_dtor()
>   and garbage-collect the rest of the unreachable code.  I have retained
>   vm_proc_dispose(), since I consider its disuse a bug.

In the same vein, the zones for vmspaces and vm_maps also have unused
fini() routines.  But I intend to leave those to someone else, since I
don't know why those zones are labeled UMA_ZONE_NOFREE in the first

On a related note, I think it would be a good idea to repurpose the
fini() callback for UMA_ZONE_NOFREE zones as a low-memory callback.
That is, fini() would be called from zone_drain() at most once on free
objects, even though the objects themselves would not be reclaimed.
This would give us a mechanism to free UAREAs for free proc structures
lazily.  This would avoid the overhead of an unmap operation in the
common case where the proc structure is immediately reused, but it
wouldn't tie up a bunch of real memory needlessly if there are many
free proc structures floating around.

Unfortunately, the above may not be as easy to implement in UMA as it
would for a magazine allocator.  (You'd need an auxiliary data
structure to keep track of which objects within a partially free slab
have already been fini'd.)  Moreover, saving one page of real memory
per long-unused proc structure may not be worth the trouble.

More information about the cvs-src mailing list