Subject: Re: shared library support
To: None <jiho@postal.c-zone.net>
From: Chuck Cranor <chuck@dworkin.wustl.edu>
List: tech-kern
Date: 03/19/1998 10:24:01
jim-

    you can re-create my test with an older non-UVM kernel by 
turning on the DEBUG and DDB options in your kernel.   the old
i386 pmap.c has a function:

void pads(struct pmap *pmap)

at the bottom that does something like the pmap_dump() function
i posted yesterday.

    i do not have easy access to a non-UVM environment to repeat
the test, so i will leave it up to you.  BTW, for the ddb "ps"
command you will have to use the old "ps/m" command since i added
"ps/a" after 1.3. 


>  1. Code pages are shared from an executable file, but are not shared from
>     shared libraries linked in such an executable.


><static>    initial     first         second         third
>    wired:   1968K   1992K(+24K)    2020K(+28K)   2044K(+24K)
>   active:   1912K   1932K(+20K)    1936K(+4K)    1944K(+8K)
> inactive:    768K    824K(+56K)     828K(+4K)     828K(==)
>     free:  18516K  18416K(-100K)  18380K(-36K)  18348K(-32K)
>all total:   4724K   4824K(+100K)   4860K(+36K)   4892K(+32K)
>
><shared>    initial     first         second         third
>    wired:   1968K   1992K(+24K)    2020K(+28K)   2044K(+24K)
>   active:   1912K   1984K(+72K)    2044K(+60K)   2108K(+64K)
> inactive:    768K    824K(+56K)     828K(+4K)     828K(==)
>     free:  18516K  18364K(-152K)  18272K(-92K)  18184K(-88K)
>all total:   4724K   4876K(+152K)   4968K(+92K)   5056K(+88K)

>Things tend to stabilize with the third instance in both cases, with
>consistent +/- figures thereafter.  Compare the increase in the active
>page count in the third instance.

using systat output adds another layer of indirection to the problem,
so i prefer the pmap_dump/pads way of looking at it since that 
cuts directly to the chase... 

however, these numbers don't look all that strange.  looking
at the "third" block... 

static: gain 24K wired + 8K active ... that's 6 wired pages and
	2 active pages.   the two active pages would be the process'
	data and stack pages.   the 6 wired pages: maybe two pages
	of u-area, three pages for page tables, etc...

dynamic: gain 24K wired + 64K active ... that's 6 wired pages and
	16 active pages.   from the data i posted yesterday we know
	that each program requires 13 pages of private data for
	data (1 pg), ld.so data (1 pg), ld.so bss (7 pgs), libc
	data (3 pgs), and stack (1 pg).   that leaves only 3 pages 
	un-accounted for.

	now, in yesterday's example, i found 37 pages of shared code
	(thats 148K).   so i assert the following:

		if code pages from shared libraries are _not_ being
		shared (as you assert), then the gain in the active
		count must be at least 144K (36 pages).   

		since the gain is only 64K, there must be some sharing
		going on.


chuck