Skip to contentSkip to conversation

vm_enough_memory() and RAM disks

DISCUSSION Scott Anderson 2 participants 3 messages May 22, 2001 – May 23, 2001 Memory management

lore
Share & tools
lore
#0 lore raw

I've noticed that vm_enough_memory() does not account for the fact that buffer cache could be used for RAM disks. It appears that it assumes that all of buffer cache is only being used for caching data from disk drives and could be freed up as needed. Logically, I think what needs to happen is that the amount of space occupied by buffers with BH_Protected needs to be subtracted off of buffermem_pages.

As you can well imagine, in small systems with relatively large RAM disks, this does not lead to good behavior...

Now for the true confession: I'm not finding time to come up with a patch for this right now. However, I thought it would be better to at least get this out instead of waiting around for me to find the time.

Thanks for listening,
Scott Anderson
[email protected] MontaVista Software Inc.
(408)328-9214 1237 East Arques Ave.
http://www.mvista.com Sunnyvale, CA 94085
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#1 lore raw

i've noticed a (possibly) related problem.

i've configured an NFS server to export a largish RAM disk for the purposes of testing NFS performance. the RAM disk is half as large as the server's physical memory. i've seen several times that when the machine runs out of memory (the "free" column in vmstat output goes below 1M) and the kernel wants to swap, the system freezes up. my theory was that something was attempting to flush buffers, but because the buffers were bh_protected (because they were part of a large RAM disk), the kernel wasn't successful at making any normal headway, and so it looped.

Quoted 22 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Scott Anderson
Sent: Tuesday, May 22, 2001 4:25 PM
To: [email protected]
Subject: vm_enough_memory() and RAM disks

I've noticed that vm_enough_memory() does not account for the fact that buffer cache could be used for RAM disks. It appears that it assumes that all of buffer cache is only being used for caching data from disk drives and could be freed up as needed. Logically, I think what needs to happen is that the amount of space occupied by buffers with BH_Protected needs to be subtracted off of buffermem_pages.

As you can well imagine, in small systems with relatively large RAM disks, this does not lead to good behavior...

Now for the true confession: I'm not finding time to come up with a patch for this right now. However, I thought it would be better to at least get this out instead of waiting around for me to find the time.

Quoted 10 lines

Thanks for listening,
Scott Anderson
[email protected] MontaVista Software Inc.
(408)328-9214 1237 East Arques Ave.
http://www.mvista.com Sunnyvale, CA 94085
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/

#2 lore raw
Quoted 13 lines · Chuck Lever

i've noticed a (possibly) related problem.

i've configured an NFS server to export a largish RAM disk for the purposes of testing NFS performance. the RAM disk is half as large as the server's physical memory. i've seen several times that when the machine runs out of memory (the "free" column in vmstat output goes below 1M) and the kernel wants to swap, the system freezes up. my theory was that something was attempting to flush buffers, but because the buffers were bh_protected (because they were part of a large RAM disk), the kernel wasn't successful at making any normal headway, and so it looped.

I believe you are seeing the same problem. I'm guessing that you're on 2.2 because you didn't mention the Out Of Memory killer coming into play. If so, you can work around the problem by playing with /proc/sys/vm/buffermem to increase the minimum amount of buffermem. This has been removed from 2.4.

Of course, the real answer is to fix the code, but I must apologize again that I haven't found the time to do that...

Scott Anderson
[email protected] MontaVista Software Inc.
(408)328-9214 1237 East Arques Ave.
http://www.mvista.com Sunnyvale, CA 94085
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/