From owner-freebsd-current@FreeBSD.ORG Thu Jan 22 16:40:58 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A877106566C for ; Thu, 22 Jan 2009 16:40:58 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id B25F38FC19 for ; Thu, 22 Jan 2009 16:40:57 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id n0MGdf4t012932; Thu, 22 Jan 2009 10:39:41 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id n0MGdei3012931; Thu, 22 Jan 2009 10:39:40 -0600 (CST) (envelope-from brooks) Date: Thu, 22 Jan 2009 10:39:40 -0600 From: Brooks Davis To: Attila Nagy Message-ID: <20090122163940.GA12490@lor.one-eyed-alien.net> References: <4978853A.2000107@fsn.hu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <4978853A.2000107@fsn.hu> User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Thu, 22 Jan 2009 10:39:41 -0600 (CST) Cc: freebsd-current@freebsd.org Subject: Re: Creating swap based ramdisks from rc.initdiskless by default X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Jan 2009 16:40:58 -0000 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 22, 2009 at 03:39:54PM +0100, Attila Nagy wrote: > Hello, >=20 > In /etc/rc.initdiskless there is a function, which creates memory disks i= n=20 > diskless environments: > # Create a generic memory disk > # > mount_md() { > /sbin/mdmfs -S -i 4096 -s $1 -M md $2 > } >=20 > I have a lot of remote booted diskless and "with disks" machines, which= =20 > rely on this kind of storage. The problem is that the above command=20 > specifies "-M", so it will create MD_MALLOC disks, which can't be swapped= =20 > out, so it constantly takes away RAM, even if there is only a lightly use= d=20 > dataset on the storage, which could be in swap too in cases, when there i= s=20 > a memory pressure on the system. >=20 > So the question is: what is the rationale behind creating malloc backed= =20 > 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 kerne= l=20 > (I haven't checked, if the swap code is enabled (default) and there is no= =20 > 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= =20 > not a goot idea to put /etc (in netbooted environment, this is by default= =20 > on memory disks) onto it. BTW, I don't see the difference here between a= =20 > netbooted machine, having /etc on a swap backed memory disk, which also= =20 > holds swap and a locally booted machine, having /etc on a disk, which als= o=20 > holds swap. (of course there is a difference, if the swap is on another= =20 > disk(s) >=20 > 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 >=20 > ? 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 --zhXaljGHf11kAtnf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFJeKFMXY6L6fI4GtQRApRFAJ9KVXQvANJrr7RrQ4UmNRikGc4PHACgsy8G 4qZyB8qFTDGRQIn+gAs3CmE= =vOVi -----END PGP SIGNATURE----- --zhXaljGHf11kAtnf--