Locking a file backed mdconfig into memory
Garrett Cooper
yanefbsd at gmail.com
Fri May 28 01:26:13 UTC 2010
On Thu, May 27, 2010 at 4:48 PM, Dave Hayes <dave at jetcafe.org> wrote:
> On FreeBSD 7.3-STABLE I'm mounting a DVD and doing something like
> this:
>
> mdconfig -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 under
> 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 with
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 memory
disk is a very easy way to panic a system.
vnode A file specified with -f file becomes the backing store
for this memory disk.
swap Storage for this type of memory disk is allocated from
buffer memory. Pages get pushed out to the swap when
the system is under memory pressure, otherwise they stay
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 above.
HTH,
-Garrett
More information about the freebsd-stable
mailing list