Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I run OpenBSD/amd64 5.2 on a system with 12GB of RAM, and I want to use about 6GB to 8GB for filesystem caching.

By default, 5.2 amd64 comes with sysctl kern.bufcachepercent set to 20 (20%); I've increased it to 50% and then to 60%, and then went through lots of files that definitely total above 10GB, yet, when I go into top, I am shown the following line:

Memory: Real: 25M/1978M act/tot Free: 9961M Cache: 1670M Swap: 0K/48G

That's 1.7GB out of 12GB, less than 15%! I've even tried increasing kern.maxvnodes from 117091 to 400000 (and kern.numvnodes did indicate that all 400k of vnodes got utilised pretty quickly), but I'm still having under 2GB of RAM used for caching.

Is it not possible to use 6GB of RAM for disc cache on OpenBSD 5.2 amd64? Is it limited to something around 1.7GB?

share|improve this question
    
The percentage in kern.bufcachepercent is not related to the total of your RAM. Ask in tech@ or misc@. –  J.F. Jan 16 '13 at 18:10

2 Answers 2

No, the cache is not limited to anything like 1.7 GB. It seems, that you have a lot of small files on your machine - if numvnodes are full, no additional space can be used for the disk cache. You can try to increase the numvnodes even more, or you can try to seek/search through a big file.

share|improve this answer
    
400k vnodes is a lot of vnodes, and more than the number of files that I require caching! I'm not sure vnodes are to blame, and I'm also not sure that vnode and bufcache settings are actually related: I would think that even if I run out of vnodes, they would potentially be re-created from bufcache data, instead of the disc data (however, I'm not familiar with the code, so, I might be wrong). –  cnst Jan 22 '13 at 16:48
up vote 0 down vote accepted

I did some testing, and it seems like on my system, an equivalent of 100% buffercache would have been about 2.8GB (I tried 75%, and I'm getting about 2.1GB used for cache), so, the percentage is taken out of a value similar to about 2.7 or 2.8GB (it might depend on a system / bios etc).

It would seem like this is related to the buffer cache being restricted to 32bit DMA memory, and most likely even at 100% of the setting, said memory is taken out of the pool that is shared with other kernel resources, so, the percentage would always be out of a number quite significantly below 4GB on any system, it seems.

http://www.openbsd.org/cgi-bin/cvsweb/src/sys/kern/vfs_bio.c
http://marc.info/?l=openbsd-tech&m=130174663714841&w=2

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.