Subject: Re: ddb & shared libs: second results
To: None <jiho@postal.c-zone.net>
From: Chuck Cranor <chuck@dworkin.wustl.edu>
List: tech-kern
Date: 03/28/1998 09:12:55
>I've now accounted for the rest. They seem to emerge from the way the Mach vm
>system deals with anonymous mappings (meaning mallocs). Apparently, at some
>point it wants to start converting them into copy objects, with shadow objects
>and duplicate pages. I don't quite understand where or why yet, but I'm
>assuming it has something to do with the swap pager.
well, it is true shadow and copy objects are paged by the swap pager.
these objects get created at fork, mmap, or write-fault time. and
the fault routine is constantly looking to collapse the chains to
prevent them from getting too long and to prevent "swap memory leak"
conditions.
>I gather it's one of the major points addressed by UVM, so I look forward to
>seeing how UVM works.
UVM has no object chains, no object collapse problems, and no
swap memory leaks. i threw all that complex stuff in the dumpster and
completely replaced the handling of anonymous memory with something
somewhat based on the SunOS4 amap-based anonymous memory system.
>Meanwhile, ddb did reveal something else. Watching 'systat vmstat' (Cranor's
>favorite), I see that each new process brings 6 wired pages with it. Yet
>looking at the actual vm_map with ddb, I see only 3 wired pages. Can anyone
>expain those different numbers?
ah, systat vmstat.
how about this:
- 2 pages for the process' U-space:
param.h:#define UPAGES 2 /* pages of u-area */
param.h:#define USPACE (UPAGES * NBPG) /* total size of u-area */
allocated in vm/vm_glue.c in the vm_fork() function:
/*
* Allocate a wired-down (for now) pcb and kernel stack for the process
*/
addr = kmem_alloc_pageable(kernel_map, USPACE);
if (addr == 0)
panic("vm_fork: no more kernel virtual memory");
vm_map_pageable(kernel_map, addr, addr + USPACE, FALSE);
- 1 page for the process' PDP (page directory page)
allocated in arch/i386/i386/pmap.c in the pmap_pinit() function:
pmap->pm_pdir = (pd_entry_t *) kmem_alloc(kernel_map, NBPG);
chuck