Re: RAMDISK Bugs (fwd from LRP mailing list)

Richard B. Johnson (root@chaos.analogic.com)
Wed, 6 Jan 1999 17:42:22 -0500 (EST)


On Tue, 5 Jan 1999, Paul Wouters wrote:

>
> Hi All
>
> I am mailing this list with a possible bug relating to ramdisks. I am not
> using the LRP package, but as LRP makes use of ramdisk, someone here
> might know about my problem, or may know the maintainers of the code.
>
> I am running Linux on an industrial PC. I have a SanDisk flash IDE drive
> configured as the primary boot drive. The flash disk has two partitions,
> one containing a compressed filesystems image and another containing a
> real ext2 filesystem.
>
> When the kernel boots, it expands the compressed image into a 16meg ramdisk,
> leaving about 4 meg free in the ramdisk and mounts the real flash filesystem
> separately. The machine has 32meg of RAM installed and I was keen to see how
> much is left for application use. (Should be a bit less than 16 was my guess,
> say 12 meg)
>
> /proc/meminfo reported about 4 meg was left (but I am never sure this is
> accurate) so I wrote two programs, one that would just malloc 1k blocks
> until failure and report how many suceeded and another that would malloc
> a huge blck of a requested size. The first program would lock the machine,
> but the second block would let me malloc up to 23 meg. This was clearly
> wrong, so I changed the code to do calloc and thus write to the block. I
> only ever tried running this requesting a 10meg block. The machine locked
> up.
>
> I can try this on a system with real disks and it is fine. It is as if
> the space used for ramdisk is not marked and the system happily dishes it
> out to requesting apps.
>
> Can anyone comment on this ? Is this a problem anyone has seen on the LRP
> project ? And finally, does anyone have an E-Mail address for the RAMDISK
> code maintainers ?
>
> Many thanks for any help
>
>
> Regards Bill Melotti
>

It does not sound like a RAM disk problem. Instead, you should know
that Linux and others over-commit memory when a program mallocs some.
If you never wrote to the memory, you could probably get 2^32's worth.

If you ran your program as root, it would use all the memory and swap
(if any) until the machine stopped.

Cheers,
Dick Johnson
***** FILE SYSTEM WAS MODIFIED *****
Penguin : Linux version 2.1.131 on an i686 machine (400.59 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.
Wisdom : It's not a Y2K problem. It's a Y2Day problem.

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