Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Aug 2003 10:28:10 +1000 (EST)
From:      Andy Farkas <andyf@speednet.com.au>
To:        Poul-Henning Kamp <phk@phk.freebsd.dk>
Cc:        arch@freebsd.org
Subject:   Re: headsup: swap_pager.c
Message-ID:  <20030802100150.H39348-100000@hewey.af.speednet.com.au>
In-Reply-To: <747.1059686371@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp wrote:

> People who do not adjust NSWAPDEV to match their configuration spend
> a lot of RAM on holding the radix bitmap which is 3/4 empty:
>
> 	critter phk> sysctl kern.malloc | grep -i swap
> 		 SWAP     2   753K    753K        2  64
> 	critter phk> pstat -s
> 	Device          1K-blocks     Used    Avail Capacity
> 	/dev/ad0s1b       1321312        0  1321312     0%
>
> This is because the radix bitmap gets allocated for the full
> stripe width, but only one quarter of it is actually used.
>
> Another thing is that striping does not belong in the swap_pager in
> the first place, we have CCD and similar pieces of code for that.

I wasn't going to say anything (you can delete now) but the more I think
about it, the more I think "if it aint broke, dont fix it".

For a start, what do those kern.malloc numbers mean?  Mine are different:

# sysctl kern.malloc | grep -i swap
         SWAP     2    73K    137K       12  64,65536
# pstat -s
Device          1K-blocks     Used    Avail Capacity  Type
/dev/ad0s1b         65536      144    65392     0%    Interleaved
/dev/md0            65104        0    65104     0%    Interleaved
/dev/md1            65104        0    65104     0%    Interleaved
/dev/md2           130208        0   130208     0%    Interleaved
Total              325952      144   325808     0%


I don't understand what the concern about using "a lot of RAM" is when you
yourself say that RAM is cheap. If its affecting KVA or something, then
maybe NSWAPDEV should be added into GENERIC along with an explanation that
tuning it saves memory. If the user^Wadmin is aware of the "problem" then
she can adjust the value when she customises her kernel.

Maybe it should be mentioned somewhere (sysinstall or swapctl.8) that the
*size* of swap also affect the memory footprint of the kernel. The general
rule is to have swap 2x RAM - do people really make huge swapfiles that
never get used?  My box has 512M RAM, my swapfile size is 64M and hardly
used. I don't do crashdumps. Sure, developers will want crashdumps...but
thats different.

So I guess Im saying you could "fix" this issue but just documenting what
effects swapfile metrics have on your RAM.

--

 :{ andyf@speednet.com.au

        Andy Farkas
    System Administrator
   Speednet Communications
 http://www.speednet.com.au/





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030802100150.H39348-100000>