Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 2010 18:26:11 -0700
From:      Garrett Cooper <yanefbsd@gmail.com>
To:        Dave Hayes <dave@jetcafe.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Locking a file backed mdconfig into memory
Message-ID:  <AANLkTikHWvjdsN5xU-7Hwn3tBVTUkalx4beykwDz9WH2@mail.gmail.com>
In-Reply-To: <201005272348.o4RNmgWh014243@hugeraid.jetcafe.org>
References:  <201005272348.o4RNmgWh014243@hugeraid.jetcafe.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, May 27, 2010 at 4:48 PM, Dave Hayes <dave@jetcafe.org> wrote:
> On FreeBSD 7.3-STABLE I'm mounting a DVD and doing something like
> this:
>
> =A0mdconfig -a -t vnode -o reserve -o readonly -f /dvd/file
>
> so that /dvd/file becomes the backing storage for my memory
> disk.
>
> Now if the system is under severe memory pressure, will this
> memory get swapped out, causing a read from the DVD?

What swap? Need more details...

> How would I tell the system to never swap this file out of ram, even unde=
r
> severe memory pressure?

You might be misunderstanding the purpose of the -t option for mdconfig(8):

     -t type
             Select the type of the memory disk.

             malloc   Storage for this type of memory disk is allocated wit=
h
                      malloc(9).  This limits the size to the malloc bucket
                      limit in the kernel.  If the -o reserve option is not
                      set, creating and filling a large malloc-backed memor=
y
                      disk is a very easy way to panic a system.

             vnode    A file specified with -f file becomes the backing sto=
re
                      for this memory disk.

             swap     Storage for this type of memory disk is allocated fro=
m
                      buffer memory.  Pages get pushed out to the swap when
                      the system is under memory pressure, otherwise they s=
tay
                      in the operating memory.  Using swap backing is gener=
-
                      ally preferable over malloc backing.

-t vnode points to a file, not to memory. I have no idea how that file
is being backed though on the machine..

> The idea is to load this backing storage once and only once
> from the DVD into memory and leave it there.

I think you wanted -t malloc -o reserve, maybe based on your description ab=
ove.

HTH,
-Garrett



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