4

Really can't find much about this.. hopefully someone can help. I'm spooling up a 100GB java heap to serve as a big data cache. In order to avoid conflicts with things like the filesystem cache, and because it performs better in general, I'm allocating this in large pages.

I've reserved 51,200 x 2MB huge pages and everything starts up just fine. When I kill the process and restart, however, it looks like Linux leave some of these pages as 'rsvd'.

# less /proc/meminfo | grep Hug
AnonHugePages:         0 kB
HugePages_Total:   52000
HugePages_Free:    50952
HugePages_Rsvd:     1634
HugePages_Surp:        0
Hugepagesize:       2048 kB

As far as I know I don't have anything else on the system configured to be requesting or reserving those pages. Does Linux provide a way for me to either see what is keeping those reserved and/or invalidate that reservation?

From everything I'm finding google they're not actually being USED, just that Linux is holding them in reserve, though interestingly not allowing my to use them when re-starting my huge JVM.

Any help would be great.

  • Interesting. This possibly belongs on one of the other SE sites e.g. [unix](http://unix.stackexchange.com/) though (if you end up getting lots of close votes) – Rup Jun 25 '13 at 17:30
  • That's reasonable. I'll let it sit here for a bit so i'm not spamming all of the boards with the same question. – rob.wisniewski Jun 25 '13 at 18:16

1 Answers1

0

You can very likely get Java to re use the objects still in memory, However, running the following will remove that and everything else also stored and not being used

echo 3 | sudo tee /proc/sys/vm/drop_caches 

But you dont really need to - although its "taken" its not really. As soon as anything actually needs the ram linux will give it back

for more info check out http://www.linuxatemyram.com/

You dont actually need to do anything its normal. The only memory you have to worry about really is the memory when your application is running

exussum
  • 18,275
  • 8
  • 32
  • 65
  • That's what I figured, but interestingly enough when I try to restart the JVM it fails to allocate the heap. I'll give the drop_caches a shot, though I know that also kills the filesystem cache and I don't know if I love that idea. It'll be a good test though. – rob.wisniewski Jun 25 '13 at 22:35
  • I tried the command as root but the hugepages didn't get released. – HCSF Aug 29 '19 at 01:38