Re: Reclaim space from unused ramdisk?

From: Marc Ballarin
Date: Tue Jul 26 2005 - 18:32:32 EST


On Tue, 26 Jul 2005 15:16:58 -0700
Mike Mohr <akihana@xxxxxxxxx> wrote:

> I wonder if it would be possible to somehow reclaim space that has
> been previously reserved for a ramdisk without rebooting. I read the
> ramdisk docs in the latest kernel source and it seems that it is not
> currently possible. However, the kernel keeps track of the memory
> allocated for said ramdisks; would it not be possible with root (or
> even kernel) permissions to remove the flag that prevents the VM
> subsystem from reclaiming that space? I realize that rot permissions
> may not be high enough. In that case, could a module be written that
> takes a device name as a parameter then uses it to look up the
> reserved memory that device uses, then resets the necessary flag and
> finally unloads itself? It would have to check that the filesystem
> was unmounted, of course.
>
> How difficult would this be to write?

Hi,

ramfs (always there) and tmpfs (optional) already do this.
tmpfs can be swapped out, ramfs always uses physical memory.

mount -t ramfs none /mnt/blah
mount -t tmpfs none /mnt/blah

Regards
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/