Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Jan 2009 10:39:40 -0600
From:      Brooks Davis <brooks@freebsd.org>
To:        Attila Nagy <bra@fsn.hu>
Cc:        freebsd-current@freebsd.org
Subject:   Re: Creating swap based ramdisks from rc.initdiskless by default
Message-ID:  <20090122163940.GA12490@lor.one-eyed-alien.net>
In-Reply-To: <4978853A.2000107@fsn.hu>
References:  <4978853A.2000107@fsn.hu>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Thu, Jan 22, 2009 at 03:39:54PM +0100, Attila Nagy wrote:
> Hello,
> 
> In /etc/rc.initdiskless there is a function, which creates memory disks in 
> diskless environments:
> # Create a generic memory disk
> #
> mount_md() {
>    /sbin/mdmfs -S -i 4096 -s $1 -M md $2
> }
> 
> I have a lot of remote booted diskless and "with disks" machines, which 
> rely on this kind of storage. The problem is that the above command 
> specifies "-M", so it will create MD_MALLOC disks, which can't be swapped 
> out, so it constantly takes away RAM, even if there is only a lightly used 
> dataset on the storage, which could be in swap too in cases, when there is 
> a memory pressure on the system.
> 
> So the question is: what is the rationale behind creating malloc backed 
> disks by default, instead of swap-backed ones?
> I can only think of two:
> - MD_SWAP disks cannot be created, if NO_SWAPPING is enabled in the kernel 
> (I haven't checked, if the swap code is enabled (default) and there is no 
> swap, I can create swap based disks, like malloc based ones)
> - under memory pressure, the swap based disks will be slow, so maybe it's 
> not a goot idea to put /etc (in netbooted environment, this is by default 
> on memory disks) onto it. BTW, I don't see the difference here between a 
> netbooted machine, having /etc on a swap backed memory disk, which also 
> holds swap and a locally booted machine, having /etc on a disk, which also 
> holds swap. (of course there is a difference, if the swap is on another 
> disk(s)
> 
> So, are there any objections on changing
>    /sbin/mdmfs -S -i 4096 -s $1 -M md $2
> to
>    /sbin/mdmfs -S -i 4096 -s $1 md $2
> 
> ?

It's a historical artifact rooted in the misleading name of the
swap-backed type.  I'm having a hard time imagining a case were it makes
any differece and you'd actually use the script, but we should generally
use swap backed mds.

-- Brooks

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iD8DBQFJeKFMXY6L6fI4GtQRApRFAJ9KVXQvANJrr7RrQ4UmNRikGc4PHACgsy8G
4qZyB8qFTDGRQIn+gAs3CmE=
=vOVi
-----END PGP SIGNATURE-----
help

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