Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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@. – Rufo El Magufo Jan 16 '13 at 18:10

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.


share|improve this answer
The latest discussion from 2016-02-14, marc.info/?l=openbsd-misc&m=145550665826831&w=2, has it that some variation of the above work was committed on 2013/06/11, only to be backed out on 2013-07-09, and then on 2015/07/19 a partial reimplementation was committed again, introducing bxr.su/o/sys/kern/vfs_bio.c#buf_flip_high, but no actual flipping is done yet, so, as of 2016-02-14, the buffer cache still appears to be limited to the 32bit DMA memory. – cnst Feb 15 at 3:50

Please note that as of OpenBSD 5.6 or 5.7, OpenBSD's "buffer cache" (aka OS disk/filesystem RAM cache etc.) does NOT have a 32bit/~3GB constraint anymore, see this ML post and thread for more info:



So this has changed since the other poster suggested this in Jan 2013, which was indeed ~6 months before that constraint was lifted.

I guess the numvnodes setting still can have an impact on the topic discussed here, did not really study that yet but just wanted to make this point about the buffer cache (as this post is one of the very few pages on the whole Internet where that feature in OpenBSD is discussed).

share|improve this answer
whilst it's an interesting discussion, you're making a premature conclusion here, since later in the very same thread it is revealed that all of those changes have been backed out, and they haven't been fully reintroduced yet, e.g., bxr.su/o/sys/kern/vfs_bio.c#buf_flip_high has been introduced recently, but doesn't actually do any flipping as of today, so, the cache is still limited to 32bit DMA memory. – cnst Feb 15 at 3:41
cnst, you are correct. My conclusion was premature - OpenBSD's buffer cache indeed still has a 32bit/~3GB limit. When the limit finally will be lifted (it was introduced around 2012 I think), let's remember to report it here. – Tinker Feb 15 at 6:50

Your Answer


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.